user_parameters *uplink_parameters(parameter_model *pmodel) { user_parameters *parameters = (user_parameters *)malloc(sizeof(user_parameters)); userS *users; if (new_second()) { pmodel->countdown--; if (pmodel->countdown == 0) { //printf("RB=%3i, Layer=%2i, Mod=%i\n", pmodel->inc % MAX_RB + 1, (int)(pmodel->inc/MAX_RB) + 1, MODULATION); pmodel->inc++; pmodel->active++; pmodel->countdown = PERIOD; } } users = (userS *)malloc(sizeof(userS)); parameters->first = users; parameters->last = users; users->startRB = 0; users->nmbRB = pmodel->inc % MAX_RB + 1; users->nmbLayer = (int)(pmodel->inc/MAX_RB) + 1; users->mod = MODULATION; users->data = &data[subframe_data()]; users->next = NULL; return parameters; }
int MedianOfMergedArray(std::vector<int> &first_arr, std::vector<int> &second_arr, int size){ /* arr1=[1, 3, 4, 6], arr2=[5, 7, 8, 9] => [1, 3, 4, 5, 6, 7, 8, 9]=> => med1=(3+4)/2=3; med2=(7+8)/2=7 if(med1 < med2) => arr1[3, 4, 6]; arr2[5, 7, 8]=> med1=4; med2=7 med1<med2) => arr1[4, 6]; arr2[5, 7] => size=2=> (5+6)/2 */ if(size == 0){ return -1; } else if(size == 1){ return (first_arr[0] + second_arr[0])/2; } else if(size == 2){ return (std::max(first_arr[0], second_arr[0]) + std::min(first_arr[1], second_arr[1]))/2; } int med1 = median(first_arr); int med2 = median(second_arr); if(med1 == med2){ return med1; } if(med1 < med2){ // then we can view arr1[med1,...] and arr2[...,med2] if(size % 2 == 0){ std::vector<int> new_first(first_arr.begin(),first_arr.begin()+size/2-1); return MedianOfMergedArray(new_first, second_arr, size/2+1); } else{ std::vector<int> new_first(first_arr.begin(),first_arr.begin()+size/2); return MedianOfMergedArray(new_first, second_arr, size/2); } } if(size % 2 == 0){ std::vector<int> new_second(second_arr.begin(), second_arr.begin()+size/2-1); return MedianOfMergedArray(new_second, first_arr, size/2+1); } else{ std::vector<int> new_second(second_arr.begin(), second_arr.begin()+size/2); return MedianOfMergedArray(new_second, first_arr, size/2+1); } }
user_parameters *uplink_parameters(parameter_model *pmodel) { user_parameters *parameters = (user_parameters *)malloc(sizeof(user_parameters)); userS *users; int mod; mod = (int)(pmodel->inc/(MAX_RB*MAX_LAYERS)); if (new_second()) { pmodel->countdown--; //printf("RB=%3i, Layer=%2i, Mod=%i\n", pmodel->inc%MAX_RB+1, (int)(pmodel->inc/MAX_RB)%MAX_LAYERS+1, mod); pmodel->active++; if (pmodel->countdown == 0) { pmodel->inc++; pmodel->countdown = PERIOD; } } users = (userS *)malloc(sizeof(userS)); parameters->first = users; parameters->last = users; users->startRB = 0; users->nmbRB = pmodel->inc % MAX_RB + 1; users->nmbLayer = (int)(pmodel->inc/MAX_RB) % MAX_LAYERS + 1; users->data = &data[subframe_data()]; mod = (int)(pmodel->inc/(MAX_RB*MAX_LAYERS)); switch(mod) { case 0: users->mod = MOD_QPSK; break; case 1: users->mod = MOD_16QAM; break; case 2: users->mod = MOD_64QAM; break; default: /* Finished */ exit(0); break; } users->next = NULL; return parameters; }
user_parameters *uplink_parameters(parameter_model *pmodel) { user_parameters *parameters = (user_parameters *)malloc(sizeof(user_parameters)); userS *users; int i; if (new_second()) { pmodel->countdown--; if (pmodel->countdown == 0) { //printf("USERS=%2i\n", pmodel->inc); pmodel->inc++; pmodel->active++; pmodel->countdown = PERIOD; } if (pmodel->inc == 12) exit(0); } for (i=0; i<pmodel->inc; i++) { if (i == 0) { users = (userS *)malloc(sizeof(userS)); parameters->first = users; } else { users->next = (userS *)malloc(sizeof(userS)); users = users->next; } parameters->last = users; users->startRB = (int)(100/pmodel->inc)*i; users->nmbRB = (int)100/pmodel->inc; users->nmbLayer = 3; users->mod = MOD_64QAM; users->data = &data[subframe_data()]; users->next = NULL; } return parameters; }
int filter_or_ignore_text (char *text_to_add, int len, int size, Uint8 channel) { int l, idx; if (len <= 0) return 0; // no point //check for auto receiving #help for (idx = 0; idx < len; idx++) { if (!is_color (text_to_add[idx])) break; } l = len - idx; if (l >= strlen(help_request_str) && text_to_add[idx] == '#' && (strncasecmp (&text_to_add[idx], help_request_str, strlen(help_request_str)) == 0 || strncasecmp (&text_to_add[idx], "#mod chat", 9) == 0)) { auto_open_encyclopedia = 0; } /* DANGER, WILL ROBINSON! The below code should not exist in it's present form. I'd change it, but I'd need access to the server. Simply checking text output (which is used for all sorts of things) for the phrase "Game Date" is very dangerous. Example: what if, in the future, we allow spaces in character names? Someone chooses the name "Game Date" and walks around saying "hi". Everyone's clients in the area interpret this as being a Game Date command. I've made the below code not *as* dangerous. Had a user been able to fake out the below code, previously, it would have caused a buffer overflow in their client if they didn't write in only numbers after it. Now, they won't crash; it'll just be misparsed. General practice recommendation: don't mix server commands with user input. - Karen */ /* ed (ttlanhil): made it check if it's a server colour. still not perfect (this should have been done server-side instead of parsing the date), but safer */ if (from_color_char (text_to_add[0]) == c_green1 && my_strncompare(text_to_add+1,"Game Date", 9)) { //we assume that the server will still send little-endian dd/mm/yyyy... we could make it safer by parsing the format too, but it's simpler to assume const char * const month_names[] = { "Aluwia", "Seedar", "Akbar", "Zartia", "Elandra", "Viasia", "Fruitfall", "Mortia", "Carnelar", "Nimlos", "Chimar", "Vespia" }; const char * const day_names[] = { "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th", "17th", "18th", "19th", "20th", "21st", "22nd", "23rd", "24th", "25th", "26th", "27th", "28th", "29th", "30th" }; char new_str[100]; const char *ptr=text_to_add; short unsigned int day=1, month=1, year=0; int offset = 0; while(!isdigit(ptr[offset])) { offset++; if (offset >= sizeof(new_str)) { LOG_ERROR("error (1) parsing date string: %s",text_to_add); //something evil this way comes... return 0; } } ptr += offset; if (sscanf (ptr,"%hu%*[-/]%hu%*[-/]%hu",&day,&month,&year) < 3 || day <= 0 || month <= 0 || day > 30 || month > 12 || year > 9999) { LOG_ERROR("error (2) parsing date string: %s",text_to_add); //something evil this way comes... } else { // only display initial or "#date" user requested date if (!set_date(ptr)) { safe_snprintf(new_str, sizeof(new_str), date_format, day_names[day-1], month_names[month-1], year); LOG_TO_CONSOLE(c_green1, new_str); } //Calculate fraction Big Lunar month (2 conjunction months) less game clock time //Represented in Degrees. skybox_time_d = (SDL_GetTicks()%( 1296000 * 1000 )); skybox_time_d *= 360.0/( 1296000.0 * 1000.0); skybox_time_d = -skybox_time_d; skybox_time_d += 360.0 * (((month%2)*30 + day-1)*360 + game_minute)/21600.0; skybox_update_positions(); return 0; } } if (from_color_char (text_to_add[0]) == c_green1 && my_strncompare(text_to_add+1,"Game Time", 9)) { real_game_second = atoi(&text_to_add[18]); next_second_time = cur_time + 1000; new_second(); } // Check for local messages to be translated into actor movements (contains [somthing]) if (channel == CHAT_LOCAL) { if(parse_text_for_emote_commands(text_to_add, len)) return 0; } if (channel == CHAT_SERVER) { if (my_strncompare(text_to_add+1, "You started to harvest ", 23)) { strncpy(harvest_name, text_to_add+1+23, len-1-23-1); harvest_name[len-1-23-1] = '\0'; harvesting = 1; } else if ((my_strncompare(text_to_add+1, "You stopped harvesting.", 23)) || (my_strncompare(text_to_add+1, "You can't harvest while fighting (duh)!", 39)) || (my_strncompare(text_to_add+1, "You can't do that while trading!", 32)) || (my_strncompare(text_to_add+1, "You are too far away! Get closer!", 33)) || (my_strncompare(text_to_add+1, "You can't harvest here", 22)) || (my_strncompare(text_to_add+1, "You lack the knowledge of ", 26)) || ((my_strncompare(text_to_add+1, "You need to wear ", 17) && strstr(text_to_add, "order to harvest") != NULL)) || ((my_strncompare(text_to_add+1, "You need to have a ", 19) && strstr(text_to_add, "order to harvest") != NULL))) { harvesting = 0; } else if (is_death_message(text_to_add+1)) { // nothing to be done here cause all is done in the test function } else if (my_strncompare(text_to_add+1, "You found ", 10) && strstr(text_to_add+1, " coins.")) { decrement_harvest_counter(atoi(text_to_add+11)); } else if (my_strncompare(text_to_add+1, "Send Item UIDs ", 15)) { if (text_to_add[1+15] == '0') item_uid_enabled = 0; else if (text_to_add[1+15] == '1') item_uid_enabled = 1; printf("item_uid_enabled=%d\n", item_uid_enabled); } else if ((copy_next_LOCATE_ME > 0) && my_strncompare(text_to_add+1, "You are in ", 11)) { char buffer[4096]; switch (copy_next_LOCATE_ME) { case 1: copy_to_clipboard(text_to_add+1); break; case 2: snprintf(buffer, sizeof(buffer), "@My Position: %s", text_to_add + 12); send_input_text_line(buffer, strlen(buffer)); break; } copy_next_LOCATE_ME = 0; return 0; } else if (my_strncompare(text_to_add+1, "You see: ", 9)) { achievements_player_name(text_to_add+10, len-10); } else if (my_strncompare(text_to_add+1, "You just got food poisoned!", 27)) { increment_poison_incidence(); } else if (strstr(text_to_add+1, "aborted the trade.")) { trade_aborted(text_to_add+1); } else if (strstr(text_to_add+1, "Trade session failed")) { trade_aborted(text_to_add+1); } else if (strstr(text_to_add+1, "You have been saved!")) { last_save_time = time(NULL); } } else if (channel == CHAT_LOCAL) { if (harvesting && my_strncompare(text_to_add+1, username_str, strlen(username_str))) { char *ptr = text_to_add+1+strlen(username_str); if (my_strncompare(ptr, " found a ", 9)) { ptr += 9; if (my_strncompare(ptr, "bag of gold, getting ", 21)) { decrement_harvest_counter(atoi(ptr+21)); } else if (!strstr(ptr, " could not carry ")) { decrement_harvest_counter(1); } } } else if (my_strncompare(text_to_add+1, "(*) ", 4)) { increment_summon_counter(text_to_add+1+4); if (summoning_filter) return 0; } } /* check for misc counter strings */ catch_counters_text(text_to_add+1); /* put #mpm in a popup box, on top of all else */ if ((channel == CHAT_MODPM) && (my_strncompare(text_to_add+1, "[Mod PM from", 12))) { display_server_popup_win(text_to_add); } //Make sure we don't check our own messages. if( !(channel == CHAT_PERSONAL && len >= strlen(pm_from_str) && strncasecmp (text_to_add+1, pm_from_str, strlen(pm_from_str)) != 0) && !(channel == CHAT_MODPM && len >= strlen(mod_pm_from_str) && strncasecmp (text_to_add+1, mod_pm_from_str, strlen(mod_pm_from_str)) != 0) ) { //check if ignored - pre_check_if_ignored() checks for Mod PM's etc to not ignore (or it would be asking for trouble) if (pre_check_if_ignored (text_to_add, len, channel)) { return 0; } //All right, we do not ignore the person if (afk) { if (channel == CHAT_PERSONAL || channel == CHAT_MODPM) { // player sent us a PM add_message_to_pm_log (text_to_add, len, channel); if (afk_snd_warning) { do_afk_sound(); } } else if (channel == CHAT_LOCAL && from_color_char (text_to_add[0]) == c_grey1 && is_talking_about_me (&text_to_add[1], len-1, 0)) { // player mentions our name in local chat if (afk_local) { add_message_to_pm_log (&text_to_add[1], len - 1, channel); if (afk_snd_warning) { do_afk_sound(); } } else { send_afk_message (&text_to_add[1], len - 1, channel); } } else if (channel == CHAT_SERVER) { // check if this was a trade attempt int i; for (i = 1; i < len; i++) { if (text_to_add[i] == ' ' || text_to_add[i] == ':' || is_color (text_to_add[i])) { break; } } if (i < len-15 && strncasecmp (&text_to_add[i], " wants to trade", 15) == 0) { send_afk_message (&text_to_add[1], len - 1, channel); if (afk_snd_warning) { do_afk_sound(); } } } } } else { //We sent this PM or MODPM. Can we expect a reply? int len = 0; char name[MAX_USERNAME_LENGTH]; for(;text_to_add[len+8] != ':' && len < MAX_USERNAME_LENGTH - 1; ++len); safe_strncpy(name, text_to_add+8, len+1); if(check_if_ignored(name)){ char msg[65]; safe_snprintf(msg, sizeof(msg), warn_currently_ignoring, name); LOG_TO_CONSOLE(c_red2, msg); } } // parse for URLs find_all_url (text_to_add, len); // look for buddy-wants-to-add-you messages if(channel == CHAT_SERVER && from_color_char (text_to_add[0]) == c_green1) { for (l = 1; l < len; l++) { if (text_to_add[l] == ' ') break; } if (len - l >= strlen(msg_accept_buddy_str) && strncmp (&text_to_add[l], msg_accept_buddy_str, strlen(msg_accept_buddy_str)) == 0 && l <=32) { char name[32]; int i; int cur_char; /*entropy says: I really fail to understand the logic of that safe_snprintf. And gcc can't understand it either because the name is corrupted. so we implement it the old fashioned way. Grum responds: actually it's the MingW compiler on windows that doesn't understand it, because it doesn't terminate the string when the buffer threatens to overflow. It works fine with gcc on Unix, and using sane_safe_snprintf should also fix it on windows. safe_snprintf (name, l, "%s", &text_to_add[1]); */ for (i = 0; i < sizeof (name); i++) { cur_char = text_to_add[i+1]; name[i] = cur_char; if (cur_char == ' ') { name[i] = '\0'; break; } } add_buddy_confirmation (name); } } // look for astrology messages if((channel == CHAT_SERVER) && is_astrology_message (text_to_add)) { return 0; } // filter any naughty words out return filter_text (text_to_add, len, size); }
user_parameters *uplink_parameters(parameter_model *pmodel) { int nmbUsers = 0; int nmbRB = MAX_RB; int startPos = 0; float distribution = 0; float p; int newRB; userS *users = NULL; user_parameters *parameters = (user_parameters *)malloc(sizeof(user_parameters)); int load = 0; if (new_second()) { pmodel->countdown--; if (pmodel->countdown < 0) { pmodel->countdown = COUNTDOWN; pmodel->inc++; switch(pmodel->inc) { case 1: pmodel->active = TASK_THREADS*3/4; break; case 2: pmodel->active = TASK_THREADS/2; break; case 3: pmodel->active = TASK_THREADS/4+5; break; case 4: pmodel->active = TASK_THREADS/2; break; case 5: pmodel->active = TASK_THREADS*3/4; break; case 6: pmodel->active = TASK_THREADS; break; case 7: pmodel->active = TASK_THREADS*3/4; break; case 8: pmodel->active = TASK_THREADS/2; break; case 9: pmodel->active = TASK_THREADS/4+5; break; default: exit(0); break; } } } while (nmbUsers < MAX_USERS && nmbRB > 0) { /* New user so we need to allocate memory to store its information */ if (users == NULL) { users = (userS *)malloc(sizeof(userS)); users->next = NULL; parameters->first = users; } else { users->next = (userS *)malloc(sizeof(userS)); users = users->next; users->next = NULL; } parameters->last = users; /* The number of layers determines the workload (each layer is a rough representative of 25% of work) */ users->nmbLayer = pmodel->active/(TASK_THREADS/4); users->startRB = startPos; newRB = (int)(MAX_RB*(rand()/(float)RAND_MAX)); distribution = rand()/(float)RAND_MAX; /* Create a nonlinear distribution of the RBs between users */ if (distribution < 0.4) newRB = newRB/8; else if (distribution < 0.6) newRB = newRB/4; else if (distribution < 0.9) newRB = newRB/2; /* A user has at leas one RB */ if (!newRB) newRB = 1; if ( newRB > nmbRB ) { newRB = nmbRB; } users->nmbRB = newRB; nmbRB = nmbRB - users->nmbRB; startPos = startPos + users->nmbRB; users->mod = MOD_QPSK; p = (rand()/(float)RAND_MAX); if (p > 0.3 ) users->mod = MOD_16QAM; if (p > 0.7 ) users->mod = MOD_64QAM; users->data = &data[subframe_data()]; nmbUsers++; load += users->nmbRB*users->nmbLayer; } //printf("Load: %3i, Users: %2i\n", load, nmbUsers); return parameters; }
user_parameters *uplink_parameters(parameter_model *pmodel) { int active = 0; int nmbUsers = 0; int nmbRB = MAX_RB; int startPos = 0; float distribution = 0; int newRB; userS *users = NULL; user_parameters *parameters = NULL; int load_QPSK = 0; int load_16QAM = 0; int load_64QAM = 0; float load_perc = 0.0; int minLayer = 4; int maxLayer = 1; int minMod = MOD_64QAM; int maxMod = MOD_QPSK; int maxRB = 0; int minRB = 100; if (new_second()) { pmodel->countdown--; pmodel->active_min = 100; pmodel->active_max = 0; pmodel->active_sum = 0; pmodel->active_frames = 0; if (pmodel->countdown <= 0) { if (pmodel->inc) pmodel->count++; else pmodel->count--; pmodel->countdown = COUNTDOWN - 1; } if (pmodel->count == 170) pmodel-> inc = 0; else if (pmodel->count == 0) exit(0); } while (nmbUsers < MAX_USERS && nmbRB > 0) { /* New user so we need to allocate memory to store its information */ if (users == NULL) { users = (userS *)malloc(sizeof(userS)); users->next = NULL; parameters = (user_parameters *)malloc(sizeof(user_parameters)); parameters->first = users; } else { users->next = (userS *)malloc(sizeof(userS)); users = users->next; users->next = NULL; } parameters->last = users; /* Lets determine the number of layers (max 4) */ users->nmbLayer = 1; if (PROB_EXTRA_LAYER*pmodel->count/80 > (rand()/(float)RAND_MAX)) users->nmbLayer++; if (PROB_EXTRA_LAYER*pmodel->count/80 > (rand()/(float)RAND_MAX)) users->nmbLayer++; if (PROB_EXTRA_LAYER*pmodel->count/80 > (rand()/(float)RAND_MAX)) users->nmbLayer++; users->startRB = startPos; newRB = 10; /* newRB = (int)(MAX_RB*(rand()/(float)RAND_MAX)); distribution = rand()/(float)RAND_MAX; */ /* Create a nonlinear distribution of the RBs between users */ /* if (distribution < 0.4) newRB = newRB/8; else if (distribution < 0.6) newRB = newRB/4; else if (distribution < 0.9) newRB = newRB/2; */ /* A user has at leas one RB */ if (!newRB) newRB = 1; if ( newRB > nmbRB ) { newRB = nmbRB; } users->nmbRB = newRB; nmbRB = nmbRB - users->nmbRB; startPos = startPos + users->nmbRB; /* users->mod = MOD_QPSK; if (PROB_MOD*pmodel->count/80 > (rand()/(float)RAND_MAX)) { users->mod = MOD_16QAM; if (PROB_MOD*pmodel->count/80 > (rand()/(float)RAND_MAX)) { users->mod = MOD_64QAM; } } */ users->mod = MOD_64QAM; //users->mod = MOD_QPSK; users->data = &data[subframe_data()]; nmbUsers++; switch(users->mod) { case MOD_PSK: case MOD_QPSK: load_QPSK += users->nmbRB * users->nmbLayer; break; case MOD_16QAM: load_16QAM += users->nmbRB * users->nmbLayer; break; case MOD_64QAM: load_64QAM += users->nmbRB * users->nmbLayer; break; } if (minRB > users->nmbRB) minRB = users->nmbRB; if (maxRB < users->nmbRB) maxRB = users->nmbRB; if (minLayer > users->nmbLayer) minLayer = users->nmbLayer; if (maxLayer < users->nmbLayer) maxLayer = users->nmbLayer; if (minMod > users->mod) minMod = users->mod; if (maxMod < users->mod) maxMod = users->mod; load_perc += user_load(users->nmbRB, users->nmbLayer, users->mod); } active = ceil(TASK_THREADS*(load_perc/100))+2; pmodel->active = active; // printf("QPSK: %3i, 16QAM: %3i, 64QAM: %3i, Users: %2i, Active: %2i, Count: %2i, Load: %3.1f\n", load_QPSK, load_16QAM, load_64QAM, nmbUsers, pmodel->active, pmodel->count, load_perc); return parameters; }
int start_rendering() { static int done = 0; static void * network_thread_data[2] = { NULL, NULL }; static Uint32 last_frame_and_command_update = 0; SDL_Thread *network_thread; queue_t *message_queue; #ifndef WINDOWS SDL_EventState(SDL_SYSWMEVENT,SDL_ENABLE); #endif queue_initialise(&message_queue); network_thread_data[0] = message_queue; network_thread_data[1] = &done; network_thread = SDL_CreateThread(get_message_from_server, network_thread_data); /* Loop until done. */ while( !done ) { SDL_Event event; // handle SDL events in_main_event_loop = 1; while( SDL_PollEvent( &event ) ) { done = HandleEvent(&event); } in_main_event_loop = 0; //advance the clock cur_time = SDL_GetTicks(); //check for network data if(!queue_isempty(message_queue)) { message_t *message; while((message = queue_pop(message_queue)) != NULL) { process_message_from_server(message->data, message->length); free(message->data); free(message); } } #ifdef OLC olc_process(); #endif //OLC my_tcp_flush(my_socket); // make sure the tcp output buffer is set if (have_a_map && cur_time > last_frame_and_command_update + 60) { LOCK_ACTORS_LISTS(); next_command(); UNLOCK_ACTORS_LISTS(); move_to_next_frame(); last_frame_and_command_update = cur_time; } while (cur_time > next_second_time && real_game_second < 59) { real_game_second += 1; new_second(); next_second_time += 1000; } #ifdef NEW_SOUND weather_sound_control(); #endif //NEW_SOUND if(!limit_fps || (cur_time-last_time && 1000/(cur_time-last_time) <= limit_fps)) { weather_update(); animate_actors(); //draw everything draw_scene(); last_time=cur_time; } else { SDL_Delay(1);//give up timeslice for anyone else } #ifdef TIMER_CHECK //Check the timers to make sure that they are all still alive... check_timers(); #endif //cache handling if(cache_system)cache_system_maint(); //see if we need to exit if(exit_now) { done = 1; break; } } if(!done) { done = 1; } LOG_INFO("Client closed"); SDL_WaitThread(network_thread,&done); queue_destroy(message_queue); if(pm_log.ppl)free_pm_log(); //save all local data save_local_data(NULL, 0); #ifdef PAWN cleanup_pawn (); #endif #ifdef NEW_SOUND destroy_sound(); // Cleans up physical elements of the sound system and the streams thread clear_sound_data(); // Cleans up the config data #endif // NEW_SOUND ec_destroy_all_effects(); if (have_a_map) { destroy_map(); free_buffers(); } unload_questlog(); save_item_lists(); free_emotes(); free_actor_defs(); free_books(); free_vars(); cleanup_rules(); save_exploration_map(); cleanup_counters(); cleanup_chan_names(); cleanup_hud(); SDL_RemoveTimer(draw_scene_timer); SDL_RemoveTimer(misc_timer); end_particles (); free_bbox_tree(main_bbox_tree); main_bbox_tree = NULL; free_astro_buffer(); free_translations(); free_skybox(); /* Destroy our GL context, etc. */ SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_QuitSubSystem(SDL_INIT_TIMER); /*#ifdef WINDOWS // attempt to restart if requested if(restart_required > 0){ LOG_INFO("Restarting %s", win_command_line); SDL_CreateThread(system, win_command_line); } #endif //WINDOWS */ #ifdef NEW_SOUND final_sound_exit(); #endif #ifdef CUSTOM_UPDATE stopp_custom_update(); #endif /* CUSTOM_UPDATE */ clear_zip_archives(); destroy_tcp_out_mutex(); if (use_frame_buffer) free_reflection_framebuffer(); printf("doing SDL_Quit\n"); fflush(stderr); SDL_Quit( ); printf("done SDL_Quit\n"); fflush(stderr); cleanup_mem(); xmlCleanupParser(); FreeXML(); exit_logging(); return(0); }