netpanzer-cvs
[Top][All Lists]
Advanced

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

[netPanzer-CVS] netpanzer/src ChangeLog Lib/Particles/FlamePart...


From: Matthias Braun
Subject: [netPanzer-CVS] netpanzer/src ChangeLog Lib/Particles/FlamePart...
Date: Tue, 09 Sep 2003 12:21:07 -0400

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Matthias Braun <address@hidden> 03/09/09 12:21:07

Modified files:
        src            : ChangeLog 
        src/Lib/Particles: FlameParticle2D.hpp Particle2D.cpp 
                           ParticleInterface.cpp ParticleInterface.hpp 
                           WindParticle2D.cpp WindParticle2D.hpp 
        src/NetPanzer/Interfaces: GameManager.cpp 

Log message:
        -worked around issues with the block allocator code for Particl2D (new 
operator
        is overloaded, but latest C++ draft doesn't allow to return 0 from such 
an
        overloaded new.) I added exceptions and lots of try {} catch{} blocks, 
let's
        hope I didn't miss some new calls.

Patches:
Index: netpanzer/src/ChangeLog
diff -u netpanzer/src/ChangeLog:1.12 netpanzer/src/ChangeLog:1.13
--- netpanzer/src/ChangeLog:1.12        Mon Sep  8 17:25:08 2003
+++ netpanzer/src/ChangeLog     Tue Sep  9 12:21:06 2003
@@ -1,3 +1,9 @@
+9-Sep-2003 by Matze Braun
+-worked around issues with the block allocator code for Particl2D (new operator
+ is overloaded, but laste C++ draft doesn't allow to return 0 from such an
+ overloaded new.) I added exceptions and lots of try {} catch{} blocks, let's
+ hope I didn't miss something.
+
 8-Sep-2003 by Matze Braun
 -added some basic music plying support (all files in sfx/music are played in
                random order, so simply put some .mp3 or .ogg there)
Index: netpanzer/src/Lib/Particles/FlameParticle2D.hpp
diff -u netpanzer/src/Lib/Particles/FlameParticle2D.hpp:1.2 
netpanzer/src/Lib/Particles/FlameParticle2D.hpp:1.3
--- netpanzer/src/Lib/Particles/FlameParticle2D.hpp:1.2 Mon Sep  1 16:24:18 2003
+++ netpanzer/src/Lib/Particles/FlameParticle2D.hpp     Tue Sep  9 12:21:06 2003
@@ -46,7 +46,6 @@
 
        static void pakFiles();
        static void loadPakFiles();
-
 }; // end FlameParticle2D
 
 #endif // __FlameParticle2D_hpp__
Index: netpanzer/src/Lib/Particles/Particle2D.cpp
diff -u netpanzer/src/Lib/Particles/Particle2D.cpp:1.4 
netpanzer/src/Lib/Particles/Particle2D.cpp:1.5
--- netpanzer/src/Lib/Particles/Particle2D.cpp:1.4      Sun Sep  7 16:49:02 2003
+++ netpanzer/src/Lib/Particles/Particle2D.cpp  Tue Sep  9 12:21:06 2003
@@ -67,10 +67,7 @@
        // Check global particle disable flag.
        if (!createParticles)
        {
-               // XXX my compiler claims that new mustn't return 0, so I'm 
throwing an
-               // exception...
-               throw "allocation error.";
-               //return 0;
+               throw "particles disabled";
        }
 
        // Check for trying to create a particle that's too big.
@@ -82,10 +79,7 @@
        // Check if all slots used.
        if (firstAvailableParticle == 0)
        {
-               // XXX my compiler claims that new mustn't return 0, so I'm 
throwing an
-               // exception...
-               throw "allocation error.";
-               //return 0;
+               throw "all particle slots used";
        }
 
        // Remove particle from available list and return it.
@@ -93,7 +87,6 @@
        firstAvailableParticle = firstAvailableParticle->next;
 
        return p;
-
 } // end Particle2D::operator new
 
 // operator delete
