summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
authorRogier Polak <rogier.l.a.polak@gmail.com>2007-03-05 03:32:59 +0000
committerRogier Polak <rogier.l.a.polak@gmail.com>2007-03-05 03:32:59 +0000
commitd811a539474a6eeb4439a4204f3d96551a5b7c1e (patch)
tree66b2482085965598845a0e58fa04d1bcdb6dd5a1 /src/game-server
parentf0d969eba1840362daad9debc93907c270b22ea5 (diff)
downloadmanaserv-d811a539474a6eeb4439a4204f3d96551a5b7c1e.tar.gz
manaserv-d811a539474a6eeb4439a4204f3d96551a5b7c1e.tar.bz2
manaserv-d811a539474a6eeb4439a4204f3d96551a5b7c1e.tar.xz
manaserv-d811a539474a6eeb4439a4204f3d96551a5b7c1e.zip
Added an abstrart base class for characterdata, in order to use the same serialize and deserialize functions on both the accountserver and the gameserver.
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/accountconnection.cpp2
-rw-r--r--src/game-server/gamehandler.cpp4
-rw-r--r--src/game-server/item.cpp5
-rw-r--r--src/game-server/item.hpp16
-rw-r--r--src/game-server/main-game.cpp2
-rw-r--r--src/game-server/map.cpp4
-rw-r--r--src/game-server/mapcomposite.cpp2
-rw-r--r--src/game-server/state.cpp2
-rw-r--r--src/game-server/testing.cpp4
9 files changed, 26 insertions, 15 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index e380d25a..2c3fc85b 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -67,9 +67,9 @@ void AccountConnection::processMessage(MessageIn &msg)
{
case AGMSG_PLAYER_ENTER:
{
+ std::string token = msg.readString(32);
int id = msg.readLong();
std::string name = msg.readString();
- std::string token = msg.readString(32);
Player *ptr = new Player(name, id);
ptr->deserialize(msg);
ptr->setMapId(ptr->getMap());
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index 768a2cd9..6b11f542 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -247,7 +247,7 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message)
{
int mapId = computer.character->getMapId();
MapComposite *map = gameState->getMap(mapId);
- Point ipos = { x, y };
+ Point ipos(x, y);
for (FixedObjectIterator i(map->getAroundPointIterator(ipos, 0)); i; ++i)
{
Object *o = *i;
@@ -284,7 +284,7 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message)
{
int x = message.readShort();
int y = message.readShort();
- Point dst = {x, y};
+ Point dst(x, y);
computer.character->setDestination(dst);
// no response should be required
diff --git a/src/game-server/item.cpp b/src/game-server/item.cpp
index 7eb9afb6..9345e33e 100644
--- a/src/game-server/item.cpp
+++ b/src/game-server/item.cpp
@@ -32,10 +32,7 @@ bool ItemClass::use(Being *itemUser)
// Calling a script if scriptName != ""
if (!mScriptName.empty())
{
- if (runScript(itemUser) && usedSuccessfully)
- return true;
- else
- return false;
+ return (runScript(itemUser) && usedSuccessfully);
}
else
return usedSuccessfully;
diff --git a/src/game-server/item.hpp b/src/game-server/item.hpp
index dd61dd2a..21b9e6dd 100644
--- a/src/game-server/item.hpp
+++ b/src/game-server/item.hpp
@@ -67,7 +67,7 @@ enum
WPNTYPE_STICK, // 13
WPNTYPE_HAMMER, // 14
WPNTYPE_AXE, // 15
- WPNTYPE_HAND_PROECTILE // 16
+ WPNTYPE_HAND_PROJECTILE // 16
};
/**
@@ -205,6 +205,19 @@ class ItemClass
int getDatabaseID()
{ return mDatabaseID; }
+ /**
+ * Sets the sprite ID.
+ */
+ void setSpriteID(unsigned short spriteID)
+ { mSpriteID = spriteID; }
+
+ /**
+ * Gets the sprite ID.
+ */
+ unsigned short getSpriteID()
+ { return mSpriteID; }
+
+
private:
/**
@@ -214,6 +227,7 @@ class ItemClass
// Item reference information
unsigned short mDatabaseID;
+ unsigned short mSpriteID; /**< The sprite that should be shown to the player */
unsigned char mType; /**< Type: usable, equipment. */
unsigned short mWeight; /**< Weight of the item. */
unsigned short mCost; /**< Unit cost the item. */
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index 831dc9f1..da1b60f2 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -68,7 +68,7 @@ std::string scriptLanugage = "none";
#endif // SCRIPT_SUPPORT
// Default options that automake should be able to override.
-#define DEFAULT_LOG_FILE "tmwserv.log"
+#define DEFAULT_LOG_FILE "tmwserv-game.log"
#define DEFAULT_CONFIG_FILE "tmwserv.xml"
#define DEFAULT_ITEMSDB_FILE "items.xml"
#define DEFAULT_MAPSDB_FILE "maps.xml"
diff --git a/src/game-server/map.cpp b/src/game-server/map.cpp
index 876ba674..6ca447ae 100644
--- a/src/game-server/map.cpp
+++ b/src/game-server/map.cpp
@@ -21,10 +21,10 @@
* $Id$
*/
-#include <queue>
-
#include "game-server/map.hpp"
+#include <queue>
+
MetaTile::MetaTile():
whichList(0)
{
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp
index 207f1e33..0250d14a 100644
--- a/src/game-server/mapcomposite.cpp
+++ b/src/game-server/mapcomposite.cpp
@@ -343,7 +343,7 @@ MapComposite::~MapComposite()
delete buckets[i];
}
delete[] zones;
- delete map;
+ // MapManger will delete the maps when necessary.
}
bool MapComposite::allocate(MovingObject *obj)
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index 09513b95..0c392da8 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -318,7 +318,7 @@ void State::update()
case EVENT_WARP:
{
remove(o);
- Point pos = { e.x, e.y };
+ Point pos(e.x, e.y);
o->setMapId(e.map);
o->setPosition(pos);
diff --git a/src/game-server/testing.cpp b/src/game-server/testing.cpp
index 4f269e29..b48a7e77 100644
--- a/src/game-server/testing.cpp
+++ b/src/game-server/testing.cpp
@@ -20,7 +20,7 @@ static void dropItem(int map, int x, int y, int type)
assert(ic);
Item *i = new Item(ic, 1);
i->setMapId(map);
- Point pos = { x, y };
+ Point pos(x, y);
i->setPosition(pos);
gameState->insert(i);
}
@@ -39,7 +39,7 @@ void testingMap(int id)
being->setSize(8);
being->setHitpoints(3);
being->setMapId(1);
- Point pos = { 720, 900 };
+ Point pos(720, 900);
being->setPosition(pos);
gameState->insert(being);
}