Alex/AT
-
Posts
2 -
Joined
-
Last visited
Never -
Donations
0.00 GBP
Content Type
Profiles
Bug Tracker
Wiki
Release Notes
Forums
Downloads
Blogs
Events
Posts posted by Alex/AT
-
-
Unit.cpp contains small mistake which can cause wrong object typization and calls to non-existent methods when the object is player and it has no group.
Look:
if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup())
will fail if unit is not TYPEID_PLAYER or if it has no group. In both cases it goes to else, and then:
if(((Creature*)this)->isPet())
executes. When unit is TYPEID_PLAYER without group, it is (Player*) and has no isPet function. Calls to nowhere are surely bad
Fix here [4692+]:
--- src/game/Unit.cpp 2008-04-27 12:40:49.000000000 +0400 +++ src/game/Unit.cpp 2008-04-27 20:52:05.000000000 +0400 @@ -6193,8 +6193,11 @@ { SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype); - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9014,8 +9020,11 @@ SetUInt32Value(UNIT_FIELD_HEALTH, val); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9033,8 +9042,11 @@ SetUInt32Value(UNIT_FIELD_MAXHEALTH, val); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9058,8 +9070,11 @@ SetStatInt32Value(UNIT_FIELD_POWER1 + power, val); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9077,8 +9092,11 @@ SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + power, val); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9098,8 +9116,11 @@ ApplyModUInt32Value(UNIT_FIELD_POWER1+power, val, apply); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9116,8 +9137,11 @@ ApplyModUInt32Value(UNIT_FIELD_MAXPOWER1+power, val, apply); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this);
[patch] Instance Renumbering System Cleanup
in ... rejectedOld
Posted
Instance renumbering routine requires some cleanup to work properly.
Currently it can left over some instance IDs causing them to reapper in DB each time server is run and sometimes leads to wrong instance associations for corpses and/or characters.
The patch is here: