Core/GameObjects: Removed the possibility to spawn transports wih gm commands (such objects did not have any transport mechanics but could still cause crashes)

Closes #14542

(cherry picked from commit 149ff8da879a8286a01081d4ffb1f200a67ddefd)

Conflicts:
	src/server/game/Entities/GameObject/GameObject.cpp
	src/server/game/Entities/GameObject/GameObject.h
	src/server/game/Globals/ObjectMgr.cpp
This commit is contained in:
Shauren authored and DDuarte committed 2015-04-29 00:05:47 +01:00
1 parent 9759aa2cfd
commit 8b07f1cd4d
5 files changed
+29 -6

No files matched your search

@@ -190,6 +190,12 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
return false;
}
if (goinfo->type == GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT)
{
TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD " Entry: %u) not created: gameobject type GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT cannot be manually created.", guidlow, name_id);
return false;
}
if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
m_updateFlag = (m_updateFlag | UPDATEFLAG_TRANSPORT) & ~UPDATEFLAG_POSITION;
@@ -2068,6 +2074,15 @@ void GameObject::SetGoState(GOState state)
}
}
uint32 GameObject::GetTransportPeriod() const
{
ASSERT(GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT);
if (m_goValue.Transport.AnimationInfo)
return m_goValue.Transport.AnimationInfo->TotalTime;
return 0;
}
void GameObject::SetDisplayId(uint32 displayid)
{
SetUInt32Value(GAMEOBJECT_DISPLAYID, displayid);
@@ -2206,9 +2221,16 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
if (ActivateToQuest(target))
dynFlags |= GO_DYNFLAG_LO_SPARKLE;
break;
case GAMEOBJECT_TYPE_TRANSPORT:
case GAMEOBJECT_TYPE_MO_TRANSPORT:
pathProgress = int16(float(m_goValue.Transport.PathProgress) / float(GetUInt32Value(GAMEOBJECT_LEVEL)) * 65535.0f);
{
if (uint32 transportPeriod = GetTransportPeriod())
{
float timer = float(m_goValue.Transport.PathProgress % transportPeriod);
pathProgress = int16(timer / float(transportPeriod) * 65535.0f);
}
break;
}
default:
break;
}