summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/battle.c16
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;
}
/*==========================================