summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 84a734d1..3b982694 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -33,17 +33,25 @@
#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"
+#ifdef TMWSERV_SUPPORT
+Engine::Engine():
+ mCurrentMap(NULL)
+#else
Engine::Engine(Network *network):
mCurrentMap(NULL),
mNetwork(network)
+#endif
{
}
@@ -57,6 +65,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
@@ -66,7 +75,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";
@@ -104,6 +117,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);
@@ -129,15 +148,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();
}