summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-04 18:37:29 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-04 18:37:29 +0000
commit262e60ab0b9cfc1f942a7b3ef11f7ed3abc7b208 (patch)
tree82cb02f8048521c7479ff012511a066612f6d439 /src/map/intif.c
parentce4352cfef6f07bf3b4c0324f48f880c5c74f041 (diff)
downloadhercules-262e60ab0b9cfc1f942a7b3ef11f7ed3abc7b208.tar.gz
hercules-262e60ab0b9cfc1f942a7b3ef11f7ed3abc7b208.tar.bz2
hercules-262e60ab0b9cfc1f942a7b3ef11f7ed3abc7b208.tar.xz
hercules-262e60ab0b9cfc1f942a7b3ef11f7ed3abc7b208.zip
- Guild Castle code cleanup:
- removed `MAX_GUILDCASTLE` limit - char-server now caches guild castles in `DBMap` - improved guild castle SQL queries to support non-default values of `MAX_GUARDIANS` - disallowed declaring guild castles on maps that are on other map-servers - map-server now requests data for all guild castles from char-server on initial connect (bugreport:287) - removed ''guildcastleinfo events'' as they were esentially duplicated ''OnAgitInit'' - optimized castle data load packets (bugreport:287) - updated WoE scripts to reflect source changes (scripts no longer need or should request castle or guild data) - updated related docs - Added `db_size` macro. - Replaced manual counting of castles occupied by a guild with `guild_checkcastles()` calls. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15657 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/intif.c')
-rw-r--r--src/map/intif.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index 54d039347..20d686c11 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -36,7 +36,7 @@ static const int packet_len_table[]={
0, 0, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810
39,-1,15,15, 14,19, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820
10,-1,15, 0, 79,19, 7,-1, 0,-1,-1,-1, 14,67,186,-1, //0x3830
- 9, 9,-1,14, 0, 0, 0, 0, -1,74,-1,11, 11,-1, 0, 0, //0x3840
+ -1, 9, 0,14, 0, 0, 0, 0, -1,74,-1,11, 11,-1, 0, 0, //0x3840
-1,-1, 7, 7, 7,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3850 Auctions [Zephyrus]
-1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] [Inkfish]
-1, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3870 Mercenaries [Zephyrus]
@@ -720,17 +720,22 @@ int intif_guild_emblem(int guild_id,int len,const char *data)
WFIFOSET(inter_fd,len+12);
return 0;
}
-//現在のギルド城占領ギルドを調べる
-int intif_guild_castle_dataload(int castle_id,int index)
+
+/**
+ * Requests guild castles data from char-server.
+ * @param num Number of castles, size of castle_ids array.
+ * @param castle_ids Pointer to array of castle IDs.
+ */
+int intif_guild_castle_dataload(int num, int *castle_ids)
{
if (CheckForCharServer())
return 0;
- WFIFOHEAD(inter_fd,5);
- WFIFOW(inter_fd,0)=0x3040;
- WFIFOW(inter_fd,2)=castle_id;
- WFIFOB(inter_fd,4)=index;
- WFIFOSET(inter_fd,5);
- return 0;
+ WFIFOHEAD(inter_fd, 4 + num * sizeof(int));
+ WFIFOW(inter_fd, 0) = 0x3040;
+ WFIFOW(inter_fd, 2) = 4 + num * sizeof(int);
+ memcpy(WFIFOP(inter_fd, 4), castle_ids, num * sizeof(int));
+ WFIFOSET(inter_fd, WFIFOW(inter_fd, 2));
+ return 1;
}
//ギルド城占領ギルド変更要求
@@ -1072,7 +1077,6 @@ int intif_parse_GuildInfo(int fd)
guild_recv_noinfo(RFIFOL(fd,4));
return 0;
}
-
if( RFIFOW(fd,2)!=sizeof(struct guild)+4 )
ShowError("intif: guild info : data size error Gid: %d recv size: %d Expected size: %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4);
guild_recv_info((struct guild *)RFIFOP(fd,4));
@@ -1203,7 +1207,7 @@ int intif_parse_GuildMessage(int fd)
// ギルド城データ要求返信
int intif_parse_GuildCastleDataLoad(int fd)
{
- return guild_castledataloadack(RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5));
+ return guild_castledataloadack(RFIFOW(fd,2), (struct guild_castle *)RFIFOP(fd,4));
}
// ギルド城データ変更通知
int intif_parse_GuildCastleDataSave(int fd)
@@ -1211,12 +1215,6 @@ int intif_parse_GuildCastleDataSave(int fd)
return guild_castledatasaveack(RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5));
}
-// ギルド城データ一括受信(初期化時)
-int intif_parse_GuildCastleAllDataLoad(int fd)
-{
- return guild_castlealldataload(RFIFOW(fd,2),(struct guild_castle *)RFIFOP(fd,4));
-}
-
int intif_parse_GuildMasterChanged(int fd)
{
return guild_gm_changed(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
@@ -2040,7 +2038,6 @@ int intif_parse(int fd)
case 0x383f: intif_parse_GuildEmblem(fd); break;
case 0x3840: intif_parse_GuildCastleDataLoad(fd); break;
case 0x3841: intif_parse_GuildCastleDataSave(fd); break;
- case 0x3842: intif_parse_GuildCastleAllDataLoad(fd); break;
case 0x3843: intif_parse_GuildMasterChanged(fd); break;
//Quest system