summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorveider <veider@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-31 20:34:23 +0000
committerveider <veider@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-31 20:34:23 +0000
commit1b9da54036054f509abb4cc922bfff624e6f636d (patch)
tree0248112f6b672faa02bc5f02c585f5cc2969f80d /src/char/char.c
parent634bdec0ab92f420ad2e004790514b9350c663bd (diff)
downloadhercules-1b9da54036054f509abb4cc922bfff624e6f636d.tar.gz
hercules-1b9da54036054f509abb4cc922bfff624e6f636d.tar.bz2
hercules-1b9da54036054f509abb4cc922bfff624e6f636d.tar.xz
hercules-1b9da54036054f509abb4cc922bfff624e6f636d.zip
Added adoption to TXT version
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1364 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c54
1 files changed, 49 insertions, 5 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 1a5fa49e8..85f97e154 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -263,7 +263,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p) {
str_p += sprintf(str_p, "%d\t%d,%d\t%s\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
"\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
- "\t%s,%d,%d\t%s,%d,%d,%d\t",
+ "\t%s,%d,%d\t%s,%d,%d,%d,%d,%d,%d\t",
p->char_id, p->account_id, p->char_num, p->name, //
p->class_, p->base_level, p->job_level,
p->base_exp, p->job_exp, p->zeny,
@@ -276,7 +276,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p) {
p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom,
p->last_point.map, p->last_point.x, p->last_point.y, //
p->save_point.map, p->save_point.x, p->save_point.y,
- p->partner_id);
+ p->partner_id,p->father,p->mother,p->child);
for(i = 0; i < 10; i++)
if (p->memo_point[i].map[0]) {
str_p += sprintf(str_p, "%s,%d,%d", p->memo_point[i].map, p->memo_point[i].x, p->memo_point[i].y);
@@ -325,8 +325,28 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) {
// initilialise character
memset(p, '\0', sizeof(struct mmo_charstatus));
-
- // If it's not char structure of version 1008 and after
+
+ // If it's not char structure of version 1363 and after
+ if ((set = sscanf(str, "%d\t%d,%d\t%[^\t]\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
+ "\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
+ "\t%[^,],%d,%d\t%[^,],%d,%d,%d,%d,%d,%d%n",
+ &tmp_int[0], &tmp_int[1], &tmp_int[2], p->name, //
+ &tmp_int[3], &tmp_int[4], &tmp_int[5],
+ &tmp_int[6], &tmp_int[7], &tmp_int[8],
+ &tmp_int[9], &tmp_int[10], &tmp_int[11], &tmp_int[12],
+ &tmp_int[13], &tmp_int[14], &tmp_int[15], &tmp_int[16], &tmp_int[17], &tmp_int[18],
+ &tmp_int[19], &tmp_int[20],
+ &tmp_int[21], &tmp_int[22], &tmp_int[23], //
+ &tmp_int[24], &tmp_int[25], &tmp_int[26],
+ &tmp_int[27], &tmp_int[28], &tmp_int[29],
+ &tmp_int[30], &tmp_int[31], &tmp_int[32], &tmp_int[33], &tmp_int[34],
+ p->last_point.map, &tmp_int[35], &tmp_int[36], //
+ p->save_point.map, &tmp_int[37], &tmp_int[38], &tmp_int[39],
+ &tmp_int[40], &tmp_int[41], &tmp_int[42], &next)) != 46) {
+ tmp_int[40] = 0; // father
+ tmp_int[41] = 0; // mother
+ tmp_int[42] = 0; // child
+ // If it's not char structure of version 1008 and before 1363
if ((set = sscanf(str, "%d\t%d,%d\t%[^\t]\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
"\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
"\t%[^,],%d,%d\t%[^,],%d,%d,%d%n",
@@ -385,9 +405,14 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) {
}
// Char structure of version 1008+
} else {
+ set+=3;
//printf("char: new char data ver.3\n");
}
- if (set != 43)
+ // Char structture of version 1363+
+ } else {
+ //printf("char: new char data ver.4\n");
+ }
+ if (set != 46)
return 0;
p->char_id = tmp_int[0];
@@ -430,6 +455,9 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) {
p->save_point.x = tmp_int[37];
p->save_point.y = tmp_int[38];
p->partner_id = tmp_int[39];
+ p->father = tmp_int[40];
+ p->mother = tmp_int[41];
+ p->child = tmp_int[42];
// Some checks
for(i = 0; i < char_num; i++) {
@@ -3566,3 +3594,19 @@ int do_init(int argc, char **argv) {
return 0;
}
+
+int char_married(int pl1,int pl2) {
+ if (char_dat[pl1].char_id == char_dat[pl2].partner_id && char_dat[pl2].char_id == char_dat[pl1].partner_id)
+ return 1;
+ else
+ return 0;
+}
+
+int char_child(int parent_id, int child_id) {
+ if (char_dat[parent_id].child == char_dat[child_id].char_id &&
+ ((char_dat[parent_id].char_id == char_dat[child_id].father) ||
+ (char_dat[parent_id].char_id == char_dat[child_id].mother)))
+ return 1;
+ else
+ return 0;
+}