From 57fbe69be8382e1f659dad2e7d9ae3ecc1c273d7 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 2 Aug 2006 23:21:54 +0000 Subject: - Fixed a logic error on battle_get_master which was causing infinite loops... ~.~ git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8077 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/map/battle.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index b8d83a13e..267f2e1c4 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/08/02 + * Fixed a logic error on battle_get_master which was causing infinite + loops.. [Skotlex] * Fixed homunculus error message [Toms] * Rewrote pc_payzeny to not use doubles, it may more accurately prevent charging a player more zeny than they can withhold. [Skotlex] diff --git a/src/map/battle.c b/src/map/battle.c index 60f6a1f01..4a84744d1 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3085,29 +3085,29 @@ int battle_check_undead(int race,int element) //Returns the upmost level master starting with the given object static struct block_list* battle_get_master(struct block_list *src) { - struct block_list *mst; //Used for infinite loop check (master of yourself?) + struct block_list *prev; //Used for infinite loop check (master of yourself?) do { - mst = src; + prev = src; switch (src->type) { case BL_PET: if (((TBL_PET*)src)->msd) - mst = (struct block_list*)((TBL_PET*)src)->msd; + src = (struct block_list*)((TBL_PET*)src)->msd; break; case BL_MOB: if (((TBL_MOB*)src)->master_id) - mst = map_id2bl(((TBL_MOB*)src)->master_id); + src = map_id2bl(((TBL_MOB*)src)->master_id); break; case BL_HOMUNCULUS: if (((TBL_HOMUNCULUS*)src)->master) - mst = (struct block_list*)((TBL_HOMUNCULUS*)src)->master; + src = (struct block_list*)((TBL_HOMUNCULUS*)src)->master; break; case BL_SKILL: if (((TBL_SKILL*)src)->group && ((TBL_SKILL*)src)->group->src_id) - mst = map_id2bl(((TBL_SKILL*)src)->group->src_id); + src = map_id2bl(((TBL_SKILL*)src)->group->src_id); break; } - } while (mst && src != mst); - return src; + } while (src && src != prev); + return prev; } /*========================================== -- cgit v1.2.3-70-g09d2