summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-25 00:29:15 +0200
committerHaru <haru@dotalux.com>2013-09-25 00:29:15 +0200
commit44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7 (patch)
tree1c1e300503d99ecbe8b41355daa716858aaece5d /src/map/script.c
parentb9c8f57b92d2935db971a38e144529682712dc82 (diff)
downloadhercules-44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7.tar.gz
hercules-44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7.tar.bz2
hercules-44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7.tar.xz
hercules-44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7.zip
Renamed more forgotten variables during interface conversions
(related: b9c8f57) Most renames are trivial (just to avoid shadowing global variables, even if they currently did no harm), but there were some cases of partly renamed variables that caused some NULL checks to always pass and who knows what could have been happened when they were too subtle to make the application crash. Also corrected some potentially unsafe macro definitions Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c51
1 files changed, 21 insertions, 30 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 87d2b475c..86d69658c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2761,11 +2761,10 @@ void pop_stack(struct script_state* st, int start, int end)
/*==========================================
* Release script dependent variable, dependent variable of function
*------------------------------------------*/
-void script_free_vars(struct DBMap* storage)
-{
- if( storage )
- {// destroy the storage construct containing the variables
- db_destroy(storage);
+void script_free_vars(struct DBMap* var_storage) {
+ if( var_storage ) {
+ // destroy the storage construct containing the variables
+ db_destroy(var_storage);
}
}
@@ -15496,17 +15495,15 @@ BUILDIN(mercenary_sc_start)
return true;
}
-BUILDIN(mercenary_get_calls)
-{
+BUILDIN(mercenary_get_calls) {
struct map_session_data *sd = script_rid2sd(st);
- int guild;
+ int guild_id;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
- switch( guild )
- {
+ guild_id = script_getnum(st,2);
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
script_pushint(st,sd->status.arch_calls);
break;
@@ -15524,19 +15521,17 @@ BUILDIN(mercenary_get_calls)
return true;
}
-BUILDIN(mercenary_set_calls)
-{
+BUILDIN(mercenary_set_calls) {
struct map_session_data *sd = script_rid2sd(st);
- int guild, value, *calls;
+ int guild_id, value, *calls;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
+ guild_id = script_getnum(st,2);
value = script_getnum(st,3);
- switch( guild )
- {
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
calls = &sd->status.arch_calls;
break;
@@ -15556,17 +15551,15 @@ BUILDIN(mercenary_set_calls)
return true;
}
-BUILDIN(mercenary_get_faith)
-{
+BUILDIN(mercenary_get_faith) {
struct map_session_data *sd = script_rid2sd(st);
- int guild;
+ int guild_id;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
- switch( guild )
- {
+ guild_id = script_getnum(st,2);
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
script_pushint(st,sd->status.arch_faith);
break;
@@ -15584,19 +15577,17 @@ BUILDIN(mercenary_get_faith)
return true;
}
-BUILDIN(mercenary_set_faith)
-{
+BUILDIN(mercenary_set_faith) {
struct map_session_data *sd = script_rid2sd(st);
- int guild, value, *calls;
+ int guild_id, value, *calls;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
+ guild_id = script_getnum(st,2);
value = script_getnum(st,3);
- switch( guild )
- {
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
calls = &sd->status.arch_faith;
break;
@@ -15612,7 +15603,7 @@ BUILDIN(mercenary_set_faith)
*calls += value;
*calls = cap_value(*calls, 0, INT_MAX);
- if( mercenary->get_guild(sd->md) == guild )
+ if( mercenary->get_guild(sd->md) == guild_id )
clif->mercenary_updatestatus(sd,SP_MERCFAITH);
return true;