Skip to content

Commit

Permalink
Fix trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed May 3, 2024
1 parent 61e469e commit 069c5cd
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 39 deletions.
6 changes: 3 additions & 3 deletions src/display3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3649,7 +3649,7 @@ enum GROUPNUMBER_TYPE
GN_DAMAGED,
GN_FACTORY
};
/// rendering of the object's group next to the object itself,
/// rendering of the object's group next to the object itself,
/// or the group that will be assigned to the object after production in the factory
static void drawGroupNumber(BASE_OBJECT *psObject)
{
Expand All @@ -3671,11 +3671,11 @@ static void drawGroupNumber(BASE_OBJECT *psObject)
groupNumber = psDroid->repairGroup;
groupNumberType = GN_DAMAGED;
}
else
else
{
groupNumber = psDroid->group;
}
}
}
else if (auto *psStruct = castStructure(psObject))
{
// same as in queueStructureHealth
Expand Down
16 changes: 8 additions & 8 deletions src/droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void recycleDroid(DROID *psDroid)
{
addEffect(&position, EFFECT_EXPLOSION, EXPLOSION_TYPE_DISCOVERY, false, nullptr, false, gameTime - deltaGameTime + 1);
}

CHECK_DROID(psDroid);
}

Expand Down Expand Up @@ -874,7 +874,7 @@ void droidUpdate(DROID *psDroid)
droidUpdateDroidSelfRepair(psDroid);
}


/* Update the fire damage data */
if (psDroid->periodicalDamageStart != 0 && psDroid->periodicalDamageStart != gameTime - deltaGameTime) // -deltaGameTime, since projectiles are updated after droids.
{
Expand Down Expand Up @@ -1261,7 +1261,7 @@ void droidWasFullyRepaired(DROID *psDroid, const REPAIR_FACILITY *psRepairFac)
}

droidWasFullyRepairedBase(psDroid);
}
}

