mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 22:58:09 +00:00
DIRECTOR: LINGO: Properly compile scripts with mixed immediate code and definitions
This commit is contained in:
parent
c489e87bf3
commit
c3dde9220c
@ -1002,7 +1002,7 @@ void Lingo::c_whencode() {
|
||||
int entity = g_lingo->_currentEntityId;
|
||||
g_lingo->_currentEntityId = 0;
|
||||
|
||||
Symbol *sym = g_lingo->define(eventname, start, 0, NULL, end);
|
||||
Symbol *sym = g_lingo->define(eventname, start, 0, NULL, end, false); // Redefine, but not remove code
|
||||
|
||||
g_lingo->_currentEntityId = entity;
|
||||
|
||||
|
@ -212,7 +212,7 @@ void Lingo::cleanLocalVars() {
|
||||
g_lingo->_localvars = 0;
|
||||
}
|
||||
|
||||
Symbol *Lingo::define(Common::String &name, int start, int nargs, Common::String *prefix, int end) {
|
||||
Symbol *Lingo::define(Common::String &name, int start, int nargs, Common::String *prefix, int end, bool removeCode) {
|
||||
if (prefix)
|
||||
name = *prefix + "-" + name;
|
||||
|
||||
@ -244,6 +244,12 @@ Symbol *Lingo::define(Common::String &name, int start, int nargs, Common::String
|
||||
sym->nargs = nargs;
|
||||
sym->maxArgs = nargs;
|
||||
|
||||
// Now remove all defined code from the _currentScript
|
||||
if (removeCode)
|
||||
for (int i = end - 1; i >= start; i--) {
|
||||
_currentScript->remove_at(i);
|
||||
}
|
||||
|
||||
return sym;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ public:
|
||||
void popContext();
|
||||
Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
|
||||
void cleanLocalVars();
|
||||
Symbol *define(Common::String &s, int start, int nargs, Common::String *prefix = NULL, int end = -1);
|
||||
Symbol *define(Common::String &s, int start, int nargs, Common::String *prefix = NULL, int end = -1, bool removeCode = true);
|
||||
void processIf(int elselabel, int endlabel);
|
||||
|
||||
int alignTypes(Datum &d1, Datum &d2);
|
||||
|
Loading…
Reference in New Issue
Block a user