netpanzer-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netPanzer-Devel] Some compile warnings..


From: Raphael Bosshard
Subject: [netPanzer-Devel] Some compile warnings..
Date: Mon, 08 Sep 2003 21:57:00 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030903 Mozilla Thunderbird/0.2a

in the Particle-System should be gone with this patch.
Mostly conversions from float to int.

Nevertheless, I saw that there were quite a lot float-operations. Did we convert the types to int? I did not fix stuff like particleCount, 'cause I'm not sure if floats wouldn't fit better there.

Raphael
Only in netpanzer.mod/src/Lib/Particles/: ChunkTrajectoryParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: CloudParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: CraterParticle2D.o
Common subdirectories: netpanzer/src/Lib/Particles/CVS and 
netpanzer.mod/src/Lib/Particles/CVS
Only in netpanzer.mod/src/Lib/Particles/: DirtKickParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: FireParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: FireParticleSystem2D.o
diff -iu netpanzer/src/Lib/Particles/FlameParticle2D.cpp 
netpanzer.mod/src/Lib/Particles/FlameParticle2D.cpp
--- netpanzer/src/Lib/Particles/FlameParticle2D.cpp     2003-09-07 
22:49:02.000000000 +0200
+++ netpanzer.mod/src/Lib/Particles/FlameParticle2D.cpp 2003-09-08 
21:05:53.231453800 +0200
@@ -94,8 +94,8 @@
 
                float percent = float(i) / float(maxLevel);
 
-               newSize.x = float(tempSurface.getPixX()) * percent;
-               newSize.y = float(tempSurface.getPixY()) * percent;
+               newSize.x = int(float(tempSurface.getPixX()) * percent);
+               newSize.y = int(float(tempSurface.getPixY()) * percent);
 
                tempSurface.scale(newSize);
                tempSurface.setFPS(explosionFPS);
@@ -116,8 +116,8 @@
 
                float percent = float(i) / float(maxLevel);
 
-               newSize.x = float(tempSurface.getPixX()) * percent;
-               newSize.y = float(tempSurface.getPixY()) * percent;
+               newSize.x = int(float(tempSurface.getPixX()) * percent);
+               newSize.y = int(float(tempSurface.getPixY()) * percent);
 
                tempSurface.scale(newSize);
                tempSurface.setFPS(explosionFPS);
@@ -180,7 +180,7 @@
                return;
        }
 
-       packedSurface.setAttrib(PointXYi(pos.x, pos.z), layer);
+       packedSurface.setAttrib(PointXYi((int)pos.x, (int)pos.z), layer);
        sorter.addSprite(&packedSurface);
 
 } // end FlameParticle2D::draw
Only in netpanzer.mod/src/Lib/Particles/: FlameParticle2D.o
diff -iu netpanzer/src/Lib/Particles/FlashParticle2D.cpp 
netpanzer.mod/src/Lib/Particles/FlashParticle2D.cpp
--- netpanzer/src/Lib/Particles/FlashParticle2D.cpp     2003-09-07 
22:49:02.000000000 +0200
+++ netpanzer.mod/src/Lib/Particles/FlashParticle2D.cpp 2003-09-08 
21:18:15.079675728 +0200
@@ -80,11 +80,11 @@
        const float maxFlashSize = 200.0f;
        const float flashCount   =  20.0f;
 
-       outputSurface.create(surface.getPixX(), surface.getPixY(), 
surface.getPixX(), flashCount);
+       outputSurface.create(surface.getPixX(), surface.getPixY(), 
surface.getPixX(), int(flashCount));
 
        int n = 0;
 
