Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #5366
  • Loading branch information
ashdnazg committed Oct 6, 2016
1 parent f2f3bfd commit 45b60cb
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 32 deletions.
5 changes: 1 addition & 4 deletions rts/Rendering/Env/Particles/Classes/BitmapMuzzleFlame.cpp
@@ -1,10 +1,7 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */


#include "BitmapMuzzleFlame.h"

#include <cmath>

#include "Sim/Misc/GlobalSynced.h"
#include "Rendering/GlobalRendering.h"
#include "Rendering/Env/Particles/ProjectileDrawer.h"
Expand All @@ -13,6 +10,7 @@
#include "Rendering/Textures/TextureAtlas.h"
#include "Sim/Projectiles/ExpGenSpawnableMemberInfo.h"
#include "Sim/Projectiles/ProjectileHandler.h"
#include "System/myMath.h"

CR_BIND_DERIVED(CBitmapMuzzleFlame, CProjectile, )

Expand Down Expand Up @@ -124,4 +122,3 @@ bool CBitmapMuzzleFlame::GetMemberInfo(SExpGenSpawnableMemberInfo& memberInfo)

return false;
}

4 changes: 1 addition & 3 deletions rts/Rendering/Env/Particles/Classes/SimpleParticleSystem.cpp
@@ -1,10 +1,7 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */


#include "SimpleParticleSystem.h"

#include <cmath>

#include "GenericParticleProjectile.h"
#include "Game/Camera.h"
#include "Game/GlobalUnsynced.h"
Expand All @@ -15,6 +12,7 @@
#include "Sim/Projectiles/ExpGenSpawnableMemberInfo.h"
#include "System/float3.h"
#include "System/Log/ILog.h"
#include "System/myMath.h"

CR_BIND_DERIVED(CSimpleParticleSystem, CProjectile, )

Expand Down
3 changes: 1 addition & 2 deletions rts/Rendering/Env/Particles/Classes/SpherePartProjectile.cpp
Expand Up @@ -2,13 +2,12 @@

#include "SpherePartProjectile.h"

#include <cmath>

#include "Rendering/GlobalRendering.h"
#include "Rendering/Env/Particles/ProjectileDrawer.h"
#include "Rendering/GL/VertexArray.h"
#include "Rendering/Textures/TextureAtlas.h"
#include "Sim/Projectiles/ExpGenSpawnableMemberInfo.h"
#include "System/myMath.h"

CR_BIND_DERIVED(CSpherePartProjectile, CProjectile, )

Expand Down
3 changes: 1 addition & 2 deletions rts/Rendering/Env/Particles/Classes/WakeProjectile.cpp
Expand Up @@ -2,15 +2,14 @@

#include "WakeProjectile.h"

#include <cmath>

#include "Game/Camera.h"
#include "Game/GlobalUnsynced.h"
#include "Rendering/GlobalRendering.h"
#include "Rendering/Env/Particles/ProjectileDrawer.h"
#include "Rendering/Env/IWater.h"
#include "Rendering/GL/VertexArray.h"
#include "Rendering/Textures/TextureAtlas.h"
#include "System/myMath.h"

CR_BIND_DERIVED(CWakeProjectile, CProjectile, )

Expand Down
17 changes: 8 additions & 9 deletions rts/Sim/Projectiles/ExplosionGenerator.cpp
@@ -1,13 +1,11 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */

#include "ExplosionGenerator.h"

#include <iostream>
#include <stdexcept>
#include <cassert>
#include <cinttypes>
#include <cmath>

#include "ExplosionGenerator.h"
#include "ExpGenSpawner.h" //!!
#include "ExpGenSpawnable.h"
#include "ExpGenSpawnableMemberInfo.h"
Expand All @@ -31,15 +29,16 @@

#include "System/creg/STL_Map.h"
#include "System/Config/ConfigHandler.h"
#include "System/FileSystem/ArchiveScanner.h"
#include "System/FileSystem/FileHandler.h"
#include "System/FileSystem/FileSystemInitializer.h"
#include "System/FileSystem/VFSHandler.h"
#include "System/Log/DefaultFilter.h"
#include "System/Log/ILog.h"
#include "System/Sync/HsiehHash.h"
#include "System/Exceptions.h"
#include "System/FileSystem/ArchiveScanner.h"
#include "System/FileSystem/FileHandler.h"
#include "System/FileSystem/VFSHandler.h"
#include "System/myMath.h"
#include "System/Util.h"
#include "System/Sync/HsiehHash.h"


