diff options
author | Haru <haru@dotalux.com> | 2013-08-02 19:45:04 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-08-02 19:54:42 +0200 |
commit | 15a0a5af55fd11f585319b646e5e96f57d722a2f (patch) | |
tree | e5d3bf67b4e8debe18333021425945344fbb6556 /src | |
parent | f6991edd8a6fa2347460c7c1728ffa5643d0bec8 (diff) | |
download | hercules-15a0a5af55fd11f585319b646e5e96f57d722a2f.tar.gz hercules-15a0a5af55fd11f585319b646e5e96f57d722a2f.tar.bz2 hercules-15a0a5af55fd11f585319b646e5e96f57d722a2f.tar.xz hercules-15a0a5af55fd11f585319b646e5e96f57d722a2f.zip |
Fixed @reloadatcommand breaking all @-commands
- Follow-up to e7750ec
- Fixes bugreport:7618
http://hercules.ws/board/tracker/issue-7618-reloadatcommand/
Thanks to kyeme, Via for the report.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index f25a8f8f6..cd7b74d6b 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -10293,7 +10293,7 @@ bool atcommand_hp_add(char *name, AtCommandFunc func) { return false; } - if( !atcommand->db ) + if( atcommand->db == NULL ) atcommand->db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH); if( atcommand->exists(name) ) { @@ -10315,8 +10315,7 @@ bool atcommand_hp_add(char *name, AtCommandFunc func) { /** * @see DBApply */ -static int atcommand_db_clear_sub(DBKey key, DBData *data, va_list args) -{ +static int atcommand_db_clear_sub(DBKey key, DBData *data, va_list args) { AtCommandInfo *cmd = DB->data2ptr(data); aFree(cmd->at_groups); aFree(cmd->char_groups); @@ -10325,20 +10324,24 @@ static int atcommand_db_clear_sub(DBKey key, DBData *data, va_list args) return 0; } -void atcommand_db_clear(void) -{ - if (atcommand->db != NULL) +void atcommand_db_clear(void) { + if( atcommand->db != NULL ) { atcommand->db->destroy(atcommand->db, atcommand_db_clear_sub); - if (atcommand->alias_db != NULL) + atcommand->db = NULL; + } + if( atcommand->alias_db != NULL ) { db_destroy(atcommand->alias_db); + atcommand->alias_db = NULL; + } } void atcommand_doload(void) { if( runflag >= MAPSERVER_ST_RUNNING ) atcommand_db_clear(); - if( !atcommand->db ) + if( atcommand->db == NULL ) atcommand->db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH); - atcommand->alias_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH); + if( atcommand->alias_db == NULL ) + atcommand->alias_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH); atcommand_basecommands(); //fills initial atcommand_db with known commands atcommand_config_read(iMap->ATCOMMAND_CONF_FILENAME); } |