1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 14:02:59 +01:00

Move remaining EntityBase functions to EntityBase.cpp

This commit is contained in:
ζeh Matt
2021-11-27 15:12:57 +02:00
parent bcb527d331
commit 496fdfd3eb
4 changed files with 76 additions and 76 deletions

View File

@@ -11,6 +11,62 @@
#include "../core/DataSerialiser.h"
// Required for GetEntity to return a default
template<> bool EntityBase::Is<EntityBase>() const
{
return true;
}
CoordsXYZ EntityBase::GetLocation() const
{
return { x, y, z };
}
void EntityBase::SetLocation(const CoordsXYZ& newLocation)
{
x = newLocation.x;
y = newLocation.y;
z = newLocation.z;
}
void EntityBase::Invalidate()
{
if (x == LOCATION_NULL)
return;
int32_t maxZoom = 0;
switch (Type)
{
case EntityType::Vehicle:
case EntityType::Guest:
case EntityType::Staff:
maxZoom = 2;
break;
case EntityType::CrashedVehicleParticle:
case EntityType::JumpingFountain:
maxZoom = 0;
break;
case EntityType::Duck:
maxZoom = 1;
break;
case EntityType::SteamParticle:
case EntityType::MoneyEffect:
case EntityType::ExplosionCloud:
case EntityType::CrashSplash:
case EntityType::ExplosionFlare:
case EntityType::Balloon:
maxZoom = 2;
break;
case EntityType::Litter:
maxZoom = 0;
break;
default:
break;
}
viewports_invalidate(SpriteRect, maxZoom);
}
void EntityBase::Serialise(DataSerialiser& stream)
{
stream << Type;