CR_BIND_INTERFACE(IExplosionGenerator)
Expand Down Expand Up @@ -104,7 +103,7 @@ unsigned int CCustomExplosionGenerator::GetFlagsFromHeight(float height, float g
{
unsigned int flags = 0;

const float waterDist = std::abs(height);
const float waterDist = math::fabsf(height);
const float altitude = height - groundHeight;

// note: ranges do not overlap, although code in
Expand Down Expand Up @@ -433,7 +432,7 @@ bool CStdExplosionGenerator::Explosion(
const float time = (40.0f + smokeDamageSQRT * 15.0f) * (0.8f + gu->RandFloat() * 0.7f);

float3 dir = gu->RandVector() * smokeDamage;
dir.y = std::abs(dir.y);
dir.y = math::fabsf(dir.y);
const float3 npos = pos + dir;

new CSmokeProjectile2(owner, pos, npos, speed, time, smokeDamageSQRT * 4.0f, 0.4f, 0.6f);
Expand Down
5 changes: 2 additions & 3 deletions rts/Sim/Weapons/EmgCannon.cpp
Expand Up @@ -2,15 +2,14 @@

#include "EmgCannon.h"

#include <cmath>

#include "WeaponDef.h"
#include "Sim/Misc/Team.h"
#include "Map/Ground.h"
#include "Sim/Projectiles/WeaponProjectiles/WeaponProjectileFactory.h"
#include "Sim/Units/Unit.h"
#include "Sim/Units/UnitDef.h"
#include "System/Sync/SyncTracer.h"
#include "System/myMath.h"

CR_BIND_DERIVED(CEmgCannon, CWeapon, (NULL, NULL))
CR_REG_METADATA(CEmgCannon, )
Expand All @@ -36,7 +35,7 @@ void CEmgCannon::FireImpl(const bool scriptCall)
ProjectileParams params = GetProjectileParams();
params.pos = weaponMuzzlePos;
params.speed = dir * projectileSpeed;
params.ttl = std::ceil(std::max(dist, range) / projectileSpeed);
params.ttl = math::ceil(std::max(dist, range) / projectileSpeed);

WeaponProjectileFactory::LoadProjectile(params);
}
5 changes: 2 additions & 3 deletions rts/Sim/Weapons/FlameThrower.cpp
Expand Up @@ -2,12 +2,11 @@

#include "FlameThrower.h"

#include <cmath>

#include "WeaponDef.h"
#include "Map/Ground.h"
#include "Sim/Projectiles/WeaponProjectiles/WeaponProjectileFactory.h"
#include "Sim/Units/Unit.h"
#include "System/myMath.h"

CR_BIND_DERIVED(CFlameThrower, CWeapon, (NULL, NULL))

Expand All @@ -34,7 +33,7 @@ void CFlameThrower::FireImpl(const bool scriptCall)
params.pos = weaponMuzzlePos;
params.speed = dir * projectileSpeed;
params.spread = spread;
params.ttl = std::ceil(std::max(dist, range) / projectileSpeed * weaponDef->duration);
params.ttl = math::ceil(std::max(dist, range) / projectileSpeed * weaponDef->duration);

WeaponProjectileFactory::LoadProjectile(params);
}
Expand Down
5 changes: 2 additions & 3 deletions rts/Sim/Weapons/MissileLauncher.cpp
Expand Up @@ -2,14 +2,13 @@

#include "MissileLauncher.h"

#include <cmath>

#include "WeaponDef.h"
#include "Game/TraceRay.h"
#include "Map/Ground.h"
#include "Sim/Projectiles/WeaponProjectiles/WeaponProjectileFactory.h"
#include "Sim/Units/Unit.h"
#include "Sim/Units/UnitDef.h"
#include "System/myMath.h"

CR_BIND_DERIVED(CMissileLauncher, CWeapon, (NULL, NULL))
CR_REG_METADATA(CMissileLauncher, )
Expand Down Expand Up @@ -56,7 +55,7 @@ void CMissileLauncher::FireImpl(const bool scriptCall)
params.pos = weaponMuzzlePos;
params.end = currentTargetPos;
params.speed = startSpeed;
params.ttl = weaponDef->flighttime == 0? std::ceil(std::max(dist, range) / projectileSpeed + 25 * weaponDef->selfExplode): weaponDef->flighttime;
params.ttl = weaponDef->flighttime == 0? math::ceil(std::max(dist, range) / projectileSpeed + 25 * weaponDef->selfExplode): weaponDef->flighttime;

WeaponProjectileFactory::LoadProjectile(params);
}
Expand Down
5 changes: 2 additions & 3 deletions rts/Sim/Weapons/TorpedoLauncher.cpp
Expand Up @@ -2,13 +2,12 @@

#include "TorpedoLauncher.h"

#include <cmath>

#include "WeaponDef.h"
#include "Map/Ground.h"
#include "Sim/Projectiles/WeaponProjectiles/WeaponProjectileFactory.h"
#include "Sim/Units/UnitDef.h"
#include "Sim/Units/Unit.h"
#include "System/myMath.h"

CR_BIND_DERIVED(CTorpedoLauncher, CWeapon, (NULL, NULL))

Expand Down Expand Up @@ -68,7 +67,7 @@ void CTorpedoLauncher::FireImpl(const bool scriptCall)
params.speed = vel;
params.pos = weaponMuzzlePos;
params.end = currentTargetPos;
params.ttl = (weaponDef->flighttime == 0)? std::ceil(std::max(dist, range) / projectileSpeed + 25): weaponDef->flighttime;
params.ttl = (weaponDef->flighttime == 0)? math::ceil(std::max(dist, range) / projectileSpeed + 25): weaponDef->flighttime;
params.tracking = tracking;

WeaponProjectileFactory::LoadProjectile(params);
Expand Down

0 comments on commit 45b60cb

Please sign in to comment.