-       for (int i = minFlashSize; i < maxFlashSize - minFlashSize; i += 
(maxFlashSize - minFlashSize) / flashCount)
+       for (int i = (int)minFlashSize; i < maxFlashSize - minFlashSize; i += 
int((maxFlashSize - minFlashSize) / flashCount))
        {
                // Set the output frame.
                outputSurface.setFrame(n++);
@@ -92,8 +92,8 @@
 
                // Copy and scale the surface.
                scaledSurface.copy(surface);
-               float x = float(surface.getPixX()) * (float(i) / maxFlashSize);
-               float y = float(surface.getPixY()) * (float(i) / maxFlashSize);
+               int x = int(float(surface.getPixX()) * (float(i) / 
maxFlashSize));
+               int y = int(float(surface.getPixY()) * (float(i) / 
maxFlashSize));
                scaledSurface.scale(x, y);
 
                iXY dest((surface.getPix() - scaledSurface.getPix()) / 2);
@@ -133,7 +133,7 @@
 
        packedSurface.setFrame(frame);
 
-       packedSurface.setAttrib(PointXYi(pos.x, pos.z), layer);
+       packedSurface.setAttrib(PointXYi((int)pos.x, (int)pos.z), layer);
        sorter.addSprite(&packedSurface);
 
        // Since we only want a single frame of the flash, kill it after it is 
done.
Only in netpanzer.mod/src/Lib/Particles/: FlashParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: GroundExplosionParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: GroundExplosionParticleSystem2D.o
Only in netpanzer.mod/src/Lib/Particles/: Particle2D.o
diff -iu netpanzer/src/Lib/Particles/ParticleInterface.cpp 
netpanzer.mod/src/Lib/Particles/ParticleInterface.cpp
--- netpanzer/src/Lib/Particles/ParticleInterface.cpp   2003-09-08 
14:12:18.000000000 +0200
+++ netpanzer.mod/src/Lib/Particles/ParticleInterface.cpp       2003-09-08 
21:23:54.202121280 +0200
@@ -482,9 +482,9 @@
 
        e.percentScaleMin    = 0.8f;
        e.percentScaleRand   = 0.6f;
-       e.speedSmall         = 400 * hitPointScale;
-       e.speedMedium        = 250 * hitPointScale;
-       e.speedLarge         = 150 * hitPointScale;
+       e.speedSmall         = int(400 * hitPointScale);
+       e.speedMedium        = int(250 * hitPointScale);
+       e.speedLarge         = int(150 * hitPointScale);
        e.percentCountSmall  = 0.4f;
        e.percentCountMedium = 0.3f;
        e.percentCountLarge  = 0.3f;
@@ -496,7 +496,7 @@
        e.flashMinScale      = 0.6f * hitPointScale;
        e.flashRandScale     = 0.4f * hitPointScale;
        e.flashLifetime      = 0.5f;
-       e.flashCount         = 3 * 
float(unitParticleInfo[unitState.unit_type].minBounds.getArea()) / 
float(unitBodyMaxArea);
+       e.flashCount         = int( 3 * 
float(unitParticleInfo[unitState.unit_type].minBounds.getArea()) / 
float(unitBodyMaxArea));
        e.flashBounds        = unitParticleInfo[unitState.unit_type].minBounds;
 
        int randTrajectoryAngleMin = rand() % 3;
@@ -621,7 +621,7 @@
        float randomness = 1.0f; //Particle2D::getScale(0.8f, 0.4f);
        float frameRateAdjustment = getFrameRateAdjustment();
 
-       e.particleCount = 5 * (frameRateAdjustment * 
float(unitAttackFactorTable[unitType]) * randomness);
+       e.particleCount = int(5 * (frameRateAdjustment * 
float(unitAttackFactorTable[unitType]) * randomness));
 
        if (gDrawExplosionParticleCount)
        {
@@ -643,9 +643,9 @@
 
        e.percentScaleMin    = 0.8f;
        e.percentScaleRand   = 0.4f;
-       e.speedSmall         = 400 * attackScale;
-       e.speedMedium        = 250 * attackScale;
-       e.speedLarge         = 150 * attackScale;
+       e.speedSmall         = int(400 * attackScale);
+       e.speedMedium        = int(250 * attackScale);
+       e.speedLarge         = int(150 * attackScale);
        e.percentCountSmall  = 0.5f;
        e.percentCountMedium = 0.3f;
        e.percentCountLarge  = 0.2f;
@@ -682,8 +682,8 @@
        {
                UnitProfile *p = UnitProfileInterface::getUnitProfile(i);
                
-               unitHitPointTable[i]     = sqrt(p->hit_points);
-               unitAttackFactorTable[i] = sqrt(p->attack_factor * 2);
+               unitHitPointTable[i]     = int(sqrt(p->hit_points));
+               unitAttackFactorTable[i] = int(sqrt(p->attack_factor * 2));
        }
 }
 
@@ -703,7 +703,7 @@
 //--------------------------------------------------------------------------
 void ParticleInterface::addMissleFlightPuff(const iXY &worldPos, const fXY 
&direction, float &curWait, float &totalWait, BYTE unitType)
 {
-       iXY thrustOffset(-10.0f * direction.x, -10.0f * direction.y);
+       iXY thrustOffset(int(-10.0f * direction.x), int(-10.0f * direction.y));
        fXYZ loc(worldPos.x + thrustOffset.x, 0, worldPos.y + thrustOffset.y);
 
        curWait += TimerInterface::getTimeSlice();
Only in netpanzer.mod/src/Lib/Particles/: ParticleInterface.o
Only in netpanzer.mod/src/Lib/Particles/: ParticleSystem2D.o
Only in netpanzer.mod/src/Lib/Particles/: ParticleSystemGlobals.o
Only in netpanzer.mod/src/Lib/Particles/: ParticleTweakView.o
Only in netpanzer.mod/src/Lib/Particles/: PuffParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: RadarPingParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: SmokingTrajectoryParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: SmolderParticleSystem2D.o
Only in netpanzer.mod/src/Lib/Particles/: SnowParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: SnowParticleSystem2D.o
Only in netpanzer.mod/src/Lib/Particles/: SparkParticle2D.o
diff -iu netpanzer/src/Lib/Particles/TemplateExplosionSystem.cpp 
netpanzer.mod/src/Lib/Particles/TemplateExplosionSystem.cpp
--- netpanzer/src/Lib/Particles/TemplateExplosionSystem.cpp     2003-09-06 
04:01:18.000000000 +0200
+++ netpanzer.mod/src/Lib/Particles/TemplateExplosionSystem.cpp 2003-09-08 
21:39:11.986596832 +0200
@@ -57,7 +57,7 @@
        int halfBoundsY = bounds.getSizeY() / 2;
 
        // Add a crater on the ground if it is a logical location.
-       int pixMovementValue = TileInterface::getWorldPixMovementValue(pos.x, 
pos.z);
+       int pixMovementValue = 
TileInterface::getWorldPixMovementValue(int(pos.x), int(pos.z));
 
        // Check for water or impassible.
        if (pixMovementValue != 5 &&
@@ -84,7 +84,7 @@
                        // Since this is a water explosion and only particles 
are getting thrown,
                        // add some more particles.
                        canHaveSmoke  = 0;
-                       particleCount = e.particleCount * 1.7f;
+                       particleCount = int(e.particleCount * 1.7f);
 
                } else 
                {
@@ -155,7 +155,7 @@
                offset.z = pos.z - (rand() % bounds.getSizeY()) + halfBoundsY;
 
                new ChunkTrajectoryParticle2D(  offset,
-                                                                               
maxSpeed,
+                                                                               
int(maxSpeed),
                                                                                
scaleMin,
                                                                                
scaleRand,
                                                                                
waitMin,
@@ -181,7 +181,7 @@
                offset.z = pos.z - (rand() % bounds.getSizeY()) + halfBoundsY;
 
                new ChunkTrajectoryParticle2D(  pos,
-                                                                               
maxSpeed,
+                                                                               
int(maxSpeed),
                                                                                
scaleMin,
                                                                                
scaleRand,
                                                                                
waitMin,
@@ -208,7 +208,7 @@
 
 
                new ChunkTrajectoryParticle2D(  pos,
-                                                                               
maxSpeed,
+                                                                               
int(maxSpeed),
                                                                                
scaleMin,
                                                                                
scaleRand,
                                                                                
waitMin,
Only in netpanzer.mod/src/Lib/Particles/: TemplateExplosionSystem.o
Only in netpanzer.mod/src/Lib/Particles/: TemplateMuzzleSystem.o
diff -iu netpanzer/src/Lib/Particles/TrajectoryParticle2D.cpp 
netpanzer.mod/src/Lib/Particles/TrajectoryParticle2D.cpp
--- netpanzer/src/Lib/Particles/TrajectoryParticle2D.cpp        2003-09-06 
04:01:18.000000000 +0200
+++ netpanzer.mod/src/Lib/Particles/TrajectoryParticle2D.cpp    2003-09-08 
21:45:41.250419736 +0200
@@ -36,7 +36,7 @@
        
        TrajectoryParticle2D::dieAtMidFlight = dieAtMidFlight;
        
-       lifetime = (float(initialVelocity * Math::getSin(trajectoryAngle)) / 
Physics::getGravity()) * 2.0f;
+       lifetime = (float(initialVelocity * Math::getSin(int(trajectoryAngle))) 
/ Physics::getGravity()) * 2.0f;
        
        if (dieAtMidFlight)
        {
@@ -62,7 +62,7 @@
 void TrajectoryParticle2D::sim()
 {
        // Get the particle horizontal position.
-       float dx = Physics::getHorizontalPosition(initialVelocity, 
trajectoryAngle, age);
+       float dx = Physics::getHorizontalPosition(initialVelocity, 
int(trajectoryAngle), age);
 
        //pos += velocity;
 
@@ -71,7 +71,7 @@
        pos.x = initialPos.x + dx * direction.x;
        pos.z = initialPos.z + dx * direction.z;
 
-       pos.y = Physics::getVerticalPosition(initialVelocity, trajectoryAngle, 
age);
+       pos.y = Physics::getVerticalPosition(initialVelocity, 
int(trajectoryAngle), age);
 
        if (dieAtMidFlight)
        {
Only in netpanzer.mod/src/Lib/Particles/: TrajectoryParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: VectorPuffParticle2D.o
Only in netpanzer.mod/src/Lib/Particles/: WindParticle2D.o

reply via email to

[Prev in Thread] Current Thread [Next in Thread]