summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-12-27 06:35:34 +0100
committerHaru <haru@dotalux.com>2015-01-23 04:14:28 +0100
commite778f4f5f1b6a08adee5e7e908a44c38cd29bd12 (patch)
tree63cbc8e6eb78ffc374ffac374bf5e533b58bcafa /src/map/unit.c
parentb1b1b1aa8edc866a83029081e93d3e7d0f138189 (diff)
downloadhercules-e778f4f5f1b6a08adee5e7e908a44c38cd29bd12.tar.gz
hercules-e778f4f5f1b6a08adee5e7e908a44c38cd29bd12.tar.bz2
hercules-e778f4f5f1b6a08adee5e7e908a44c38cd29bd12.tar.xz
hercules-e778f4f5f1b6a08adee5e7e908a44c38cd29bd12.zip
Cleaned up spirit charms implementation (optimized memory and CPU usage)
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 27b96c55b..6e4efd533 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2593,8 +2593,6 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
case BL_PC:
{
struct map_session_data *sd = (struct map_session_data*)bl;
- int i;
- unsigned int k;
sd->state.loggingout = 1;
@@ -2619,8 +2617,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
pc->cleareventtimer(sd);
pc->inventory_rental_clear(sd);
pc->delspiritball(sd,sd->spiritball,1);
- for(i = SPIRITS_TYPE_CHARM_WATER; i < SPIRITS_TYPE_SPHERE; i++)
- pc->del_charm(sd, sd->spiritcharm[i], i);
+ pc->del_charm(sd, sd->charm_count, sd->charm_type);
if( sd->st && sd->st->state != RUN ) {// free attached scripts that are waiting
script->free_state(sd->st);
@@ -2634,6 +2631,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
sd->combo_count = 0;
/* [Ind/Hercules] */
if( sd->sc_display_count ) {
+ int i;
for(i = 0; i < sd->sc_display_count; i++) {
ers_free(pc->sc_display_ers, sd->sc_display[i]);
}
@@ -2657,8 +2655,8 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
sd->num_quests = sd->avail_quests = 0;
}
- if( sd->hdata )
- {
+ if (sd->hdata) {
+ unsigned int k;
for( k = 0; k < sd->hdatac; k++ ) {
if( sd->hdata[k]->flag.free ) {
aFree(sd->hdata[k]->data);