aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-05-30 20:57:07 +0200
committerShauren <shauren.trinity@gmail.com>2013-05-30 20:57:07 +0200
commitadb78862da66b13984c6494befdffbf5da0cdbe6 (patch)
tree1514857a0131189194c251b7045d234a2bf45d86 /src/server/game/Entities
parentcf23793b4b04cfe12f6fc1441a7d9f8192f7dfa6 (diff)
parent3a697d4c9f5e9f2fa9c3b08c8e103d90472a871a (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Achievements/AchievementMgr.cpp src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Vehicle/Vehicle.cpp src/server/game/Handlers/ItemHandler.cpp src/server/game/Handlers/MailHandler.cpp src/server/game/Server/Protocol/Opcodes.cpp src/server/game/Server/Protocol/Opcodes.h src/server/scripts/Commands/cs_misc.cpp
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp38
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp44
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp5
-rw-r--r--src/server/game/Entities/Item/Item.cpp24
-rw-r--r--src/server/game/Entities/Item/Item.h4
-rw-r--r--src/server/game/Entities/Player/Player.cpp22
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp22
-rw-r--r--src/server/game/Entities/Transport/Transport.h4
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp13
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.cpp20
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.h4
-rw-r--r--src/server/game/Entities/Vehicle/VehicleDefines.h4
12 files changed, 122 insertions, 82 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index cf8a01a765e..79beab4f7e6 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -2451,19 +2451,18 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
time_t ptime = time(NULL);
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
- {
- ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
-
- uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
- if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount)
+ if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
{
- m_vendorItemCounts.erase(itr);
- return vItem->maxcount;
- }
+ uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
+ if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount)
+ {
+ m_vendorItemCounts.erase(itr);
+ return vItem->maxcount;
+ }
- vCount->count += diff * pProto->BuyCount;
- vCount->lastIncrementTime = ptime;
- }
+ vCount->count += diff * pProto->BuyCount;
+ vCount->lastIncrementTime = ptime;
+ }
return vCount->count;
}
@@ -2490,15 +2489,14 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
time_t ptime = time(NULL);
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
- {
- ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
-
- uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
- if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount)
- vCount->count += diff * pProto->BuyCount;
- else
- vCount->count = vItem->maxcount;
- }
+ if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
+ {
+ uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
+ if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount)
+ vCount->count += diff * pProto->BuyCount;
+ else
+ vCount->count = vItem->maxcount;
+ }
vCount->count = vCount->count > used_count ? vCount->count-used_count : 0;
vCount->lastIncrementTime = ptime;
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index c6d9bd52e18..3cefc5881e9 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -184,7 +184,9 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
data << item.BoxMessage; // accept text (related to money) pop up box, 2.0.3
}
- data << uint32(_questMenu.GetMenuItemCount()); // max count 0x20
+ size_t count_pos = data.wpos();
+ data << uint32(0); // max count 0x20
+ uint32 count = 0;
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
@@ -193,26 +195,29 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
{
QuestMenuItem const& item = _questMenu.GetItem(i);
uint32 questID = item.QuestId;
- Quest const* quest = sObjectMgr->GetQuestTemplate(questID);
-
- data << uint32(questID);
- data << uint32(item.QuestIcon);
- data << int32(quest->GetQuestLevel());
- data << uint32(quest->GetFlags()); // 3.3.3 quest flags
- data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
- std::string title = quest->GetTitle();
+ if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
+ {
+ ++count;
+ data << uint32(questID);
+ data << uint32(item.QuestIcon);
+ data << int32(quest->GetQuestLevel());
+ data << uint32(quest->GetFlags()); // 3.3.3 quest flags
+ data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
+ std::string title = quest->GetTitle();
- int32 locale = _session->GetSessionDbLocaleIndex();
- if (locale >= 0)
- if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
- ObjectMgr::GetLocaleString(localeData->Title, locale, title);
+ int32 locale = _session->GetSessionDbLocaleIndex();
+ if (locale >= 0)
+ if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
+ ObjectMgr::GetLocaleString(localeData->Title, locale, title);
- if (questLevelInTitle)
- AddQuestLevelToTitle(title, quest->GetQuestLevel());
+ if (questLevelInTitle)
+ AddQuestLevelToTitle(title, quest->GetQuestLevel());
- data << title; // max 0x200
+ data << title; // max 0x200
+ }
}
+ data.put<uint8>(count_pos, count);
_session->SendPacket(&data);
}
@@ -300,20 +305,21 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
data << uint32(eEmote._Emote); // NPC emote
size_t count_pos = data.wpos();
- data << uint8 (_questMenu.GetMenuItemCount());
+ data << uint8 (0);
uint32 count = 0;
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
- for (; count < _questMenu.GetMenuItemCount(); ++count)
+ for (uint32 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
- QuestMenuItem const& qmi = _questMenu.GetItem(count);
+ QuestMenuItem const& qmi = _questMenu.GetItem(i);
uint32 questID = qmi.QuestId;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
{
+ ++count;
std::string title = quest->GetTitle();
int32 locale = _session->GetSessionDbLocaleIndex();
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index ff74c6921f7..8d15e6ab39a 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -87,7 +87,10 @@ bool GameObject::AIM_Initialize()
std::string GameObject::GetAIName() const
{
- return sObjectMgr->GetGameObjectTemplate(GetEntry())->AIName;
+ if (GameObjectTemplate const* got = sObjectMgr->GetGameObjectTemplate(GetEntry()))
+ return got->AIName;
+
+ return "";
}
void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index a25bd463a55..86d02132eca 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -858,16 +858,26 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
return true;
}
-void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges)
+void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster /*= 0*/)
{
// Better lost small time at check in comparison lost time at item save to DB.
if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
return;
+ Player* owner = GetOwner();
+ if (slot < MAX_INSPECTED_ENCHANTMENT_SLOT)
+ {
+ if (uint32 oldEnchant = GetEnchantmentId(slot))
+ owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), 0, GetEntry(), oldEnchant);
+
+ if (id)
+ owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetEntry(), id);
+ }
+
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET, id);
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges);
- SetState(ITEM_CHANGED, GetOwner());
+ SetState(ITEM_CHANGED, owner);
}
void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner)
@@ -984,6 +994,16 @@ bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) cons
return proto && ((proto->Map && proto->Map != cur_mapId) || (proto->Area && proto->Area != cur_zoneId));
}
+void Item::SendUpdateSockets()
+{
+ WorldPacket data(SMSG_SOCKET_GEMS_RESULT, 8+4+4+4+4);
+ data << uint64(GetGUID());
+ for (uint32 i = SOCK_ENCHANTMENT_SLOT; i <= BONUS_ENCHANTMENT_SLOT; ++i)
+ data << uint32(GetEnchantmentId(EnchantmentSlot(i)));
+
+ GetOwner()->GetSession()->SendPacket(&data);
+}
+
// Though the client has the information in the item's data field,
// we have to send SMSG_ITEM_TIME_UPDATE to display the remaining
// time.
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index f69ac0f8965..cdc79d96d67 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -295,7 +295,7 @@ class Item : public Object
void SetItemRandomProperties(int32 randomPropId);
void UpdateItemSuffixFactor();
static int32 GenerateItemRandomPropertyId(uint32 item_id);
- void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges);
+ void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster = 0);
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
void ClearEnchantment(EnchantmentSlot slot);
@@ -306,6 +306,8 @@ class Item : public Object
std::string const& GetText() const { return m_text; }
void SetText(std::string const& text) { m_text = text; }
+ void SendUpdateSockets();
+
void SendTimeUpdate(Player* owner);
void UpdateDuration(Player* owner, uint32 diff);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 10004862b74..718223304da 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -8017,6 +8017,10 @@ void Player::DuelComplete(DuelCompleteType type)
if (getClass() == CLASS_DEATH_KNIGHT && duel->opponent->GetQuestStatus(12733) == QUEST_STATUS_INCOMPLETE)
duel->opponent->CastSpell(duel->opponent, 52994, true);
+ // Honor points after duel (the winner) - ImpConfig
+ if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL))
+ duel->opponent->RewardHonor(NULL, 1, amount);
+
break;
default:
break;
@@ -8063,10 +8067,6 @@ void Player::DuelComplete(DuelCompleteType type)
else if (duel->opponent->GetComboTarget() == GetPetGUID())
duel->opponent->ClearComboPoints();
- // Honor points after duel (the winner) - ImpConfig
- if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL))
- duel->opponent->RewardHonor(NULL, 1, amount);
-
//cleanups
SetUInt64Value(PLAYER_DUEL_ARBITER, 0);
SetUInt32Value(PLAYER_DUEL_TEAM, 0);
@@ -9885,6 +9885,16 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
bf->FillInitialWorldStates(data);
break;
}
+ case 4820:
+ if (instance && mapid == 668)
+ instance->FillInitialWorldStates(data);
+ else
+ {
+ data << uint32(4884) << uint32(0); // 9 WORLD_STATE_HOR_WAVES_ENABLED
+ data << uint32(4882) << uint32(0); // 10 WORLD_STATE_HOR_WAVE_COUNT
+ }
+ break;
+
// No break here, intended.
default:
data << uint32(0x914) << uint32(0x0); // 7
@@ -22711,7 +22721,7 @@ void Player::UpdateTriggerVisibility()
if (!obj || !(obj->isTrigger() || obj->HasAuraType(SPELL_AURA_TRANSFORM))) // can transform into triggers
continue;
- obj->BuildCreateUpdateBlockForPlayer(&udata, this);
+ obj->BuildValuesUpdateBlockForPlayer(&udata, this);
}
}
@@ -23681,7 +23691,7 @@ void Player::UpdateForQuestWorldObjects()
if (buildUpdateBlock)
{
- obj->BuildCreateUpdateBlockForPlayer(&udata, this);
+ obj->BuildValuesUpdateBlockForPlayer(&udata, this);
break;
}
}
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 43664a7853e..3ed41781982 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -691,30 +691,34 @@ void Transport::UpdatePassengerPositions()
float x, y, z, o;
npc->m_movementInfo.t_pos.GetPosition(x, y, z, o);
- CalculatePassengerPosition(x, y, z, o);
+ CalculatePassengerPosition(x, y, z, &o);
GetMap()->CreatureRelocation(npc, x, y, z, o, false);
npc->GetTransportHomePosition(x, y, z, o);
- CalculatePassengerPosition(x, y, z, o);
+ CalculatePassengerPosition(x, y, z, &o);
npc->SetHomePosition(x, y, z, o);
}
}
-void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o) const
+void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const
{
- float inx = x, iny = y, inz = z, ino = o;
- o = GetOrientation() + ino;
+ float inx = x, iny = y, inz = z;
+ if (o)
+ *o = Position::NormalizeOrientation(GetOrientation() + *o);
+
x = GetPositionX() + inx * std::cos(GetOrientation()) - iny * std::sin(GetOrientation());
y = GetPositionY() + iny * std::cos(GetOrientation()) + inx * std::sin(GetOrientation());
z = GetPositionZ() + inz;
}
-void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o) const
+void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const
{
- o -= GetOrientation();
+ if (o)
+ *o = Position::NormalizeOrientation(*o - GetOrientation());
+
z -= GetPositionZ();
y -= GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o)
x -= GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
float inx = x, iny = y;
- y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation()));
- x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation()));
+ y = (iny - inx * std::tan(GetOrientation())) / (std::cos(GetOrientation()) + std::sin(GetOrientation()) * std::tan(GetOrientation()));
+ x = (inx + iny * std::tan(GetOrientation())) / (std::cos(GetOrientation()) + std::sin(GetOrientation()) * std::tan(GetOrientation()));
}
diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h
index bae09335f62..445bec456fd 100644
--- a/src/server/game/Entities/Transport/Transport.h
+++ b/src/server/game/Entities/Transport/Transport.h
@@ -50,10 +50,10 @@ class Transport : public GameObject, public TransportBase
void UpdatePassengerPositions();
/// This method transforms supplied transport offsets into global coordinates
- void CalculatePassengerPosition(float& x, float& y, float& z, float& o) const;
+ void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const;
/// This method transforms supplied global coordinates into local offsets
- void CalculatePassengerOffset(float& x, float& y, float& z, float& o) const;
+ void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const;
void BuildStartMovePacket(Map const* targetMap);
void BuildStopMovePacket(Map const* targetMap);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index a0aea414cef..8fa929131e2 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -416,15 +416,8 @@ void Unit::UpdateSplinePosition()
pos.m_positionZ = loc.z;
pos.SetOrientation(loc.orientation);
- if (Unit* vehicle = GetVehicleBase())
- {
- loc.x += vehicle->GetPositionX();
- loc.y += vehicle->GetPositionY();
- loc.z += vehicle->GetPositionZMinusOffset();
- loc.orientation = vehicle->GetOrientation();
- }
- else if (TransportBase* transport = GetDirectTransport())
- transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
+ if (TransportBase* transport = GetDirectTransport())
+ transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
}
if (HasUnitState(UNIT_STATE_CANNOT_TURN))
@@ -11246,7 +11239,7 @@ void Unit::setDeathState(DeathState s)
SetPower(getPowerType(), 0);
// players in instance don't have ZoneScript, but they have InstanceScript
- if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
+ if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : GetInstanceScript())
zoneScript->OnUnitDeath(this);
}
else if (s == JUST_RESPAWNED)
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 214a47a6611..503d89a8e82 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -556,7 +556,7 @@ void Vehicle::RelocatePassengers()
float px, py, pz, po;
passenger->m_movementInfo.t_pos.GetPosition(px, py, pz, po);
- CalculatePassengerPosition(px, py, pz, po);
+ CalculatePassengerPosition(px, py, pz, &po);
passenger->UpdatePosition(px, py, pz, po);
}
@@ -675,24 +675,28 @@ uint8 Vehicle::GetAvailableSeatCount() const
return ret;
}
-void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o) const
+void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const
{
- float inx = x, iny = y, inz = z, ino = o;
- o = GetBase()->GetOrientation() + ino;
+ float inx = x, iny = y, inz = z;
+ if (o)
+ *o = Position::NormalizeOrientation(GetBase()->GetOrientation() + *o);
+
x = GetBase()->GetPositionX() + inx * std::cos(GetBase()->GetOrientation()) - iny * std::sin(GetBase()->GetOrientation());
y = GetBase()->GetPositionY() + iny * std::cos(GetBase()->GetOrientation()) + inx * std::sin(GetBase()->GetOrientation());
z = GetBase()->GetPositionZ() + inz;
}
-void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o) const
+void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const
{
- o -= GetBase()->GetOrientation();
+ if (o)
+ *o = Position::NormalizeOrientation(*o - GetBase()->GetOrientation());
+
z -= GetBase()->GetPositionZ();
y -= GetBase()->GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o)
x -= GetBase()->GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
float inx = x, iny = y;
- y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
- x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
+ y = (iny - inx * std::tan(GetBase()->GetOrientation())) / (std::cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * std::tan(GetBase()->GetOrientation()));
+ x = (inx + iny * std::tan(GetBase()->GetOrientation())) / (std::cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * std::tan(GetBase()->GetOrientation()));
}
/**
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index 3e4a2fd3a78..c83a9fa5f33 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -89,10 +89,10 @@ class Vehicle : public TransportBase
void InitMovementInfoForBase();
/// This method transforms supplied transport offsets into global coordinates
- void CalculatePassengerPosition(float& x, float& y, float& z, float& o) const;
+ void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const;
/// This method transforms supplied global coordinates into local offsets
- void CalculatePassengerOffset(float& x, float& y, float& z, float& o) const;
+ void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const;
void RemovePendingEvent(VehicleJoinEvent* e);
void RemovePendingEventsForSeat(int8 seatId);
diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h
index 9db8c15f697..55c47df86ad 100644
--- a/src/server/game/Entities/Vehicle/VehicleDefines.h
+++ b/src/server/game/Entities/Vehicle/VehicleDefines.h
@@ -105,10 +105,10 @@ protected:
public:
/// This method transforms supplied transport offsets into global coordinates
- virtual void CalculatePassengerPosition(float& x, float& y, float& z, float& o) const = 0;
+ virtual void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const = 0;
/// This method transforms supplied global coordinates into local offsets
- virtual void CalculatePassengerOffset(float& x, float& y, float& z, float& o) const = 0;
+ virtual void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const = 0;
};
#endif