diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-22 19:45:03 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-22 19:45:56 +0100 |
commit | 0c43d04b438d41c277ae80402d4b4888db1a0b64 (patch) | |
tree | 3aaeb75ecd1bcbe85decedab5f1fa426fe0411e3 /src/engine.cpp | |
parent | a7f5eaeb7f643658d356533a608f0f18d85b6d32 (diff) | |
parent | 401802c1d7a1b3d659bdc53a45d9a6292fc1121e (diff) | |
download | mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.gz mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.bz2 mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.xz mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.zip |
Merged the tmwserv client with the eAthena client
This merge involved major changes on both sides, and as such took
several weeks. Lots of things are expected to be broken now, however, we
now have a single code base to improve and extend, which can be compiled
to support either eAthena or tmwserv.
In the coming months, the plan is to work towards a client that supports
both eAthena and tmwserv, without needing to be recompiled.
Conflicts:
Everywhere!
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index a67d379f..872ecd57 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -33,19 +33,27 @@ #include "gui/minimap.h" #include "gui/viewport.h" +#ifdef EATHENA_SUPPORT #include "net/messageout.h" -#include "net/protocol.h" +#include "net/ea/protocol.h" +#endif #include "resources/mapreader.h" +#include "resources/monsterdb.h" #include "resources/resourcemanager.h" #include "utils/stringutils.h" char itemCurrenyQ[10] = "0"; +#ifdef TMWSERV_SUPPORT +Engine::Engine(): + mCurrentMap(NULL) +#else Engine::Engine(Network *network): mCurrentMap(NULL), mNetwork(network) +#endif { } @@ -59,6 +67,7 @@ void Engine::changeMap(const std::string &mapPath) // Clean up floor items, beings and particles floorItemManager->clear(); beingManager->clear(); + particleEngine->clear(); // Unset the map of the player so that its particles are cleared before // being deleted in the next step @@ -68,7 +77,11 @@ void Engine::changeMap(const std::string &mapPath) particleEngine->clear(); // Store full map path in global var +#ifdef TMWSERV_SUPPORT + map_path = "maps/" + mapPath + ".tmx"; +#else map_path = "maps/" + mapPath.substr(0, mapPath.rfind(".")) + ".tmx"; +#endif ResourceManager *resman = ResourceManager::getInstance(); if (!resman->exists(map_path)) map_path += ".gz"; @@ -106,6 +119,12 @@ void Engine::changeMap(const std::string &mapPath) else minimap->setProportion(0.5); } + if (newMap->hasProperty("name")) + { + minimap->setCaption(newMap->getProperty("name")); + } else { + minimap->setCaption("Map"); + } minimap->setMapImage(mapImage); beingManager->setMap(newMap); particleEngine->setMap(newMap); @@ -131,15 +150,18 @@ void Engine::changeMap(const std::string &mapPath) mCurrentMap = newMap; mMapName = mapPath; +#ifdef EATHENA_SUPPORT // Send "map loaded" MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_MAP_LOADED); +#endif } void Engine::logic() { beingManager->logic(); particleEngine->update(); - mCurrentMap->update(); + if (mCurrentMap) + mCurrentMap->update(); gui->logic(); } |