diff options
author | Dastgir Pojee <dastgirp@gmail.com> | 2017-01-13 20:34:25 +0530 |
---|---|---|
committer | Dastgir Pojee <dastgirp@gmail.com> | 2017-01-17 19:29:39 +0530 |
commit | 4cb8dedbe87523475bbf589f6dc627f3c8e8f7c4 (patch) | |
tree | dfe6389e68d07363d7ce599d7d15ace843615663 /src | |
parent | dbc54eaa7e6091110e6437066b49a7cf8faea2b8 (diff) | |
download | hercules-4cb8dedbe87523475bbf589f6dc627f3c8e8f7c4.tar.gz hercules-4cb8dedbe87523475bbf589f6dc627f3c8e8f7c4.tar.bz2 hercules-4cb8dedbe87523475bbf589f6dc627f3c8e8f7c4.tar.xz hercules-4cb8dedbe87523475bbf589f6dc627f3c8e8f7c4.zip |
Fixes #1543
Infinite Duration status would result in error since there was no timers
attached to it.
Added a condition to check if status is having infinite duration and
return value according to it.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/script.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/map/script.c b/src/map/script.c index 38931bd11..eb2bd05ee 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11591,14 +11591,16 @@ BUILDIN(getstatus) case 3: script_pushint(st, sd->sc.data[id]->val3); break; case 4: script_pushint(st, sd->sc.data[id]->val4); break; case 5: - { - const struct TimerData *td = timer->get(sd->sc.data[id]->timer); + if (sd->sc.data[id]->infinite_duration) { + script_pushint(st, INFINITE_DURATION); + } else { + const struct TimerData *td = timer->get(sd->sc.data[id]->timer); - if (td != NULL) { - // return the amount of time remaining - script_pushint(st, (int)(td->tick - timer->gettick())); // TODO: change this to int64 when we'll support 64 bit script values + if (td != NULL) { + // return the amount of time remaining + script_pushint(st, (int)(td->tick - timer->gettick())); // TODO: change this to int64 when we'll support 64 bit script values + } } - } break; default: script_pushint(st, 1); break; } |