summaryrefslogtreecommitdiffstats
path: root/src/scripting/script.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-10 23:38:36 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-11 16:56:56 +0100
commitb822dcee52d15d41c4186a250e73b85b16c9dc39 (patch)
tree45515c75175b67fe458701f3a70bf0ee8b14bee5 /src/scripting/script.h
parent2dd3c5c06978584e3e076609554f225ffbabd3e2 (diff)
Removed the create_npc wrapper and the last two NPC callbacks
When creating an NPC, you now provide its optional talk and update functions directly rather than them being stored in a table on the Lua side and then called in response to a global callback. Also fixed an issue with a missing gender parameter to the delayed NPC creation callback used by NPCs defined on the map (found by Erik while reviewing this patch). Reviewed-by: Erik Schilling
Diffstat (limited to 'src/scripting/script.h')
-rw-r--r--src/scripting/script.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/scripting/script.h b/src/scripting/script.h
index b55f204..f6d6d18 100644
--- a/src/scripting/script.h
+++ b/src/scripting/script.h
@@ -22,6 +22,7 @@
#define SCRIPTING_SCRIPT_H
#include "common/inventorydata.h"
+#include "common/manaserv_protocol.h"
#include "game-server/eventlistener.h"
#include <list>
@@ -61,6 +62,7 @@ class Script
{
public:
Ref() : value(-1) {}
+ Ref(int value) : value(value) {}
bool isValid() const { return value != -1; }
int value;
};
@@ -111,7 +113,10 @@ class Script
* Loads a chunk of text and considers it as an NPC handler. This
* handler will later be used to create the given NPC.
*/
- virtual void loadNPC(const std::string &name, int id, int x, int y,
+ virtual void loadNPC(const std::string &name,
+ int id,
+ ManaServ::BeingGender gender,
+ int x, int y,
const char *);
/**
@@ -187,6 +192,12 @@ class Script
virtual void assignCallback(Ref &function) = 0;
/**
+ * Unreferences the script object given by \a ref, if any, and sets
+ * \a ref to invalid.
+ */
+ virtual void unref(Ref &ref) = 0;
+
+ /**
* Returns the currently executing thread, or null when no thread is
* currently executing.
*/