bool droidUpdateRepair(DROID *psDroid)
{
Expand Down Expand Up @@ -1859,9 +1859,9 @@ void assignObjectToGroup(UDWORD playerNumber, UDWORD groupNumber, bool clearGrou
if (groupNumber < UBYTE_MAX)
{
/* Run through all the structures */
for (STRUCTURE *psStruct : apsStructLists[playerNumber])
for (STRUCTURE *psStruct : apsStructLists[playerNumber])
{
if (psStruct->selected && psStruct->isFactory())
if (psStruct->selected && psStruct->isFactory())
{
psStruct->productToGroup = (UBYTE)groupNumber;
return;
Expand Down Expand Up @@ -1917,9 +1917,9 @@ void removeObjectFromGroup(UDWORD playerNumber)

ASSERT_OR_RETURN(, playerNumber < MAX_PLAYERS, "Invalid player: %" PRIu32 "", playerNumber);

for (STRUCTURE *psStruct : apsStructLists[playerNumber])
for (STRUCTURE *psStruct : apsStructLists[playerNumber])
{
if (psStruct->selected && psStruct->isFactory())
if (psStruct->selected && psStruct->isFactory())
{
psStruct->productToGroup = UBYTE_MAX;
return;
Expand Down Expand Up @@ -3499,7 +3499,7 @@ void SelectDroid(DROID *psDroid, bool programmaticSelection)

psDroid->selected = true;
intRefreshScreen();
if (!programmaticSelection)
if (!programmaticSelection)
{
triggerEventSelected();
jsDebugSelected(psDroid);
Expand Down
2 changes: 1 addition & 1 deletion src/hci/groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class GroupsUIController: public std::enable_shared_from_this<GroupsUIController
size_t numberCommandedByGroup = 0; // the number of droids commanded by commanders in this group
uint64_t totalGroupMaxHealth = 0;
DROID_TEMPLATE displayDroidTemplate;

uint8_t currAttackGlowAlpha = 0;

// used for calculating display info
Expand Down
2 changes: 1 addition & 1 deletion src/hci/manufacture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class ManufactureStatsButton: public StatsButton
if (expgfx != UDWORD_MAX)
{
// FIXME: use offsets relative to template positon, not hardcoded values ?
iV_DrawImage(IntImages, (UWORD)expgfx, xOffset + 45, yOffset + 4);
iV_DrawImage(IntImages, (UWORD)expgfx, xOffset + 45, yOffset + 4);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/keybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ void kf_MakeMeHero()
if (psDroid->selected && (psDroid->droidType == DROID_COMMAND || psDroid->droidType == DROID_SENSOR))
{
psDroid->experience = 8 * 65536 * 128;
}
}
else if (psDroid->selected)
{
psDroid->experience = 4 * 65536 * 128;
Expand Down Expand Up @@ -741,7 +741,6 @@ void kf_ListDroids()
debug(LOG_INFO, "droid %i;%s;%i;%i;%i", i, psDroid->aName, psDroid->droidType, x, y);
}
}

}


Expand Down
22 changes: 11 additions & 11 deletions src/order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct RtrBestResult
BASE_OBJECT *psObj;
RtrBestResult(RTR_DATA_TYPE type, BASE_OBJECT *psObj): type(type), psObj(psObj) {}
RtrBestResult(): type(RTR_TYPE_NO_RESULT), psObj(nullptr) {}
RtrBestResult(DROID_ORDER_DATA *psOrder): type(psOrder->rtrType), psObj(psOrder->psObj)
RtrBestResult(DROID_ORDER_DATA *psOrder): type(psOrder->rtrType), psObj(psOrder->psObj)
{
if (psObj->type == OBJ_STRUCTURE && ((STRUCTURE*)psObj)->pStructureType->type == REF_REPAIR_FACILITY) type = RTR_TYPE_REPAIR_FACILITY;
else if (psObj->type == OBJ_STRUCTURE) type = RTR_TYPE_HQ;
Expand Down Expand Up @@ -175,8 +175,8 @@ struct RSComparator
RSComparator(const STRUCTURE *self) : selfPosX(self->pos.x), selfPosY(self->pos.y), selfPlayer(self->player) {}
RSComparator(const DROID *self) : selfPosX(self->pos.x), selfPosY(self->pos.y), selfPlayer(self->player) {}
// "less" comparator for our priority queue
bool operator() (const DROID* l, const DROID* r) const
{
bool operator() (const DROID* l, const DROID* r) const
{
// Here, we know that both left and right Droids are:
// - either our own, or one of our allies
// - already within repair radius
Expand Down Expand Up @@ -246,7 +246,7 @@ struct RSComparator

/// @return return top priority droid to repair, or nullptr
static DROID* _findSomeoneToRepair(REPAIR_FACILITY *psRepairFac,
std::priority_queue<DROID*, std::vector<DROID*>, RSComparator> queue,
std::priority_queue<DROID*, std::vector<DROID*>, RSComparator> queue,
int x, int y, int radius, int player)
{
GridList gridList;
Expand All @@ -265,7 +265,7 @@ static DROID* _findSomeoneToRepair(REPAIR_FACILITY *psRepairFac,
droidWasFullyRepaired(psDroid, psRepairFac);
}
}
if (!queue.empty())
if (!queue.empty())
{
debug(LOG_REPAIRS, "top was %i", queue.top()->id);
return queue.top();
Expand Down Expand Up @@ -991,8 +991,8 @@ void orderUpdateDroid(DROID *psDroid)
psDroid->order.psObj = nullptr;
}
}
if ((psDroid->action == DACTION_WAITFORREPAIR || psDroid->action == DACTION_WAITDURINGREPAIR) &&
psDroid->order.psObj &&
if ((psDroid->action == DACTION_WAITFORREPAIR || psDroid->action == DACTION_WAITDURINGREPAIR) &&
psDroid->order.psObj &&
objPosDiffSq(psDroid->pos, psDroid->order.psObj->pos) > REPAIR_RANGE * REPAIR_RANGE)
{ // was being repaired, but somehow got lost. recalculate reparing point
psDroid->order.psObj = nullptr;
Expand Down Expand Up @@ -1374,7 +1374,7 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
const Vector3i rPos(psOrder->pos, 0);
syncDebugDroid(psDroid, '-');
syncDebug("%d ordered %s", psDroid->id, getDroidOrderName(psOrder->type));

objTrace(psDroid->id, "base set order to %s (was %s)", getDroidOrderName(psOrder->type), getDroidOrderName(psDroid->order.type));

if (psOrder->type != DORDER_TRANSPORTIN // transporters special
Expand Down Expand Up @@ -1573,7 +1573,7 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
// help to build a structure that is starting to be built
ASSERT_OR_RETURN(, psDroid->isConstructionDroid(), "Not a constructor droid");
ASSERT_OR_RETURN(, psOrder->psObj != nullptr, "Help to build a NULL pointer?");
if (psDroid->action == DACTION_BUILD && psOrder->psObj == psDroid->psActionTarget[0]
if (psDroid->action == DACTION_BUILD && psOrder->psObj == psDroid->psActionTarget[0]
// skip DORDER_LINEBUILD -> we still want to drop pending structure blueprints
// this isn't a perfect solution, because ordering a LINEBUILD with negative energy, and then clicking
// on first structure being built, will remove it, as we change order from DORDR_LINEBUILD to DORDER_BUILD
Expand Down Expand Up @@ -1721,7 +1721,7 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
objTrace(psDroid->id, "DONE FOR NOW");
break;
}

// RTR_SPECIFIED can only ever be given to a repair facility, never a mobile repair turret
// move to front of structure
psDroid->order = DroidOrder(psOrder->type, psOrder->psObj, RTR_TYPE_REPAIR_FACILITY);
Expand Down Expand Up @@ -3391,7 +3391,7 @@ static inline RtrBestResult decideWhereToRepairAndBalance(DROID *psDroid)
}
}

// If we are repair droid ourselves that accept retreating units, don't consider
// If we are repair droid ourselves that accept retreating units, don't consider
// other repairs droids. Since this would cause traffic jams if we are attacked amongst
// other accepting repair droids. Thus causing chaos as repair units simply clump up
// instead of actually retreating.
Expand Down
23 changes: 11 additions & 12 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2766,7 +2766,7 @@ void aiUpdateRepair_handleState(STRUCTURE &station)
// apply logic for current state
switch (psRepairFac->state)
{
case RepairState::Idle:
case RepairState::Idle:
{
actionAlignTurret(psStructure, 0);
return;
Expand Down Expand Up @@ -2805,7 +2805,7 @@ RepairEvents aiUpdateRepair_obtainEvents(const STRUCTURE &station, DROID **psDro
switch (psRepairFac->state)
{
case RepairState::Idle:
{
{
DROID *psDroid = findSomeoneToRepair(psStructure, (TILE_UNITS * 5 / 2));
*psDroidOut = psDroid;
return psDroid? RepairEvents::RepairTargetFound : RepairEvents::NoEvents;
Expand All @@ -2822,7 +2822,7 @@ RepairEvents aiUpdateRepair_obtainEvents(const STRUCTURE &station, DROID **psDro
{
return RepairEvents::UnitMovedAway;
}
if (psDroid->body >= psDroid->originalBody)
if (psDroid->body >= psDroid->originalBody)
{
return RepairEvents::UnitReachedMaxHP;
}
Expand Down Expand Up @@ -2854,7 +2854,7 @@ RepairState aiUpdateRepair_handleEvents(STRUCTURE &station, RepairEvents ev, DRO
switch (ev)
{
case RepairEvents::NoEvents:
{
{
return psRepairFac->state;
};
case RepairEvents::RepairTargetFound:
Expand Down Expand Up @@ -2903,7 +2903,6 @@ void aiUpdateRepairStation(STRUCTURE &station)
ASSERT(nextState != RepairState::Invalid, "Bug! invalid state received.");
station.pFunctionality->repairFacility.state = nextState;
aiUpdateRepair_handleState(station);

}

static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
Expand Down Expand Up @@ -3947,7 +3946,7 @@ std::vector<STRUCTURE_STATS *> fillStructureList(UDWORD _selectedPlayer, UDWORD
int8_t *counter;
if (asStructureStats[inc].type == REF_RESEARCH)
{
counter = researchLabCurrMax;
counter = researchLabCurrMax;
}
else if (asStructureStats[inc].type == REF_FACTORY)
{
Expand Down Expand Up @@ -4022,7 +4021,7 @@ std::vector<STRUCTURE_STATS *> fillStructureList(UDWORD _selectedPlayer, UDWORD

if (psBuilding->type == REF_RESEARCH_MODULE)
{
//don't add to list if Research Facility not presently built
//don't add to list if Research Facility not presently built
//or if all labs already have a module
if (!researchLabCurrMax[0] || researchModules >= researchLabCurrMax[1])
{
Expand Down Expand Up @@ -4318,7 +4317,7 @@ bool validLocation(BASE_STATS *psStats, Vector2i pos, uint16_t direction, unsign
{
STRUCTURE const *psStruct = getTileStructure(map_coord(pos.x), map_coord(pos.y));
if (psStruct && (psStruct->pStructureType->type == REF_FACTORY ||
psStruct->pStructureType->type == REF_VTOL_FACTORY)
psStruct->pStructureType->type == REF_VTOL_FACTORY)
&& psStruct->status == SS_BUILT && aiCheckAlliances(player, psStruct->player)
&& nextModuleToBuild(psStruct, -1) > 0)
{
Expand All @@ -4330,8 +4329,8 @@ bool validLocation(BASE_STATS *psStats, Vector2i pos, uint16_t direction, unsign
if (TileHasStructure(worldTile(pos)))
{
STRUCTURE const *psStruct = getTileStructure(map_coord(pos.x), map_coord(pos.y));
if (psStruct && psStruct->pStructureType->type == REF_RESEARCH
&& psStruct->status == SS_BUILT
if (psStruct && psStruct->pStructureType->type == REF_RESEARCH
&& psStruct->status == SS_BUILT
&& aiCheckAlliances(player, psStruct->player)
&& nextModuleToBuild(psStruct, -1) > 0)
{
Expand All @@ -4343,8 +4342,8 @@ bool validLocation(BASE_STATS *psStats, Vector2i pos, uint16_t direction, unsign
if (TileHasStructure(worldTile(pos)))
{
STRUCTURE const *psStruct = getTileStructure(map_coord(pos.x), map_coord(pos.y));
if (psStruct && psStruct->pStructureType->type == REF_POWER_GEN
&& psStruct->status == SS_BUILT
if (psStruct && psStruct->pStructureType->type == REF_POWER_GEN
&& psStruct->status == SS_BUILT
&& aiCheckAlliances(player, psStruct->player)
&& nextModuleToBuild(psStruct, -1) > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/structuredef.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ enum class RepairEvents
UnitMovedAway
};

enum class RepairState
enum class RepairState
{
Invalid = -1,
Idle,
Expand Down

0 comments on commit 069c5cd

Please sign in to comment.