Skip to content
Permalink
Browse files

Use container's size_type in CVehicleManager for vehicle count

Also rename Count to GetVehicleCount for clarity
  • Loading branch information...
botder committed Oct 23, 2019
1 parent ca698e7 commit 3525964073e00f0412db4013e7661e55e672857c
@@ -35,8 +35,7 @@ class CVehicleManager
CVehicle* CreateFromXML(CElement* pParent, CXMLNode& Node, CEvents* pEvents);
void DeleteAll();

unsigned int Count() { return static_cast<unsigned int>(m_List.size()); };
bool Exists(CVehicle* pVehicle);
bool Exists(CVehicle* pVehicle);

static bool IsValidModel(unsigned int uiVehicleModel);
static eVehicleType GetVehicleType(unsigned short usModel);
@@ -59,6 +58,8 @@ class CVehicleManager

void GetVehiclesOfType(unsigned int uiModel, lua_State* luaVM);

Container::size_type GetVehicleCount() { return m_List.size(); }

Container& GetVehicles() noexcept { return m_List; }
Container const& GetVehicles() const noexcept { return m_List; }

@@ -18,7 +18,7 @@ CUnoccupiedVehicleSyncPacket::~CUnoccupiedVehicleSyncPacket()

bool CUnoccupiedVehicleSyncPacket::Read(NetBitStreamInterface& BitStream)
{
uint uiMaxCount = g_pGame->GetVehicleManager()->Count() * 2 + 10;
uint uiMaxCount = static_cast<uint>(g_pGame->GetVehicleManager()->GetVehicleCount()) * 2u + 10u;
// While we're not out of bytes
for (uint i = 0; BitStream.GetNumberOfUnreadBits() >= 8; i++)
{

0 comments on commit 3525964

Please sign in to comment.
You can’t perform that action at this time.