@@ -114,7 +107,6 @@
        Particle2D *p = (Particle2D *)block;
        p->next = firstAvailableParticle;
        firstAvailableParticle = p;
-
 } // end Particle2D::operator delete
 
 // Particle2D
@@ -128,12 +120,10 @@
        if (this == zParticle2D)
        {
                prev = next = zParticle2D;
-       }       else
-               {
-                       prev = next = 0;
-                       insertMe();
-               }
-
+       } else {
+               prev = next = 0;
+               insertMe();
+       }
 } // end Particle2D
 
 // ~Particle2D
@@ -186,7 +176,6 @@
        {
                peakCount = frameCount;
        }
-
 } // end Particle2D::insertMe
 
 // removeMe
@@ -219,7 +208,6 @@
                delete e;
                e = nextPtr;
        }
-
 } // end Particle2D::removeAll
 
 // simAll
@@ -236,7 +224,6 @@
                e->sim();
                e = nextPtr;
        }
-
 } // end Particle2D::simAll
 
 // drawAll
@@ -254,7 +241,6 @@
                e->draw(clientArea, sorter);
                e = nextPtr;
        }
-
 } // end Particle2D::drawAll
 
 // draw
@@ -263,11 +249,6 @@
 //---------------------------------------------------------------------------
 void Particle2D::draw(const Surface &dest, SpriteSorter &sorter)
 {
-       if (!isAlive)
-       {
-               return;
-       }
-
 } // end draw
 
 // Particle2D::sim
@@ -293,264 +274,6 @@
 
 } // end Particle2D::sim
 
