Marking this issue down for reference to other forks. It's kind of a dumb hack, but it works.
(TODO Test to ensure this actually works on DOD:S.) DOD doesn't use this
RCBot2's CTeamControlPointMaster has different offsets on Windows and Linux. The offsets are based on it being a subclass of CBaseEntity, and so the offset is sizeof(CBaseEntity).
There is ability to access the size of entities via an IEntityFactory, and conveniently we can access and perform lookups against an IEntityFactoryDictionary interface.
The following code does just that:
extern IServerTools *servertools;
// HACK: we use one of the known CBaseEntity-sized entities to compute the offset to the first subclass member for CTeamControlPointMaster / CTeamControlPointRound
size_t baseEntityOffset = servertools->GetEntityFactoryDictionary()->FindFactory("simple_physics_brush")->GetEntitySize();
uintptr_t pMasterMembers = reinterpret_cast<uintptr_t>(servergameents->EdictToBaseEntity(pMaster)) + baseEntityOffset;
m_PointMaster = (CTeamControlPointMaster*) pMasterMembers;
Marking this issue down for reference to other forks. It's kind of a dumb hack, but it works.
(TODO Test to ensure this actually works on DOD:S.)DOD doesn't use thisRCBot2's
CTeamControlPointMaster
has different offsets on Windows and Linux. The offsets are based on it being a subclass ofCBaseEntity
, and so the offset issizeof(CBaseEntity)
.There is ability to access the size of entities via an
IEntityFactory
, and conveniently we can access and perform lookups against anIEntityFactoryDictionary
interface.The following code does just that: