00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __WORLD_H
00014 #define __WORLD_H
00015
00016 #include <iostream>
00017 #include <fstream>
00018 #include <string>
00019 #include <vector>
00020 #include "building.h"
00021 #include "tile.h"
00022 #include "player.h"
00023 #include "tool.h"
00024 #include "util.h"
00025
00026 using namespace std;
00027
00028
00032 class World {
00033 public:
00034
00035 World(string const & name, char color=0,
00036 unsigned h=100, unsigned w=100, int cPlayer=0);
00037 ~World();
00038
00039 vector<Tile>& getMap();
00040 Player& getCurrentPlayer();
00041 unsigned getCurrentPlayerIndex() const;
00042 int getHeight() const;
00043 int getWidth() const;
00044 unsigned getNumPlayers() const;
00045 int getNumBuildings() const;
00046 int getTemperature() const;
00047 Tile& getTile(unsigned x, unsigned y);
00048
00057 Tile& getTileFromPixel(int x, int y);
00058 Player& getPlayer(unsigned i);
00059 void setTemperature(unsigned t);
00060 bool parseMap(string & file);
00061 bool playerExists(unsigned index) const;
00062 void addPlayer(const Player& p);
00063 void addPlayer(unsigned id, string name, int race, char color);
00064
00072 void setCurrentPlayer(unsigned p);
00073
00074 char* resource2string(Resource r);
00075 private:
00076 unsigned currentPlayer;
00077 unsigned height;
00078 unsigned width;
00079 int temperature;
00080
00081 vector<Tile> map;
00082 vector<Player> players;
00083 vector<Tool> tools;
00084 vector<Building> buildings;
00085 Tile nullTile;
00086 };
00087
00088 #endif