summaryrefslogtreecommitdiff
path: root/src/char/int_pet.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-27 14:54:01 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-27 14:54:01 +0000
commit036bbfd9ae5a4a77031fb33a87264e58214c2ba0 (patch)
tree7df6db240c83ab4c0e7b5733dee337c0583010b8 /src/char/int_pet.c
parentf68366250c523440b972616f61577edfe6d51c04 (diff)
downloadhercules-036bbfd9ae5a4a77031fb33a87264e58214c2ba0.tar.gz
hercules-036bbfd9ae5a4a77031fb33a87264e58214c2ba0.tar.bz2
hercules-036bbfd9ae5a4a77031fb33a87264e58214c2ba0.tar.xz
hercules-036bbfd9ae5a4a77031fb33a87264e58214c2ba0.zip
- Fixed indentation on int_pet.c (how did it got messed up?)
- Added mapflag "loadevent", now load-map script events will ONLY trigger on maps with this mapflag on, rather than every map. - High Jump can now be used in all versus maps. - Added Kaite's opt3 value, taken from jA - Added state dirty == 2 to storages. Signals when a storage was sent for final saving. Said storage is removed from memory after the ack from the char-server, and they are sent to save if the map/char servers reconnect before the act arrives. In short: they are guaranteed to be saved after a char logs out. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7358 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char/int_pet.c')
-rw-r--r--src/char/int_pet.c192
1 files changed, 96 insertions, 96 deletions
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index d787b9821..67f3fb697 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -217,8 +217,8 @@ int mapif_delete_pet_ack(int fd,int flag)
WFIFOB(fd,2)=flag;
WFIFOSET(fd,3);
- return 0;
- }
+ return 0;
+}
int mapif_rename_pet_ack(int fd, int account_id, int char_id, int flag, char *name){
WFIFOW(fd, 0) =0x3884;
@@ -231,112 +231,112 @@ int mapif_rename_pet_ack(int fd, int account_id, int char_id, int flag, char *na
return 0;
}
- int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet_lv,short pet_egg_id,
- short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name)
- {
- struct s_pet *p;
- p= (struct s_pet *) aCalloc(sizeof(struct s_pet), 1);
- if(p==NULL){
- ShowFatalError("int_pet: out of memory !\n");
- mapif_pet_created(fd,account_id,NULL);
- return 0;
- }
- // memset(p,0,sizeof(struct s_pet)); unnecessary after aCalloc [Skotlex]
- p->pet_id = pet_newid++;
- memcpy(p->name,pet_name,NAME_LENGTH-1);
- if(incuvate == 1)
- p->account_id = p->char_id = 0;
- else {
- p->account_id = account_id;
- p->char_id = char_id;
- }
- p->class_ = pet_class;
- p->level = pet_lv;
- p->egg_id = pet_egg_id;
- p->equip = pet_equip;
- p->intimate = intimate;
- p->hungry = hungry;
- p->rename_flag = rename_flag;
- p->incuvate = incuvate;
-
- if(p->hungry < 0)
- p->hungry = 0;
- else if(p->hungry > 100)
- p->hungry = 100;
- if(p->intimate < 0)
- p->intimate = 0;
- else if(p->intimate > 1000)
- p->intimate = 1000;
-
- idb_put(pet_db,p->pet_id,p);
-
- mapif_pet_created(fd,account_id,p);
-
+int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet_lv,short pet_egg_id,
+ short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name)
+{
+ struct s_pet *p;
+ p= (struct s_pet *) aCalloc(sizeof(struct s_pet), 1);
+ if(p==NULL){
+ ShowFatalError("int_pet: out of memory !\n");
+ mapif_pet_created(fd,account_id,NULL);
return 0;
}
+// memset(p,0,sizeof(struct s_pet)); unnecessary after aCalloc [Skotlex]
+ p->pet_id = pet_newid++;
+ memcpy(p->name,pet_name,NAME_LENGTH-1);
+ if(incuvate == 1)
+ p->account_id = p->char_id = 0;
+ else {
+ p->account_id = account_id;
+ p->char_id = char_id;
+ }
+ p->class_ = pet_class;
+ p->level = pet_lv;
+ p->egg_id = pet_egg_id;
+ p->equip = pet_equip;
+ p->intimate = intimate;
+ p->hungry = hungry;
+ p->rename_flag = rename_flag;
+ p->incuvate = incuvate;
+
+ if(p->hungry < 0)
+ p->hungry = 0;
+ else if(p->hungry > 100)
+ p->hungry = 100;
+ if(p->intimate < 0)
+ p->intimate = 0;
+ else if(p->intimate > 1000)
+ p->intimate = 1000;
+
+ idb_put(pet_db,p->pet_id,p);
+
+ mapif_pet_created(fd,account_id,p);
- int mapif_load_pet(int fd,int account_id,int char_id,int pet_id)
- {
- struct s_pet *p;
- p= idb_get(pet_db,pet_id);
- if(p!=NULL) {
- if(p->incuvate == 1) {
- p->account_id = p->char_id = 0;
- mapif_pet_info(fd,account_id,p);
- }
- else if(account_id == p->account_id && char_id == p->char_id)
- mapif_pet_info(fd,account_id,p);
- else
- mapif_pet_noinfo(fd,account_id);
+ return 0;
+}
+
+int mapif_load_pet(int fd,int account_id,int char_id,int pet_id)
+{
+ struct s_pet *p;
+ p= idb_get(pet_db,pet_id);
+ if(p!=NULL) {
+ if(p->incuvate == 1) {
+ p->account_id = p->char_id = 0;
+ mapif_pet_info(fd,account_id,p);
}
+ else if(account_id == p->account_id && char_id == p->char_id)
+ mapif_pet_info(fd,account_id,p);
else
mapif_pet_noinfo(fd,account_id);
-
- return 0;
}
+ else
+ mapif_pet_noinfo(fd,account_id);
+
+ return 0;
+}
- static void* create_pet(DBKey key, va_list args) {
- struct s_pet *p;
- p=(struct s_pet *)aCalloc(sizeof(struct s_pet),1);
- p->pet_id = key.i;
- return p;
+static void* create_pet(DBKey key, va_list args) {
+ struct s_pet *p;
+ p=(struct s_pet *)aCalloc(sizeof(struct s_pet),1);
+ p->pet_id = key.i;
+ return p;
+}
+int mapif_save_pet(int fd,int account_id,struct s_pet *data)
+{
+ struct s_pet *p;
+ int pet_id, len;
+ RFIFOHEAD(fd);
+ len=RFIFOW(fd,2);
+
+ if(sizeof(struct s_pet)!=len-8) {
+ ShowError("inter pet: data size error %d %d\n",sizeof(struct s_pet),len-8);
}
- int mapif_save_pet(int fd,int account_id,struct s_pet *data)
- {
- struct s_pet *p;
- int pet_id, len;
- RFIFOHEAD(fd);
- len=RFIFOW(fd,2);
-
- if(sizeof(struct s_pet)!=len-8) {
- ShowError("inter pet: data size error %d %d\n",sizeof(struct s_pet),len-8);
- }
- else{
- pet_id = data->pet_id;
- if (pet_id == 0)
- pet_id = data->pet_id = pet_newid++;
- p= idb_ensure(pet_db,pet_id,create_pet);
- if(data->hungry < 0)
- data->hungry = 0;
- else if(data->hungry > 100)
- data->hungry = 100;
- if(data->intimate < 0)
- data->intimate = 0;
- else if(data->intimate > 1000)
- data->intimate = 1000;
- memcpy(p,data,sizeof(struct s_pet));
- if(p->incuvate == 1)
- p->account_id = p->char_id = 0;
-
- mapif_save_pet_ack(fd,account_id,0);
- }
+ else{
+ pet_id = data->pet_id;
+ if (pet_id == 0)
+ pet_id = data->pet_id = pet_newid++;
+ p= idb_ensure(pet_db,pet_id,create_pet);
+ if(data->hungry < 0)
+ data->hungry = 0;
+ else if(data->hungry > 100)
+ data->hungry = 100;
+ if(data->intimate < 0)
+ data->intimate = 0;
+ else if(data->intimate > 1000)
+ data->intimate = 1000;
+ memcpy(p,data,sizeof(struct s_pet));
+ if(p->incuvate == 1)
+ p->account_id = p->char_id = 0;
- return 0;
+ mapif_save_pet_ack(fd,account_id,0);
}
- int mapif_delete_pet(int fd,int pet_id)
- {
- mapif_delete_pet_ack(fd,inter_pet_delete(pet_id));
+ return 0;
+}
+
+int mapif_delete_pet(int fd,int pet_id)
+{
+ mapif_delete_pet_ack(fd,inter_pet_delete(pet_id));
return 0;
}