Skip to content

Commit

Permalink
Get rid of fallbackGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich authored and past-due committed May 1, 2024
1 parent e9c26f3 commit 80f9bac
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/basedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ struct BASE_OBJECT : public SIMPLE_OBJECT
SCREEN_DISP_DATA sDisplay; ///< screen coordinate details
UBYTE group = 0; ///< Which group selection is the droid currently in?
UBYTE repairGroup = UBYTE_MAX; ///< Group to be set when the unit has been repaired
UBYTE fallbackGroup = UBYTE_MAX; ///< Group to revert if the commander capacity is full
UBYTE selected; ///< Whether the object is selected (might want this elsewhere)
UBYTE visible[MAX_PLAYERS]; ///< Whether object is visible to specific player
UBYTE seenThisTick[MAX_PLAYERS]; ///< Whether object has been seen this tick by the specific player.
Expand Down
7 changes: 2 additions & 5 deletions src/cmddroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ bool cmdDroidAddDroid(DROID *psCommander, DROID *psDroid)

auto initialDroidGroup = psDroid->group;
auto initialRepairDroidGroup = psDroid->repairGroup;
// select a value depending on whether the commander was assigned manually or after construction in the factory
auto fallbackDroidGroup = initialDroidGroup != UBYTE_MAX ? initialDroidGroup : psDroid->fallbackGroup;

if (psCommander->psGroup == nullptr)
{
Expand Down Expand Up @@ -127,10 +125,9 @@ bool cmdDroidAddDroid(DROID *psCommander, DROID *psDroid)
lastMaxCmdLimitMsgTime = gameTime;
}

if (fallbackDroidGroup != UBYTE_MAX)
if (initialDroidGroup != UBYTE_MAX)
{
psDroid->group = fallbackDroidGroup;
psDroid->fallbackGroup = UBYTE_MAX;
psDroid->group = initialDroidGroup;
SelectGroupDroid(psDroid);
}
psDroid->repairGroup = initialRepairDroidGroup;
Expand Down
7 changes: 1 addition & 6 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2478,19 +2478,14 @@ static bool structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl, DR
psFact = &psStructure->pFunctionality->factory;
bool hasCommander = psFact->psCommander != nullptr && myResponsibility(psStructure->player);
// assign a group to the manufactured droid
// if a commander is assigned, ignore this behavior (except for builders)
if (psStructure->productToGroup != UBYTE_MAX)
{
psNewDroid->group = psStructure->productToGroup;
if (!hasCommander || isConstructionDroid(psNewDroid))
{
psNewDroid->group = psStructure->productToGroup;
intGroupsChanged(psNewDroid->group); // update groups UI
SelectGroupDroid(psNewDroid);
}
else
{
psNewDroid->fallbackGroup = psStructure->productToGroup;
}
}
setFactorySecondaryState(psNewDroid, psStructure);
const auto mapCoord = map_coord({x, y});
Expand Down

0 comments on commit 80f9bac

Please sign in to comment.