-//---------------------------------------------------------------------------
-#ifdef _DEBUG
-       //void Particle2D::verifyList()
-       //{
-    /*
-               // Verify head/tail node
-               assert(isValidPtr(zParticle2D));
-               assert(isValidPtr(zParticle2D->next));
-               assert(isValidPtr(zParticle2D->prev));
-
-               // Go through links and verify nodes match up
-               Particle2D *e = zParticle2D;
-               int numLeftToCount = particleCount+1;
-    do
-               {
-                       assert(isValidPtr(e));
-                       assert(isValidPtr(e->next));
-                       assert(isValidPtr(e->prev));
-
-                       assert(e->prev->next == e);
-                       assert(e->next->prev == e);
-
-                       e = e->next;
-      assert(numLeftToCount > 0);
-      --numLeftToCount;
-               } while (e != zParticle2D);
-         if (numLeftToCount != 0) {
-      LOG(("numLeftToCount: %d", numLeftToCount));
-    }
-    assert(numLeftToCount == 0);
-    */
-  //}
-#endif
-
-//// blit
-////--------------------------------------------------------------------------
-//void SpriteBltNormal::blit(Surface *surface, Recti &world_win)
-//{
-//     // blit_offset
-//     PointXYi bo = world_pos - world_win.min; 
-//     
-//     blt(*surface, bo.x, bo.y);
-//} // end blit
-//
-//// blit
-////--------------------------------------------------------------------------
-//void SpriteBltTrans::blit(Surface *surface, Recti &world_win)
-//{
-//     // blit_offset
-//     PointXYi bo = world_pos - world_win.min; 
-//     
-//     bltTrans(*surface, bo.x, bo.y);
-//} // end blit
-//
-//// blit
-////--------------------------------------------------------------------------
-//void SpriteBltBrightness::blit(Surface *surface, Recti &world_win)
-//{
-//     // blit_offset
-//     PointXYi bo = world_pos - world_win.min; 
-//     
-//     bltBrightness(*surface, iXY(bo.x, bo.y), brightness);
-//} // end blit
-//
-//// SpriteBltBlendRandomScale constructor
-////--------------------------------------------------------------------------
-//SpriteBltBlendRandomScale::SpriteBltBlendRandomScale()
-//{
-//     blendTable = rand() % Palette::COLOR_BLEND_TABLE_COUNT;
-//} // end SpriteBltBlendRandomScale constructor
-//     
-//// blit
-////--------------------------------------------------------------------------
-//void SpriteBltBlendRandomScale::blit(Surface *surface, Recti &world_win)
-//{
-//     // blit_offset
-//     PointXYi bo = world_pos - world_win.min; 
-//     
-//     iRect r(bo, bo + 10 + yPos / 2);
-//     //iRect r(bo, bo + 50);
-//     
-//     iXY center = r.getSize() / (-2);
-//     
-//     r.min += center;
-//     r.max += center;
-//
-//     //surface->setOffset((surface->getPix() - r.getSize()) / (-2));
-//     //surface->setOffset(r.getSize() / (-2));
-//
-//     if(1)
-//     {       
-//             if      (blendTable == 0)
-//             {
-//                     surface->bltBlendScale(*this, r, 
Palette::colorTable2575);
-//             }
-//             else if (blendTable == 1)
-//             {
-//                     surface->bltBlendScale(*this, r, 
Palette::colorTable5050);
-//             }
-//             else if (blendTable == 2)
-//             {
-//                     surface->bltBlendScale(*this, r, 
Palette::colorTable7525);
-//             }
-//     }
-//} // end SpriteBltBlendRandomScale::blit
-//     
-//// blit
-////--------------------------------------------------------------------------
-//void SpriteBltBlendScale::blit(Surface *surface, Recti &world_win)
-//{
-//     if (scale <= 0) { return; }
-//
-//     PointXYi viewPos = world_pos - world_win.min; 
-//     
-//     //iRect r(bo, bo + 10 + yPos / 2);
-//     //iXY center = r.getSize() / (-2);
-//     
-//     // Use scale to adjust the size of the image while keeping the
-//     // aspect ratio correct.
-//
-//     iRect r(viewPos.x, viewPos.y, viewPos.x + this->pix.x * scale, 
viewPos.y + this->pix.y * scale);
-//     
-//     iXY center;
-//     center.x = -(r.getSizeX() >> 1);
-//     center.y = -(r.getSizeY() >> 1);
-//
-//     r.translate(center);
-//
-//     surface->bltBlendScale(*this, r, *colorTable);
-//     //surface->bltScale(*this, r);
-//
-//} // end SpriteBltBlendScale::blit
-//
-//// SpriteBltBlendRandom constructor
-////--------------------------------------------------------------------------
-//SpriteBltBlendRandom::SpriteBltBlendRandom()
-//{
-//     blendTable = rand() % Palette::COLOR_BLEND_TABLE_COUNT;
-//
-//} // end SpriteBltBlendRandom constructor
-//     
-//// blit
-////--------------------------------------------------------------------------
-//void SpriteBltBlendRandom::blit(Surface *surface, Recti &world_win)
-//{
-//     // blit_offset
-//     PointXYi bo = world_pos - world_win.min; 
-//     
-//     if(1)
-//     {       
-//             if      (blendTable == 0)
-//             {
-//                     surface->blendIn(*this, bo.x, bo.y, 
Palette::colorTable2575);
-//             }
-//             else if (blendTable == 1)
-//             {
-//                     surface->blendIn(*this, bo.x, bo.y, 
Palette::colorTable5050);
-//             }
-//             else if (blendTable == 2)
-//             {
-//                     surface->blendIn(*this, bo.x, bo.y, 
Palette::colorTable7525);
-//             }
-//     }
-//
-//} // end SpriteBltBlendRandom::blit
-//
-//// blit
-////--------------------------------------------------------------------------
-//void SpriteBltBlend::blit(Surface *surface, Recti &world_win)
-//{
-//     // blit_offset
-//     PointXYi bo = world_pos - world_win.min; 
-//     
-//     if (useBlend)
-//     {
-//             surface->blendIn(*this, bo.x, bo.y, *colorTable);
-//     } else
-//     {
-//             blt(*surface, bo);
-//     }
-//
-//} // end SpriteBltBlend::blit
-//
-//// blit
-////--------------------------------------------------------------------------
-//void SpriteBltScale::blit(Surface *surface, Recti &world_win)
-//{
-//     if (scale <= 0) { return; }
-//
-//     PointXYi viewPos = world_pos - world_win.min; 
-//
-//     iRect r(viewPos.x, viewPos.y, viewPos.x + this->pix.x * scale, 
viewPos.y + this->pix.y * scale);
-//     
-//     iXY center;
-//     center.x = -(r.getSizeX() >> 1);
-//     center.y = -(r.getSizeY() >> 1);
-//
-//     r.translate(center);
-//
-//     //surface->bltScale(*this, r);
-//     surface->bltBlendScale(*this, r, Palette::colorTableSolidTrans0);
-//
-//} // end SpriteBltScale::blit
-//
-//// blit
-////--------------------------------------------------------------------------
-//void PackedSurfacePreScaled::blit(Surface *surface, Recti &world_win)
-//{
-//     PointXYi viewPos = world_pos - world_win.min; 
-//
-//     blt(*surface, viewPos);
-//
-//} // end PackedSurfacePreScaled::blit
-//
-////--------------------------------------------------------------------------
-//void PackedSurfacePreScaled::setTo(const PackedSurface &source)
-//{
-//     assert(isValidPtr(this));
-//
-//     free();
-//
-//     myMem      = false;
-//     pix        = source.getPix();
-//     center     = source.getCenter();
-//     frameCount = source.getFrameCount();
-//     fps        = source.getFPS();
-//     offset     = source.getOffset();
-//
-//} // end Surface::setTo
-//
-//// blit
-////--------------------------------------------------------------------------
-//void SpritePackedBlt::blit(Surface *surface, Recti &world_win)
-//{
-//     //if (scale <= 0) { return; }
-//
-//     PointXYi viewPos = world_pos - world_win.min;
-//     
-//     //iRect r(bo, bo + 10 + yPos / 2);
-//     //iXY center = r.getSize() / (-2);
-//     
-//     // Use scale to adjust the size of the image while keeping the
-//     // aspect ratio correct.
-//
-//     //iRect r(viewPos.x, viewPos.y, viewPos.x + this->pix.x * scale, 
viewPos.y + this->pix.y * scale);
-//     
-//     //iXY center;
-//     //center.x = -(r.getSizeX() >> 1);
-//     //center.y = -(r.getSizeY() >> 1);
-//
-//     //r.translate(center);
-//
-//     //surface->bltBlendScale(*this, r, *colorTable);
-//     //surface->bltScale(*this, r);
-//     blt(*surface, viewPos);
-//
-//} // end SpritePackedBlit::blit
-
 // getFPS
 //--------------------------------------------------------------------------
 int Particle2D::getFPS(int FPSmin, int FPSrand)
