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

Commit 42a9f8d

Browse files
committed
Force set team as active in MovableObject::SetTeam
1 parent e870995 commit 42a9f8d

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

Entities/Actor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ bool Actor::HasObjectInGroup(std::string groupName) const
608608

609609
void Actor::SetTeam(int team)
610610
{
611-
SceneObject::SetTeam(team);
611+
MovableObject::SetTeam(team);
612612

613613
// Change the Team Icon to display
614614
m_pTeamIcon = 0;

Entities/MovableObject.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "MovableObject.h"
1515

16+
#include "ActivityMan.h"
1617
#include "PresetMan.h"
1718
#include "SceneMan.h"
1819
#include "ConsoleMan.h"
@@ -692,6 +693,11 @@ MovableObject::MovableObject(const MovableObject &reference):
692693
}
693694
*/
694695

696+
void MovableObject::SetTeam(int team) {
697+
SceneObject::SetTeam(team);
698+
if (g_ActivityMan.GetActivity()) { g_ActivityMan.GetActivity()->ForceSetTeamAsActive(team); }
699+
}
700+
695701
//////////////////////////////////////////////////////////////////////////////////////////
696702
// Virtual method: GetAltitude
697703
//////////////////////////////////////////////////////////////////////////////////////////

Entities/MovableObject.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ enum MOType
544544

545545
bool GetsHitByMOs() const { return m_GetsHitByMOs; }
546546

547+
/// <summary>
548+
/// Sets the team of this MovableObject.
549+
/// </summary>
550+
/// <param name="team">The new team to assign.</returns>
551+
void SetTeam(int team) override;
547552

548553
//////////////////////////////////////////////////////////////////////////////////////////
549554
// Method: SetIgnoresTeamHits

Managers/MovableMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,6 @@ bool MovableMan::AddMO(MovableObject *movableObjectToAdd) {
833833

834834
void MovableMan::AddActor(Actor *actorToAdd) {
835835
if (actorToAdd) {
836-
g_ActivityMan.GetActivity()->ForceSetTeamAsActive(actorToAdd->GetTeam());
837836
actorToAdd->SetAsAddedToMovableMan();
838837
actorToAdd->CorrectAttachableAndWoundPositionsAndRotations();
839838

@@ -848,6 +847,7 @@ void MovableMan::AddActor(Actor *actorToAdd) {
848847
}
849848

850849
m_AddedActors.push_back(actorToAdd);
850+
// This will call SetTeam and subsequently force the team as active.
851851
AddActorToTeamRoster(actorToAdd);
852852
}
853853
}

0 commit comments

Comments
 (0)