diff options
author | Haru <haru@dotalux.com> | 2015-12-26 02:28:59 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-05-08 19:53:57 +0200 |
commit | 2349b2a1528fe5dc41d930f8dd332df5ba521eb6 (patch) | |
tree | 3656a91a896f0ef090606b2b4c9184ad73153a3f /src/map/status.c | |
parent | 58a7bf46508b7f186704e7efb39576e09f0ab866 (diff) | |
download | hercules-2349b2a1528fe5dc41d930f8dd332df5ba521eb6.tar.gz hercules-2349b2a1528fe5dc41d930f8dd332df5ba521eb6.tar.bz2 hercules-2349b2a1528fe5dc41d930f8dd332df5ba521eb6.tar.xz hercules-2349b2a1528fe5dc41d930f8dd332df5ba521eb6.zip |
Fixed various issues pointed out by cppcheck
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/status.c')
-rw-r--r-- | src/map/status.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/map/status.c b/src/map/status.c index 39bb25737..34bfd06b5 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -11613,7 +11613,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { if( --(sce->val4) > 0 ) { struct block_list *src = map->id2bl(sce->val2); int damage; - if( !src || (src && (status->isdead(src) || src->m != bl->m || distance_bl(src, bl) >= 12)) ) + if (src == NULL || (status->isdead(src) || src->m != bl->m || distance_bl(src, bl) >= 12)) break; map->freeblock_lock(); damage = sce->val3; @@ -12964,7 +12964,7 @@ int status_readdb_refine_libconfig(const char *filename) { struct config_t refine_db_conf; struct config_setting_t *r; char filepath[256]; - int i = 0, count = 0,type = 0; + int i = 0, count = 0; sprintf(filepath, "%s/%s", map->db_path, filename); if (!libconfig->load_file(&refine_db_conf, filepath)) @@ -12974,10 +12974,13 @@ int status_readdb_refine_libconfig(const char *filename) { while((r = libconfig->setting_get_elem(refine_db_conf.root,i++))) { char *name = config_setting_name(r); - if((type=status->readdb_refine_libconfig_sub(r, name, filename))) { - if( duplicate[type-1] ) { + int type = status->readdb_refine_libconfig_sub(r, name, filename); + if (type != 0) { + if (duplicate[type-1]) { ShowWarning("status_readdb_refine_libconfig: duplicate entry for %s in \"%s\", overwriting previous entry...\n", name, filename); - } else duplicate[type-1] = true; + } else { + duplicate[type-1] = true; + } count++; } } |