diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-01-31 02:55:26 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-01-31 02:55:26 +0000 |
commit | b0d28814ecdd29d3f33ab926b3ff3c325675e3b2 (patch) | |
tree | 57878c3e9900db640a34df7c319dbd930c18ab24 /src | |
parent | 3b1cb45812fe4308073057c27837bc0c69a5d35e (diff) | |
download | mana-b0d28814ecdd29d3f33ab926b3ff3c325675e3b2.tar.gz mana-b0d28814ecdd29d3f33ab926b3ff3c325675e3b2.tar.bz2 mana-b0d28814ecdd29d3f33ab926b3ff3c325675e3b2.tar.xz mana-b0d28814ecdd29d3f33ab926b3ff3c325675e3b2.zip |
Various small cleanups.
Diffstat (limited to 'src')
-rwxr-xr-x | src/floor_item.cpp | 8 | ||||
-rw-r--r-- | src/graphics.h | 2 | ||||
-rw-r--r-- | src/gui/login.cpp | 1 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 3 | ||||
-rw-r--r-- | src/gui/windowcontainer.cpp | 1 | ||||
-rw-r--r-- | src/map.cpp | 32 | ||||
-rw-r--r-- | src/map.h | 52 | ||||
-rw-r--r-- | src/properties.h | 2 | ||||
-rw-r--r-- | src/resources/sdlimageloader.cpp | 1 | ||||
-rw-r--r-- | src/sprite.h | 6 |
10 files changed, 42 insertions, 66 deletions
diff --git a/src/floor_item.cpp b/src/floor_item.cpp index 4f2b84b3..66adcd9b 100755 --- a/src/floor_item.cpp +++ b/src/floor_item.cpp @@ -22,12 +22,16 @@ */ #include "floor_item.h" + +#include <list> + +#include "map.h" + #include "graphic/spriteset.h" + #include "resources/itemmanager.h" #include "resources/iteminfo.h" -#include <list> - extern Spriteset *itemset; typedef std::list<FloorItem*> FloorItems; diff --git a/src/graphics.h b/src/graphics.h index 6a69a7ef..3c060e97 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -26,8 +26,6 @@ #include <guichan/sdl/sdlgraphics.hpp> -#include "guichanfwd.h" - class Image; class ImageRect; diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 696e4c6f..836c1c14 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -24,7 +24,6 @@ #include "login.h" #include <string> -#include <sstream> #include <guichan/widgets/label.hpp> diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index d1873cb5..7f39b5a8 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -199,7 +199,6 @@ void ScrollArea::draw(gcn::Graphics *graphics) if (mContent) { - gcn::Rectangle contdim = mContent->getDimension(); graphics->pushClipArea(getContentDimension()); if (mContent->getBorderSize() > 0) @@ -214,7 +213,7 @@ void ScrollArea::draw(gcn::Graphics *graphics) graphics->popClipArea(); } - graphics->pushClipArea(contdim); + graphics->pushClipArea(mContent->getDimension()); mContent->draw(graphics); graphics->popClipArea(); graphics->popClipArea(); diff --git a/src/gui/windowcontainer.cpp b/src/gui/windowcontainer.cpp index c42d5ccf..b79e39de 100644 --- a/src/gui/windowcontainer.cpp +++ b/src/gui/windowcontainer.cpp @@ -21,7 +21,6 @@ * $Id$ */ -#include <iostream> #include "windowcontainer.h" WindowContainer::WindowContainer() diff --git a/src/map.cpp b/src/map.cpp index 248c07d0..d249426a 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -33,21 +33,27 @@ #include "resources/image.h" -MetaTile::MetaTile(): - whichList(0) -{ -} - - -Location::Location(int iX, int iY, MetaTile *iTile): - x(iX), y(iY), tile(iTile) +/** + * A location on a tile map. Used for pathfinding, open list. + */ +struct Location { -} + /** + * Constructor. + */ + Location(int px, int py, MetaTile *ptile):x(px),y(py),tile(ptile) {}; + + /** + * Comparison operator. + */ + bool operator< (const Location &loc) const + { + return tile->Fcost > loc.tile->Fcost; + } -bool Location::operator< (const Location &loc) const -{ - return tile->Fcost > loc.tile->Fcost; -} + int x, y; + MetaTile *tile; +}; Map::Map(int width, int height, int tileWidth, int tileHeight): mWidth(width), mHeight(height), @@ -25,8 +25,8 @@ #define _TMW_MAP_H_ #include <list> -#include <map> #include <vector> + #include "properties.h" class Graphics; @@ -44,42 +44,21 @@ typedef std::list<Sprite*> Sprites; * This is information that doesn't need to be repeated for each tile in each * layer of the map. */ -class MetaTile -{ - public: - /** - * Constructor. - */ - MetaTile(); - - // Pathfinding members - int Fcost; /**< Estimation of total path cost */ - int Gcost; /**< Cost from start to this location */ - int Hcost; /**< Estimated cost to goal */ - int whichList; /**< No list, open list or closed list */ - int parentX; /**< X coordinate of parent tile */ - int parentY; /**< Y coordinate of parent tile */ - bool walkable; /**< Can beings walk on this tile */ -}; - -/** - * A location on a tile map. Used for pathfinding, open list. - */ -class Location +struct MetaTile { - public: - /** - * Constructor. - */ - Location(int x, int y, MetaTile *tile); - - /** - * Comparison operator. - */ - bool operator< (const Location &loc) const; - - int x, y; - MetaTile *tile; + /** + * Constructor. + */ + MetaTile():whichList(0) {}; + + // Pathfinding members + int Fcost; /**< Estimation of total path cost */ + int Gcost; /**< Cost from start to this location */ + int Hcost; /**< Estimated cost to goal */ + int whichList; /**< No list, open list or closed list */ + int parentX; /**< X coordinate of parent tile */ + int parentY; /**< Y coordinate of parent tile */ + bool walkable; /**< Can beings walk on this tile */ }; /** @@ -211,7 +190,6 @@ class Map : public Properties int mTileWidth, mTileHeight; MetaTile *metaTiles; Image **tiles; - std::map<std::string,std::string> properties; Tilesets tilesets; Sprites mSprites; diff --git a/src/properties.h b/src/properties.h index ccf8cd00..18caa6e1 100644 --- a/src/properties.h +++ b/src/properties.h @@ -77,7 +77,7 @@ class Properties properties[name] = value; } - private: + protected: std::map<std::string, std::string> properties; }; diff --git a/src/resources/sdlimageloader.cpp b/src/resources/sdlimageloader.cpp index 42bbf1ca..88c4143e 100644 --- a/src/resources/sdlimageloader.cpp +++ b/src/resources/sdlimageloader.cpp @@ -23,7 +23,6 @@ #include "sdlimageloader.h" -#include <iostream> #include <string> #include <SDL_image.h> diff --git a/src/sprite.h b/src/sprite.h index 2950f4e8..282091cc 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -54,12 +54,6 @@ class Sprite */ virtual int getPixelY() const = 0; - - protected: - /** - * Constructor. - */ - Sprite() {} }; #endif |