@@ -564,7 +287,6 @@
        }
 
        return FPS;
-
 } // end Particle2D::getFPS
 
 // getPakIndex
@@ -579,7 +301,6 @@
        }
 
        return destIndex;
-
 } // end Particle2D::getPakIndex
 
 // getScale
@@ -587,7 +308,6 @@
 float Particle2D::getScale(float scaleMin, float scaleRand)
 {
        return (float(rand()) / float(RAND_MAX)) * scaleRand + scaleMin;
-
 } // end Particle2D::getScale
 
 // getLifetime
@@ -595,7 +315,6 @@
 float Particle2D::getLifetime(float lifetimeMin, float lifetimeRand)
 {
        return (float(rand()) / float(RAND_MAX)) * lifetimeRand + lifetimeMin;
-
 } // end Particle2D::getLifetime
 
 // getFarAway
@@ -650,5 +369,5 @@
 
        // The particle must be near the screen.
        return 0;
-
 } // end Particle2D::getFarAway
+
Index: netpanzer/src/Lib/Particles/ParticleInterface.cpp
diff -u netpanzer/src/Lib/Particles/ParticleInterface.cpp:1.5 
netpanzer/src/Lib/Particles/ParticleInterface.cpp:1.6
--- netpanzer/src/Lib/Particles/ParticleInterface.cpp:1.5       Mon Sep  8 
17:25:08 2003
+++ netpanzer/src/Lib/Particles/ParticleInterface.cpp   Tue Sep  9 12:21:06 2003
@@ -15,8 +15,8 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-
 #include <config.h>
