diff options
-rw-r--r-- | Changelog.txt | 5 | ||||
-rw-r--r-- | src/map/map.c | 74 | ||||
-rw-r--r-- | src/map/storage.c | 19 |
3 files changed, 58 insertions, 40 deletions
diff --git a/Changelog.txt b/Changelog.txt index aabc49955..de35e52a4 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,8 @@ Date Added 01/05 + * Fixed some typos in map_versionscreen() [MC Cameri] + * Removed loop freeing in map-server's do_final(), it was causing seg faults [MC Cameri] + * Finished do_storage_final() in map-server's do_final(), it was there but doing nothing [MC Cameri] * Fixed Celest's typo making all vended items cost 0 zeny [Codemaster] [SVN 919] * If a vending item was priced at 0 it'll be auto changed to 1million [celest] * Fixed TXT logging - log_athena.conf reading was kind of messed up [celest] @@ -57,7 +60,7 @@ Date Added (you were right! ^^; ) (SVN 891) [celest] * Modified Spiral Pierce and Breaker to type ranged (SVN 891) [celest] -01/01 +01/01/05 * Attempted to fix a memory leak [Codemaster] - tell me if it works XD (NPC/Mob memory leak in npc_parse_mob(...)) [SVN 886] * Added a char config that allows GMs that have a certain level or above to bypass the server's user limit [Codemaster] diff --git a/src/map/map.c b/src/map/map.c index 7d82bc40c..fd8228bdc 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1233,7 +1233,7 @@ void map_removenpc(void) { } } - sprintf(tmp_output,"Successfully removed and freed from memory '"CL_WHITE"%d"CL_RESET"' NPCs.\n",n); + sprintf(tmp_output,"Successfully removed and freed from memory '"CL_WHITE"%d"CL_RESET"' NPCs.\n",n); ShowStatus(tmp_output); } @@ -1899,7 +1899,7 @@ static int map_readmap(int m,char *fn, char *alias, int *map_cache, int maxmap) char progress[21] = " "; //printf("\rLoading Maps [%d/%d]: %-50s ",m,map_num,fn); - if (map_num) { //avoid map-server crashing if there are 0 maps + if (maxmap) { //avoid map-server crashing if there are 0 maps char c = '-'; static int lasti = -1; static int last_time = -1; @@ -2079,7 +2079,9 @@ int map_addmap(char *mapname) { } if (map_num >= MAX_MAP_PER_SERVER - 1) { - printf("too many map\n"); + snprintf(tmp_output,sizeof(tmp_output),"Could not add map '" + CL_WHITE"%s"CL_RESET"', the limit of maps has been reached.\n",mapname); + ShowError(tmp_output); return 1; } memcpy(map[map_num].name, mapname, 24); @@ -2416,45 +2418,32 @@ int sql_config_read(char *cfgName) //Map Server SQL DB } else if(strcmpi(w1,"map_server_ip")==0){ strcpy(map_server_ip, w2); -// printf ("set map_server_ip : %s\n",w2); } else if(strcmpi(w1,"map_server_port")==0){ map_server_port=atoi(w2); -// printf ("set map_server_port : %s\n",w2); } else if(strcmpi(w1,"map_server_id")==0){ strcpy(map_server_id, w2); -// printf ("set map_server_id : %s\n",w2); } else if(strcmpi(w1,"map_server_pw")==0){ strcpy(map_server_pw, w2); -// printf ("set map_server_pw : %s\n",w2); } else if(strcmpi(w1,"map_server_db")==0){ strcpy(map_server_db, w2); -// printf ("set map_server_db : %s\n",w2); - //Map server option to use SQL db or not } else if(strcmpi(w1,"use_sql_db")==0){ if (strcmpi(w2,"yes")){db_use_sqldbs=0;} else if (strcmpi(w2,"no")){db_use_sqldbs=1;} printf ("Using SQL dbs: %s\n",w2); //Login Server SQL DB } else if(strcmpi(w1,"login_server_ip")==0){ strcpy(login_server_ip, w2); -// printf ("set login_server_ip : %s\n",w2); } else if(strcmpi(w1,"login_server_port")==0){ login_server_port = atoi(w2); -// printf ("set login_server_port : %s\n",w2); } else if(strcmpi(w1,"login_server_id")==0){ strcpy(login_server_id, w2); -// printf ("set login_server_id : %s\n",w2); } else if(strcmpi(w1,"login_server_pw")==0){ strcpy(login_server_pw, w2); -// printf ("set login_server_pw : %s\n",w2); } else if(strcmpi(w1,"login_server_db")==0){ strcpy(login_server_db, w2); -// printf ("set login_server_db : %s\n",w2); } else if(strcmpi(w1,"lowest_gm_level")==0){ lowest_gm_level = atoi(w2); -// printf ("set lowest_gm_level : %s\n",w2); } else if(strcmpi(w1,"read_gm_interval")==0){ read_gm_interval = ( atoi(w2) * 60 * 1000 ); // Minutes multiplied by 60 secs per min by 1000 milliseconds per second -// printf ("set read_gm_interval : %s\n",w2); } else if(strcmpi(w1,"log_db")==0) { strcpy(log_db, w2); } else if(strcmpi(w1,"log_db_ip")==0) { @@ -2544,8 +2533,9 @@ int flush_timer(int tid, unsigned int tick, int id, int data){ int id_db_final(void *k,void *d,va_list ap) { +printf struct mob_data *id; - nullpo_retr(0, id=d); +// nullpo_retr(0, id=d); if(id->lootitem) free(id->lootitem); if(id) @@ -2597,11 +2587,11 @@ static int cleanup_sub(struct block_list *bl, va_list ap) { */ void do_final(void) { int map_id, i; - ShowStatus("Terminating.\n"); - for (map_id = 0; map_id < map_num;map_id++) { - if(map[map_id].m) - map_foreachinarea(cleanup_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, 0, 0); - } + ShowStatus("Terminating...\n"); + + for (map_id = 0; map_id < map_num;map_id++) + if(map[map_id].m) + map_foreachinarea(cleanup_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, 0, 0); #ifndef TXT_ONLY chrif_char_reset_offline(); @@ -2613,37 +2603,43 @@ void do_final(void) { delete_session(i); map_removenpc(); - //do_final_timer(); (we used timer_final() instead) - timer_final(); +// do_final_timer(); (we used timer_final() instead) + timer_final(); numdb_final(id_db, id_db_final); strdb_final(map_db, map_db_final); strdb_final(nick_db, nick_db_final); numdb_final(charid_db, charid_db_final); - for(i=0;i<=map_num;i++){ + + do_final_script(); + do_final_itemdb(); + do_final_storage(); + do_final_guild(); +/* + for(i=0;i<map_num;i++){ if(map[i].gat) { free(map[i].gat); - map[i].gat=NULL; + map[i].gat=NULL; //isn't it NULL already o_O? } if(map[i].block) free(map[i].block); if(map[i].block_mob) free(map[i].block_mob); if(map[i].block_count) free(map[i].block_count); if(map[i].block_mob_count) free(map[i].block_mob_count); } - - do_final_script(); - do_final_itemdb(); - do_final_storage(); - do_final_guild(); +*/ #ifndef TXT_ONLY map_sql_close(); #endif /* not TXT_ONLY */ - ShowStatus("Successfully terminated."); + ShowStatus("Successfully terminated.\n"); } -void map_helpscreen(int flag) { +/*====================================================== + * Map-Server Version Screen [MC Cameri] + *------------------------------------------------------ + */ +void map_helpscreen(int flag) { // by MC Cameri puts("Usage: map-server [options]"); puts("Options:"); puts(CL_WHITE" Commands\t\t\tDescription"CL_RESET); @@ -2665,14 +2661,18 @@ void map_helpscreen(int flag) { if (flag) exit(1); } +/*====================================================== + * Map-Server Version Screen [MC Cameri] + *------------------------------------------------------ + */ void map_versionscreen(int flag) { printf("CL_WHITE" "eAthena version %d.%02d.%02d, Athena Mod version %d" CL_RESET"\n", ATHENA_MAJOR_VERSION, ATHENA_MINOR_VERSION, ATHENA_REVISION, ATHENA_MOD_VERSION); - puts(CL_GREEN "Website/Forum:" "CL_RESET" "\thttp://eathena.deltaanime.net/"); - puts(CL_GREEN "Download URL:" "CL_RESET" "\thttp://eathena.systeminplace.net/"); - puts(CL_GREEN "IRC Channel:" "CL_RESET" "\tirc://irc.deltaanime.net/#athena"); - puts("\nOpen "CL_WHITE"readme.html"CL_RESET" for more information."); + puts(CL_GREEN "Website/Forum:" CL_RESET "\thttp://eathena.deltaanime.net/"); + puts(CL_GREEN "Download URL:" CL_RESET "\thttp://eathena.systeminplace.net/"); + puts(CL_GREEN "IRC Channel:" CL_RESET "\tirc://irc.deltaanime.net/#athena"); + puts("\nOpen " CL_WHITE "readme.html" CL_RESET " for more information."); if (ATHENA_RELEASE_FLAG) ShowNotice("This version is not for release.\n"); if (flag) exit(1); } diff --git a/src/map/storage.c b/src/map/storage.c index 3944f1ac1..f0e22c71d 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -62,9 +62,24 @@ int do_init_storage(void) // map.c::do_init()から呼ばれる guild_storage_db=numdb_init(); return 1; } - -void do_final_storage(void) // map.c::do_final()から呼ばれる +static int guild_storage_db_final(void *key,void *data,va_list ap) +{ + struct guild_storage *gstor=data; + free(gstor); + return 0; +} +static int storage_db_final(void *key,void *data,va_list ap) +{ + struct storage *stor=data; + free(stor); + return 0; +} +void do_final_storage(void) // by [MC Cameri] { + if (storage_db) + numdb_final(storage_db,storage_db_final); + if (guild_storage_db) + numdb_final(guild_storage_db,guild_storage_db_final); } struct storage *account2storage(int account_id) |