summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-02 17:00:17 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-02 17:00:17 +0000
commit0e8da0a06a86128c2c2a9f663592e2a8e4980141 (patch)
tree8f7a77bef02219b4144efecb1d5ffd4c6e503f9e /src/map/script.c
parent830f648e2f75671c835e3c382ef8d11c8e58565c (diff)
downloadhercules-0e8da0a06a86128c2c2a9f663592e2a8e4980141.tar.gz
hercules-0e8da0a06a86128c2c2a9f663592e2a8e4980141.tar.bz2
hercules-0e8da0a06a86128c2c2a9f663592e2a8e4980141.tar.xz
hercules-0e8da0a06a86128c2c2a9f663592e2a8e4980141.zip
Replaced some magic numbers related to castle guardians with `MAX_GUARDIANS`.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15650 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 5f84aa2d9..d3d28a84e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10147,14 +10147,14 @@ BUILDIN_FUNC(getcastledata)
if(script_hasdata(st,4) && index==0 && gc) {
const char* event = script_getstr(st,4);
check_event(st, event);
- guild_addcastleinfoevent(gc->castle_id,17,event);
+ guild_addcastleinfoevent(gc->castle_id, 9+MAX_GUARDIANS, event);
}
if(gc){
switch(index){
case 0: {
int i;
- for(i=1;i<18;i++) // Initialize[AgitInit]
+ for (i = 1; i <= 9+MAX_GUARDIANS; i++) // Initialize[AgitInit]
guild_castledataload(gc->castle_id,i);
} break;
case 1:
@@ -10175,17 +10175,12 @@ BUILDIN_FUNC(getcastledata)
script_pushint(st,gc->createTime); break;
case 9:
script_pushint(st,gc->visibleC); break;
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- script_pushint(st,gc->guardian[index-10].visible); break;
default:
- script_pushint(st,0); break;
+ if (index > 9 && index <= 9+MAX_GUARDIANS)
+ script_pushint(st,gc->guardian[index-10].visible);
+ else
+ script_pushint(st,0);
+ break;
}
return 0;
}
@@ -10222,16 +10217,11 @@ BUILDIN_FUNC(setcastledata)
gc->createTime = value; break;
case 9:
gc->visibleC = value; break;
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- gc->guardian[index-10].visible = value; break;
default:
+ if (index > 9 && index <= 9+MAX_GUARDIANS) {
+ gc->guardian[index-10].visible = value;
+ break;
+ }
return 0;
}
guild_castledatasave(gc->castle_id,index,value);