Skip to content

Commit add6c02

Browse files
author
Bart Roossien
committed
[ZH] Fix warnings about operators between enumerations and floating point types (TheSuperHackers#534)
1 parent a5d56b7 commit add6c02

35 files changed

+74
-75
lines changed

GeneralsMD/Code/GameEngine/Include/Common/BattleHonors.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ enum
108108

109109
enum
110110
{
111-
MAX_BATTLE_HONOR_COLUMNS = 4,
112-
MAX_BATTLE_HONOR_IMAGE_WIDTH = 40,
113-
MAX_BATTLE_HONOR_IMAGE_HEIGHT = 41,
111+
MAX_BATTLE_HONOR_COLUMNS = 4
114112
};
115113

114+
#define MAX_BATTLE_HONOR_IMAGE_WIDTH 40.0f
115+
#define MAX_BATTLE_HONOR_IMAGE_HEIGHT 41.0f
116+
116117
//-----------------------------------------------------------------------------
117118
// INLINING ///////////////////////////////////////////////////////////////////
118119
//-----------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ void BuildAssistant::reset( void )
173173

174174
} // end reset
175175

176-
static const Real FRAMES_TO_ALLOW_SCAFFOLD = LOGICFRAMES_PER_SECOND * 1.5f;
177-
static const Real TOTAL_FRAMES_TO_SELL_OBJECT = LOGICFRAMES_PER_SECOND * 3.0f;
176+
static const Real FRAMES_TO_ALLOW_SCAFFOLD = static_cast<Real>(LOGICFRAMES_PER_SECOND) * 1.5f;
177+
static const Real TOTAL_FRAMES_TO_SELL_OBJECT = static_cast<Real>(LOGICFRAMES_PER_SECOND) * 3.0f;
178178
//-------------------------------------------------------------------------------------------------
179179
/** Update phase for the build assistant */
180180
//-------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
Radar *TheRadar = NULL; ///< the radar global singleton
6464

6565
// PRIVATE ////////////////////////////////////////////////////////////////////////////////////////
66-
#define RADAR_QUEUE_TERRAIN_REFRESH_DELAY (LOGICFRAMES_PER_SECOND * 3.0f)
66+
#define RADAR_QUEUE_TERRAIN_REFRESH_DELAY (static_cast<Real>(LOGICFRAMES_PER_SECOND) * 3.0f)
6767

6868
//-------------------------------------------------------------------------------------------------
6969
/** Delete list resources used by the radar and return them to the memory pools */
@@ -345,8 +345,8 @@ void Radar::newMap( TerrainLogic *terrain )
345345
terrain->getExtent( &m_mapExtent );
346346

347347
// we will sample at these intervals across the map
348-
m_xSample = m_mapExtent.width() / RADAR_CELL_WIDTH;
349-
m_ySample = m_mapExtent.height() / RADAR_CELL_HEIGHT;
348+
m_xSample = m_mapExtent.width() / static_cast<Real>(RADAR_CELL_WIDTH);
349+
m_ySample = m_mapExtent.height() / static_cast<Real>(RADAR_CELL_HEIGHT);
350350

