diff options
author | Aaron Marks <nymacro@gmail.com> | 2005-07-31 05:26:08 +0000 |
---|---|---|
committer | Aaron Marks <nymacro@gmail.com> | 2005-07-31 05:26:08 +0000 |
commit | 18b778662388e98e90b13f28f28a83911ee96e95 (patch) | |
tree | 5e16ba5adc9cdc3d4f84769e0a4e93ff7155c7a0 /src/state.h | |
parent | d593cb2395ddc144844297ea12122c12e60d3bba (diff) | |
download | manaserv-18b778662388e98e90b13f28f28a83911ee96e95.tar.gz manaserv-18b778662388e98e90b13f28f28a83911ee96e95.tar.bz2 manaserv-18b778662388e98e90b13f28f28a83911ee96e95.tar.xz manaserv-18b778662388e98e90b13f28f28a83911ee96e95.zip |
Added beginnings of game core logic and state.
Fixed a few problems with SQL queries using different SQL DB backends.
I forget everything else.
Diffstat (limited to 'src/state.h')
-rw-r--r-- | src/state.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/state.h b/src/state.h new file mode 100644 index 00000000..31142d11 --- /dev/null +++ b/src/state.h @@ -0,0 +1,71 @@ +/* + * The Mana World Server + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_SERVER_STATE_ +#define _TMW_SERVER_STATE_ + +#include <string> +#include <map> +#include "connectionhandler.h" +#include "being.h" +#include "map.h" +#include "utils/singleton.h" + +namespace tmwserv +{ + +/** + * State class contains all information/procedures associated with the game + * state. + */ +class State : public utils::Singleton<State> +{ + friend class utils::Singleton<State>; + + State() throw() { } + ~State() throw() { } + + public: + /** + * 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. + */ + std::map<std::string, Beings> beings; + + /** + * Container for loaded maps. + */ + std::map<std::string, Map*> maps; + + /** + * Update game state (contains core server logic) + */ + void update(ConnectionHandler &); +}; + +} // namespace tmwserv + +#endif |