From b0d28814ecdd29d3f33ab926b3ff3c325675e3b2 Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Tue, 31 Jan 2006 02:55:26 +0000 Subject: Various small cleanups. --- src/floor_item.cpp | 8 +++++-- src/graphics.h | 2 -- src/gui/login.cpp | 1 - src/gui/scrollarea.cpp | 3 +-- src/gui/windowcontainer.cpp | 1 - src/map.cpp | 32 +++++++++++++++---------- src/map.h | 52 ++++++++++++---------------------------- src/properties.h | 2 +- src/resources/sdlimageloader.cpp | 1 - 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 + +#include "map.h" + #include "graphic/spriteset.h" + #include "resources/itemmanager.h" #include "resources/iteminfo.h" -#include - extern Spriteset *itemset; typedef std::list 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 -#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 -#include #include 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 #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), diff --git a/src/map.h b/src/map.h index 95144695..35e3d75f 100644 --- a/src/map.h +++ b/src/map.h @@ -25,8 +25,8 @@ #define _TMW_MAP_H_ #include -#include #include + #include "properties.h" class Graphics; @@ -44,42 +44,21 @@ typedef std::list 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 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 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 #include #include 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 -- cgit v1.2.3-70-g09d2