summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-07 18:58:33 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-07 18:58:33 +0000
commitdff76e1a9840fe00a6c738d89de5d1074eae858a (patch)
tree33d2843fa4495142449e5a3175db6a1b48123bcd /src/map
parent4f713a631bcb5df4ee4afc8667b51c2893ce693b (diff)
downloadhercules-dff76e1a9840fe00a6c738d89de5d1074eae858a.tar.gz
hercules-dff76e1a9840fe00a6c738d89de5d1074eae858a.tar.bz2
hercules-dff76e1a9840fe00a6c738d89de5d1074eae858a.tar.xz
hercules-dff76e1a9840fe00a6c738d89de5d1074eae858a.zip
- Corrected the pet/homunc data not being free'd if the player logs out before being authed.
- Initialized player's speed on pc_setnewpc to prevent homunculus copying a speed of 0. - Added comment to reloadbattleconf specifying that some settings do not take effect inmediately. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9975 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/status.c3
-rw-r--r--src/map/unit.c38
4 files changed, 28 insertions, 18 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 48ca20dff..6be703545 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1669,6 +1669,8 @@ void map_deliddb(struct block_list *bl) {
int map_quit(struct map_session_data *sd) {
if(!sd->state.auth) { //Removing a player that hasn't even finished loading
+ if (sd->pd) unit_free(&sd->pd->bl,-1);
+ if (sd->hd) unit_free(&sd->hd->bl,-1);
idb_remove(pc_db,sd->status.account_id);
idb_remove(charid_db,sd->status.char_id);
idb_remove(id_db,sd->bl.id);
diff --git a/src/map/pc.c b/src/map/pc.c
index de5977bcf..7ed9c5245 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -358,7 +358,8 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo
sd->bl.type = BL_PC;
sd->canlog_tick = gettick();
sd->state.waitingdisconnect = 0;
-
+ //Required to prevent homunculus copuing a base speed of 0.
+ sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED;
return 0;
}
diff --git a/src/map/status.c b/src/map/status.c
index 924a97407..660241cd3 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2370,8 +2370,7 @@ int status_calc_homunculus(struct homun_data *hd, int first)
status->rhw.range = 1 + status->size;
status->mode = MD_CANMOVE|MD_CANATTACK;
status->speed = DEFAULT_WALK_SPEED;
- if (battle_config.hom_setting&0x8 &&
- hd->master && hd->master->state.auth) //Master needs be authed to have valid speed.
+ if (battle_config.hom_setting&0x8 && hd->master)
status->speed = status_get_speed(&hd->master->bl);
status->hp = 1;
diff --git a/src/map/unit.c b/src/map/unit.c
index 984867cfe..492714bc2 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1739,6 +1739,8 @@ int unit_remove_map(struct block_list *bl, int clrtype) {
/*==========================================
* Function to free all related resources to the bl
* if unit is on map, it is removed using the clrtype specified
+ * If clrtype is <0, no saving is performed. This is only for non-authed
+ * objects that shouldn't be on a map yet.
*------------------------------------------
*/
@@ -1825,9 +1827,11 @@ int unit_free(struct block_list *bl, int clrtype) {
guild_send_memberinfoshort(sd,0);
pc_cleareventtimer(sd);
pc_delspiritball(sd,sd->spiritball,1);
- chrif_save_scdata(sd); //Save status changes, then clear'em out from memory. [Skotlex]
- pc_makesavestatus(sd);
- pc_clean_skilltree(sd);
+ if (clrtype >= 0) {
+ chrif_save_scdata(sd); //Save status changes, then clear'em out from memory. [Skotlex]
+ pc_makesavestatus(sd);
+ pc_clean_skilltree(sd);
+ }
} else if( bl->type == BL_PET ) {
struct pet_data *pd = (struct pet_data*)bl;
struct map_session_data *sd = pd->msd;
@@ -1870,12 +1874,14 @@ int unit_free(struct block_list *bl, int clrtype) {
aFree (pd->loot);
pd->loot = NULL;
}
- if(pd->pet.intimate > 0)
- intif_save_petdata(pd->pet.account_id,&pd->pet);
- else
- { //Remove pet.
- intif_delete_petdata(pd->pet.pet_id);
- if (sd) sd->status.pet_id = 0;
+ if (clrtype >= 0) {
+ if(pd->pet.intimate > 0)
+ intif_save_petdata(pd->pet.account_id,&pd->pet);
+ else
+ { //Remove pet.
+ intif_delete_petdata(pd->pet.pet_id);
+ if (sd) sd->status.pet_id = 0;
+ }
}
if (sd) sd->pd = NULL;
} else if(bl->type == BL_MOB) {
@@ -1912,12 +1918,14 @@ int unit_free(struct block_list *bl, int clrtype) {
struct map_session_data *sd = hd->master;
// Desactive timers
merc_hom_hungry_timer_delete(hd);
- if (hd->homunculus.intimacy > 0)
- merc_save(hd);
- else
- {
- intif_homunculus_requestdelete(hd->homunculus.hom_id);
- if (sd) sd->status.hom_id = 0;
+ if (clrtype >= 0) {
+ if (hd->homunculus.intimacy > 0)
+ merc_save(hd);
+ else
+ {
+ intif_homunculus_requestdelete(hd->homunculus.hom_id);
+ if (sd) sd->status.hom_id = 0;
+ }
}
if(sd) sd->hd = NULL;
}