summaryrefslogtreecommitdiff
path: root/src/scripting/script.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-01 21:54:04 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-02 22:57:47 +0100
commitc0c208d4c29ff49f940e8a6c54adb26cc4e5eba3 (patch)
tree8de105c5e154912acf354bbe1bbf8509ac44e25a /src/scripting/script.h
parentba5b55f3eba0aa3898c5fe42de9838b22473c24a (diff)
downloadmanaserv-c0c208d4c29ff49f940e8a6c54adb26cc4e5eba3.tar.gz
manaserv-c0c208d4c29ff49f940e8a6c54adb26cc4e5eba3.tar.bz2
manaserv-c0c208d4c29ff49f940e8a6c54adb26cc4e5eba3.tar.xz
manaserv-c0c208d4c29ff49f940e8a6c54adb26cc4e5eba3.zip
Converted functions called by LuaScript to callbacks
This includes the quest reply, post reply, death notification and remove notification. Also, Script::Ref was changed from a typedef to a small class, automating initialization and making the check for validness clearer. Reviewed-by: Erik Schilling
Diffstat (limited to 'src/scripting/script.h')
-rw-r--r--src/scripting/script.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/scripting/script.h b/src/scripting/script.h
index b475a0f0..9cc50a1c 100644
--- a/src/scripting/script.h
+++ b/src/scripting/script.h
@@ -52,13 +52,16 @@ class Script
static Script *create(const std::string &engine);
/**
- * A reference to a script object. It's just an integer, but the
- * typedef makes the purpose of the variable clear.
- *
- * Variables of this type should be initialized to Script::NoRef.
- */
- typedef int Ref;
- static Ref NoRef;
+ * A reference to a script object. It wraps an integer value, but adds
+ * custom initialization and a definition of valid. It also makes the
+ * purpose clear.
+ */
+ class Ref {
+ public:
+ Ref() : value(-1) {}
+ bool isValid() const { return value != -1; }
+ int value;
+ };
Script();