+
 #include "KeyScanCodeDefs.h"
 #include "ParticleInterface.hpp"
 #include "PuffParticle2D.hpp"
@@ -30,7 +30,6 @@
 #include "MapInterface.hpp"
 #include "KeyboardInterface.hpp"
 #include "Physics.hpp"
-//#include "DSound.hpp"
 //#include "DirtKickParticle2D.hpp"
 #include "SparkParticle2D.hpp"
 #include "FireParticleSystem2D.hpp"
@@ -46,6 +45,7 @@
 #include "TemplateMuzzleSystem.hpp"
 #include "UnitGlobals.hpp"
 #include "CraterParticle2D.hpp"
+#include "Exception.hpp"
 
 
 cGrowList <UnitParticleInfo> ParticleInterface::unitParticleInfo;
@@ -99,7 +99,8 @@
 
        if (particleType == 0)
        {
-               new PuffParticle2D(     newPos,
+               try {
+                       new PuffParticle2D(     newPos,
                                                        LIGHT,
                                                        0.0f,
                                                        0.4f,
@@ -109,10 +110,14 @@
                                                        smokeShadowLayer,
                                                        smokeWindScale,
                                                        
Particle2D::getFarAway(newPos));
+               } catch(...) {
+                       // ignored for now
+               }
        }
        else if (particleType == 1)
        {
-               new PuffParticle2D(     newPos,
+               try {
+                       new PuffParticle2D(     newPos,
                                                        DARK,
                                                        0.0f,
                                                        0.4f,
@@ -122,9 +127,12 @@
                                                        smokeShadowLayer,
                                                        smokeWindScale,
                                                        
Particle2D::getFarAway(newPos));
-
-       } else { assert(false); }
-
+               } catch(...) {
+                       // ignored for now
+               }
+       } else {
+               throw Exception("Unknonw DamagePuffParticle type");
+       }
 } // end ParticleInterface::addUnitDamagePuffParticle
 
 //--------------------------------------------------------------------------
@@ -170,7 +178,10 @@
 //--------------------------------------------------------------------------
 void ParticleInterface::addPuffParticle(const iXY &worldPos, PUFF_TYPE type, 
float minScale, float randScale, int minFPS, int randFPS, int layer, float 
windScale /* = 1.0f */, float incrementScale /* = 0.0f */)
 {
+       try {
 //     new PuffParticle2D(fXYZ(worldPos.x, 0, worldPos.y), type, minScale, 
randScale, minFPS, randFPS, layer, layer - 1, windScale);
+       } catch(...) {
+       }
 }
 
 //--------------------------------------------------------------------------
@@ -225,7 +236,10 @@
 //        
 //        // These particles have a hardcoded waitMax and waitMin.  They are 
the last 2 variables
 //        // in the following statement.
+//               try {
 //        new PuffParticle2D(offset, particleType, minScale, randScale, 
minFPS, randFPS, layer, layer - 1, smolderWindScale);
+//               } catch(...) {
+//        }
 //    }
 }
 
@@ -256,13 +270,21 @@
 //--------------------------------------------------------------------------
 void ParticleInterface::addFlashParticle(const iXY &worldPos, float minScale, 
float randScale, float lifetime, int layer, bool singleFrame /* = false */)
 {
-       new FlashParticle2D(fXYZ(worldPos.x, 0, worldPos.y), minScale, 
randScale, lifetime, layer, singleFrame);
+       try {
+               new FlashParticle2D(fXYZ(worldPos.x, 0, worldPos.y), minScale, 
randScale, lifetime, layer, singleFrame);
+       } catch(...) {
+               // ignrored
+       }
 }
 
 //--------------------------------------------------------------------------
 void ParticleInterface::addExplosionFlameParticle(const iXY &worldPos, const 
float &minScale, const float &randScale, const int &layer)
 {
+       try {
 //     new ExplosionFireParticle2D(fXYZ(worldPos.x, 0, worldPos.y), minScale, 
randScale, layer);
+       } catch(...) {
+               // ignored
+       }
 }
 
 //--------------------------------------------------------------------------
