Replaced some magic numbers related to castle guardians with MAX_GUARDIANS
.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15650 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
ce45ab511f
commit
654676b73e
@ -1836,16 +1836,9 @@ int mapif_parse_GuildCastleDataLoad(int fd,int castle_id,int index)
|
|||||||
case 7: return mapif_guild_castle_dataload(gc.castle_id,index,gc.payTime); break;
|
case 7: return mapif_guild_castle_dataload(gc.castle_id,index,gc.payTime); break;
|
||||||
case 8: return mapif_guild_castle_dataload(gc.castle_id,index,gc.createTime); break;
|
case 8: return mapif_guild_castle_dataload(gc.castle_id,index,gc.createTime); break;
|
||||||
case 9: return mapif_guild_castle_dataload(gc.castle_id,index,gc.visibleC); break;
|
case 9: return mapif_guild_castle_dataload(gc.castle_id,index,gc.visibleC); break;
|
||||||
case 10:
|
|
||||||
case 11:
|
|
||||||
case 12:
|
|
||||||
case 13:
|
|
||||||
case 14:
|
|
||||||
case 15:
|
|
||||||
case 16:
|
|
||||||
case 17:
|
|
||||||
return mapif_guild_castle_dataload(gc.castle_id,index,gc.guardian[index-10].visible); break;
|
|
||||||
default:
|
default:
|
||||||
|
if (index > 9 && index <= 9+MAX_GUARDIANS)
|
||||||
|
return mapif_guild_castle_dataload(gc.castle_id,index,gc.guardian[index-10].visible);
|
||||||
ShowError("mapif_parse_GuildCastleDataLoad ERROR!! (Not found index=%d)\n", index);
|
ShowError("mapif_parse_GuildCastleDataLoad ERROR!! (Not found index=%d)\n", index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1880,16 +1873,11 @@ int mapif_parse_GuildCastleDataSave(int fd,int castle_id,int index,int value)
|
|||||||
case 7: gc.payTime = value; break;
|
case 7: gc.payTime = value; break;
|
||||||
case 8: gc.createTime = value; break;
|
case 8: gc.createTime = value; break;
|
||||||
case 9: gc.visibleC = 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:
|
default:
|
||||||
|
if (index > 9 && index <= 9+MAX_GUARDIANS) {
|
||||||
|
gc.guardian[index-10].visible = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
ShowError("mapif_parse_GuildCastleDataSave ERROR!! (Not found index=%d)\n", index);
|
ShowError("mapif_parse_GuildCastleDataSave ERROR!! (Not found index=%d)\n", index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1731,16 +1731,11 @@ int guild_castledataloadack(int castle_id,int index,int value)
|
|||||||
case 7: gc->payTime = value; break;
|
case 7: gc->payTime = value; break;
|
||||||
case 8: gc->createTime = value; break;
|
case 8: gc->createTime = value; break;
|
||||||
case 9: gc->visibleC = 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:
|
default:
|
||||||
|
if (index > 9 && index <= 9+MAX_GUARDIANS) {
|
||||||
|
gc->guardian[index-10].visible = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
ShowError("guild_castledataloadack ERROR!! (Not found castle_id=%d index=%d)\n", castle_id, index);
|
ShowError("guild_castledataloadack ERROR!! (Not found castle_id=%d index=%d)\n", castle_id, index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1801,16 +1796,11 @@ int guild_castledatasaveack(int castle_id,int index,int value)
|
|||||||
case 7: gc->payTime = value; break;
|
case 7: gc->payTime = value; break;
|
||||||
case 8: gc->createTime = value; break;
|
case 8: gc->createTime = value; break;
|
||||||
case 9: gc->visibleC = 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:
|
default:
|
||||||
|
if (index > 9 && index <= 9+MAX_GUARDIANS) {
|
||||||
|
gc->guardian[index-10].visible = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
ShowError("guild_castledatasaveack ERROR!! (Not found index=%d)\n", index);
|
ShowError("guild_castledatasaveack ERROR!! (Not found index=%d)\n", index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -10147,14 +10147,14 @@ BUILDIN_FUNC(getcastledata)
|
|||||||
if(script_hasdata(st,4) && index==0 && gc) {
|
if(script_hasdata(st,4) && index==0 && gc) {
|
||||||
const char* event = script_getstr(st,4);
|
const char* event = script_getstr(st,4);
|
||||||
check_event(st, event);
|
check_event(st, event);
|
||||||
guild_addcastleinfoevent(gc->castle_id,17,event);
|
guild_addcastleinfoevent(gc->castle_id, 9+MAX_GUARDIANS, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gc){
|
if(gc){
|
||||||
switch(index){
|
switch(index){
|
||||||
case 0: {
|
case 0: {
|
||||||
int i;
|
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);
|
guild_castledataload(gc->castle_id,i);
|
||||||
} break;
|
} break;
|
||||||
case 1:
|
case 1:
|
||||||
@ -10175,17 +10175,12 @@ BUILDIN_FUNC(getcastledata)
|
|||||||
script_pushint(st,gc->createTime); break;
|
script_pushint(st,gc->createTime); break;
|
||||||
case 9:
|
case 9:
|
||||||
script_pushint(st,gc->visibleC); break;
|
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:
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -10222,16 +10217,11 @@ BUILDIN_FUNC(setcastledata)
|
|||||||
gc->createTime = value; break;
|
gc->createTime = value; break;
|
||||||
case 9:
|
case 9:
|
||||||
gc->visibleC = value; break;
|
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:
|
default:
|
||||||
|
if (index > 9 && index <= 9+MAX_GUARDIANS) {
|
||||||
|
gc->guardian[index-10].visible = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
guild_castledatasave(gc->castle_id,index,value);
|
guild_castledatasave(gc->castle_id,index,value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user