summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsheraf <Asheraf@users.noreply.github.com>2019-02-26 23:47:47 +0000
committerGitHub <noreply@github.com>2019-02-26 23:47:47 +0000
commit1ac84c2dd856087a4a72fec95b3322137187637a (patch)
treeb7555ae3491c6179b0e171f88561f89ee41cf48d
parentd496d8963fb4c2eb9015a2911a88299e29644681 (diff)
parent7eb109d6ce54266c041c73fd619339270751f333 (diff)
downloadhercules-1ac84c2dd856087a4a72fec95b3322137187637a.tar.gz
hercules-1ac84c2dd856087a4a72fec95b3322137187637a.tar.bz2
hercules-1ac84c2dd856087a4a72fec95b3322137187637a.tar.xz
hercules-1ac84c2dd856087a4a72fec95b3322137187637a.zip
Merge pull request #2392 from AnnieRuru/65-setunitdata_phase_2
getunitdata should return -1 instead of 0. Phase 2
-rw-r--r--doc/script_commands.txt2
-rw-r--r--src/map/script.c22
2 files changed, 12 insertions, 12 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index db851128f..c3cc8a799 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -10159,7 +10159,7 @@ Applicable Data types (available as constants) -
UDT_LIFETIME: LifeTime (int) - for summons.
UDT_MERC_KILLCOUNT: Kill count for mercenaries (int).
-returns 0 if value could not be retrieved.
+returns -1 if value could not be retrieved.
---------------------------------------
diff --git a/src/map/script.c b/src/map/script.c
index 7578fcdcc..7e6e06376 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19767,7 +19767,7 @@ static BUILDIN(getunitdata)
if (bl == NULL) {
ShowWarning("buildin_getunitdata: Error in finding object with given GID %d!\n", script_getnum(st, 2));
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
@@ -19776,7 +19776,7 @@ static BUILDIN(getunitdata)
/* Type check */
if (type < UDT_TYPE || type >= UDT_MAX) {
ShowError("buildin_getunitdata: Invalid unit data type %d provided.\n", type);
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
@@ -19784,7 +19784,7 @@ static BUILDIN(getunitdata)
if (type == UDT_MAPIDXY) {
if (data == NULL || !data_isreference(data)) {
ShowWarning("buildin_getunitdata: Error in argument 3. Please provide a reference variable to store values in.\n");
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
@@ -19794,7 +19794,7 @@ static BUILDIN(getunitdata)
sd = script->rid2sd(st);
if (sd == NULL) {
ShowWarning("buildin_getunitdata: Player not attached! Cannot use player variable %s.\n",name);
- script_pushint(st, 0);
+ script_pushint(st, -1);
return true;// no player attached
}
}
@@ -19864,7 +19864,7 @@ static BUILDIN(getunitdata)
case UDT_DMOTION: script_pushint(st, md->status.dmotion); break;
default:
ShowWarning("buildin_getunitdata: Invalid data type '%s' for Mob unit.\n", udtype);
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
}
@@ -19921,7 +19921,7 @@ static BUILDIN(getunitdata)
case UDT_INTIMACY: script_pushint(st, hd->homunculus.intimacy); break;
default:
ShowWarning("buildin_getunitdata: Invalid data type '%s' for Homunculus unit.\n", udtype);
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
}
@@ -19978,7 +19978,7 @@ static BUILDIN(getunitdata)
case UDT_INTIMACY: script_pushint(st, pd->pet.intimate); break;
default:
ShowWarning("buildin_getunitdata: Invalid data type '%s' for Pet unit.\n", udtype);
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
}
@@ -20034,7 +20034,7 @@ static BUILDIN(getunitdata)
case UDT_LIFETIME: script_pushint(st, mc->mercenary.life_time); break;
default:
ShowWarning("buildin_getunitdata: Invalid data type '%s' for Mercenary unit.\n", udtype);
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
}
@@ -20088,7 +20088,7 @@ static BUILDIN(getunitdata)
case UDT_MASTERCID: script_pushint(st, ed->elemental.char_id); break;
default:
ShowWarning("buildin_getunitdata: Invalid data type '%s' for Elemental unit.\n", udtype);
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
}
@@ -20153,14 +20153,14 @@ static BUILDIN(getunitdata)
case UDT_BODY2: script_pushint(st, nd->vd.body_style); break;
default:
ShowWarning("buildin_getunitdata: Invalid data type '%s' for NPC unit.\n", udtype);
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
}
}
break;
default:
ShowError("buildin_getunitdata: Unknown object!\n");
- script_pushint(st, 0);
+ script_pushint(st, -1);
return false;
} // end of bl->type switch