Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 9e28f3b

Browse files
committed
Solve
Add m_PassengerSlots Fix very tiny small typo by overlord Weegee
1 parent 9fe8eb7 commit 9e28f3b

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

Entities/Actor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ void Actor::Clear()
112112
m_WhiteFlashTimer.Reset();
113113
m_PieSlices.clear();
114114
m_DeploymentID = 0;
115+
m_PassengerSlots = 1;
115116

116117
m_ScriptedAIUpdate = false;
117118
m_AIMode = AIMODE_NONE;
@@ -292,6 +293,7 @@ int Actor::Create(const Actor &reference)
292293
m_sIconsLoaded = true;
293294
}
294295
m_DeploymentID = reference.m_DeploymentID;
296+
m_PassengerSlots = reference.m_PassengerSlots;
295297

296298
m_ScriptedAIUpdate = reference.m_ScriptedAIUpdate;
297299
m_AIMode = reference.m_AIMode;
@@ -337,6 +339,8 @@ int Actor::ReadProperty(std::string propName, Reader &reader)
337339
reader >> m_Status;
338340
else if (propName == "DeploymentID")
339341
reader >> m_DeploymentID;
342+
else if (propName == "PassengerSlots")
343+
reader >> m_PassengerSlots;
340344
else if (propName == "Health")
341345
{
342346
reader >> m_Health;

Entities/Actor.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,15 @@ ENTITYALLOCATION(Actor)
397397

398398
float GetAimAngle(bool adjustForFlipped = true) const { return adjustForFlipped ? FacingAngle(m_AimAngle) : m_AimAngle; }
399399

400+
//////////////////////////////////////////////////////////////////////////////////////////
401+
// Method: GetPassengerSlots
402+
//////////////////////////////////////////////////////////////////////////////////////////
403+
// Description: Gets this Actor's passenger slots.
404+
// Arguments: None.
405+
// Return value: The Actor's passenger plots
406+
407+
int GetPassengerSlots() const { return m_PassengerSlots; }
408+
400409

401410
//////////////////////////////////////////////////////////////////////////////////////////
402411
// Virtual method: GetCPUPos
@@ -532,6 +541,15 @@ ENTITYALLOCATION(Actor)
532541

533542
void SetAimAngle(float newAngle) { m_AimAngle = newAngle; Clamp(m_AimAngle, m_AimRange, -m_AimRange); }
534543

544+
//////////////////////////////////////////////////////////////////////////////////////////
545+
// Method: SetPassengerSlots
546+
//////////////////////////////////////////////////////////////////////////////////////////
547+
// Description: Sets this Actor's passenger slots.
548+
// Arguments: A new amount of passenger slots.
549+
// Return value: None.
550+
551+
void SetPassengerSlots(int newPassengerSlots) { m_PassengerSlots = newPassengerSlots;; }
552+
535553

536554
//////////////////////////////////////////////////////////////////////////////////////////
537555
// Method: SetViewPoint
@@ -1457,6 +1475,8 @@ ENTITYALLOCATION(Actor)
14571475
float m_DigStrength;
14581476
// ID of deployment which spawned this actor
14591477
unsigned int m_DeploymentID;
1478+
// How many passenger slots this actor will take in a craft
1479+
int m_PassengerSlots;
14601480

14611481

14621482
////////////////////

Managers/LuaMan.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,8 @@ int LuaMan::Create()
912912
.def("IsDead", &Actor::IsDead)
913913
.def("FacingAngle", &Actor::FacingAngle)
914914
.property("AIMode", &Actor::GetAIMode, &Actor::SetAIMode)
915-
.property("DeploymentID", &Actor::GetDeploymentID)
915+
.property("DeploymentID", &Actor::GetDeploymentID)
916+
.property("PassengerSlots", &Actor::GetPassengerSlots, &Actor::SetPassengerSlots)
916917
.def("AddAISceneWaypoint", &Actor::AddAISceneWaypoint)
917918
.def("AddAIMOWaypoint", &Actor::AddAIMOWaypoint)
918919
.def("ClearAIWaypoints", &Actor::ClearAIWaypoints)

Menus/BuyMenuGUI.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ float BuyMenuGUI::GetCraftMass()
782782
//////////////////////////////////////////////////////////////////////////////////////////
783783
// Method: GetTotalOrderPassengers
784784
//////////////////////////////////////////////////////////////////////////////////////////
785-
// Description: Return teh total number of passengers in the order box.
785+
// Description: Return the total number of passengers in the order box.
786786
// Arguments: None.
787787
// Return value: The total number of passengers.
788788

@@ -791,8 +791,9 @@ int BuyMenuGUI::GetTotalOrderPassengers()
791791
int passengers = 0;
792792
for (vector<GUIListPanel::Item *>::iterator itr = m_pCartList->GetItemList()->begin(); itr != m_pCartList->GetItemList()->end(); ++itr)
793793
{
794-
if (dynamic_cast<const Actor *>((*itr)->m_pEntity))
795-
passengers++;
794+
const Actor* passenger = dynamic_cast<const Actor*>((*itr)->m_pEntity);
795+
if (passenger)
796+
passengers = passengers + passenger->GetPassengerSlots();
796797
}
797798

798799
return passengers;

0 commit comments

Comments
 (0)