Skip to content

Commit

Permalink
Fix optional value
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij committed Dec 25, 2023
1 parent 84fa9a0 commit 1d89b6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Client/mods/deathmatch/logic/luadefs/CLuaBuildingDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void CLuaBuildingDefs::AddClass(lua_State* luaVM)
lua_registerclass(luaVM, "Building");
}

CClientBuilding* CLuaBuildingDefs::CreateBuilding(lua_State* const luaVM, uint16_t modelId, CVector pos, CVector rot, uint8_t interior)
CClientBuilding* CLuaBuildingDefs::CreateBuilding(lua_State* const luaVM, uint16_t modelId, CVector pos, CVector rot, std::optional<uint8_t> interior)
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);

Expand All @@ -51,7 +51,7 @@ CClientBuilding* CLuaBuildingDefs::CreateBuilding(lua_State* const luaVM, uint16

ConvertDegreesToRadians(rot);

CClientBuilding* pBuilding = new CClientBuilding(m_pManager, INVALID_ELEMENT_ID, modelId, pos, rot, interior);
CClientBuilding* pBuilding = new CClientBuilding(m_pManager, INVALID_ELEMENT_ID, modelId, pos, rot, interior.value_or(0));

CClientEntity* pRoot = pResource->GetResourceDynamicEntity();
pBuilding->SetParent(pRoot);
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaBuildingDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ class CLuaBuildingDefs : public CLuaDefs
static void AddClass(lua_State* luaVM);

// Buiding create funcs
static CClientBuilding* CreateBuilding(lua_State* const luaVM, uint16_t modelId, CVector pos, CVector rot, uint8_t interior = 0);
static CClientBuilding* CreateBuilding(lua_State* const luaVM, uint16_t modelId, CVector pos, CVector rot, std::optional<uint8_t> interior);
};

0 comments on commit 1d89b6d

Please sign in to comment.