[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3716 - trunk/pingus/src
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3716 - trunk/pingus/src |
Date: |
Mon, 7 Jul 2008 11:19:22 +0200 |
Author: grumbel
Date: 2008-07-07 11:19:21 +0200 (Mon, 07 Jul 2008)
New Revision: 3716
Modified:
trunk/pingus/src/ground_map.cpp
trunk/pingus/src/ground_map.hpp
trunk/pingus/src/world.cpp
trunk/pingus/src/world.hpp
Log:
Tweaked GroundMap constructor to get width/height instead of PingusLevel
Modified: trunk/pingus/src/ground_map.cpp
===================================================================
--- trunk/pingus/src/ground_map.cpp 2008-07-07 09:09:43 UTC (rev 3715)
+++ trunk/pingus/src/ground_map.cpp 2008-07-07 09:19:21 UTC (rev 3716)
@@ -80,37 +80,27 @@
sprite = Sprite(surface);
}
-GroundMap::GroundMap(const PingusLevel& plf)
+GroundMap::GroundMap(int width_, int height_)
+ : width(width_), height(height_)
{
- width = plf.get_size().width;
- height = plf.get_size().height;
-
colmap = new CollisionMap(width, height);
+ tile_width = width /tile_size;
+ tile_height = height/tile_size;
+
// Checking that the map has the correct size, only multiples of
// tile_size are allowed, anything else wouldn't fit very well on
// the colmap
if ((width % tile_size) != 0)
- {
- width += (tile_size - (width % tile_size));
- }
+ tile_width += 1;
if ((height % tile_size) != 0)
- {
- height += (tile_size - (height % tile_size));
- }
+ tile_height += 1;
- tile_width = width/tile_size;
- tile_height = height/tile_size;
-
// Allocating tile map
tiles.resize(tile_width * tile_height);
for(std::vector<MapTile*>::iterator i = tiles.begin(); i != tiles.end(); ++i)
*i = new MapTile();
-
- // fix the height back to the correct values
- width = plf.get_size().width;
- height = plf.get_size().height;
}
GroundMap::~GroundMap(void)
Modified: trunk/pingus/src/ground_map.hpp
===================================================================
--- trunk/pingus/src/ground_map.hpp 2008-07-07 09:09:43 UTC (rev 3715)
+++ trunk/pingus/src/ground_map.hpp 2008-07-07 09:19:21 UTC (rev 3716)
@@ -24,7 +24,6 @@
#include "surface.hpp"
class SceneContext;
-class PingusLevel;
class CollisionMap;
class GroundMap;
class MapTile;
@@ -50,7 +49,7 @@
int tile_height;
public:
- GroundMap(const PingusLevel& arg_plf);
+ GroundMap(int width, int height);
virtual ~GroundMap();
void draw(SceneContext& gc);
Modified: trunk/pingus/src/world.cpp
===================================================================
--- trunk/pingus/src/world.cpp 2008-07-07 09:09:43 UTC (rev 3715)
+++ trunk/pingus/src/world.cpp 2008-07-07 09:19:21 UTC (rev 3716)
@@ -36,7 +36,7 @@
#include "debug.hpp"
using Actions::Bomber;
-
+
static
bool WorldObj_less (WorldObj* a, WorldObj* b)
{
@@ -45,7 +45,7 @@
World::World(const PingusLevel& plf)
: ambient_light(Color(plf.get_ambient_light())),
- gfx_map(new GroundMap(plf)),
+ gfx_map(new GroundMap(plf.get_size().width, plf.get_size().height)),
game_time(0),
do_armageddon(false),
pingus(new PinguHolder(plf)),
@@ -322,5 +322,5 @@
return pos;
}
-
+
/* EOF */
Modified: trunk/pingus/src/world.hpp
===================================================================
--- trunk/pingus/src/world.hpp 2008-07-07 09:09:43 UTC (rev 3715)
+++ trunk/pingus/src/world.hpp 2008-07-07 09:19:21 UTC (rev 3716)
@@ -51,7 +51,7 @@
class SmokeParticleHolder;
class SnowParticleHolder;
}
-
+
/** The World holds all objects of the pingu enviroment.
It holds the pingus, traps, exits, entrances, etc.. It keeps
@@ -173,8 +173,7 @@
World (const World&);
World& operator= (const World&);
};
-
-
+
#endif
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3716 - trunk/pingus/src,
grumbel at BerliOS <=