diff options
-rw-r--r-- | ChangeLog | 236 | ||||
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/game-server/being.hpp | 2 | ||||
-rw-r--r-- | src/game-server/movingobject.cpp (renamed from src/game-server/object.cpp) | 2 | ||||
-rw-r--r-- | src/game-server/movingobject.hpp | 134 | ||||
-rw-r--r-- | src/game-server/object.hpp | 198 | ||||
-rw-r--r-- | src/game-server/thing.hpp | 113 | ||||
-rw-r--r-- | src/game-server/trigger.cpp | 4 | ||||
-rw-r--r-- | src/game-server/trigger.hpp | 12 |
9 files changed, 397 insertions, 310 deletions
@@ -1,9 +1,18 @@ +2007-03-30 Bjørn Lindeijer <bjorn@lindeijer.nl> + + * src/Makefile.am, src/game-server/thing.hpp, + src/game-server/movingobject.cpp, src/game-server/being.hpp, + src/game-server/movingobject.hpp, src/game-server/trigger.cpp, + src/game-server/object.cpp, src/game-server/trigger.hpp, + src/game-server/object.hpp: Separated the Thing and MovingObject + classes from the Object module. + 2007-03-30 Philipp Sehmisch <tmw@crushnet.org> * src/controller.cpp, src/controller.h, src/game-server/monster.cpp, - src/game-server/monster.hpp, src/game-server/testing.cpp, src/Makefile.am: - Renamed "Controlled" to "Monster" and moved it into the game-server - directory. + src/game-server/monster.hpp, src/game-server/testing.cpp, + src/Makefile.am: Renamed "Controlled" to "Monster" and moved it into + the game-server directory. 2007-03-23 Eugenio Favalli <elvenprogrammer@gmail.com> @@ -36,8 +45,8 @@ * src/account-server/accounthandler.cpp, src/defines.h: Removed check for difference between lowest and highest attribute at char creation. - * src/account-server/dalstorage.cpp, src/account-server/dalstorage.hpp: - Unified order of basic attributes. + * src/account-server/dalstorage.cpp, + src/account-server/dalstorage.hpp: Unified order of basic attributes. 2007-03-20 Rogier Polak <rogier.l.a.polak@gmail.com> @@ -190,7 +199,8 @@ src/gameserver/gamehandler.cpp, src/gameserver/object.hpp, src/gameserver/player.cpp, src/gameserver/player.hpp, src/gameserver/state.cpp, src/gameserver/testing.cpp, - src/point.h: Implemented being death, removal of dead mobs and sitting. + src/point.h: Implemented being death, removal of dead mobs and + sitting. 2007-03-01 Bjørn Lindeijer <bjorn@lindeijer.nl> @@ -288,9 +298,9 @@ 2007-01-05 Guillaume Melquiond <guillaume.melquiond@gmail.com> - * src/game-server/player.cpp, src/game-server/state.cpp: Delayed update - of persistent position and put it into state handling, so that the - update happens before map change. + * src/game-server/player.cpp, src/game-server/state.cpp: Delayed + update of persistent position and put it into state handling, so that + the update happens before map change. * src/game-server/item.hpp: Added an amount property to items lying on the ground. * src/game-server/testing.cpp: Added a piece of equipment. @@ -330,9 +340,9 @@ src/game-server/accountconnection.cpp: Simplified by relying on the serialization functionality of PlayerData. * src/game-server/inventory.hpp, src/game-server/inventory.cpp: - Transformed Inventory into a strict helper class, as data are now stored - inside PlayerData. Reduced memory footprint of inventory by avoiding - storing empty slots. + Transformed Inventory into a strict helper class, as data are now + stored inside PlayerData. Reduced memory footprint of inventory by + avoiding storing empty slots. * src/game-server/player.hpp, src/game-server/player.cpp, src/game-server/gamehandler.cpp: Updated accordingly. * src/net/messagein.hpp, src/net/messagein.cpp: Removed signedness @@ -408,8 +418,8 @@ * configure.ac, src/Makefile.am, src/tests, src/client.cpp: Removed obsolete tests and text client. * src/game-server/mapcomposite.hpp, src/game-server/mapcomposite.cpp, - src/point.h: Removed implicit radius for checking range of Point. Added - a Rectangle class. Added support for rectangles in MapComposite. + src/point.h: Removed implicit radius for checking range of Point. + Added a Rectangle class. Added support for rectangles in MapComposite. * src/object.h, src/defines.h, src/game-server/mapcomposite.hpp, src/game-server/mapcomposite.cpp, src/game-server/state.hpp, src/game-server/state.cpp: Put an ancestor for Object that are not @@ -437,9 +447,9 @@ 2006-12-31 Guillaume Melquiond <guillaume.melquiond@gmail.com> - * src/account-server/dalstorage.hpp, src/account-server/dalstorage.cpp, - src/account-server/storage.hpp: Added function to query a character in - the database. + * src/account-server/dalstorage.hpp, + src/account-server/dalstorage.cpp, src/account-server/storage.hpp: + Added function to query a character in the database. * src/account-server/serverhandler.cpp: Finished implementation for warping players around servers. @@ -450,8 +460,9 @@ * src/Makefile.am: Updated accordingly. * src/object.h, src/being.h: Changed definition of directions. * src/being.cpp: Relied on MapComposite iterators to scan only beings - in the vincinity one time instead of all objects of the map four times. - Used a pixel-based zone instead of tile-based zone for damaging. + in the vincinity one time instead of all objects of the map four + times. Used a pixel-based zone instead of tile-based zone for + damaging. * src/player.cpp: Removed useless dependency. * src/game-server/mapcomposite.hpp, src/game-server/mapcomposite.cpp: Added a radius parameter to iterator creators. Removed unused and @@ -460,8 +471,9 @@ function into updateMap and informPlayer. Simplified code a bit. * src/game-server/mapcomposite.hpp, src/game-server/mapcomposite.cpp, src/object.h, src/game-server/state.hpp, src/game-server/state.cpp, - src/game-server/accountconnection.cpp, src/game-server/gamehandler.cpp: - Removed reference-counted pointers on Object. + src/game-server/accountconnection.cpp, + src/game-server/gamehandler.cpp: Removed reference-counted pointers on + Object. * src/game-server/gameclient.hpp, src/game-server/gameclient.cpp, src/player.h, src/game-server/gamehandler.cpp, src/Makefile.am: Embedded a simplified version of GameClient into GameHandler. Removed @@ -474,10 +486,12 @@ when warped. * src/defines.h, src/game-server/state.hpp, src/game-server/state.cpp, src/account-server/serverhandler.cpp, src/game-server/gamehandler.hpp, - src/game-server/gamehandler.cpp, src/game-server/accountconnection.hpp, + src/game-server/gamehandler.cpp, + src/game-server/accountconnection.hpp, src/game-server/accountconnection.cpp: Added a queue for delaying - intrusive events until update is finished. Partially implemented server - communications to update player data and to warp players around. + intrusive events until update is finished. Partially implemented + server communications to update player data and to warp players + around. 2006-12-29 Guillaume Melquiond <guillaume.melquiond@gmail.com> @@ -494,12 +508,12 @@ src/gameclient.cpp, src/mapmanager.h, src/mapmanager.cpp: Moved to src/game-server directory and changed header extension to hpp. * src/messagein.h, src/messagein.cpp, src/messageout.h, - src/messageout.cpp, src/connectionhandler.h, src/connectionhandler.cpp, - src/netcomputer.h, src/netcomputer.cpp: Moved to src/net directory and - changed header extension to hpp. + src/messageout.cpp, src/connectionhandler.h, + src/connectionhandler.cpp, src/netcomputer.h, src/netcomputer.cpp: + Moved to src/net directory and changed header extension to hpp. * src/controller.h, src/controller.cpp, src/game-server/state.cpp, - src/being.cpp, src/being.h: Removed knowledge of Controller in Being by - deriving a Controlled Being. + src/being.cpp, src/being.h: Removed knowledge of Controller in Being + by deriving a Controlled Being. * src/game-server/state.cpp, src/game-server/mapmanager.cpp, src/game-server/mapmanager.hpp, src/object.cpp: Simplified by removing Singleton pattern. @@ -522,8 +536,8 @@ * src/player.cpp, src/game-server/gamehandler.cpp: Commented out the currently unused inventory interface. * src/net/messagein.hpp: Updated from tmwclient to add getUnreadLength. - * src/net/connectionhandler.hpp, src/net/connectionhandler.cpp: Removed - unused ClientData class. + * src/net/connectionhandler.hpp, src/net/connectionhandler.cpp: + Removed unused ClientData class. * src/inventory.h: Removed "at" accessors, as nobody is ready to catch exceptions. Removed unneeded dependency and unused pointer. * src/net/netcomputer.hpp: Fixed typos. @@ -545,9 +559,9 @@ 2006-12-29 Philipp Sehmisch <tmw@crushnet.org> * src/being.cpp, src/being.h, src/defines.h, src/gamehandler.cpp, - src/mapcomposite.cpp, src/mapcomposite.h, src/object.h, src/player.cpp, - src/player.h, src/state.cpp: Implemented basic attack hit detection and - damage notification. + src/mapcomposite.cpp, src/mapcomposite.h, src/object.h, + src/player.cpp, src/player.h, src/state.cpp: Implemented basic attack + hit detection and damage notification. 2006-12-27 Philipp Sehmisch <tmw@crushnet.org> @@ -628,8 +642,8 @@ messages. Changed default buffer size of outgoing packets. * src/src/accounthandler.cpp, src/point.h, src/object.cpp, src/controller.cpp, src/dalstorage.cpp, src/object.h, src/state.cpp, - src/gamehandler.cpp: Made Point a POD type. Simplified server algorithm - for moving objects; it now matches the one in the client. + src/gamehandler.cpp: Made Point a POD type. Simplified server + algorithm for moving objects; it now matches the one in the client. * src/gameclient.cpp, src/player.h, src/gamehandler.cpp: Added GameClient pointer to Player class for O(1) message sending. * src/mapcomposite.h, src/mapcomposite.cpp, src/Makefile.am: Moved @@ -762,8 +776,8 @@ * tmwserv.cbp, tmwserv.dev: Updated project files. * src/accounthandler.cpp, src/connectionhandler.cpp, - src/dalstorage.cpp, src/defines.h: Changed character list to a sequence - of packets and fixed a db issue. + src/dalstorage.cpp, src/defines.h: Changed character list to a + sequence of packets and fixed a db issue. 2006-08-11 Bjørn Lindeijer <bjorn@lindeijer.nl> @@ -779,8 +793,8 @@ constness. Added a proximity tester. Moved path node structure. * src/accounthandler.cpp: Modified logging. Prevented empty packets from being sent and killing ENet. Set destination to current position. - * src/defines.h, src/gamehandler.cpp, src/client.cpp: Added support for - move messages. Changed sayAround to pixel distance. + * src/defines.h, src/gamehandler.cpp, src/client.cpp: Added support + for move messages. Changed sayAround to pixel distance. * src/object.cpp, src.object.h, src/state.cpp: Implemented being movements. @@ -804,17 +818,18 @@ * src/state.cpp: Used Player ID. * src/dal/recordset.cpp: Removed redundant checks. * src/dalstorage.cpp, src/dalstorage.h, src/storage.h: Prevented - database failure from allowing already existing character name or email - address. + database failure from allowing already existing character name or + email address. * src/accounthandler.cpp: Fixed control for changing email address. 2006-08-03 Guillaume Melquiond <guillaume.melquiond@gmail.com> * src/storage.h, src/dalstorage.h, src/dalstorage.cpp: Removed AccountInfo. Restricted addAccount to accounts without characters, - removed wrong SQL code. Fixed casting in updAccount, promoted member as - flush. Added implicit flush to addAccount and delAccount. Fixed user_id - for every SQL backend. Added flushAll and unloadAccount members. + removed wrong SQL code. Fixed casting in updAccount, promoted member + as flush. Added implicit flush to addAccount and delAccount. Fixed + user_id for every SQL backend. Added flushAll and unloadAccount + members. * src/accounthandler.cpp: Restricted flush to only modified accounts. * src/account.h, src/account.cpp: Added the database primary key to Account. @@ -860,8 +875,8 @@ 2006-07-27 Eugenio Favalli <elvenprogrammer@gmail.com> * tmwserv.cbp, tmwserv.dev: Updated project files. - * src/accounthandler.cpp, src/client.cpp: Modified client version to be - an int. + * src/accounthandler.cpp, src/client.cpp: Modified client version to + be an int. * src/accounthandler.cpp, src/defines.h: Client version is being sent also during registration. @@ -883,8 +898,9 @@ * src/accounthandler.cpp, src/account.cpp, src/object.cpp, src/storage.h, src/dalstorage.cpp, src/account.h, src/object.h, src/gamehandler.h, src/state.cpp, src/being.cpp, src/gamehandler.cpp, - src/state.h, src/being.h: Removed tmwserv namespace. Added MovingObject - and Player classes. Removed exhaustive statistic accessors. + src/state.h, src/being.h: Removed tmwserv namespace. Added + MovingObject and Player classes. Removed exhaustive statistic + accessors. 2006-07-26 Eugenio Favalli <elvenprogrammer@gmail.com> @@ -913,14 +929,15 @@ * src/chatchannelmanager.cpp, src/chatchannelmanager.h: Removed unwarranted constness. Used binary searches instead of loops. - * src/chatchannel.cpp, src/chatchannel.h: Replaced usage of whole Being - by character name. + * src/chatchannel.cpp, src/chatchannel.h: Replaced usage of whole + Being by character name. * src/client.cpp: Implemented client-side server split. * src/messagehandler.cpp, src/messagehandler.h, src/Makefile.am: Removed unused MessageHandler class. * src/accounthandler.cpp, src/accounthandler.h, src/chathandler.cpp, - src/chathandler.h, src/gamehandler.cpp, src/gamehandler.h: Respectively - changed into an account server, a chat server, and a game server. + src/chathandler.h, src/gamehandler.cpp, src/gamehandler.h: + Respectively changed into an account server, a chat server, and a game + server. * src/main.cpp, src/state.cpp, src/state.h, src/defines.h: Small fixes to cope with server split. * src/connectionhandler.cpp, src/connectionhandler.h, @@ -1187,13 +1204,13 @@ * src/connectionhandler.h, src.connectionhandler.cpp, src/client.cpp, src/accounthandler.cpp, src/defines.h: Added a check if the maximum - number of client is already logged in at login attempt. Added a default - behaviour in protocol. Some cleanups. + number of client is already logged in at login attempt. Added a + default behaviour in protocol. Some cleanups. * src/client.cpp, src/storage.h, src/dalstorage.cpp, src/dalstorage.h, src/main.cpp, src/defines.h, src/accounthandler.cpp, src/Makefile.am: Implemented server response handling to the test client. Fixed a bug - that made the Email change not possible. Changed some protocol value to - have a litte neater client code. Added FreeBSD fix idea from icy to + that made the Email change not possible. Changed some protocol value + to have a litte neater client code. Added FreeBSD fix idea from icy to server code. 2005-12-31 Yohann Ferreira <bertram@cegetel.net> @@ -1240,11 +1257,11 @@ * src/chathandler.h, src/chathandler.cpp, src/defines.h, src/utils/slangsfilter.h, src/utils/slangsfilter.cpp, src/Makefile.am, src/main.cpp, src/accounthandler.cpp, - src/connectionhandler.h, src/connectionhandler.cpp: Implemented - common chat handling, except for chatting in channels. Also the - Channel registering/unregistering isn't there yet and the commands - needs to be implemented. Added a small slangs filter to reduce bad - words in account names and in conversations a little. + src/connectionhandler.h, src/connectionhandler.cpp: Implemented common + chat handling, except for chatting in channels. Also the Channel + registering/unregistering isn't there yet and the commands needs to be + implemented. Added a small slangs filter to reduce bad words in + account names and in conversations a little. 2005-12-26 Bjørn Lindeijer <bjorn@lindeijer.nl> @@ -1273,10 +1290,10 @@ * src/accounthandler.cpp, src/netcomputer.h, src/netcomputer.cpp, src/chathandler.cpp, src/connectionhandler.cpp, src/gamehandler.cpp, src/connectionhandler.h, src/state.h, - src/state.cpp: Made the handlers use the countedPtr for Beings - as they should. Fixed a segfault when removing a being from the - world. Also made use of AccountPtr instead of Account* to fix a - not seen but yet present account reselection segfault bug. + src/state.cpp: Made the handlers use the countedPtr for Beings as they + should. Fixed a segfault when removing a being from the world. Also + made use of AccountPtr instead of Account* to fix a not seen but yet + present account reselection segfault bug. 2005-12-17 Bjorn Steinbrink <B.Steinbrink@gmx.de> @@ -1287,78 +1304,74 @@ * src/accounthandler.cpp, src/netcomputer.h, src/netcomputer.cpp, src/defines.h, src/dalstorage.cpp, src/dalstorage.h, src/storage.h, src/client.cpp, src/main.cpp: - Now beings are handled in netcomputer when added and removed - from the world. addBeing() and removeBeing() are still crashy. - Added check if the character's name already exists. Forgot about - that. Added CMSG_CHAR_LIST packet support. + Now beings are handled in netcomputer when added and removed from the + world. addBeing() and removeBeing() are still crashy. Added check if + the character's name already exists. Forgot about that. Added + CMSG_CHAR_LIST packet support. 2005-12-11 Yohann Ferreira <bertram@cegetel.net> * src/accounthandler.cpp, src/main.cpp, src/account.h, src/account.cpp, src/dalstorage.cpp, src/client.cpp, - src/defines.h: Added Logout, and character deletion support. - Also changed the response code when trying to login when already - logged. + src/defines.h: Added Logout, and character deletion support. Also + changed the response code when trying to login when already logged. * src/accounthandler.cpp, src/main.cpp, src/dalstorage.cpp, src/client.cpp, src/connectionhandler.cpp, src/defines.h: - Added unregistering, checking on character's name and email - length support. Also made some little tweaks. + Added unregistering, checking on character's name and email length + support. Also made some little tweaks. 2005-12-10 Yohann Ferreira <bertram@cegetel.net> - * src/dalstorage.cpp: Fixed the buggy part of getAccount() - where the mapInfo() recordSet erased the value of charInfo. - Now, characters can be created and selected, with the map - they were in, set. + * src/dalstorage.cpp: Fixed the buggy part of getAccount() where the + mapInfo() recordSet erased the value of charInfo. Now, characters can + be created and selected, with the map they were in, set. 2005-12-09 Yohann Ferreira <bertram@cegetel.net> - * src/dalstorage.cpp, src/accounthandler.cpp: Temporary - made a workaround the character misloading at login. - Work is to be made to see why the mapInfo recordset is - buggy. Also made the server more verbose about characters. + * src/dalstorage.cpp, src/accounthandler.cpp: Temporary made a + workaround the character misloading at login. Work is to be made to + see why the mapInfo recordset is buggy. Also made the server more + verbose about characters. 2005-12-08 Yohann Ferreira <bertram@cegetel.net> - * src/dalstorage.cpp, src/dalstorage.h, src/storage.h: - Radically improve the getEmailList() again based on - MrLindeijer's good idea. - * src/accounthandler.cpp: Simplify the code of Email check - based on the previous improvement. + * src/dalstorage.cpp, src/dalstorage.h, src/storage.h: Radically + improve the getEmailList() again based on MrLindeijer's good idea. + * src/accounthandler.cpp: Simplify the code of Email check based on + the previous improvement. 2005-12-06 Yohann Ferreira <bertram@cegetel.net> - * src/dalstorage.cpp: Improved the getEmailList() function. - Now the file used as db or the db name is shown in log. - * src/defines.h: Added some missing messages and values for - them. Login, pass min, max length can be changed there now. - * src/accounthandler.cpp: Added check and appropriate response - when selecting, creating a character. + * src/dalstorage.cpp: Improved the getEmailList() function. Now the + file used as db or the db name is shown in log. + * src/defines.h: Added some missing messages and values for them. + Login, pass min, max length can be changed there now. + * src/accounthandler.cpp: Added check and appropriate response when + selecting, creating a character. 2005-12-05 Yohann Ferreira <bertram@cegetel.net> * src/dalstorage.cpp: Added a working getEmailList() function. * src/accounthandler: Now tests if email already exists. - * src/accounthandler.cpp, src/defines.h: Strengthens the way - email addresses checked. Added good response for selecting - a char when not logged. - * src/storage.h, src/dalstorage.h, src/dalstorage.cpp: Added - the getEmailList function, doesn't seem to work, but committed - to see why. + * src/accounthandler.cpp, src/defines.h: Strengthens the way email + addresses checked. Added good response for selecting a char when not + logged. + * src/storage.h, src/dalstorage.h, src/dalstorage.cpp: Added the + getEmailList function, doesn't seem to work, but committed to see why. 2005-12-03 Yohann Ferreira <bertram@cegetel.net> * src/accounthandler.cpp: Handling good conditions to register. Still lacks checking if the Email already exists. * src/dalstorage.cpp: Fixed a bug that throwed an exception when - logging with an account that had no mapInfo yet. - Still has to set these to defaults in such case. + logging with an account that had no mapInfo yet. Still has to set + these to defaults in such case. 2005-12-02 Yohann Ferreira <bertram@cegetel.net> * src/main.cpp, src/accounthandler.h, src/accounthandler.cpp, - src/configuration.h: Made the accounthandler reopen the db for - SQLite to enable registering ! Now working. + src/configuration.h: Made the accounthandler reopen the db for SQLite + to enable registering! Now working. 2005-11-21 Aaron Marks <nymacro@gmail.com> @@ -1371,8 +1384,8 @@ * src/state.h, src/state.cpp: Updated world related functions. * src/accounthandler.cpp: Now adds players who have selected a character to the game world. - * src/object.h: Updated to include member variable for current map - the object is located. + * src/object.h: Updated to include member variable for current map the + object is located. 2005-11-15 Aaron Marks <nymacro@gmail.com> @@ -1384,15 +1397,14 @@ 2005-11-14 Aaron Marks <nymacro@gmail.com> - * src/bindings.i: Enabled "directors", allowing scripting language - to override virtual functions. + * src/bindings.i: Enabled "directors", allowing scripting language + to override virtual functions. 2005-11-12 Aaron Marks <nymacro@gmail.com> * src/main.cpp: Added scripting with Ruby support * src/bindings.i: Created basic SWIG bindings. - * src/Makefile.am: Updated to support Ruby & generate SWIG - bindings. + * src/Makefile.am: Updated to support Ruby & generate SWIG bindings. * configure.ac: Updated to detect SWIG & Ruby, using them appropriately. * scripts/init.rb: Server initialization test script. @@ -1409,5 +1421,5 @@ * src/dal/dataprovider.h, src/dal/dataprovider.cpp, src/dal/sqlitedataprovider.cpp, src/dal/mysqldataprovider.cpp, src/dal/pqdataprovider.cpp, src/main.cpp, src/client.cpp: - Grammar corrections, and a little bit of work on getting the name - of the Db. + Grammar corrections, and a little bit of work on getting the name of + the Db. diff --git a/src/Makefile.am b/src/Makefile.am index c8a9037f..3df85d79 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -102,11 +102,13 @@ tmwserv_game_SOURCES = \ game-server/mapreader.cpp \ game-server/monster.hpp \ game-server/monster.cpp \ + game-server/movingobject.hpp \ + game-server/movingobject.cpp \ game-server/object.hpp \ - game-server/object.cpp \ game-server/state.hpp \ game-server/state.cpp \ game-server/testing.cpp \ + game-server/thing.hpp \ game-server/trigger.hpp \ game-server/trigger.cpp \ net/connection.hpp \ @@ -170,4 +172,4 @@ bindings_wrap.cpp: bindings.i $(SWIG) $(SWIGFLAGS) -o bindings_wrap.cpp bindings.i tmwserv_game_SOURCES += \ bindings_wrap.cpp -endif
\ No newline at end of file +endif diff --git a/src/game-server/being.hpp b/src/game-server/being.hpp index cd613376..4423c68e 100644 --- a/src/game-server/being.hpp +++ b/src/game-server/being.hpp @@ -28,7 +28,7 @@ #include <vector> #include "defines.h" -#include "game-server/object.hpp" +#include "game-server/movingobject.hpp" class Being; class MapComposite; diff --git a/src/game-server/object.cpp b/src/game-server/movingobject.cpp index 5dcafb15..7eb040e3 100644 --- a/src/game-server/object.cpp +++ b/src/game-server/movingobject.cpp @@ -22,7 +22,7 @@ #include "game-server/map.hpp" #include "game-server/mapmanager.hpp" -#include "game-server/object.hpp" +#include "game-server/movingobject.hpp" void MovingObject::move() { diff --git a/src/game-server/movingobject.hpp b/src/game-server/movingobject.hpp new file mode 100644 index 00000000..99f1caa3 --- /dev/null +++ b/src/game-server/movingobject.hpp @@ -0,0 +1,134 @@ +/* + * 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 _TMWSERV_MOVINGOBJECT_H_ +#define _TMWSERV_MOVINGOBJECT_H_ + +#include "point.h" +#include "game-server/map.hpp" +#include "game-server/object.hpp" + + +/** + * Base class for in-game moving objects. This class adds a sense of direction, + * destination and size. + */ +class MovingObject : public Object +{ + public: + /** + * Proxy constructor. + */ + MovingObject(int type, int id) + : Object(type), + mPublicID(id), + mDirection(0), + mActionTime(0) + {} + + /** + * Gets the destination coordinates of the object. + */ + Point const &getDestination() const + { return mDst; } + + /** + * Sets the destination coordinates of the object. + */ + void setDestination(const Point &dst) + { + mDst = dst; + raiseUpdateFlags(UPDATEFLAG_NEW_DESTINATION); + mPath.clear(); + } + + /** + * Gets the old coordinates of the object. + */ + Point getOldPosition() const + { return mOld; } + + /** + * Sets object direction. + */ + void setDirection(int direction) + { mDirection = direction; } + + /** + * Gets object direction. + */ + unsigned char getDirection() const + { return mDirection; } + + /** + * Sets object speed. + */ + void setSpeed(unsigned s) + { mSpeed = s; } + + /** + * Sets object bounding circle radius. + */ + void setSize(unsigned s) + { mSize = s; } + + /** + * Gets object bounding circle radius. + */ + unsigned getSize() + { return mSize; } + + /** + * Moves the object toward its destination. + */ + virtual void move(); + + /** + * Get public ID. + * + * @return the public ID, 65535 if none yet. + */ + int getPublicID() const + { return mPublicID; } + + /** + * Set public ID. The object shall not have any public ID yet. + */ + void setPublicID(int id) + { mPublicID = id; } + + private: + /** Object ID sent to clients (unique with respect to the map). */ + unsigned short mPublicID; + + Point mDst; /**< Target coordinates. */ + Point mOld; /**< Old coordinates. */ + unsigned short mSpeed; /**< Speed. */ + std::list<PATH_NODE> mPath; + + protected: + unsigned char mDirection; /**< Facing direction. */ + unsigned short mActionTime; /**< Delay until next action. */ + unsigned mSize; /**< Radius of bounding circle. */ +}; + +#endif // _TMWSERV_OBJECT_H_ diff --git a/src/game-server/object.hpp b/src/game-server/object.hpp index 3071f710..6c30bb0d 100644 --- a/src/game-server/object.hpp +++ b/src/game-server/object.hpp @@ -20,28 +20,16 @@ * $Id$ */ - #ifndef _TMWSERV_OBJECT_H_ #define _TMWSERV_OBJECT_H_ -#include <vector> - #include "point.h" -#include "game-server/map.hpp" - -// Object type enumeration -enum -{ - OBJECT_ITEM = 0, // A simple item - OBJECT_ACTOR, // An item that toggle map/quest actions (doors, switchs, ...) and can speak (map panels). - OBJECT_NPC, // Non-Playable-Character is an actor capable of movement and maybe actions - OBJECT_MONSTER, // A monster (moving actor with AI. Should be able to toggle map/quest actions, too) - OBJECT_CHARACTER,// A normal being - OBJECT_OTHER // Server-only object -}; - -class MapComposite; +#include "game-server/thing.hpp" +/** + * Flags that are raised as necessary. They trigger messages that are sent to + * the clients. + */ enum { UPDATEFLAG_NEW_ON_MAP = 1, @@ -52,79 +40,10 @@ enum }; /** - * Base class for in-game objects. - */ -class Thing -{ - public: - /** - * Constructor. - */ - Thing(int type) - : mType(type) - {} - - /** - * Empty virtual destructor. - */ - virtual ~Thing() {} - - /** - * Gets type. - * - * @return the type. - */ - int getType() const - { return mType; } - - /** - * Returns whether this thing is visible on the map or not. (Object) - */ - bool isVisible() const - { return mType != OBJECT_OTHER; } - - /** - * Returns whether this thing can move on the map or not. (MovingObject) - */ - bool canMove() const - { return mType == OBJECT_CHARACTER || mType == OBJECT_MONSTER || - mType == OBJECT_NPC; } - - /** - * Returns whether this thing can fight or not. (Being) - */ - bool canFight() const - { return mType == OBJECT_CHARACTER || mType == OBJECT_MONSTER; } - - /** - * Updates the internal status. - */ - virtual void - update() = 0; - - /** - * Gets the map this thing is located on. - * - * @return ID of map. - */ - int getMapId() const - { return mMapId; } - - /** - * Sets the map this thing is located on. - */ - void setMapId(int mapId) - { mMapId = mapId; } - - private: - unsigned short mMapId; /**< id of the map being is on */ - char mType; /**< Object type */ -}; - -/** - * Generic client-visible object definition. + * Generic client-visible object definition. Keeps track of position and what + * to update clients about. */ -class Object: public Thing +class Object : public Thing { public: /** @@ -170,105 +89,8 @@ class Object: public Thing { mUpdateFlags = 0; } private: - char mUpdateFlags; /**< changes in object status */ - Point mPos; /**< coordinates */ -}; - -/** - * Base class for in-game moving objects. - */ -class MovingObject: public Object -{ - public: - /** - * Proxy constructor. - */ - MovingObject(int type, int id) - : Object(type), - mPublicID(id), - mDirection(0), - mActionTime(0) - {} - - /** - * Gets the destination coordinates of the object. - */ - Point const &getDestination() const - { return mDst; } - - /** - * Sets the destination coordinates of the object. - */ - void setDestination(Point dst) - { mDst = dst; raiseUpdateFlags(UPDATEFLAG_NEW_DESTINATION); mPath.clear(); } - - /** - * Gets the old coordinates of the object. - */ - Point getOldPosition() const - { return mOld; } - - /** - * Sets object direction - */ - void setDirection(int direction) - { mDirection = direction; } - - /** - * Gets object direction - */ - unsigned char getDirection() const - { return mDirection; } - - /** - * Sets object speed. - */ - void setSpeed(unsigned s) - { mSpeed = s; } - - /** - * Sets object bounding circle radius - */ - void setSize(unsigned s) - { mSize = s; } - - /** - * Gets object bounding circle radius - */ - unsigned getSize() - { return mSize; } - - /** - * Moves the object toward its destination. - */ - virtual void move(); - - /** - * Get public ID. - * - * @return the public ID, 65535 if none yet. - */ - int getPublicID() const - { return mPublicID; } - - /** - * Set public ID. - * The object shall not have any public ID yet. - */ - void setPublicID(int id) - { mPublicID = id; } - - private: - unsigned short mPublicID; /**< Object ID sent to clients (unique with respect to the map) */ - Point mDst; /**< target coordinates */ - Point mOld; /**< old coordinates */ - unsigned short mSpeed; /**< speed */ - std::list<PATH_NODE> mPath; - - protected: - unsigned char mDirection; /**< Facing direction */ - unsigned short mActionTime; /**< delay until next action */ - unsigned mSize; /**< radius of bounding circle */ + char mUpdateFlags; /**< Changes in object status. */ + Point mPos; /**< Coordinates. */ }; #endif // _TMWSERV_OBJECT_H_ diff --git a/src/game-server/thing.hpp b/src/game-server/thing.hpp new file mode 100644 index 00000000..547885c4 --- /dev/null +++ b/src/game-server/thing.hpp @@ -0,0 +1,113 @@ +/* + * 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 _TMWSERV_THING_H_ +#define _TMWSERV_THING_H_ + +/** + * Object type enumeration. + */ +enum +{ + OBJECT_ITEM = 0, /**< A simple item. */ + OBJECT_ACTOR, /**< An item that toggle map/quest actions (doors, + switchs, ...) and can speak (map panels). */ + OBJECT_NPC, /**< Non-Playable-Character is an actor capable of + movement and maybe actions. */ + OBJECT_MONSTER, /**< A monster (moving actor with AI. Should be able to + toggle map/quest actions, too). */ + OBJECT_CHARACTER, /**< A normal being. */ + OBJECT_OTHER /**< Server-only object. */ +}; + +/** + * Base class for in-game objects. Knows only its type and the map is resides + * on. + */ +class Thing +{ + public: + /** + * Constructor. + */ + Thing(int type) + : mType(type) + {} + + /** + * Empty virtual destructor. + */ + virtual ~Thing() {} + + /** + * Gets type of this thing. + * + * @return the type of this thing. + */ + int getType() const + { return mType; } + + /** + * Returns whether this thing is visible on the map or not. (Object) + */ + bool isVisible() const + { return mType != OBJECT_OTHER; } + + /** + * Returns whether this thing can move on the map or not. (MovingObject) + */ + bool canMove() const + { return mType == OBJECT_CHARACTER || mType == OBJECT_MONSTER || + mType == OBJECT_NPC; } + + /** + * Returns whether this thing can fight or not. (Being) + */ + bool canFight() const + { return mType == OBJECT_CHARACTER || mType == OBJECT_MONSTER; } + + /** + * Updates the internal status. + */ + virtual void + update() = 0; + + /** + * Gets the map this thing is located on. + * + * @return ID of map. + */ + int getMapId() const + { return mMapId; } + + /** + * Sets the map this thing is located on. + */ + void setMapId(int mapId) + { mMapId = mapId; } + + private: + unsigned short mMapId; /**< ID of the map this thing is on. */ + char mType; /**< Type of this thing. */ +}; + +#endif // _TMWSERV_THING_H_ diff --git a/src/game-server/trigger.cpp b/src/game-server/trigger.cpp index 4e593f4f..d658c7ae 100644 --- a/src/game-server/trigger.cpp +++ b/src/game-server/trigger.cpp @@ -21,10 +21,12 @@ * $Id$ */ +#include "game-server/trigger.hpp" + #include "game-server/mapcomposite.hpp" +#include "game-server/movingobject.hpp" #include "game-server/object.hpp" #include "game-server/state.hpp" -#include "game-server/trigger.hpp" void WarpAction::process(Object *obj) { diff --git a/src/game-server/trigger.hpp b/src/game-server/trigger.hpp index a3455ae4..c24e73be 100644 --- a/src/game-server/trigger.hpp +++ b/src/game-server/trigger.hpp @@ -25,28 +25,30 @@ #define _TMWSERV_TRIGGER #include "point.h" -#include "game-server/object.hpp" +#include "game-server/thing.hpp" + +class Object; class TriggerAction { public: virtual ~TriggerAction() {} - virtual void process(Object *) = 0; + virtual void process(Object *obj) = 0; }; -class WarpAction: public TriggerAction +class WarpAction : public TriggerAction { public: WarpAction(int m, int x, int y) : mMap(m), mX(x), mY(y) {} - virtual void process(Object *); + virtual void process(Object *obj); private: unsigned short mMap, mX, mY; }; -class TriggerArea: public Thing +class TriggerArea : public Thing { public: /** |