summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2015-01-01 18:06:10 +0100
committerHaruna <haru@dotalux.com>2015-01-01 18:06:10 +0100
commitff607f15ec14783aed8c0cf2749ac8cbe6d0e7db (patch)
treee121e6c1e25ff47a26090437c937b022d2bfebc6 /src/map/npc.c
parentdc6b470e4aaf252cb4f960b8b5585e51da821893 (diff)
parentf70d54001cd1b975db6f4668a6d54dbae7a8ac92 (diff)
downloadhercules-ff607f15ec14783aed8c0cf2749ac8cbe6d0e7db.tar.gz
hercules-ff607f15ec14783aed8c0cf2749ac8cbe6d0e7db.tar.bz2
hercules-ff607f15ec14783aed8c0cf2749ac8cbe6d0e7db.tar.xz
hercules-ff607f15ec14783aed8c0cf2749ac8cbe6d0e7db.zip
Merge pull request #425 from 4144/fixes
Different fixes after automatic checks
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 6762684af..04df22f2d 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2314,16 +2314,18 @@ int npc_unload(struct npc_data* nd, bool single) {
aFree(nd->ud);
nd->ud = NULL;
}
-
- for( i = 0; i < nd->hdatac; i++ ) {
- if( nd->hdata[i]->flag.free ) {
- aFree(nd->hdata[i]->data);
- }
- aFree(nd->hdata[i]);
- }
+
if( nd->hdata )
+ {
+ for( i = 0; i < nd->hdatac; i++ ) {
+ if( nd->hdata[i]->flag.free ) {
+ aFree(nd->hdata[i]->data);
+ }
+ aFree(nd->hdata[i]);
+ }
aFree(nd->hdata);
-
+ }
+
aFree(nd);
return 0;
@@ -3147,7 +3149,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
nd->u.scr.timerid = INVALID_TIMER;
- if( type == SCRIPT && options&NPO_ONINIT ) {
+ if (options&NPO_ONINIT) {
// From npc_parse_script
char evname[EVENT_NAME_LENGTH];
struct event_data *ev;
@@ -3513,13 +3515,13 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
return strchr(start,'\n');// skip and continue
}
- if( (mobspawn.state.size < 0 || mobspawn.state.size > 2) && size != -1 ) {
+ if (mobspawn.state.size > 2 && size != -1) {
ShowError("npc_parse_mob: Invalid size number %d for mob ID %d in file '%s', line '%d'.\n", mobspawn.state.size, class_, filepath, strline(buffer, start - buffer));
if (retval) *retval = EXIT_FAILURE;
return strchr(start, '\n');
}
- if( (mobspawn.state.ai < 0 || mobspawn.state.ai > 4) && ai != -1 ) {
+ if (mobspawn.state.ai > 4 && ai != -1) {
ShowError("npc_parse_mob: Invalid ai %d for mob ID %d in file '%s', line '%d'.\n", mobspawn.state.ai, class_, filepath, strline(buffer, start - buffer));
if (retval) *retval = EXIT_FAILURE;
return strchr(start, '\n');