summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-05 00:08:28 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-05 00:08:28 +0000
commita6325af8d937fbf600362bacde389e6fa7d02719 (patch)
treee6d526f4dd8ca73b757751039be5cfa388a994da /src/map/script.c
parent262e60ab0b9cfc1f942a7b3ef11f7ed3abc7b208 (diff)
downloadhercules-a6325af8d937fbf600362bacde389e6fa7d02719.tar.gz
hercules-a6325af8d937fbf600362bacde389e6fa7d02719.tar.bz2
hercules-a6325af8d937fbf600362bacde389e6fa7d02719.tar.xz
hercules-a6325af8d937fbf600362bacde389e6fa7d02719.zip
- Guild Castle code cleanup:
- all changes to guild castle data are now handled first by map-server and only sent to char-server for saving - ensured that changes made to guild castle during char-server disconnection time will be resent on reconnect - actually removed definition of `MAX_GUILDCASTLE` (r15657) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15658 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 67e9e722e..3fa32d681 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10145,7 +10145,7 @@ BUILDIN_FUNC(getcastledata)
if (gc == NULL) {
script_pushint(st,0);
- ShowWarning("builtin_setcastledata: guild castle for map '%s' not found\n", mapname);
+ ShowWarning("buildin_setcastledata: guild castle for map '%s' not found\n", mapname);
return 1;
}
@@ -10182,43 +10182,21 @@ BUILDIN_FUNC(getcastledata)
BUILDIN_FUNC(setcastledata)
{
- const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL);
+ const char *mapname = mapindex_getmapname(script_getstr(st,2),NULL);
int index = script_getnum(st,3);
int value = script_getnum(st,4);
- struct guild_castle* gc = guild_mapname2gc(mapname);
+ struct guild_castle *gc = guild_mapname2gc(mapname);
if (gc == NULL) {
- ShowWarning("builtin_setcastledata: guild castle for map '%s' not found\n", mapname);
+ ShowWarning("buildin_setcastledata: guild castle for map '%s' not found\n", mapname);
return 1;
}
- switch (index) {
- case 1:
- gc->guild_id = value; break;
- case 2:
- gc->economy = value; break;
- case 3:
- gc->defense = value; break;
- case 4:
- gc->triggerE = value; break;
- case 5:
- gc->triggerD = value; break;
- case 6:
- gc->nextTime = value; break;
- case 7:
- gc->payTime = value; break;
- case 8:
- gc->createTime = value; break;
- case 9:
- gc->visibleC = value; break;
- default:
- if (index > 9 && index <= 9+MAX_GUARDIANS) {
- gc->guardian[index-10].visible = value;
- break;
- }
- ShowWarning("buildin_setcastledata: index = '%d' is out of allowed range\n", index);
- return 1;
+ if (index <= 0 || index > 9+MAX_GUARDIANS) {
+ ShowWarning("buildin_setcastledata: index = '%d' is out of allowed range\n", index);
+ return 1;
}
+
guild_castledatasave(gc->castle_id, index, value);
return 0;
}