@@ -282,11 +304,19 @@
 
     if      (particleType == 0)
     {
+               try {
                //new ExplosionParticleSystem2D(pos, r, 1, maxParticleSpeed, 
LIGHT);
+               } catch(...) {
+                       // ignored
+               }
     }
     else if (particleType == 1)
     {
+               try {
                //new ExplosionParticleSystem2D(pos, r, 1, maxParticleSpeed, 
DARK);
+               } catch(...) {
+                       // ignored
+               }
     }
 }
 
@@ -295,7 +325,10 @@
 {
     fXYZ  pos(worldPos.x, 0, worldPos.y);
 
+       try {
     //new ExplosionParticleSystem2D(pos, bounds, dirtExplosionMaxParticleCount 
/ 2, float(explosionParticleMaxSpeed) * 0.75f, DIRT_PUFF);
+       } catch(...) {
+       }
 }
 
 //--------------------------------------------------------------------------
@@ -303,7 +336,10 @@
 {
     fXYZ  pos(worldPos.x, 0, worldPos.y);
 
-    //new GroundExplosionParticleSystem2D(pos, bounds, maxParticleCount, 
maxParticleSpeed);
+       try {
+               //new GroundExplosionParticleSystem2D(pos, bounds, 
maxParticleCount, maxParticleSpeed);
+       } catch(...) {
+       }
 }
 
 //--------------------------------------------------------------------------
@@ -320,7 +356,10 @@
 
        fXYZ  pos(worldPos.x, 0, worldPos.y);
 
+       try {
        //new ExplosionParticleSystem2D(pos, bounds, maxParticleCount, 
maxParticleSpeed, particleType);
+       } catch(...) {
+       }
 
        // Add an additional set of particles in the center of the larger 
explosion which
        // move at a slower initialVelocity, since real explosions have a lot 
of smoke lingering
@@ -329,7 +368,10 @@
 
        if (slowerParticleSpeed > 0)
        {
-               //new ExplosionParticleSystem2D(pos, bounds, maxParticleCount / 
2, slowerParticleSpeed, particleType);
+               try {
+                       //new ExplosionParticleSystem2D(pos, bounds, 
maxParticleCount / 2, slowerParticleSpeed, particleType);
+               } catch(...) {
+               }
        }
 }
 
@@ -348,11 +390,17 @@
 
        if      (particleType == 0)
        {
-               new SmolderParticleSystem2D(pos, bounds, lifetime, waitMin, 
waitMax, LIGHT);
+               try {
+                       new SmolderParticleSystem2D(pos, bounds, lifetime, 
waitMin, waitMax, LIGHT);
+               } catch(...) {
+               }
        }
        else if (particleType == 1)
        {
-               new SmolderParticleSystem2D(pos, bounds, lifetime, waitMin, 
waitMax, DARK);
+               try {
+                       new SmolderParticleSystem2D(pos, bounds, lifetime, 
waitMin, waitMax, DARK);
+               } catch(...) {
+               }
        } else
        {
                        assert(false);
@@ -367,7 +415,10 @@
 
        fXYZ  pos(worldPos.x, 0, worldPos.y);
 
-       new CloudParticle2D(pos, iXY(shit.x, shit.y), cloudWindMinPercent, 
cloudWindRandPercent);
+       try {
+               new CloudParticle2D(pos, iXY(shit.x, shit.y), 
cloudWindMinPercent, cloudWindRandPercent);
+       } catch(...) {
+       }
 }
 
 //--------------------------------------------------------------------------
@@ -517,10 +568,13 @@
        
        fXYZ pos(unitState.location.x, 0, unitState.location.y);
 
