diff options
Diffstat (limited to 'src/scripting/script.h')
-rw-r--r-- | src/scripting/script.h | 17 |
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(); |