diff options
author | DracoRPG <DracoRPG@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-03-13 20:24:08 +0000 |
---|---|---|
committer | DracoRPG <DracoRPG@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-03-13 20:24:08 +0000 |
commit | ed39bb7197c749c28f1de75a4219329465b0fa08 (patch) | |
tree | f0b59d7408c3725da780acc84f8e00e55311a786 /src/map/map.c | |
parent | 6f11fef3afc1a235628ff21aa2f2348abab4a97f (diff) | |
download | hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.gz hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.bz2 hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.xz hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.zip |
Mapcache update, should polish off remaining bugs
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10003 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/map/map.c b/src/map/map.c index 3f37c430e..dfdda95b7 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2432,12 +2432,6 @@ int map_eraseipport(unsigned short mapindex,unsigned long ip,int port) * Map cache reading *===========================================*/ -// This is the main header found at the very beginning of the file -/*struct map_cache_head { - long filesize; - unsigned short map_count; -};*/ - // This is the header appended before every compressed map cells info struct map_cache_info { char name[MAP_NAME_LENGTH]; @@ -2449,6 +2443,7 @@ struct map_cache_info { FILE *map_cache_fp; +// Removes the extension from a map name char *map_normalize_name(char *mapname) { char *ptr, *ptr2; @@ -2457,7 +2452,8 @@ char *map_normalize_name(char *mapname) while (ptr[1] && (ptr2 = strchr(ptr+1, '.'))) ptr = ptr2; //Skip to the last dot. if(stricmp(ptr,".gat") == 0 || - stricmp(ptr,".afm") == 0) + stricmp(ptr,".afm") == 0 || + stricmp(ptr,".af2") == 0) *ptr = '\0'; //Remove extension. } return mapname; @@ -2471,6 +2467,9 @@ int map_readmap(struct map_data *m) unsigned long size; unsigned char *buf; + if(!map_cache_fp) + return 0; + fseek(map_cache_fp, 0, SEEK_SET); fread(&map_count, sizeof(map_count), 1, map_cache_fp); @@ -2628,6 +2627,7 @@ int map_readallmaps (void) map[i].block_count = (int*)aCallocA(size, 1); map[i].block_mob_count = (int*)aCallocA(size, 1); + mapindex_addmap(map[i].index, map[i].name); uidb_put(map_db, (unsigned int)map[i].index, &map[i]); } @@ -3177,8 +3177,6 @@ void do_final(void) { if (map[i].moblist[j]) aFree(map[i].moblist[j]); } } - - mapindex_final(); id_db->destroy(id_db, NULL); pc_db->destroy(pc_db, NULL); @@ -3337,9 +3335,6 @@ int do_init(int argc, char *argv[]) { charsql_db_init(1); //Connecting to chardb #endif /* not TXT_ONLY */ - mapindex_init(); - grfio_init(GRF_PATH_FILENAME); - map_readallmaps(); add_timer_func_list(map_freeblock_timer, "map_freeblock_timer"); @@ -3378,9 +3373,6 @@ int do_init(int argc, char *argv[]) { npc_event_do_oninit(); // npcのOnInitイベント?行 - //Done loading with the maps, no need for the grf module anymore. - grfio_final(); - if( console ) { //##TODO invoke a CONSOLE_START plugin event |