-       new TemplateExplosionSystem(    pos,
+       try {
+               new TemplateExplosionSystem(    pos,
                                                                        
unitParticleInfo[unitState.unit_type].minBounds,
                                                                        e,
                                                                        
Particle2D::getFarAway(pos));
+       } catch(...) {
+       }
 
        
        // Create some smoke in the middle of the explosion.
@@ -670,10 +724,13 @@
 
        fXYZ pos(worldPos.x, 0, worldPos.y);
 
-       new TemplateExplosionSystem(    pos,
+       try {
+               new TemplateExplosionSystem(    pos,
                                                                        
iRect(-5, -5, 5, 5),
                                                                        e,
                                                                        
Particle2D::getFarAway(pos));
+       } catch(...) {
+       }
 }
 
 void ParticleInterface::buildUnitTables()
@@ -687,19 +744,6 @@
        }
 }
 
-
-// UnitInterface.cpp
-/*
-                iXY loc = iXY( unit->unit_state.location.x, 
unit->unit_state.location.y );
-                ParticleInterface::addHit(loc, iRect(loc - 5, loc + 5));
-*/
-
-// Weapon.cpp
-/*
-        iXY loc = iXY( location.x, location.y );
-                ParticleInterface::addMiss(loc);
-*/
-
 //--------------------------------------------------------------------------
 void ParticleInterface::addMissleFlightPuff(const iXY &worldPos, const fXY 
&direction, float &curWait, float &totalWait, BYTE unitType)
 {
@@ -713,7 +757,8 @@
                curWait   = 0.0f;
                totalWait = (float(rand()) / float(RAND_MAX)) * 0.03f + 0.02f;
 
-               new PuffParticle2D(     loc,
+               try {
+                       new PuffParticle2D(     loc,
                                                        LIGHT,
                                                        0.05f,
                                                        0.05f,
@@ -723,6 +768,9 @@
                                                        smokeShadowLayer,
                                                        MuzzleSystem::windScale,
                                                        
Particle2D::getFarAway(loc));
+               } catch(...) {
+                       // ignored
+               }
        }
 }
 
@@ -808,13 +856,19 @@
        muzzlePos.z = worldPos.z + muzzleOffset.y;
 
        // Start the muzzle smoke.
-       new TemplateMuzzleSystem(muzzlePos, direction, m);
+       try {
+               new TemplateMuzzleSystem(muzzlePos, direction, m);
+       } catch(...) {
+       }
 }
 
 //--------------------------------------------------------------------------
 void ParticleInterface::addDirtKick(const iXY &worldPos)
 {
-       //new DirtKickParticle2D(fXYZ(worldPos.x, 0, worldPos.y));
+       try {
+               //new DirtKickParticle2D(fXYZ(worldPos.x, 0, worldPos.y));
+       } catch(...) {
+       }
 }
 
 //--------------------------------------------------------------------------
@@ -827,7 +881,10 @@
 
     for (int i = 0; i < count; i++)
     {
-               new CloudParticle2D(fXYZ(rand() % shit.x, 0, rand() % shit.y), 
iXY(shit.x, shit.y), cloudWindMinPercent, cloudWindRandPercent);
+               try {
+                       new CloudParticle2D(fXYZ(rand() % shit.x, 0, rand() % 
shit.y), iXY(shit.x, shit.y), cloudWindMinPercent, cloudWindRandPercent);
+               } catch(...) {
+               }
     }
 }
 
@@ -893,7 +950,8 @@
                        movePuffWaitGroup = 0.0f;
                        movePuffWaitTotal = (float(rand()) / float(RAND_MAX)) * 
0.05f + 0.05f;
 
-                       new PuffParticle2D(     pos,
+                       try {
+                               new PuffParticle2D(     pos,
                                                                DIRT,
                                                                0.0f,
                                                                0.15f,
@@ -903,6 +961,9 @@
                                                                0,
                                                                
MuzzleSystem::windScale,
                                                                isFarAway);
+                       } catch(...) {
+                               // ignored for now
+                       }
                }
        }
 }
