-
-
Notifications
You must be signed in to change notification settings - Fork 496
Allow allocating models server-side #2533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Allow allocating models server-side #2533
Conversation
|
This draft pull request is stale because it has been open for at least 90 days with no activity. Please continue on your draft pull request or it will be closed in 30 days automatically. |
efff3b5 to
5698387
Compare
|
WIP |
…l_allocation_server
|
Fixes #2571 |
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
|
This draft pull request is stale because it has been open for at least 90 days with no activity. Please continue on your draft pull request or it will be closed in 30 days automatically. |
…l_allocation_server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a huge PR, good job so far
| eModelInfoType CModelInfoSA::GetModelType() | ||
| { | ||
| return ((eModelInfoType(*)())m_pInterface->VFTBL->GetModelType)(); | ||
| return (eModelInfoType)((uint8_t(*)())m_pInterface->VFTBL->GetModelType)(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change std::uint8_t to uint8_t. Let's stick to C++ headers and namespaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer uint8_t in all cases. cstdint types are standard these days.
I think std:: for numbers adds too much noise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer
uint8_tin all cases. cstdint types are standard these days. I thinkstd::for numbers adds too much noise.
cstdint doesnt guarantee standard types in the global namespace but does guarantee having them in the std namespace
stdint.h doesnt guarantee standard types in the std namespace but does guarantee having them in the global namespace
If we go with cstdint (as we should) then std:: is required by a C++ standard (unless you do using on them)
In the end, its the matter of preference, right?
|
|
||
| CClientModelManager::CClientModelManager() : m_Models(std::make_unique<std::shared_ptr<CClientModel>[]>(g_pGame->GetBaseIDforCOL())) | ||
| { | ||
| const unsigned int uiMaxModelID = g_pGame->GetBaseIDforCOL(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto or std::uint32_t?
|
|
||
| bool CClientModelManager::RemoveClientModel(const int modelId) | ||
| { | ||
| if (m_Models[modelId] == nullptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!m_Models[modelId])|
|
||
| int CClientModelManager::GetFirstFreeModelID(void) | ||
| { | ||
| const unsigned int uiMaxModelID = g_pGame->GetBaseIDforCOL(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto or std::uint32_t?
| void CClientModelManager::DeallocateModelsAllocatedByResource(CResource* pResource) | ||
| { | ||
| const unsigned int uiMaxModelID = g_pGame->GetBaseIDforCOL(); | ||
| for (unsigned int i = 0; i < uiMaxModelID; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto maybe?
| class CModelVehicle : public CModelBase | ||
| { | ||
| public: | ||
| CModelVehicle(uint32_t uiModelID, const SModelVehicleDefs& SModelVehicleDefs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::uint32_t instead of uint32_t
| CHandlingEntry* GetVehicleHandling() { return m_pVehicleHandling; }; | ||
| const CHandlingEntry* GetOriginalHandling() { return &m_modelDef.handling; }; | ||
| void SetVehicleDefaultHandling(CHandlingEntry& pEntry) { m_modelDef.handling = pEntry; } | ||
| void SetVehicleHandling(CHandlingEntry* pEntry) { m_pVehicleHandling = pEntry; }; | ||
| void SetVehicleHandlingChanged(bool bState) { m_bVehicleHandlingChanged = bState; }; | ||
| bool HasVehicleHandlingChanged() { return m_bVehicleHandlingChanged; }; | ||
|
|
||
| void SetVehicleDafaultColors(CVehicleColors colors) { m_modelDef.vehicleColors = colors; }; | ||
|
|
||
| bool HasDamageModel(); | ||
| bool HasDoors() { return m_modelDef.bHasDoors; }; | ||
| bool IsTrailer() { return m_modelDef.eVehicleModelType == eVehicleType::TRAILER; }; | ||
| const char* GetVehicleName() { return m_modelDef.strVehicleName; }; | ||
| eVehicleType GetVehicleType() { return m_modelDef.eVehicleModelType; } | ||
| uint8_t GetVariantsCount() { return m_modelDef.uiVariantsCount; }; | ||
| uint8_t GetAttributes() { return m_modelDef.cAttributes; }; | ||
| uint8_t GetPassengesCount() { return m_modelDef.uiMaxPassengers; }; | ||
| eVehicleVariationType GetVariationType() { return m_modelDef.eVariationType; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove trailing ; from end of the lines, add const to getters, add noexcept if you can
| CVehicleColor GetRandomColor() { return m_modelDef.vehicleColors.GetRandomColor(); } | ||
| void AddColor(const CVehicleColor& color) { return m_modelDef.vehicleColors.AddColor(color); }; | ||
|
|
||
| void GetRandomVariation(unsigned char& ucVariant, unsigned char& ucVariant2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::uint8_t instead of unsigned char
| uint32_t uiModelsCount = listSimpleAllocatedModels.size(); | ||
| BitStream.Write(uiModelsCount); | ||
|
|
||
| for (auto model : listSimpleAllocatedModels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto& model
|
|
||
| if (BitStream.Can(eBitStreamVersion::SimpleModelAllocation)) | ||
| { | ||
| uint32_t uiModelsCount = listSimpleAllocatedModels.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::uint32_t instead of uint32_t
|
Any updates? |
|
Is this a draft? |
|
Is it still in progress? |
|
Directly related to #2251 |
|
Any updates? |
Fixes #2427