aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-code.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-06-24 19:09:45 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit0f3f6ba7ebefa48071f2ddddc1f1f7febd4242fe (patch)
treed5776c3f4c28e96fa3b98a0a21eac4468153ef4a /engines/director/lingo/lingo-code.cpp
parent1cf381db2aab7567e977fdc34dfc2a4598080694 (diff)
downloadscummvm-rg350-0f3f6ba7ebefa48071f2ddddc1f1f7febd4242fe.tar.gz
scummvm-rg350-0f3f6ba7ebefa48071f2ddddc1f1f7febd4242fe.tar.bz2
scummvm-rg350-0f3f6ba7ebefa48071f2ddddc1f1f7febd4242fe.zip
DIRECTOR: Lingo: Initial implementation of the handler define() method
Diffstat (limited to 'engines/director/lingo/lingo-code.cpp')
-rw-r--r--engines/director/lingo/lingo-code.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 8483861d46..e3d1b1675c 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -376,8 +376,26 @@ void Lingo::c_gotoprevious() {
warning("STUB: c_gotoprevious()");
}
-void Lingo::define(Common::String &s, int nargs) {
- warning("STUB: define(\"%s\", %d)", s.c_str(), nargs);
+void Lingo::define(Common::String &name, int start, int end, int nargs) {
+ warning("STUB: define(\"%s\", %d, %d, %d)", name.c_str(), start, end, nargs);
+
+ Symbol *sym;
+
+ if (!_handlers.contains(name)) { // Create variable if it was not defined
+ sym = new Symbol;
+
+ delete sym->u.defn;
+
+ _handlers[name] = sym;
+ } else {
+ sym = g_lingo->_handlers[name];
+
+ sym->name = (char *)calloc(name.size() + 1, 1);
+ Common::strlcpy(sym->name, name.c_str(), name.size() + 1);
+ sym->type = HANDLER;
+ }
+
+ sym->u.defn = new ScriptData(&(*_currentScript)[start], end - start + 1);
}
void Lingo::codeArg(Common::String &s) {