351351
// find the "middle" height for the terrain (most used value) and water table
352352
Int x, y;
@@ -1119,8 +1119,8 @@ void Radar::internalCreateEvent( const Coord3D *world, RadarEventType type, Real
11191119
m_event[ m_nextFreeRadarEvent ].type = type;
11201120
m_event[ m_nextFreeRadarEvent ].active = TRUE;
11211121
m_event[ m_nextFreeRadarEvent ].createFrame = TheGameLogic->getFrame();
1122-
m_event[ m_nextFreeRadarEvent ].dieFrame = TheGameLogic->getFrame() + LOGICFRAMES_PER_SECOND * secondsToLive;
1123-
m_event[ m_nextFreeRadarEvent ].fadeFrame = m_event[ m_nextFreeRadarEvent ].dieFrame - LOGICFRAMES_PER_SECOND * secondsBeforeDieToFade;
1122+
m_event[ m_nextFreeRadarEvent ].dieFrame = TheGameLogic->getFrame() + static_cast<Real>(LOGICFRAMES_PER_SECOND) * secondsToLive;
1123+
m_event[ m_nextFreeRadarEvent ].fadeFrame = m_event[ m_nextFreeRadarEvent ].dieFrame - static_cast<Real>(LOGICFRAMES_PER_SECOND) * secondsBeforeDieToFade;
11241124
m_event[ m_nextFreeRadarEvent ].color1 = *color1;
11251125
m_event[ m_nextFreeRadarEvent ].color2 = *color2;
11261126
m_event[ m_nextFreeRadarEvent ].worldLoc = *world;

GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Int UpgradeTemplate::calcTimeToBuild( Player *player ) const
164164
#endif
165165

166166
///@todo modify this by power state of player
167-
return m_buildTime * LOGICFRAMES_PER_SECOND;
167+
return m_buildTime * static_cast<Real>(LOGICFRAMES_PER_SECOND);
168168

169169
} // end calcTimeToBuild
170170

GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ Int ThingTemplate::calcCostToBuild( const Player* player) const
15481548
//-------------------------------------------------------------------------------------------------
15491549
Int ThingTemplate::calcTimeToBuild( const Player* player) const
15501550
{
1551-
Int buildTime = getBuildTime() * LOGICFRAMES_PER_SECOND;
1551+
Int buildTime = getBuildTime() * static_cast<Real>(LOGICFRAMES_PER_SECOND);
15521552
buildTime *= player->getHandicap()->getHandicap(Handicap::BUILDTIME, this);
15531553

15541554
Real factionModifier = 1 + player->getProductionTimeChangePercent( getName() );

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@
7171
//-----------------------------------------------------------------------------
7272
// DEFINES ////////////////////////////////////////////////////////////////////
7373
//-----------------------------------------------------------------------------
74-
enum{
75-
COMMAND_BAR_SIZE_OFFSET = 0
76-
};
74+
#define COMMAND_BAR_SIZE_OFFSET 0.0f
7775

7876
const FieldParse ControlBarSchemeManager::m_controlBarSchemeFieldParseTable[] =
7977
{

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1702,8 +1702,8 @@ void ControlBarArrowTransition::init( GameWindow *win )
17021702
m_isFinished = FALSE;
17031703
m_isForward = TRUE;
17041704

1705-
m_percent = 1.0f / CONTROLBARARROWTRANSITION_BEGIN_FADE;
1706-
m_fadePercent = 1.0f/ (CONTROLBARARROWTRANSITION_END - CONTROLBARARROWTRANSITION_BEGIN_FADE);
1705+
m_percent = 1.0f / static_cast<Real>(CONTROLBARARROWTRANSITION_BEGIN_FADE);
1706+
m_fadePercent = 1.0f/ (static_cast<Real>(CONTROLBARARROWTRANSITION_END) - static_cast<Real>(CONTROLBARARROWTRANSITION_BEGIN_FADE));
17071707

17081708
m_arrowImage = TheControlBar->getArrowImage();
17091709
GameWindow *twin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral"));

GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5300,7 +5300,7 @@ void InGameUI::addWorldAnimation( Anim2DTemplate *animTemplate,
53005300

53015301
// assign all data
53025302
wad->m_anim = anim;
5303-
wad->m_expireFrame = TheGameLogic->getFrame() + (durationInSeconds * LOGICFRAMES_PER_SECOND);
5303+
wad->m_expireFrame = TheGameLogic->getFrame() + (durationInSeconds * static_cast<Real>(LOGICFRAMES_PER_SECOND));
53045304
wad->m_options = options;
53055305
wad->m_worldPos = *pos;
53065306
wad->m_zRisePerSecond = zRisePerSecond;
@@ -5379,7 +5379,7 @@ void InGameUI::updateAndDrawWorldAnimations( void )
53795379

53805380
// update the Z value
53815381
if( wad->m_zRisePerSecond )
5382-
wad->m_worldPos.z += wad->m_zRisePerSecond / LOGICFRAMES_PER_SECOND;
5382+
wad->m_worldPos.z += wad->m_zRisePerSecond / static_cast<Real>(LOGICFRAMES_PER_SECOND);
53835383

53845384
} // end if
53855385

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -6848,11 +6848,11 @@ Path *Pathfinder::buildHierachicalPath( const Coord3D *fromPos, PathfindCell *go
68486848
// This allows the unit to get around friendly units that may be near it.
68496849
Coord3D pos = *path->getFirstNode()->getPosition();
68506850
Coord3D minPos = pos;
6851-
minPos.x -= PathfindZoneManager::ZONE_BLOCK_SIZE*PATHFIND_CELL_SIZE_F;
6852-
minPos.y -= PathfindZoneManager::ZONE_BLOCK_SIZE*PATHFIND_CELL_SIZE_F;
6851+
minPos.x -= static_cast<Real>(PathfindZoneManager::ZONE_BLOCK_SIZE)*PATHFIND_CELL_SIZE_F;
6852+
minPos.y -= static_cast<Real>(PathfindZoneManager::ZONE_BLOCK_SIZE)*PATHFIND_CELL_SIZE_F;
68536853
Coord3D maxPos = pos;
6854-
maxPos.x += PathfindZoneManager::ZONE_BLOCK_SIZE*PATHFIND_CELL_SIZE_F;
6855-
maxPos.y += PathfindZoneManager::ZONE_BLOCK_SIZE*PATHFIND_CELL_SIZE_F;
6854+
maxPos.x += static_cast<Real>(PathfindZoneManager::ZONE_BLOCK_SIZE)*PATHFIND_CELL_SIZE_F;
6855+
maxPos.y += static_cast<Real>(PathfindZoneManager::ZONE_BLOCK_SIZE)*PATHFIND_CELL_SIZE_F;
68566856
ICoord2D cellNdxMin, cellNdxMax;
68576857
worldToCell(&minPos, &cellNdxMin);
68586858
worldToCell(&maxPos, &cellNdxMax);

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ void AIPlayer::processBaseBuilding( void )
800800
info->decrementNumRebuilds();
801801

802802
m_readyToBuildStructure = false;
803-
m_structureTimer = TheAI->getAiData()->m_structureSeconds*LOGICFRAMES_PER_SECOND;
803+
m_structureTimer = TheAI->getAiData()->m_structureSeconds* static_cast<Real>(LOGICFRAMES_PER_SECOND);
804804
if (m_player->getMoney()->countMoney() < TheAI->getAiData()->m_resourcesPoor) {
805805
m_structureTimer = m_structureTimer/TheAI->getAiData()->m_structuresPoorMod;
806806
} else if (m_player->getMoney()->countMoney() > TheAI->getAiData()->m_resourcesWealthy) {

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ void AISkirmishPlayer::processBaseBuilding( void )
262262
bldgInfo->decrementNumRebuilds();
263263

264264
m_readyToBuildStructure = false;
265-
m_structureTimer = TheAI->getAiData()->m_structureSeconds*LOGICFRAMES_PER_SECOND;
265+
m_structureTimer = TheAI->getAiData()->m_structureSeconds* static_cast<Real>(LOGICFRAMES_PER_SECOND);
266266
if (m_player->getMoney()->countMoney() < TheAI->getAiData()->m_resourcesPoor) {
267267
m_structureTimer = m_structureTimer/TheAI->getAiData()->m_structuresPoorMod;
268268
} else if (m_player->getMoney()->countMoney() > TheAI->getAiData()->m_resourcesWealthy) {

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ StateReturnType AIRappelState::onEnter()
532532
obj->setLayer(layerAtDest);
533533

534534
AIUpdateInterface *ai = obj->getAI();
535-
Real MAX_RAPPEL_RATE = fabs(TheGlobalData->m_gravity) * LOGICFRAMES_PER_SECOND * 2.5f;
535+
Real MAX_RAPPEL_RATE = fabs(TheGlobalData->m_gravity) * static_cast<Real>(LOGICFRAMES_PER_SECOND) * 2.5f;
536536
m_rappelRate = -min(ai->getDesiredSpeed(), MAX_RAPPEL_RATE);
537537

538538
return STATE_CONTINUE;
@@ -3669,7 +3669,7 @@ StateReturnType AIAttackMoveToState::update()
36693669
if (m_retryCount<1) return ret;
36703670
/* check for close enough. */
36713671
Real distSqr = sqr(owner->getPosition()->x - m_pathGoalPosition.x) + sqr(owner->getPosition()->y-m_pathGoalPosition.y);
3672-
if (distSqr < sqr(ATTACK_CLOSE_ENOUGH_CELLS*PATHFIND_CELL_SIZE_F)) {
3672+
if (distSqr < sqr(static_cast<Real>(ATTACK_CLOSE_ENOUGH_CELLS)*PATHFIND_CELL_SIZE_F)) {
36733673
return ret;
36743674
}
36753675
DEBUG_LOG(("AIAttackMoveToState::update Distance from goal %f, retrying.\n", sqrt(distSqr)));

GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,7 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water,
24632463
// add the entry into the array of water to update
24642464
m_waterToUpdate[ m_numWaterToUpdate ].waterTable = water;
24652465
m_waterToUpdate[ m_numWaterToUpdate ].changePerFrame = (finalHeight - currentHeight) /
2466-
(LOGICFRAMES_PER_SECOND * transitionTimeInSeconds);
2466+
(static_cast<Real>(LOGICFRAMES_PER_SECOND) * transitionTimeInSeconds);
24672467
m_waterToUpdate[ m_numWaterToUpdate ].targetHeight = finalHeight;
24682468
m_waterToUpdate[ m_numWaterToUpdate ].damageAmount = damageAmount;
24692469
m_waterToUpdate[ m_numWaterToUpdate ].currentHeight = currentHeight;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ UpdateSleepTime MinefieldBehavior::update()
260260
if (m_draining)
261261
{
262262
DamageInfo damageInfo;
263-
damageInfo.in.m_amount = (obj->getBodyModule()->getMaxHealth() * d->m_healthPercentToDrainPerSecond) / LOGICFRAMES_PER_SECOND;
263+
damageInfo.in.m_amount = (obj->getBodyModule()->getMaxHealth() * d->m_healthPercentToDrainPerSecond) / static_cast<Real>(LOGICFRAMES_PER_SECOND);
264264
damageInfo.in.m_sourceID = obj->getID();
265265
damageInfo.in.m_damageType = DAMAGE_UNRESISTABLE;
266266
damageInfo.in.m_deathType = DEATH_NORMAL;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ UpdateSleepTime OverchargeBehavior::update( void )
117117
// do some damage
118118
BodyModuleInterface *body = us->getBodyModule();
119119
DamageInfo damageInfo;
120-
damageInfo.in.m_amount = (body->getMaxHealth() * modData->m_healthPercentToDrainPerSecond) / LOGICFRAMES_PER_SECOND;
120+
damageInfo.in.m_amount = (body->getMaxHealth() * modData->m_healthPercentToDrainPerSecond) / static_cast<Real>(LOGICFRAMES_PER_SECOND);
121121
damageInfo.in.m_sourceID = us->getID();
122122
damageInfo.in.m_damageType = DAMAGE_PENALTY;
123123
damageInfo.in.m_deathType = DEATH_NORMAL;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ void PropagandaTowerBehavior::effectLogic( Object *obj, Bool giving,
326326
else
327327
healthPercent = modData->m_autoHealPercentPerSecond;
328328

329-
Real amount = healthPercent / LOGICFRAMES_PER_SECOND * body->getMaxHealth();
329+
Real amount = healthPercent / static_cast<Real>(LOGICFRAMES_PER_SECOND) * body->getMaxHealth();
330330

331331
// Dustin wants the healing effect not to stack from multiple propaganda towers...
332332
// To accomplish this, I'll give every object a single healing-sender (ID)

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void )
310310
DamageInfo healingInfo;
311311

312312
// do some healing
313-
healingInfo.in.m_amount = (modData->m_holeHealthRegenPercentPerSecond / LOGICFRAMES_PER_SECOND) *
313+
healingInfo.in.m_amount = (modData->m_holeHealthRegenPercentPerSecond / static_cast<Real>(LOGICFRAMES_PER_SECOND)) *
314314
body->getMaxHealth();
315315
healingInfo.in.m_sourceID = hole->getID();
316316
healingInfo.in.m_damageType = DAMAGE_HEALING;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ Locomotor::Locomotor(const LocomotorTemplate* tmpl)
671671
m_angleOffset = GameLogicRandomValueReal(-PI/6, PI/6);
672672
m_offsetIncrement = (PI/40) * (GameLogicRandomValueReal(0.8f, 1.2f)/m_template->m_wanderLengthFactor);
673673
setFlag(OFFSET_INCREASING, GameLogicRandomValue(0,1));
674-
m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS*LOGICFRAMES_PER_SECOND;
674+
m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS* static_cast<Real>(LOGICFRAMES_PER_SECOND);
675675
}
676676

677677
//-------------------------------------------------------------------------------------------------
@@ -785,7 +785,7 @@ void Locomotor::loadPostProcess( void )
785785
void Locomotor::startMove(void)
786786
{
787787
// Reset the donut timer.
788-
m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS*LOGICFRAMES_PER_SECOND;
788+
m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS* static_cast<Real>(LOGICFRAMES_PER_SECOND);
789789
}
790790

791791
//-------------------------------------------------------------------------------------------------
@@ -1115,7 +1115,7 @@ void Locomotor::locoUpdate_moveTowardsPosition(Object* obj, const Coord3D& goalP
11151115

11161116
if (wasBraking)
11171117
{
1118-
#define MIN_VEL (PATHFIND_CELL_SIZE_F/(LOGICFRAMES_PER_SECOND))
1118+
#define MIN_VEL (PATHFIND_CELL_SIZE_F/(static_cast<Real>(LOGICFRAMES_PER_SECOND)))
11191119

11201120
Coord3D pos = *obj->getPosition();
11211121
if (obj->isKindOf(KINDOF_PROJECTILE))
@@ -1148,7 +1148,7 @@ void Locomotor::locoUpdate_moveTowardsPosition(Object* obj, const Coord3D& goalP
11481148
if (dist > 0.001f)
11491149
{
11501150
Real vel = fabs(physics->getForwardSpeed2D());
1151-
if (vel < MIN_VEL)
1151+
if (vel < MIN_VEL)
11521152
vel = MIN_VEL;
11531153
if (vel > dist)
11541154
vel = dist; // do not overcompensate!
@@ -1427,7 +1427,7 @@ void Locomotor::moveTowardsPositionWheels(Object* obj, PhysicsBehavior *physics,
14271427
}
14281428

14291429
if (onPathDistToGoal > DONUT_DISTANCE) {
1430-
m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS*LOGICFRAMES_PER_SECOND;
1430+
m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS* static_cast<Real>(LOGICFRAMES_PER_SECOND);
14311431
} else {
14321432
if (m_donutTimer < TheGameLogic->getFrame()) {
14331433
setFlag(IS_BRAKING, true);
@@ -2441,7 +2441,7 @@ Bool Locomotor::locoUpdate_maintainCurrentPosition(Object* obj)
24412441
setFlag(MAINTAIN_POS_IS_VALID, true);
24422442
}
24432443

2444-
m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS*LOGICFRAMES_PER_SECOND;
2444+
m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS* static_cast<Real>(LOGICFRAMES_PER_SECOND);
24452445
setFlag(IS_BRAKING, false);
24462446
PhysicsBehavior *physics = obj->getPhysics();
24472447
if (physics == NULL)

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ Bool Object::checkAndDetonateBoobyTrap(const Object *victim)
943943
filters[1] = &filterMapStatus;
944944
filters[2] = NULL;
945945

946-
ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( getPosition(), BOOBY_TRAP_SCAN_RANGE + getGeometryInfo().getBoundingCircleRadius(),
946+
ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( getPosition(), static_cast<Real>(BOOBY_TRAP_SCAN_RANGE) + getGeometryInfo().getBoundingCircleRadius(),
947947
FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR );
948948
MemoryPoolObjectHolder hold(iter);// This is the magic thing that frees the dynamically made iter in its destructor
949949

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
5151
#endif
5252

53+
#define CREATE_ABOVE_LOCATION_HEIGHT 300.0f
5354
enum
5455
{
55-
CREATE_ABOVE_LOCATION_HEIGHT = 300,
5656
MAX_ADJUST_RADIUS = 500
5757
};
5858

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2278,8 +2278,8 @@ UpdateSleepTime AIUpdateInterface::doLocomotor( void )
22782278
{
22792279
Real dist = sqrtf(dSqr);
22802280
if (dist<1) dist = 1;
2281-
pos.x += 2*PATHFIND_CELL_SIZE_F*dx/(dist*LOGICFRAMES_PER_SECOND);
2282-
pos.y += 2*PATHFIND_CELL_SIZE_F*dy/(dist*LOGICFRAMES_PER_SECOND);
2281+
pos.x += 2*PATHFIND_CELL_SIZE_F*dx/(dist* static_cast<Real>(LOGICFRAMES_PER_SECOND));
2282+
pos.y += 2*PATHFIND_CELL_SIZE_F*dy/(dist* static_cast<Real>(LOGICFRAMES_PER_SECOND));
22832283
if (onGround)
22842284
pos.z = TheTerrainLogic->getGroundHeight( pos.x, pos.y );
22852285
getObject()->setPosition(&pos);

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ ChinookAIUpdateModuleData::ChinookAIUpdateModuleData()
881881
m_minDropHeight = 30.0f;
882882
m_ropeFinalHeight = 0.0f;
883883
m_ropeDropSpeed = 1e10f; // um, fast.
884-
m_rappelSpeed = fabs(TheGlobalData->m_gravity) * LOGICFRAMES_PER_SECOND * 0.5f;
884+
m_rappelSpeed = fabs(TheGlobalData->m_gravity) * static_cast<Real>(LOGICFRAMES_PER_SECOND) * 0.5f;
885885
m_ropeWobbleLen = 10.0f;
886886
m_ropeWobbleAmp = 1.0f;
887887
m_ropeWobbleRate = 0.1f;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ StateReturnType DozerActionDoActionState::update( void )
717717

718718
// figure out how much health we will restore this frame
719719
Real health = body->getMaxHealth() * dozerAI->getRepairHealthPerSecond() /
720-
LOGICFRAMES_PER_SECOND;
720+
static_cast<Real>(LOGICFRAMES_PER_SECOND);
721721

722722
// try to give it a little bit-o-health
723723
if ( ! goalObject->attemptHealingFromSoleBenefactor(health, dozer, 2) )//this frame and the next

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ TheInGameUI->DEBUG_addFloatingText("entering regrouping state", getMachineOwner(
603603
return STATE_FAILURE;
604604
}
605605

606-
if( ThePartitionManager->getDistanceSquared(owner, destinationObject, FROM_BOUNDINGSPHERE_2D) < REGROUP_SUCCESS_DISTANCE_SQUARED )
606+
if( ThePartitionManager->getDistanceSquared(owner, destinationObject, FROM_BOUNDINGSPHERE_2D) < static_cast<Real>(REGROUP_SUCCESS_DISTANCE_SQUARED) )
607607
return STATE_CONTINUE; // Don't say Success so we don't spin the machine. After one update we'll go back.
608608

609609
Coord3D destination;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ UpdateSleepTime AutoDepositUpdate::update( void )
161161
return UPDATE_SLEEP_NONE;
162162

163163
// makes sure that buildings under construction do not get a bonus CCB
164-
if( getObject()->getConstructionPercent() != CONSTRUCTION_COMPLETE )
164+
if( getObject()->getConstructionPercent() != static_cast<Real>(CONSTRUCTION_COMPLETE) )
165165
return UPDATE_SLEEP_NONE;
166166

167167
int moneyAmount = modData->m_depositAmount + getUpgradedSupplyBoost();

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ UpdateSleepTime BaseRegenerateUpdate::update( void )
138138

139139
// do some healing
140140
Real amount = HEAL_RATE * (body->getMaxHealth() * TheGlobalData->m_baseRegenHealthPercentPerSecond) /
141-
LOGICFRAMES_PER_SECOND;
141+
static_cast<Real>(LOGICFRAMES_PER_SECOND);
142142
me->attemptHealing(amount, me);
143143

144144
return UPDATE_SLEEP(HEAL_RATE);

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void FireOCLAfterWeaponCooldownUpdate::fireOCL()
199199
UnsignedInt now = TheGameLogic->getFrame();
200200
Real seconds = (now - m_startFrame) * SECONDS_PER_LOGICFRAME_REAL;
201201
seconds *= data->m_oclLifetimePerSecond * 0.001f;
202-
UnsignedInt oclFrames = (UnsignedInt)(seconds * LOGICFRAMES_PER_SECOND);
202+
UnsignedInt oclFrames = (UnsignedInt)(seconds * static_cast<Real>(LOGICFRAMES_PER_SECOND));
203203
oclFrames = MIN( oclFrames, data->m_oclMaxFrames );
204204

205205
ObjectCreationList::create( data->m_ocl, obj, obj, oclFrames );

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void )
326326
{
327327

328328
// we're going towards the max self spin, increase it
329-
m_selfSpin += modData->m_selfSpinUpdateAmount / LOGICFRAMES_PER_SECOND;
329+
m_selfSpin += modData->m_selfSpinUpdateAmount / static_cast<Real>(LOGICFRAMES_PER_SECOND);
330330
if( m_selfSpin > modData->m_maxSelfSpin )
331331
{
332332

@@ -340,7 +340,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void )
340340
{
341341

342342
// we're going towards the min self spin, decrease it
343-
m_selfSpin -= modData->m_selfSpinUpdateAmount / LOGICFRAMES_PER_SECOND;
343+
m_selfSpin -= modData->m_selfSpinUpdateAmount / static_cast<Real>(LOGICFRAMES_PER_SECOND);
344344
if( m_selfSpin < modData->m_minSelfSpin )
345345
{
346346

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
562562
}
563563

564564
//Convert speed to speed per frame.
565-
speed /= LOGICFRAMES_PER_SECOND;
565+
speed /= static_cast<Real>(LOGICFRAMES_PER_SECOND);
566566

567567
//Calculate the distance from our current position to our target dest.
568568
Coord3D vector = m_overrideTargetDestination;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3
13691369
// huh huh, he said "stiff"
13701370

13711371
Real mag = getVelocityMagnitude();
1372-
const Real MINBOUNCESPEED = 1.0f/(LOGICFRAMES_PER_SECOND*5.0f);
1372+
const Real MINBOUNCESPEED = 1.0f/(static_cast<Real>(LOGICFRAMES_PER_SECOND)*5.0f);
13731373
if (mag < MINBOUNCESPEED)
13741374
mag = MINBOUNCESPEED;
13751375
factor = -mag * getMass() * stiffness;

0 commit comments

Comments
 (0)