diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-24 19:29:25 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-24 19:29:25 +0000 |
commit | 1d2cd17fbfac7aa5d54b74e6eacb6c06f2f9c40b (patch) | |
tree | efb2e4174a087f1e8838ca09fd5ee1467b244629 /src | |
parent | 7d383782ee118f1fc9837a6425b9431f031d0aa8 (diff) | |
download | hercules-1d2cd17fbfac7aa5d54b74e6eacb6c06f2f9c40b.tar.gz hercules-1d2cd17fbfac7aa5d54b74e6eacb6c06f2f9c40b.tar.bz2 hercules-1d2cd17fbfac7aa5d54b74e6eacb6c06f2f9c40b.tar.xz hercules-1d2cd17fbfac7aa5d54b74e6eacb6c06f2f9c40b.zip |
- Some cleaning around the return to egg code. Pets should stop duplicating now.
- Some cleaning of the egg hatching routine to prevent spawning the pet if the egg can't be found in the inventory.
- Removed some autoadded data/ strings in grfio.c module to see if it helps with the data_dir configuration.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5736 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/common/grfio.c | 6 | ||||
-rw-r--r-- | src/map/pet.c | 45 |
2 files changed, 22 insertions, 29 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c index fcc1ee461..9830ca85c 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -846,7 +846,7 @@ static void grfio_resourcecheck(void) FILE *fp;
// read resnametable from data directory and return if successful
- sprintf(restable, "%sdata\\resnametable.txt", data_dir);
+ sprintf(restable, "%sresnametable.txt", data_dir);
for (ptr = &restable[0]; *ptr != 0; ptr++)
if (*ptr == '\\') *ptr = '/';
@@ -857,8 +857,8 @@ static void grfio_resourcecheck(void) // we only need the map names and text files
(strstr(w2, ".gat") || strstr(w2, ".txt")))
{
- sprintf(src, "data\\%s", w1);
- sprintf(dst, "data\\%s", w2);
+ sprintf(src, "%s", w1);
+ sprintf(dst, "%s", w2);
entry = filelist_find(dst);
// create new entries reusing the original's info
if (entry != NULL) {
diff --git a/src/map/pet.c b/src/map/pet.c index e578e97d6..67049d271 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -361,7 +361,6 @@ int pet_return_egg(struct map_session_data *sd) if(sd->status.pet_id && sd->pd) {
// ルートしたItemを落とさせる
pet_lootitem_drop(sd->pd,sd);
- unit_free(&sd->pd->bl);
if(sd->petDB == NULL)
return 1;
memset(&tmp_item,0,sizeof(tmp_item));
@@ -375,18 +374,12 @@ int pet_return_egg(struct map_session_data *sd) clif_additem(sd,0,0,flag);
map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0);
}
- sd->pet.incuvate = 1;
- sd->pet.pet_id = 0;
- sd->pet.rename_flag = 0; //Prevents future captured pets from starting as "beloved" [Skotlex]
- if(battle_config.pet_status_support && sd->pet.intimate > 0) {
- if(sd->bl.prev != NULL)
- status_calc_pc(sd,0);
- else
- status_calc_pc(sd,2);
- }
intif_save_petdata(sd->status.account_id,&sd->pet);
- chrif_save(sd,0); //FIXME: Do we really need to save the char when returning to pet? Seems like a waste, and unexploitable as the pet data is just moved to an item in the inventory. [Skotlex]
-
+ unit_free(&sd->pd->bl);
+ if(battle_config.pet_status_support && sd->pet.intimate > 0)
+ status_calc_pc(sd,0);
+ memset(&sd->pet, 0, sizeof(struct s_pet));
+ sd->pet.incuvate = 1;
sd->petDB = NULL;
}
@@ -508,21 +501,21 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag) }
memcpy(&sd->pet,p,sizeof(struct s_pet));
if(sd->pet.incuvate == 1) {
- if (!pet_birth_process(sd))
- {
- int i;
- //Delete egg from inventory. [Skotlex]
- for (i = 0; i < MAX_INVENTORY; i++) {
- if(sd->status.inventory[i].card[0] == (short)0xff00 &&
- p->pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2]))
- {
- pc_delitem(sd,i,1,0);
- break;
- }
- }
- if(i >= MAX_INVENTORY && battle_config.error_log)
- ShowError("pet_recv_petdata: Hatched pet (%d:%s), but couldn't find egg in inventory for removal!\n",p->pet_id, p->name);
+ int i;
+ //Delete egg from inventory. [Skotlex]
+ for (i = 0; i < MAX_INVENTORY; i++) {
+ if(sd->status.inventory[i].card[0] == (short)0xff00 &&
+ p->pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2]))
+ break;
+ }
+ if(i >= MAX_INVENTORY) {
+ if (battle_config.error_log)
+ ShowError("pet_recv_petdata: Hatching pet (%d:%s) aborted, couldn't find egg in inventory for removal!\n",p->pet_id, p->name);
+ sd->status.pet_id = 0;
+ return 1;
}
+ if (!pet_birth_process(sd)) //Pet hatched. Delete egg.
+ pc_delitem(sd,i,1,0);
} else {
pet_data_init(sd);
if(sd->pd && sd->bl.prev != NULL) {
|