summaryrefslogtreecommitdiff
path: root/src/state.h
diff options
context:
space:
mode:
authorAaron Marks <nymacro@gmail.com>2005-11-15 11:41:17 +0000
committerAaron Marks <nymacro@gmail.com>2005-11-15 11:41:17 +0000
commit3d5bcc32ea4ac19e8da7bcf4a59443f3a013ba6d (patch)
treeff833024b07a36587d02cc8c10b59cda50229bab /src/state.h
parent9c4f838ef2e9b801a08c3550647aff4efcbb1ebd (diff)
downloadmanaserv-3d5bcc32ea4ac19e8da7bcf4a59443f3a013ba6d.tar.gz
manaserv-3d5bcc32ea4ac19e8da7bcf4a59443f3a013ba6d.tar.bz2
manaserv-3d5bcc32ea4ac19e8da7bcf4a59443f3a013ba6d.tar.xz
manaserv-3d5bcc32ea4ac19e8da7bcf4a59443f3a013ba6d.zip
Updated bindings, game state class and more (see ChangeLog).
Diffstat (limited to 'src/state.h')
-rw-r--r--src/state.h96
1 files changed, 76 insertions, 20 deletions
diff --git a/src/state.h b/src/state.h
index 21bb7566..4d1c9a37 100644
--- a/src/state.h
+++ b/src/state.h
@@ -36,7 +36,7 @@ namespace tmwserv
/**
* State class contains all information/procedures associated with the game
- * state.
+ * world's state.
*/
class State : public utils::Singleton<State>
{
@@ -45,36 +45,92 @@ class State : public utils::Singleton<State>
State() throw() { }
~State() throw() { }
+ /**
+ * Combined map/entity structure
+ */
+ struct MapComposite {
+ /**
+ * Default constructor
+ */
+ MapComposite() : map(NULL) { }
+
+ /**
+ * Actual map
+ */
+ Map *map;
+
+ /**
+ * Beings located on the map
+ */
+ Beings beings;
+
+ /**
+ * Items located on the map
+ */
+ std::vector<Object*> objects;
+ };
+
+ /**
+ * List of maps
+ */
+ std::map<std::string, MapComposite> maps;
+
public:
+
/**
- * Beings on map
- *
- * The key/value pair conforms to:
- * First - map name
- * Second - list of beings/players on the map
- *
- * NOTE: This could possibly be optimized by making first Being & second string. This will make many operations easier.
+ * Update game state (contains core server logic)
*/
- std::map<std::string, Beings> beings;
+ void update(ConnectionHandler &);
/**
- * Items on map
- *
- * The key/value pair conforms to:
- * First - map name
- * Second - Item ID
+ * Add being to game world at specified map
*/
- std::map<std::string, int> items;
+ void addBeing(Being *being, const std::string &map);
/**
- * Container for loaded maps.
+ * Remove being from game world
*/
- std::map<std::string, Map*> maps;
-
+ void removeBeing(Being *being);
+
/**
- * Update game state (contains core server logic)
+ * Check to see if a map exists in game world
*/
- void update(ConnectionHandler &);
+ bool mapExists(const std::string &map);
+
+ /**
+ * Check if being exists in game world already
+ */
+ bool beingExists(Being *being);
+
+ /**
+ * Load map into game world
+ */
+ void loadMap(const std::string &map);
+
+ /**
+ * Add object to the map
+ */
+ void addObject(Object *object, const std::string &map);
+
+ /**
+ * Remove an object from the map
+ */
+ void removeObject(Object *object);
+
+ /**
+ * Find out whether an object exists in the game world or not
+ */
+ bool objectExists(Object *object);
+
+ /**
+ * Find map player in world is on
+ */
+ const std::string findPlayer(Being *being);
+
+ /**
+ * Find map object in world is on
+ */
+ const std::string findObject(Object *object);
};
} // namespace tmwserv