summaryrefslogtreecommitdiff
path: root/src/scripting
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-16 23:20:38 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-04-04 20:18:50 +0200
commit4d84c4ffd2c4f25a67b2f094baf6ac81c68ebb07 (patch)
treecb6fc8a565689caaded7977fe249820a61dadee9 /src/scripting
parentb30e3355dbbd160ad77f2987b9758ad349830cac (diff)
downloadmanaserv-4d84c4ffd2c4f25a67b2f094baf6ac81c68ebb07.tar.gz
manaserv-4d84c4ffd2c4f25a67b2f094baf6ac81c68ebb07.tar.bz2
manaserv-4d84c4ffd2c4f25a67b2f094baf6ac81c68ebb07.tar.xz
manaserv-4d84c4ffd2c4f25a67b2f094baf6ac81c68ebb07.zip
Renamed Thing to Entity
In preparation for using an entity/component system for the entities in the game world, this name will be more recognizable and easier to talk about. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/scripting')
-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
6 files changed, 22 insertions, 22 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 47672659..1900f5ac 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 3a45b3fc..8ea78f7c 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 955fe21c..7631d982 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 feed7568..fd83b58b 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 86a748a4..ee4ac315 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 f6d6d180..238bc34c 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;
}
};