summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gameserver.cbp4
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/account-server/serverhandler.cpp8
-rw-r--r--src/common/manaserv_protocol.h6
-rw-r--r--src/game-server/accountconnection.cpp14
-rw-r--r--src/game-server/actor.cpp2
-rw-r--r--src/game-server/actor.h8
-rw-r--r--src/game-server/being.cpp2
-rw-r--r--src/game-server/being.h2
-rw-r--r--src/game-server/entity.cpp (renamed from src/game-server/thing.cpp)12
-rw-r--r--src/game-server/entity.h (renamed from src/game-server/thing.h)32
-rw-r--r--src/game-server/eventlistener.h6
-rw-r--r--src/game-server/mapcomposite.cpp26
-rw-r--r--src/game-server/mapcomposite.h12
-rw-r--r--src/game-server/mapreader.h2
-rw-r--r--src/game-server/monster.cpp6
-rw-r--r--src/game-server/monster.h2
-rw-r--r--src/game-server/quest.cpp4
-rw-r--r--src/game-server/spawnarea.cpp6
-rw-r--r--src/game-server/spawnarea.h6
-rw-r--r--src/game-server/state.cpp10
-rw-r--r--src/game-server/state.h20
-rw-r--r--src/game-server/trigger.h6
-rw-r--r--src/scripting/lua.cpp4
-rw-r--r--src/scripting/luascript.cpp12
-rw-r--r--src/scripting/luascript.h6
-rw-r--r--src/scripting/luautil.cpp8
-rw-r--r--src/scripting/luautil.h4
-rw-r--r--src/scripting/script.h10
29 files changed, 121 insertions, 123 deletions
diff --git a/gameserver.cbp b/gameserver.cbp
index 4184c09..f89db17 100644
--- a/gameserver.cbp
+++ b/gameserver.cbp
@@ -132,6 +132,8 @@
<Unit filename="src\game-server\commandhandler.h" />
<Unit filename="src\game-server\effect.cpp" />
<Unit filename="src\game-server\effect.h" />
+ <Unit filename="src\game-server\entity.cpp" />
+ <Unit filename="src\game-server\entity.h" />
<Unit filename="src\game-server\eventlistener.h" />
<Unit filename="src\game-server\gamehandler.cpp" />
<Unit filename="src\game-server\gamehandler.h" />
@@ -171,8 +173,6 @@
<Unit filename="src\game-server\statuseffect.h" />
<Unit filename="src\game-server\statusmanager.cpp" />
<Unit filename="src\game-server\statusmanager.h" />
- <Unit filename="src\game-server\thing.cpp" />
- <Unit filename="src\game-server\thing.h" />
<Unit filename="src\game-server\trade.cpp" />
<Unit filename="src\game-server\trade.h" />
<Unit filename="src\game-server\trigger.cpp" />
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 34ec389..42708f6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -212,6 +212,8 @@ SET(SRCS_MANASERVGAME
game-server/commandhandler.h
game-server/effect.h
game-server/effect.cpp
+ game-server/entity.h
+ game-server/entity.cpp
game-server/eventlistener.h
game-server/gamehandler.h
game-server/gamehandler.cpp
@@ -250,8 +252,6 @@ SET(SRCS_MANASERVGAME
game-server/statuseffect.cpp
game-server/statusmanager.h
game-server/statusmanager.cpp
- game-server/thing.h
- game-server/thing.cpp
game-server/trade.h
game-server/trade.cpp
game-server/trigger.h
diff --git a/src/account-server/serverhandler.cpp b/src/account-server/serverhandler.cpp
index 9224338..1f55bc9 100644
--- a/src/account-server/serverhandler.cpp
+++ b/src/account-server/serverhandler.cpp
@@ -46,7 +46,7 @@ using namespace ManaServ;
struct MapStatistics
{
std::vector<int> players;
- unsigned short nbThings;
+ unsigned short nbEntities;
unsigned short nbMonsters;
};
@@ -278,7 +278,7 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg)
comp->send(outMsg);
MapStatistics &m = server->maps[id];
- m.nbThings = 0;
+ m.nbEntities = 0;
m.nbMonsters = 0;
}
}
@@ -448,7 +448,7 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg)
break;
}
MapStatistics &m = i->second;
- m.nbThings = msg.readInt16();
+ m.nbEntities = msg.readInt16();
m.nbMonsters = msg.readInt16();
int nb = msg.readInt16();
m.players.resize(nb);
@@ -639,7 +639,7 @@ void GameServerHandler::dumpStatistics(std::ostream &os)
j_end = server->maps.end(); j != j_end; ++j)
{
const MapStatistics &m = j->second;
- os << "<map id=\"" << j->first << "\" nb_things=\"" << m.nbThings
+ os << "<map id=\"" << j->first << "\" nb_entities=\"" << m.nbEntities
<< "\" nb_monsters=\"" << m.nbMonsters << "\">\n";
for (std::vector< int >::const_iterator k = m.players.begin(),
k_end = m.players.end(); k != k_end; ++k)
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index 0a61dcb..a4dc71e 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -255,7 +255,7 @@ enum {
GAMSG_BAN_PLAYER = 0x0550, // D id, W duration
GAMSG_CHANGE_PLAYER_LEVEL = 0x0555, // D id, W level
GAMSG_CHANGE_ACCOUNT_LEVEL = 0x0556, // D id, W level
- GAMSG_STATISTICS = 0x0560, // { W map id, W thing nb, W monster nb, W player nb, { D character id }* }*
+ GAMSG_STATISTICS = 0x0560, // { W map id, W entity nb, W monster nb, W player nb, { D character id }* }*
CGMSG_CHANGED_PARTY = 0x0590, // D character id, D party id
GCMSG_REQUEST_POST = 0x05A0, // D character id
CGMSG_POST_RESPONSE = 0x05A1, // D receiver id, { S sender name, S letter, W num attachments { W attachment item id, W quantity } }
@@ -342,8 +342,8 @@ enum AttribmodResponseCode {
ATTRIBMOD_DENIED
};
-// Object type enumeration
-enum ThingType
+// Entity type enumeration
+enum EntityType
{
// A simple item.
OBJECT_ITEM = 0,
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index 1e97434..52282a9 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -346,14 +346,14 @@ void AccountConnection::sendStatistics()
MapComposite *m = i->second;
if (!m->isActive()) continue;
msg.writeInt16(i->first);
- int nbThings = 0, nbMonsters = 0;
- typedef std::vector< Thing * > Things;
- const Things &things = m->getEverything();
+ int nbEntities = 0, nbMonsters = 0;
+ typedef std::vector< Entity * > Entities;
+ const Entities &things = m->getEverything();
std::vector< int > players;
- for (Things::const_iterator j = things.begin(),
+ for (Entities::const_iterator j = things.begin(),
j_end = things.end(); j != j_end; ++j)
{
- Thing *t = *j;
+ Entity *t = *j;
switch (t->getType())
{
case OBJECT_CHARACTER:
@@ -364,10 +364,10 @@ void AccountConnection::sendStatistics()
++nbMonsters;
break;
default:
- ++nbThings;
+ ++nbEntities;
}
}
- msg.writeInt16(nbThings);
+ msg.writeInt16(nbEntities);
msg.writeInt16(nbMonsters);
msg.writeInt16(players.size());
for (std::vector< int >::const_iterator j = players.begin(),
diff --git a/src/game-server/actor.cpp b/src/game-server/actor.cpp
index 8325c6d..6037912 100644
--- a/src/game-server/actor.cpp
+++ b/src/game-server/actor.cpp
@@ -71,7 +71,7 @@ void Actor::setMap(MapComposite *mapComposite)
oldMap->freeTile(p.x / oldTileWidth, p.y / oldTileHeight,
getBlockType());
}
- Thing::setMap(mapComposite);
+ Entity::setMap(mapComposite);
Map *map = mapComposite->getMap();
int tileWidth = map->getTileWidth();
int tileHeight = map->getTileHeight();
diff --git a/src/game-server/actor.h b/src/game-server/actor.h
index 758424a..324393d 100644
--- a/src/game-server/actor.h
+++ b/src/game-server/actor.h
@@ -22,7 +22,7 @@
#define ACTOR_H
#include "game-server/map.h"
-#include "game-server/thing.h"
+#include "game-server/entity.h"
#include "utils/point.h"
/**
@@ -44,11 +44,11 @@ enum
* Generic client-visible object. Keeps track of position, size and what to
* update clients about.
*/
-class Actor : public Thing
+class Actor : public Entity
{
public:
- Actor(ThingType type)
- : Thing(type),
+ Actor(EntityType type)
+ : Entity(type),
mMoveTime(0),
mUpdateFlags(0),
mPublicID(65535),
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index 1669e55..bbe0782 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -35,7 +35,7 @@
#include "utils/logger.h"
#include "utils/speedconv.h"
-Being::Being(ThingType type):
+Being::Being(EntityType type):
Actor(type),
mAction(STAND),
mTarget(NULL),
diff --git a/src/game-server/being.h b/src/game-server/being.h
index 3a76025..27c14b0 100644
--- a/src/game-server/being.h
+++ b/src/game-server/being.h
@@ -70,7 +70,7 @@ class Being : public Actor
/**
* Proxy constructor.
*/
- Being(ThingType type);
+ Being(EntityType type);
/**
* Update being state.
diff --git a/src/game-server/thing.cpp b/src/game-server/entity.cpp
index 5fe9424..671ef5e 100644
--- a/src/game-server/thing.cpp
+++ b/src/game-server/entity.cpp
@@ -20,11 +20,11 @@
#include <cassert>
-#include "game-server/thing.h"
+#include "game-server/entity.h"
#include "game-server/eventlistener.h"
-Thing::~Thing()
+Entity::~Entity()
{
/* As another object will stop listening and call removeListener when it is
deleted, the following assertion ensures that all the calls to
@@ -35,17 +35,17 @@ Thing::~Thing()
assert(mListeners.empty());
}
-void Thing::addListener(const EventListener *l)
+void Entity::addListener(const EventListener *l)
{
mListeners.insert(l);
}
-void Thing::removeListener(const EventListener *l)
+void Entity::removeListener(const EventListener *l)
{
mListeners.erase(l);
}
-void Thing::inserted()
+void Entity::inserted()
{
for (Listeners::iterator i = mListeners.begin(),
i_end = mListeners.end(); i != i_end;)
@@ -56,7 +56,7 @@ void Thing::inserted()
}
}
-void Thing::removed()
+void Entity::removed()
{
for (Listeners::iterator i = mListeners.begin(),
i_end = mListeners.end(); i != i_end;)
diff --git a/src/game-server/thing.h b/src/game-server/entity.h
index 9409a0b..652db7c 100644
--- a/src/game-server/thing.h
+++ b/src/game-server/entity.h
@@ -18,8 +18,8 @@
* along with The Mana Server. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef THING_H
-#define THING_H
+#ifndef ENTITY_H
+#define ENTITY_H
#include "common/manaserv_protocol.h"
@@ -34,39 +34,39 @@ class MapComposite;
* Base class for in-game objects. Knows only its type and the map it resides
* on. Provides listeners.
*/
-class Thing
+class Entity
{
public:
- Thing(ThingType type, MapComposite *map = 0)
+ Entity(EntityType type, MapComposite *map = 0)
: mMap(map),
mType(type)
{}
- virtual ~Thing();
+ virtual ~Entity();
/**
- * Gets type of this thing.
+ * Gets type of this entity.
*
- * @return the type of this thing.
+ * @return the type of this entity.
*/
- ThingType getType() const
+ EntityType getType() const
{ return mType; }
/**
- * Returns whether this thing is visible on the map or not. (Actor)
+ * Returns whether this entity is visible on the map or not. (Actor)
*/
bool isVisible() const
{ return mType != OBJECT_OTHER; }
/**
- * Returns whether this thing can move on the map or not. (Actor)
+ * Returns whether this entity can move on the map or not. (Actor)
*/
bool canMove() const
{ return mType == OBJECT_CHARACTER || mType == OBJECT_MONSTER ||
mType == OBJECT_NPC; }
/**
- * Returns whether this thing can fight or not. (Being)
+ * Returns whether this entity can fight or not. (Being)
*/
bool canFight() const
{ return mType == OBJECT_CHARACTER || mType == OBJECT_MONSTER; }
@@ -77,13 +77,13 @@ class Thing
virtual void update() = 0;
/**
- * Gets the map this thing is located on.
+ * Gets the map this entity is located on.
*/
MapComposite *getMap() const
{ return mMap; }
/**
- * Sets the map this thing is located on.
+ * Sets the map this entity is located on.
*/
virtual void setMap(MapComposite *map)
{ mMap = map; }
@@ -113,8 +113,8 @@ class Thing
Listeners mListeners; /**< List of event listeners. */
private:
- MapComposite *mMap; /**< Map the thing is on */
- ThingType mType; /**< Type of this thing. */
+ MapComposite *mMap; /**< Map the entity is on */
+ EntityType mType; /**< Type of this entity. */
};
-#endif // THING_H
+#endif // ENTITY_H
diff --git a/src/game-server/eventlistener.h b/src/game-server/eventlistener.h
index 87dac1d..53d9207 100644
--- a/src/game-server/eventlistener.h
+++ b/src/game-server/eventlistener.h
@@ -21,7 +21,7 @@
#ifndef GAMESERVER_EVENTLISTENER_H
#define GAMESERVER_EVENTLISTENER_H
-class Thing;
+class Entity;
class Being;
class Character;
@@ -44,12 +44,12 @@ struct EventDispatch
/**
* Called just after something is inserted in a map.
*/
- void (*inserted)(const EventListener *, Thing *);
+ void (*inserted)(const EventListener *, Entity *);
/**
* Called just before something is removed from a map.
*/
- void (*removed)(const EventListener *, Thing *);
+ void (*removed)(const EventListener *, Entity *);
/**
* Called just after a being has died.
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp
index 2c60118..8dd0503 100644
--- a/src/game-server/mapcomposite.cpp
+++ b/src/game-server/mapcomposite.cpp
@@ -557,7 +557,7 @@ ZoneIterator MapComposite::getAroundBeingIterator(Being *obj, int radius) const
return ZoneIterator(r2, mContent);
}
-bool MapComposite::insert(Thing *ptr)
+bool MapComposite::insert(Entity *ptr)
{
if (ptr->isVisible())
{
@@ -571,14 +571,14 @@ bool MapComposite::insert(Thing *ptr)
}
ptr->setMap(this);
- mContent->things.push_back(ptr);
+ mContent->entities.push_back(ptr);
return true;
}
-void MapComposite::remove(Thing *ptr)
+void MapComposite::remove(Entity *ptr)
{
- for (std::vector<Thing*>::iterator i = mContent->things.begin(),
- i_end = mContent->things.end(); i != i_end; ++i)
+ for (std::vector<Entity*>::iterator i = mContent->entities.begin(),
+ i_end = mContent->entities.end(); i != i_end; ++i)
{
if ((*i)->canFight())
{
@@ -590,7 +590,7 @@ void MapComposite::remove(Thing *ptr)
}
if (*i == ptr)
{
- i = mContent->things.erase(i);
+ i = mContent->entities.erase(i);
}
}
@@ -609,9 +609,9 @@ void MapComposite::remove(Thing *ptr)
void MapComposite::update()
{
// Update object status
- const std::vector< Thing * > &things = getEverything();
- for (std::vector< Thing * >::const_iterator it = things.begin(),
- it_end = things.end(); it != it_end; ++it)
+ const std::vector< Entity * > &entities = getEverything();
+ for (std::vector< Entity * >::const_iterator it = entities.begin(),
+ it_end = entities.end(); it != it_end; ++it)
{
(*it)->update();
}
@@ -637,8 +637,8 @@ void MapComposite::update()
}
// Cannot use a WholeMap iterator as objects will change zones under its feet.
- for (std::vector< Thing * >::iterator i = mContent->things.begin(),
- i_end = mContent->things.end(); i != i_end; ++i)
+ for (std::vector< Entity * >::iterator i = mContent->entities.begin(),
+ i_end = mContent->entities.end(); i != i_end; ++i)
{
if (!(*i)->canMove())
continue;
@@ -659,9 +659,9 @@ void MapComposite::update()
}
}
-const std::vector< Thing * > &MapComposite::getEverything() const
+const std::vector< Entity * > &MapComposite::getEverything() const
{
- return mContent->things;
+ return mContent->entities;
}
diff --git a/src/game-server/mapcomposite.h b/src/game-server/mapcomposite.h
index 96939a9..079e5e4 100644
--- a/src/game-server/mapcomposite.h
+++ b/src/game-server/mapcomposite.h
@@ -35,7 +35,7 @@ class Map;
class MapComposite;
class Point;
class Rectangle;
-class Thing;
+class Entity;
struct MapContent;
struct MapZone;
@@ -205,9 +205,9 @@ struct MapContent
MapZone &getZone(const Point &pos) const;
/**
- * Things (items, characters, monsters, etc) located on the map.
+ * Entities (items, characters, monsters, etc) located on the map.
*/
- std::vector< Thing * > things;
+ std::vector< Entity * > entities;
/**
* Buckets of MovingObjects located on the map, referenced by ID.
@@ -270,12 +270,12 @@ class MapComposite
/**
* Inserts a thing on the map. Sets its public ID if relevant.
*/
- bool insert(Thing *);
+ bool insert(Entity *);
/**
* Removes a thing from the map.
*/
- void remove(Thing *);
+ void remove(Entity *);
/**
* Updates zones of every moving beings.
@@ -317,7 +317,7 @@ class MapComposite
/**
* Gets everything related to the map.
*/
- const std::vector< Thing * > &getEverything() const;
+ const std::vector< Entity * > &getEverything() const;
/**
* Gets the cached value of a map-bound script variable
diff --git a/src/game-server/mapreader.h b/src/game-server/mapreader.h
index 802f6b0..de5ce1d 100644
--- a/src/game-server/mapreader.h
+++ b/src/game-server/mapreader.h
@@ -28,8 +28,6 @@
#include <libxml/tree.h>
class Map;
-class MapComposite;
-class Thing;
/**
* Reader for XML map files (*.tmx)
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp
index 6bc69b7..34920b9 100644
--- a/src/game-server/monster.cpp
+++ b/src/game-server/monster.cpp
@@ -40,8 +40,8 @@ struct MonsterTargetEventDispatch: EventDispatch
MonsterTargetEventDispatch()
{
typedef EventListenerFactory<Monster, &Monster::mTargetListener> Factory;
- removed = &Factory::create< Thing, &Monster::forgetTarget >::function;
- died = &Factory::create<Thing, &Monster::forgetTarget, Being>::function;
+ removed = &Factory::create< Entity, &Monster::forgetTarget >::function;
+ died = &Factory::create<Entity, &Monster::forgetTarget, Being>::function;
}
};
@@ -376,7 +376,7 @@ int Monster::calculatePositionPriority(Point position, int targetPriority)
}
}
-void Monster::forgetTarget(Thing *t)
+void Monster::forgetTarget(Entity *t)
{
Being *b = static_cast< Being * >(t);
mAnger.erase(b);
diff --git a/src/game-server/monster.h b/src/game-server/monster.h
index 6de8368..3b58fa6 100644
--- a/src/game-server/monster.h
+++ b/src/game-server/monster.h
@@ -322,7 +322,7 @@ class Monster : public Being
/**
* Removes a being from the anger list.
*/
- void forgetTarget(Thing *being);
+ void forgetTarget(Entity *being);
/**
* Called when an attribute modifier is changed.
diff --git a/src/game-server/quest.cpp b/src/game-server/quest.cpp
index 3b415fe..c4cce8e 100644
--- a/src/game-server/quest.cpp
+++ b/src/game-server/quest.cpp
@@ -77,7 +77,7 @@ void setQuestVar(Character *ch, const std::string &name,
*/
struct QuestDeathListener: EventDispatch
{
- static void partialRemove(const EventListener *, Thing *);
+ static void partialRemove(const EventListener *, Entity *);
static void fullRemove(const EventListener *, Character *);
@@ -91,7 +91,7 @@ struct QuestDeathListener: EventDispatch
static QuestDeathListener questDeathDummy;
static EventListener questDeathListener(&questDeathDummy);
-void QuestDeathListener::partialRemove(const EventListener *, Thing *t)
+void QuestDeathListener::partialRemove(const EventListener *, Entity *t)
{
int id = static_cast< Character * >(t)->getDatabaseID();
PendingVariables &variables = pendingQuests[id].variables;
diff --git a/src/game-server/spawnarea.cpp b/src/game-server/spawnarea.cpp
index 43e3a93..155d4c0 100644
--- a/src/game-server/spawnarea.cpp
+++ b/src/game-server/spawnarea.cpp
@@ -31,7 +31,7 @@ struct SpawnAreaEventDispatch : EventDispatch
{
typedef EventListenerFactory< SpawnArea, &SpawnArea::mSpawnedListener >
Factory;
- removed = &Factory::create< Thing, &SpawnArea::decrease >::function;
+ removed = &Factory::create< Entity, &SpawnArea::decrease >::function;
}
};
@@ -42,7 +42,7 @@ SpawnArea::SpawnArea(MapComposite *map,
const Rectangle &zone,
int maxBeings,
int spawnRate):
- Thing(OBJECT_OTHER, map),
+ Entity(OBJECT_OTHER, map),
mSpecy(specy),
mSpawnedListener(&spawnAreaEventDispatch),
mZone(zone),
@@ -125,7 +125,7 @@ void SpawnArea::update()
}
}
-void SpawnArea::decrease(Thing *t)
+void SpawnArea::decrease(Entity *t)
{
--mNumBeings;
t->removeListener(&mSpawnedListener);
diff --git a/src/game-server/spawnarea.h b/src/game-server/spawnarea.h
index 48bfede..cc0642f 100644
--- a/src/game-server/spawnarea.h
+++ b/src/game-server/spawnarea.h
@@ -22,7 +22,7 @@
#define SPAWNAREA_H
#include "game-server/eventlistener.h"
-#include "game-server/thing.h"
+#include "game-server/entity.h"
#include "utils/point.h"
class Being;
@@ -32,7 +32,7 @@ class MonsterClass;
* A spawn area, where monsters spawn. The area is a rectangular field and will
* spawn a certain number of a given monster type.
*/
-class SpawnArea : public Thing
+class SpawnArea : public Entity
{
public:
SpawnArea(MapComposite *, MonsterClass *, const Rectangle &zone,
@@ -43,7 +43,7 @@ class SpawnArea : public Thing
/**
* Keeps track of the number of spawned being.
*/
- void decrease(Thing *);
+ void decrease(Entity *);
private:
MonsterClass *mSpecy; /**< Specy of monster that spawns in this area. */
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index 0e7bea2..843bfad 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -482,7 +482,7 @@ void GameState::update(int worldTime)
delayedEvents.clear();
}
-bool GameState::insert(Thing *ptr)
+bool GameState::insert(Entity *ptr)
{
assert(!dbgLockObjects);
MapComposite *map = ptr->getMap();
@@ -550,7 +550,7 @@ bool GameState::insert(Thing *ptr)
case OBJECT_ACTOR:
case OBJECT_OTHER:
default:
- LOG_DEBUG("Thing inserted: " << obj->getType());
+ LOG_DEBUG("Entity inserted: " << obj->getType());
}
obj->raiseUpdateFlags(UPDATEFLAG_NEW_ON_MAP);
@@ -573,14 +573,14 @@ bool GameState::insert(Thing *ptr)
return true;
}
-bool GameState::insertOrDelete(Thing *ptr)
+bool GameState::insertOrDelete(Entity *ptr)
{
if (insert(ptr)) return true;
delete ptr;
return false;
}
-void GameState::remove(Thing *ptr)
+void GameState::remove(Entity *ptr)
{
assert(!dbgLockObjects);
MapComposite *map = ptr->getMap();
@@ -618,7 +618,7 @@ void GameState::remove(Thing *ptr)
case OBJECT_ACTOR:
case OBJECT_OTHER:
default:
- LOG_DEBUG("Thing removed: " << ptr->getType());
+ LOG_DEBUG("Entity removed: " << ptr->getType());
}
if (ptr->canMove())
diff --git a/src/game-server/state.h b/src/game-server/state.h
index 6fae5c8..ba87a76 100644
--- a/src/game-server/state.h
+++ b/src/game-server/state.h
@@ -24,7 +24,7 @@
#include <string>
class MapComposite;
-class Thing;
+class Entity;
class Actor;
class Character;
@@ -37,30 +37,30 @@ namespace GameState
void update(int worldTime);
/**
- * Inserts an thing in the game world.
- * @return false if the insertion failed and the thing is in limbo.
+ * Inserts an entity in the game world.
+ * @return false if the insertion failed and the entity is in limbo.
* @note No update may be in progress.
*/
- bool insert(Thing *)
+ bool insert(Entity *)
# ifdef __GNUC__
__attribute__((warn_unused_result))
# endif
;
/**
- * Inserts a thing in the game world. Deletes the thing if the insertion
+ * Inserts a entity in the game world. Deletes the entity if the insertion
* failed.
* @return false if the insertion failed.
* @note No update may be in progress. Invalid for characters.
*/
- bool insertOrDelete(Thing *);
+ bool insertOrDelete(Entity *);
/**
- * Removes a thing from the game world.
+ * Removes a entity from the game world.
* @note No update may be in progress.
- * @note The thing is not destroyed by this call.
+ * @note The entity is not destroyed by this call.
*/
- void remove(Thing *);
+ void remove(Entity *);
/**
* Warps a character between places of the game world.
@@ -78,7 +78,7 @@ namespace GameState
/**
* Enqueues a remove event.
* @note The event will be executed at end of update.
- * @note The thing will be destroyed at that time.
+ * @note The entity will be destroyed at that time.
*/
void enqueueRemove(Actor *);
diff --git a/src/game-server/trigger.h b/src/game-server/trigger.h
index 2a3aa61..fbd41fa 100644
--- a/src/game-server/trigger.h
+++ b/src/game-server/trigger.h
@@ -21,7 +21,7 @@
#ifndef TRIGGER_H
#define TRIGGER_H
-#include "game-server/thing.h"
+#include "game-server/entity.h"
#include "scripting/script.h"
#include "utils/point.h"
@@ -60,14 +60,14 @@ class ScriptAction : public TriggerAction
int mArg; // Argument passed to script function (meaning is function-specific)
};
-class TriggerArea : public Thing
+class TriggerArea : public Entity
{
public:
/**
* Creates a rectangular trigger for a given map.
*/
TriggerArea(MapComposite *m, const Rectangle &r, TriggerAction *ptr, bool once)
- : Thing(OBJECT_OTHER, m), mZone(r), mAction(ptr), mOnce(once) {}
+ : Entity(OBJECT_OTHER, m), mZone(r), mAction(ptr), mOnce(once) {}
virtual void update();
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 4767265..1900f5a 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -938,8 +938,8 @@ static int being_set_status_time(lua_State *s)
}
/**
- * being_type(Being*): ThingType
- * Returns the Thing type of the given being.
+ * being_type(Being*): EntityType
+ * Returns the entity type of the given being.
*/
static int being_type(lua_State *s)
{
diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp
index 3a45b3f..8ea78f7 100644
--- a/src/scripting/luascript.cpp
+++ b/src/scripting/luascript.cpp
@@ -86,7 +86,7 @@ void LuaScript::push(const std::string &v)
++nbArgs;
}
-void LuaScript::push(Thing *v)
+void LuaScript::push(Entity *v)
{
assert(nbArgs >= 0);
if (v)
@@ -235,30 +235,30 @@ void LuaScript::load(const char *prog, const char *name)
}
}
-void LuaScript::processDeathEvent(Being *being)
+void LuaScript::processDeathEvent(Being *entity)
{
if (mDeathNotificationCallback.isValid())
{
prepare(mDeathNotificationCallback);
- push(being);
+ push(entity);
//TODO: get and push a list of creatures who contributed to killing the
// being. This might be very interesting for scripting quests.
execute();
}
}
-void LuaScript::processRemoveEvent(Thing *being)
+void LuaScript::processRemoveEvent(Entity *entity)
{
if (mRemoveNotificationCallback.isValid())
{
prepare(mRemoveNotificationCallback);
- push(being);
+ push(entity);
//TODO: get and push a list of creatures who contributed to killing the
// being. This might be very interesting for scripting quests.
execute();
}
- being->removeListener(getScriptListener());
+ entity->removeListener(getScriptListener());
}
/**
diff --git a/src/scripting/luascript.h b/src/scripting/luascript.h
index 955fe21..7631d98 100644
--- a/src/scripting/luascript.h
+++ b/src/scripting/luascript.h
@@ -54,7 +54,7 @@ class LuaScript : public Script
void push(const std::string &);
- void push(Thing *);
+ void push(Entity *);
void push(const std::list<InventoryItem> &itemList);
@@ -75,9 +75,9 @@ class LuaScript : public Script
const std::string &letter,
Script *);
- void processDeathEvent(Being *thing);
+ void processDeathEvent(Being *entity);
- void processRemoveEvent(Thing *thing);
+ void processRemoveEvent(Entity *entity);
static void setDeathNotificationCallback(Script *script)
diff --git a/src/scripting/luautil.cpp b/src/scripting/luautil.cpp
index feed756..fd83b58 100644
--- a/src/scripting/luautil.cpp
+++ b/src/scripting/luautil.cpp
@@ -144,7 +144,7 @@ Character *getCharacter(lua_State *s, int p)
{
if (!lua_islightuserdata(s, p))
return 0;
- Thing *t = static_cast<Thing *>(lua_touserdata(s, p));
+ Entity *t = static_cast<Entity *>(lua_touserdata(s, p));
if (t->getType() != OBJECT_CHARACTER)
return 0;
return static_cast<Character *>(t);
@@ -174,7 +174,7 @@ Monster *getMonster(lua_State *s, int p)
{
if (!lua_islightuserdata(s, p))
return 0;
- Thing *t = static_cast<Thing *>(lua_touserdata(s, p));
+ Entity *t = static_cast<Entity *>(lua_touserdata(s, p));
if (t->getType() != OBJECT_MONSTER)
return 0;
return static_cast<Monster *>(t);
@@ -204,7 +204,7 @@ NPC *getNPC(lua_State *s, int p)
{
if (!lua_islightuserdata(s, p))
return 0;
- Thing *t = static_cast<Thing *>(lua_touserdata(s, p));
+ Entity *t = static_cast<Entity *>(lua_touserdata(s, p));
if (t->getType() != OBJECT_NPC)
return 0;
return static_cast<NPC *>(t);
@@ -309,7 +309,7 @@ void push(lua_State *s, const std::string &val)
lua_pushstring(s, val.c_str());
}
-void push(lua_State *s, Thing *val)
+void push(lua_State *s, Entity *val)
{
lua_pushlightuserdata(s, val);
}
diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h
index 86a748a..ee4ac31 100644
--- a/src/scripting/luautil.h
+++ b/src/scripting/luautil.h
@@ -45,7 +45,7 @@ class Monster;
class MonsterClass;
class NPC;
class StatusEffect;
-class Thing;
+class Entity;
// Report script errors and interrupt the script.
void raiseScriptError(lua_State *s, const char *format, ...);
@@ -182,7 +182,7 @@ Script::Thread* checkCurrentThread(lua_State *s, Script *script = 0);
Useful for templates.*/
void push(lua_State *s, int val);
void push(lua_State *s, const std::string &val);
-void push(lua_State *s, Thing *val);
+void push(lua_State *s, Entity *val);
void push(lua_State *s, double val);
inline void push(lua_State *s, MapObject *val)
diff --git a/src/scripting/script.h b/src/scripting/script.h
index f6d6d18..238bc34 100644
--- a/src/scripting/script.h
+++ b/src/scripting/script.h
@@ -30,7 +30,7 @@
#include <vector>
class MapComposite;
-class Thing;
+class Entity;
/**
* Abstract interface for calling functions written in an external language.
@@ -163,7 +163,7 @@ class Script
* scripting engine, if needed. This value will usually be passed
* by the script to some callback functions.
*/
- virtual void push(Thing *) = 0;
+ virtual void push(Entity *) = 0;
/**
* Pushes a list of items with amounts to the script engine.
@@ -219,9 +219,9 @@ class Script
EventListener *getScriptListener()
{ return &mEventListener; }
- virtual void processDeathEvent(Being *thing) = 0;
+ virtual void processDeathEvent(Being *entity) = 0;
- virtual void processRemoveEvent(Thing *thing) = 0;
+ virtual void processRemoveEvent(Entity *entity) = 0;
static void setCreateNpcDelayedCallback(Script *script)
{ script->assignCallback(mCreateNpcDelayedCallback); }
@@ -251,7 +251,7 @@ struct ScriptEventDispatch: EventDispatch
{
typedef EventListenerFactory< Script, &Script::mEventListener > Factory;
died = &Factory::create< Being, &Script::processDeathEvent >::function;
- removed = &Factory::create< Thing, &Script::processRemoveEvent >::function;
+ removed = &Factory::create< Entity, &Script::processRemoveEvent >::function;
}
};