summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-06 23:39:24 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-06 23:39:24 +0000
commit6dcb99e42257de276814d3fe42a19c8f85e776d2 (patch)
treef1c78b005030bdb010ef54e49b96d44127e98b9a /src/char/char.c
parent5b1d1678fd03d6c780e933f6e464e3b02a860c0d (diff)
downloadhercules-6dcb99e42257de276814d3fe42a19c8f85e776d2.tar.gz
hercules-6dcb99e42257de276814d3fe42a19c8f85e776d2.tar.bz2
hercules-6dcb99e42257de276814d3fe42a19c8f85e776d2.tar.xz
hercules-6dcb99e42257de276814d3fe42a19c8f85e776d2.zip
- Modified the party_data structure on the map server to remove some redundant data. Added a party_data structure on the char-server to hold a more complete set of information about parties. Added to the party_member structure the class of each member so that the map server can do the appropiate checks even if the character is on another mapserver/offline. Due to the format changes in the party structure, txt servers will have to wipe their party file... (sql save format has not been changed)
- Added function char_family to check if there's a family state given the three character ids, instead of doing individual checks all the time. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7553 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/src/char/char.c b/src/char/char.c
index c2e80ae8a..774554037 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -205,6 +205,16 @@ int isGM(int account_id) {
return 0;
}
+//Search character data from the aid/cid givem
+struct mmo_charstatus* search_character(int aid, int cid) {
+ int i;
+ for (i = 0; i < char_num; i++) {
+ if (char_dat[i].status.char_id == cid && char_dat[i].status.account_id == aid)
+ return &char_dat[i].status;
+ }
+ return NULL;
+}
+
//----------------------------------------------
// Search an character id
// (return character index or -1 (if not found))
@@ -1695,6 +1705,35 @@ int char_child(int parent_id, int child_id) {
(char_dat[parent_id].status.char_id == char_dat[child_id].status.mother)));
}
+int char_family(int cid1, int cid2, int cid3) {
+ int i, idx1 = -1, idx2 =-1;//, idx3 =-1;
+ for(i = 0; i < char_num && (idx1 == -1 || idx2 == -1/* || idx3 == 1*/); i++)
+ {
+ if (char_dat[i].status.char_id == cid1)
+ idx1 = i;
+ if (char_dat[i].status.char_id == cid2)
+ idx2 = i;
+// if (char_dat[i].status.char_id == cid2)
+// idx3 = i;
+ }
+ if (idx1 == -1 || idx2 == -1/* || idx3 == -1*/)
+ return 0; //Some character not found??
+
+ //Unless the dbs are corrupted, these 3 checks should suffice, even though
+ //we could do a lot more checks and force cross-reference integrity.
+ if(char_dat[idx1].status.partner_id == cid2 &&
+ char_dat[idx1].status.child == cid3)
+ return 1; //cid1/cid2 parents. cid3 child.
+
+ if(char_dat[idx1].status.partner_id == cid3 &&
+ char_dat[idx1].status.child == cid2)
+ return 1; //cid1/cid3 parents. cid2 child.
+
+ if(char_dat[idx2].status.partner_id == cid3 &&
+ char_dat[idx2].status.child == cid1)
+ return 1; //cid2/cid3 parents. cid1 child.
+ return 0;
+}
//------------------------------------------------------------
// E-mail check: return 0 (not correct) or 1 (valid). by [Yor]
//------------------------------------------------------------
@@ -2636,8 +2675,6 @@ int parse_frommap(int fd) {
data = status_search_scdata(aid, cid);
if (data->count > 0)
{ //Deliver status change data.
- int i;
-
WFIFOW(fd,0) = 0x2b1d;
WFIFOW(fd,2) = 14 + data->count*sizeof(struct status_change_data);
WFIFOL(fd,4) = aid;
@@ -2739,7 +2776,7 @@ int parse_frommap(int fd) {
return 0;
{
unsigned short name;
- int map_id, map_fd = -1, i;
+ int map_id, map_fd = -1;
struct online_char_data* data;
struct mmo_charstatus* char_data;
@@ -2948,7 +2985,7 @@ int parse_frommap(int fd) {
if (RFIFOREST(fd) < 12)
return 0;
{
- int i, j;
+ int j;
int id = RFIFOL(fd, 2);
int fame = RFIFOL(fd, 6);
char type = RFIFOB(fd, 10);
@@ -3054,7 +3091,7 @@ int parse_frommap(int fd) {
return 0;
{
#ifdef ENABLE_SC_SAVING
- int count, aid, cid, i;
+ int count, aid, cid;
struct scdata *data;
aid = RFIFOL(fd, 4);
cid = RFIFOL(fd, 8);