void init_players(void) { uint32 i = 0; player_array = (player_t *)calloc(MAX_PLAYERS,sizeof(player_t)); job_array = (job_t *)calloc(MAX_JOBS, sizeof(job_t)); temp_data_t = (ingame_t *)calloc(1, sizeof(ingame_t)); for( i = 0; i < MAX_JOBS; i++) job_array[i].stat = (uint8 *)calloc(STAT_COUNT, sizeof(uint8)); for( i = 0; i < MAX_PLAYERS; i++){ player_array[i].username = (char *)calloc(MAX_NAME_LENGTH, sizeof(char)); player_array[i].charname = (char *)calloc(MAX_NAME_LENGTH, sizeof(char)); player_array[i].password = (char *)calloc(MAX_PASS_LENGTH, sizeof(char)); player_array[i].equipment = (uint16 *)calloc(EQUIPMENT_COUNT, sizeof(uint16)); player_array[i].vitals = (uint16 *)calloc(VITAL_COUNT, sizeof(uint16)); player_array[i].maxvitals = (uint16 *)calloc(VITAL_COUNT, sizeof(uint16)); player_array[i].inv = (inventory_t *)calloc(MAX_INV, sizeof(inventory_t)); player_array[i].spells = (uint16 *)calloc(MAX_PLAYER_SPELLS, sizeof(uint16)); player_array[i].stat = (uint8 *)calloc(STAT_COUNT, sizeof(uint8)); } online.index = (int16 *)calloc(MAX_PLAYERS,sizeof(int16)); online.players_online = 0; onmap_t.map_players = 1; onmap_t.index = (int16 *)calloc(MAX_PLAYERS,sizeof(int16)); init_jobs(); }
int main(int argc, char **argv) { int res; int err = parse_args(argc, argv); if (show_ver) printf("mlz v" MLZ_VERSION "\n"); if (err) { help(); return err; } #if defined(MLZ_THREADS) init_jobs(); res = process(); destroy_jobs(); #else res = process(); #endif return res; }