- 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://svn.code.sf.net/p/rathena/svn/trunk@15658 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
gepard1984
2012-03-05 00:08:28 +00:00
parent f810293de3
commit 47fc6d2fe2
9 changed files with 119 additions and 146 deletions

View File

@@ -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;
}