diff options
author | Haruna <haru@dotalux.com> | 2014-12-04 00:17:33 +0100 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2014-12-04 00:17:33 +0100 |
commit | f3b72587466f484b62145dfe616d5f9e9e29e0b9 (patch) | |
tree | 60a79b39a2948913013ebdfea00bbb2c86570950 /src/common | |
parent | 3378fa7502f8504bf0566d9082b60e4cd7817798 (diff) | |
parent | 54c6b9f6cb8e8f8d0e0284838bc1e9b2b3bbac8d (diff) | |
download | hercules-f3b72587466f484b62145dfe616d5f9e9e29e0b9.tar.gz hercules-f3b72587466f484b62145dfe616d5f9e9e29e0b9.tar.bz2 hercules-f3b72587466f484b62145dfe616d5f9e9e29e0b9.tar.xz hercules-f3b72587466f484b62145dfe616d5f9e9e29e0b9.zip |
Merge pull request #394 from 4144/mapindex
In mapindex move check for default map into separate method.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/mapindex.c | 14 | ||||
-rw-r--r-- | src/common/mapindex.h | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/common/mapindex.c b/src/common/mapindex.c index ec829ee56..e00fc107d 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -165,13 +165,20 @@ int mapindex_init(void) { } fclose(fp); - if( !strdb_iget(mapindex->db, MAP_DEFAULT) ) { - ShowError("mapindex_init: MAP_DEFAULT '%s' not found in cache! update mapindex.h MAP_DEFAULT var!!!\n",MAP_DEFAULT); - } + mapindex->check_default(); return total; } +bool mapindex_check_default(void) +{ + if (!strdb_iget(mapindex->db, MAP_DEFAULT)) { + ShowError("mapindex_init: MAP_DEFAULT '%s' not found in cache! update mapindex.h MAP_DEFAULT var!!!\n",MAP_DEFAULT); + return false; + } + return true; +} + void mapindex_removemap(int index){ strdb_remove(mapindex->db, mapindex->list[index].name); mapindex->list[index].name[0] = '\0'; @@ -201,4 +208,5 @@ void mapindex_defaults(void) { mapindex->getmapname_ext = mapindex_getmapname_ext; mapindex->name2id = mapindex_name2id; mapindex->id2name = mapindex_id2name_sub; + mapindex->check_default = mapindex_check_default; } diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 446a2422d..53d08f8e6 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -84,6 +84,7 @@ struct mapindex_interface { /* TODO: Hello World! make up your mind, this thing is int on some places and unsigned short on others */ unsigned short (*name2id) (const char*); const char* (*id2name) (unsigned short,const char *file, int line, const char *func); + bool (*check_default) (void); }; struct mapindex_interface *mapindex; |