summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-02 23:21:54 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-02 23:21:54 +0000
commit57fbe69be8382e1f659dad2e7d9ae3ecc1c273d7 (patch)
tree2f8bb925301d675051b6b28da620bc94f4c16ffb
parent632c620f0acb0119bc7edf46ffb3b5301c4ebf1f (diff)
downloadhercules-57fbe69be8382e1f659dad2e7d9ae3ecc1c273d7.tar.gz
hercules-57fbe69be8382e1f659dad2e7d9ae3ecc1c273d7.tar.bz2
hercules-57fbe69be8382e1f659dad2e7d9ae3ecc1c273d7.tar.xz
hercules-57fbe69be8382e1f659dad2e7d9ae3ecc1c273d7.zip
- 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
-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;
}
/*==========================================