Index: netpanzer/src/Lib/Particles/ParticleInterface.hpp
diff -u netpanzer/src/Lib/Particles/ParticleInterface.hpp:1.2 
netpanzer/src/Lib/Particles/ParticleInterface.hpp:1.3
--- netpanzer/src/Lib/Particles/ParticleInterface.hpp:1.2       Mon Sep  1 
16:24:18 2003
+++ netpanzer/src/Lib/Particles/ParticleInterface.hpp   Tue Sep  9 12:21:07 2003
@@ -15,24 +15,15 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-
 #ifndef __ParticleInterface_hpp__
 #define __ParticleInterface_hpp__
 
-
-#if _MSC_VER > 1000
-       #pragma once
-#endif
-
-
-
 #include "iXY.hpp"
 #include "iRect.hpp"
 #include "PuffParticle2D.hpp"
 #include "ParticleSystemGlobals.hpp"
 #include "UnitTypes.hpp"
 #include "UnitState.hpp"
-
 
 class Surface;
 class PackedSurface;
Index: netpanzer/src/Lib/Particles/WindParticle2D.cpp
diff -u netpanzer/src/Lib/Particles/WindParticle2D.cpp:1.3 
netpanzer/src/Lib/Particles/WindParticle2D.cpp:1.4
--- netpanzer/src/Lib/Particles/WindParticle2D.cpp:1.3  Fri Sep  5 22:01:18 2003
+++ netpanzer/src/Lib/Particles/WindParticle2D.cpp      Tue Sep  9 12:21:07 2003
@@ -15,17 +15,16 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-
 #include <config.h>
+
 #include "WindParticle2D.hpp"
 #include "Physics.hpp"
 
-
 //--------------------------------------------------------------------------
-WindParticle2D::WindParticle2D(const fXYZ &pos, float windScale /* = 1.0f */) 
: Particle2D(pos)
+WindParticle2D::WindParticle2D(const fXYZ &pos, float windScale /* = 1.0f */)
+       : Particle2D(pos)
 {
        WindParticle2D::windScale = windScale;
-
 } // end WindParticle2D::WindParticle2D
 
 // WindParticle2D::sim
@@ -35,5 +34,4 @@
        pos += (Physics::wind.getDisplacement() * windScale);
 
        Particle2D::sim();
-
 } // end WindParticle2D::sim
Index: netpanzer/src/Lib/Particles/WindParticle2D.hpp
diff -u netpanzer/src/Lib/Particles/WindParticle2D.hpp:1.1 
netpanzer/src/Lib/Particles/WindParticle2D.hpp:1.2
--- netpanzer/src/Lib/Particles/WindParticle2D.hpp:1.1  Sun Dec  1 12:51:46 2002
+++ netpanzer/src/Lib/Particles/WindParticle2D.hpp      Tue Sep  9 12:21:07 2003
@@ -15,15 +15,12 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-
 #ifndef __WindParticle2D_hpp__
 #define __WindParticle2D_hpp__
 
-
 #include "Particle2D.hpp"
 #include "fXYZ.hpp"
 
-
 // WindParticle2D
 //--------------------------------------------------------------------------
 class WindParticle2D : public Particle2D
@@ -35,7 +32,6 @@
        WindParticle2D(const fXYZ &pos, float windScale = 1.0f); // Used to 
increase or decrease wind. (Maybe depending on elevation.)
 
        virtual void sim();
-
 }; // end WindParticle2D
 
 #endif // __WindParticle2D_hpp__
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.29 
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.30
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.29     Mon Sep  8 
18:50:28 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp  Tue Sep  9 12:21:07 2003
@@ -1649,7 +1649,7 @@
   //winsock hack
   //JoinSession( gapp.hwndApp );
   //InitStreamClient(gapp.hwndApp);
-  CLIENT->joinSession("kiff.local");
+  CLIENT->joinSession("127.0.0.1");
   
   // XXX how should that work? we can't process (network) events while waiting
 #if 0




reply via email to

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