[Scummvm-cvs-logs] SF.net SVN: scummvm:[40182] scummvm/trunk/engines/sci/engine
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Apr 28 17:58:19 CEST 2009
Revision: 40182
http://scummvm.svn.sourceforge.net/scummvm/?rev=40182&view=rev
Author: fingolfin
Date: 2009-04-28 15:58:19 +0000 (Tue, 28 Apr 2009)
Log Message:
-----------
SCI: Renamed execution_stack -> _executionStack and turned it into a Common::Array
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/game.cpp
scummvm/trunk/engines/sci/engine/gc.cpp
scummvm/trunk/engines/sci/engine/kscripts.cpp
scummvm/trunk/engines/sci/engine/scriptconsole.cpp
scummvm/trunk/engines/sci/engine/scriptdebug.cpp
scummvm/trunk/engines/sci/engine/state.cpp
scummvm/trunk/engines/sci/engine/state.h
scummvm/trunk/engines/sci/engine/vm.cpp
Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp 2009-04-28 15:00:56 UTC (rev 40181)
+++ scummvm/trunk/engines/sci/engine/game.cpp 2009-04-28 15:58:19 UTC (rev 40182)
@@ -444,7 +444,7 @@
s->r_acc = s->r_prev = NULL_REG;
s->r_amp_rest = 0;
- s->execution_stack = NULL; // Start without any execution stack
+ s->_executionStack.clear(); // Start without any execution stack
s->execution_stack_base = -1; // No vm is running yet
s->execution_stack_pos = -1; // Start at execution stack position 0
@@ -620,7 +620,7 @@
}
int game_exit(EngineState *s) {
- free(s->execution_stack);
+ s->_executionStack.clear();
if (!s->successor) {
sfx_exit(&s->sound);
Modified: scummvm/trunk/engines/sci/engine/gc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/gc.cpp 2009-04-28 15:00:56 UTC (rev 40181)
+++ scummvm/trunk/engines/sci/engine/gc.cpp 2009-04-28 15:58:19 UTC (rev 40182)
@@ -153,10 +153,10 @@
// Init: Value Stack
// We do this one by hand since the stack doesn't know the current execution stack
{
- ExecStack *xs = s->execution_stack + s->execution_stack_pos;
+ ExecStack &xs = s->_executionStack[s->execution_stack_pos];
reg_t *pos;
- for (pos = s->stack_base; pos < xs->sp; pos++)
+ for (pos = s->stack_base; pos < xs.sp; pos++)
worklist_push(&worklist, nonnormal_map, *pos);
}
#ifdef DEBUG_GC_VERBOSE
@@ -165,13 +165,13 @@
// Init: Execution Stack
for (i = 0; i <= s->execution_stack_pos; i++) {
- ExecStack *es = s->execution_stack + i;
+ ExecStack &es = s->_executionStack[i];
- if (es->type != EXEC_STACK_TYPE_KERNEL) {
- worklist_push(&worklist, nonnormal_map, es->objp);
- worklist_push(&worklist, nonnormal_map, es->sendp);
- if (es->type == EXEC_STACK_TYPE_VARSELECTOR)
- worklist_push(&worklist, nonnormal_map, *(es->addr.varp));
+ if (es.type != EXEC_STACK_TYPE_KERNEL) {
+ worklist_push(&worklist, nonnormal_map, es.objp);
+ worklist_push(&worklist, nonnormal_map, es.sendp);
+ if (es.type == EXEC_STACK_TYPE_VARSELECTOR)
+ worklist_push(&worklist, nonnormal_map, *(es.addr.varp));
}
}
#ifdef DEBUG_GC_VERBOSE
Modified: scummvm/trunk/engines/sci/engine/kscripts.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kscripts.cpp 2009-04-28 15:00:56 UTC (rev 40181)
+++ scummvm/trunk/engines/sci/engine/kscripts.cpp 2009-04-28 15:58:19 UTC (rev 40182)
@@ -271,12 +271,12 @@
if (s->seg_manager->scriptIsLoaded(script, SCRIPT_ID)) {
int id = s->seg_manager->segGet(script);
- if (s->execution_stack[s->execution_stack_pos].addr.pc.segment != id)
+ if (s->_executionStack[s->execution_stack_pos].addr.pc.segment != id)
s->seg_manager->setLockers(1, script, SCRIPT_ID);
}
script_uninstantiate(s, script);
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
return s->r_acc;
}
Modified: scummvm/trunk/engines/sci/engine/scriptconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptconsole.cpp 2009-04-28 15:00:56 UTC (rev 40181)
+++ scummvm/trunk/engines/sci/engine/scriptconsole.cpp 2009-04-28 15:58:19 UTC (rev 40182)
@@ -227,10 +227,10 @@
rel_offsetting = 1;
if (!scumm_strnicmp(str + 1, "PC", 2)) {
- *dest = s->execution_stack[s->execution_stack_pos].addr.pc;
+ *dest = s->_executionStack[s->execution_stack_pos].addr.pc;
offsetting = str + 3;
} else if (!scumm_strnicmp(str + 1, "P", 1)) {
- *dest = s->execution_stack[s->execution_stack_pos].addr.pc;
+ *dest = s->_executionStack[s->execution_stack_pos].addr.pc;
offsetting = str + 2;
} else if (!scumm_strnicmp(str + 1, "PREV", 4)) {
*dest = s->r_prev;
@@ -242,10 +242,10 @@
*dest = s->r_acc;
offsetting = str + 2;
} else if (!scumm_strnicmp(str + 1, "OBJ", 3)) {
- *dest = s->execution_stack[s->execution_stack_pos].objp;
+ *dest = s->_executionStack[s->execution_stack_pos].objp;
offsetting = str + 4;
} else if (!scumm_strnicmp(str + 1, "O", 1)) {
- *dest = s->execution_stack[s->execution_stack_pos].objp;
+ *dest = s->_executionStack[s->execution_stack_pos].objp;
offsetting = str + 2;
} else
return 1; // No matching register
Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp 2009-04-28 15:00:56 UTC (rev 40181)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp 2009-04-28 15:58:19 UTC (rev 40182)
@@ -693,21 +693,16 @@
}
int c_debuginfo(EngineState *s) {
- ExecStack *eframe = NULL;
-
if (!_debugstate_valid) {
sciprintf("Not in debug state\n");
return 1;
}
- if (s->execution_stack && s->execution_stack_pos >= 0)
- eframe = s->execution_stack + s->execution_stack_pos;
-
sciprintf("acc="PREG" prev="PREG" &rest=%x\n", PRINT_REG(s->r_acc), PRINT_REG(s->r_prev), *p_restadjust);
- if (eframe)
+ if (!s->_executionStack.empty() && s->execution_stack_pos >= 0) {
sciprintf("pc="PREG" obj="PREG" fp="PSTK" sp="PSTK"\n", PRINT_REG(*p_pc), PRINT_REG(*p_objp), PRINT_STK(*p_pp), PRINT_STK(*p_sp));
- else
+ } else
sciprintf("<no execution stack: pc,obj,fp omitted>\n");
return 0;
@@ -1155,26 +1150,23 @@
}
int c_stack(EngineState *s) {
- int i;
- ExecStack *xs;
-
if (!s) {
sciprintf("Not in debug state\n");
return 1;
}
- if (s->execution_stack_pos >= 0)
- xs = s->execution_stack + s->execution_stack_pos;
- else {
+ if (s->execution_stack_pos < 0) {
sciprintf("No exec stack!");
return 1;
}
- for (i = cmd_params[0].val ; i > 0; i--) {
- if ((xs->sp - xs->fp - i) == 0)
+ ExecStack &xs = s->_executionStack[s->execution_stack_pos];
+
+ for (int i = cmd_params[0].val ; i > 0; i--) {
+ if ((xs.sp - xs.fp - i) == 0)
sciprintf("-- temp variables --\n");
- if (xs->sp - i >= s->stack_base)
- sciprintf(PSTK" = "PREG"\n", PRINT_STK(xs->sp - i), PRINT_REG(xs->sp[-i]));
+ if (xs.sp - i >= s->stack_base)
+ sciprintf(PSTK" = "PREG"\n", PRINT_STK(xs.sp - i), PRINT_REG(xs.sp[-i]));
}
return 0;
@@ -1547,58 +1539,58 @@
sciprintf("Call stack (current base: 0x%x):\n", s->execution_stack_base);
for (i = 0; i <= s->execution_stack_pos; i++) {
- ExecStack *call = &(s->execution_stack[i]);
- const char *objname = obj_get_name(s, call->sendp);
+ ExecStack &call = s->_executionStack[i];
+ const char *objname = obj_get_name(s, call.sendp);
int paramc, totalparamc;
- switch (call->type) {
+ switch (call.type) {
case EXEC_STACK_TYPE_CALL: {// Normal function
- sciprintf(" %x:[%x] %s::%s(", i, call->origin, objname, (call->selector == -1) ? "<call[be]?>" :
- selector_name(s, call->selector));
+ sciprintf(" %x:[%x] %s::%s(", i, call.origin, objname, (call.selector == -1) ? "<call[be]?>" :
+ selector_name(s, call.selector));
}
break;
case EXEC_STACK_TYPE_KERNEL: // Kernel function
- sciprintf(" %x:[%x] k%s(", i, call->origin, s->_kernelNames[-(call->selector)-42].c_str());
+ sciprintf(" %x:[%x] k%s(", i, call.origin, s->_kernelNames[-(call.selector)-42].c_str());
break;
case EXEC_STACK_TYPE_VARSELECTOR:
- sciprintf(" %x:[%x] vs%s %s::%s (", i, call->origin, (call->argc) ? "write" : "read",
- objname, s->_selectorNames[call->selector].c_str());
+ sciprintf(" %x:[%x] vs%s %s::%s (", i, call.origin, (call.argc) ? "write" : "read",
+ objname, s->_selectorNames[call.selector].c_str());
break;
}
- totalparamc = call->argc;
+ totalparamc = call.argc;
if (totalparamc > 16)
totalparamc = 16;
for (paramc = 1; paramc <= totalparamc; paramc++) {
- sciprintf(PREG, PRINT_REG(call->variables_argp[paramc]));
+ sciprintf(PREG, PRINT_REG(call.variables_argp[paramc]));
- if (paramc < call->argc)
+ if (paramc < call.argc)
sciprintf(", ");
}
- if (call->argc > 16)
+ if (call.argc > 16)
sciprintf("...");
- sciprintf(")\n obj@"PREG, PRINT_REG(call->objp));
- if (call->type == EXEC_STACK_TYPE_CALL) {
- sciprintf(" pc="PREG, PRINT_REG(call->addr.pc));
- if (call->sp == CALL_SP_CARRY)
+ sciprintf(")\n obj@"PREG, PRINT_REG(call.objp));
+ if (call.type == EXEC_STACK_TYPE_CALL) {
+ sciprintf(" pc="PREG, PRINT_REG(call.addr.pc));
+ if (call.sp == CALL_SP_CARRY)
sciprintf(" sp,fp:carry");
else {
- sciprintf(" sp="PSTK, PRINT_STK(call->sp));
- sciprintf(" fp="PSTK, PRINT_STK(call->fp));
+ sciprintf(" sp="PSTK, PRINT_STK(call.sp));
+ sciprintf(" fp="PSTK, PRINT_STK(call.fp));
}
} else
sciprintf(" pc:none");
- sciprintf(" argp:"PSTK, PRINT_STK(call->variables_argp));
- if (call->type == EXEC_STACK_TYPE_CALL)
- sciprintf(" script: %d", s->seg_manager->heap[call->addr.pc.segment]->data.script.nr);
+ sciprintf(" argp:"PSTK, PRINT_STK(call.variables_argp));
+ if (call.type == EXEC_STACK_TYPE_CALL)
+ sciprintf(" script: %d", s->seg_manager->heap[call.addr.pc.segment]->data.script.nr);
sciprintf("\n");
}
@@ -2153,7 +2145,7 @@
static int c_send(EngineState *s) {
reg_t object = cmd_params[0].reg;
char *selector_name = cmd_params[1].str;
- StackPtr stackframe = s->execution_stack->sp;
+ StackPtr stackframe = s->_executionStack[0].sp;
int selector_id;
unsigned int i;
ExecStack *xstack;
@@ -2187,8 +2179,8 @@
for (i = 2; i < cmd_paramlength; i++)
stackframe[i] = cmd_params[i].reg;
- xstack = add_exec_stack_entry(s, fptr, s->execution_stack->sp + cmd_paramlength, object, cmd_paramlength - 2,
- s->execution_stack->sp - 1, 0, object, s->execution_stack_pos, SCI_XS_CALLEE_LOCALS);
+ xstack = add_exec_stack_entry(s, fptr, s->_executionStack[0].sp + cmd_paramlength, object, cmd_paramlength - 2,
+ s->_executionStack[0].sp - 1, 0, object, s->execution_stack_pos, SCI_XS_CALLEE_LOCALS);
xstack->selector = selector_id;
xstack->type = selector_type == kSelectorVariable ? EXEC_STACK_TYPE_VARSELECTOR : EXEC_STACK_TYPE_CALL;
@@ -2198,7 +2190,7 @@
xstack->sp += cmd_paramlength;
xstack->fp += cmd_paramlength;
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
return 0;
}
@@ -2934,7 +2926,7 @@
return;
if ((op & 0x3) > 1)
return; // param or temp
- if ((op & 0x3) && s->execution_stack[s->execution_stack_pos].local_segment > 0)
+ if ((op & 0x3) && s->_executionStack[s->execution_stack_pos].local_segment > 0)
return; // locals and not running in script.000
if (paramf1 != _debug_seek_special)
return; // CORRECT global?
Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp 2009-04-28 15:00:56 UTC (rev 40181)
+++ scummvm/trunk/engines/sci/engine/state.cpp 2009-04-28 15:58:19 UTC (rev 40182)
@@ -111,11 +111,9 @@
kernel_opt_flags = 0;
- execution_stack = 0;
- execution_stack_size = 0;
execution_stack_pos = 0;
execution_stack_base = 0;
- execution_stack_pos_changed = 0;
+ _executionStackPosChanged = false;
r_acc = NULL_REG;
r_amp_rest = 0;
Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h 2009-04-28 15:00:56 UTC (rev 40181)
+++ scummvm/trunk/engines/sci/engine/state.h 2009-04-28 15:58:19 UTC (rev 40182)
@@ -209,15 +209,14 @@
/* VM Information */
- ExecStack *execution_stack; /**< The execution stack */
- int execution_stack_size; /**< Number of stack frames allocated */
+ Common::Array<ExecStack> _executionStack; /**< The execution stack */
int execution_stack_pos; /**< Position on the execution stack */
/**
* When called from kernel functions, the vm is re-started recursively on
* the same stack. This variable contains the stack base for the current vm.
*/
int execution_stack_base;
- int execution_stack_pos_changed; /**< Set to 1 if the execution stack position should be re-evaluated by the vm */
+ bool _executionStackPosChanged; /**< Set to true if the execution stack position should be re-evaluated by the vm */
reg_t r_acc; /**< Accumulator */
unsigned int r_amp_rest; /**< &rest register (only used for save games) */
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2009-04-28 15:00:56 UTC (rev 40181)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2009-04-28 15:58:19 UTC (rev 40182)
@@ -297,14 +297,14 @@
// Executes all varselector read/write ops on the TOS
// Now check the TOS to execute all varselector entries
if (s->execution_stack_pos >= 0)
- while (s->execution_stack[s->execution_stack_pos].type == EXEC_STACK_TYPE_VARSELECTOR) {
+ while (s->_executionStack[s->execution_stack_pos].type == EXEC_STACK_TYPE_VARSELECTOR) {
// varselector access?
- if (s->execution_stack[s->execution_stack_pos].argc) { // write?
- reg_t temp = s->execution_stack[s->execution_stack_pos].variables_argp[1];
- *(s->execution_stack[s->execution_stack_pos].addr.varp) = temp;
+ if (s->_executionStack[s->execution_stack_pos].argc) { // write?
+ reg_t temp = s->_executionStack[s->execution_stack_pos].variables_argp[1];
+ *(s->_executionStack[s->execution_stack_pos].addr.varp) = temp;
} else // No, read
- s->r_acc = *(s->execution_stack[s->execution_stack_pos].addr.varp);
+ s->r_acc = *(s->_executionStack[s->execution_stack_pos].addr.varp);
--(s->execution_stack_pos);
}
@@ -321,7 +321,6 @@
int selector;
int argc;
int origin = s->execution_stack_pos; // Origin: Used for debugging
- ExecStack *retval = s->execution_stack + s->execution_stack_pos;
int print_send_action = 0;
// We return a pointer to the new active ExecStack
@@ -460,18 +459,17 @@
while (!sendCalls.empty()) {
CallsStruct call = sendCalls.pop();
if (call.type == EXEC_STACK_TYPE_VARSELECTOR) // Write/read variable?
- retval = add_exec_stack_varselector(s, work_obj, call.argc, call.argp,
+ add_exec_stack_varselector(s, work_obj, call.argc, call.argp,
call.selector, call.address.var, origin);
else
- retval = add_exec_stack_entry(s, call.address.func, call.sp, work_obj,
+ add_exec_stack_entry(s, call.address.func, call.sp, work_obj,
call.argc, call.argp,
call.selector, send_obj, origin, SCI_XS_CALLEE_LOCALS);
}
_exec_varselectors(s);
- retval = s->execution_stack + s->execution_stack_pos;
- return retval;
+ return &(s->_executionStack[s->execution_stack_pos]);
}
ExecStack *add_exec_stack_varselector(EngineState *s, reg_t objp, int argc, StackPtr argp, Selector selector, reg_t *address, int origin) {
@@ -488,18 +486,15 @@
StackPtr argp, Selector selector, reg_t sendp, int origin, SegmentId locals_segment) {
// Returns new TOS element for the execution stack
// locals_segment may be -1 if derived from the called object
- ExecStack *xstack = NULL;
- if (!s->execution_stack)
- s->execution_stack = (ExecStack *)sci_malloc(sizeof(ExecStack) * (s->execution_stack_size = 16));
+ ++s->execution_stack_pos;
+ if (s->execution_stack_pos >= (int)s->_executionStack.size()) // Out of stack space?
+ s->_executionStack.resize(s->execution_stack_pos+1);
- if (++(s->execution_stack_pos) == s->execution_stack_size) // Out of stack space?
- s->execution_stack = (ExecStack*)sci_realloc(s->execution_stack, sizeof(ExecStack) * (s->execution_stack_size += 8));
+ //sciprintf("Exec stack: [%d/%d], origin %d, at %p\n", s->execution_stack_pos, s->_executionStack.size(), origin, s->execution_stack);
- //sciprintf("Exec stack: [%d/%d], origin %d, at %p\n", s->execution_stack_pos, s->execution_stack_size, origin, s->execution_stack);
+ ExecStack *xstack = &(s->_executionStack[s->execution_stack_pos]);
- xstack = s->execution_stack + s->execution_stack_pos;
-
xstack->objp = objp;
if (locals_segment != SCI_XS_CALLEE_LOCALS)
xstack->local_segment = locals_segment;
@@ -596,7 +591,7 @@
int restadjust = s->r_amp_rest;
// &rest adjusts the parameter count by this value
// Current execution data:
- ExecStack *xs = s->execution_stack + s->execution_stack_pos;
+ ExecStack *xs = &(s->_executionStack[s->execution_stack_pos]);
ExecStack *xs_new = NULL;
Object *obj = obj_get(s, xs->objp);
Script *local_script = script_locate_by_segment(s, xs->local_segment);
@@ -637,7 +632,7 @@
- s->execution_stack_pos_changed = 1; // Force initialization
+ s->_executionStackPosChanged = true; // Force initialization
while (1) {
byte opcode;
@@ -649,10 +644,10 @@
old_pc_offset = xs->addr.pc.offset;
- if (s->execution_stack_pos_changed) {
+ if (s->_executionStackPosChanged) {
Script *scr;
- xs = s->execution_stack + s->execution_stack_pos;
- s->execution_stack_pos_changed = 0;
+ xs = &(s->_executionStack[s->execution_stack_pos]);
+ s->_executionStackPosChanged = false;
scr = script_locate_by_segment(s, xs->addr.pc.segment);
if (!scr) {
@@ -1003,7 +998,7 @@
restadjust = 0; // Used up the &rest adjustment
xs->sp = call_base;
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
break;
}
@@ -1037,8 +1032,8 @@
// Calculate xs again: The kernel function might
// have spawned a new VM
- xs_new = s->execution_stack + s->execution_stack_pos;
- s->execution_stack_pos_changed = 1;
+ xs_new = &(s->_executionStack[s->execution_stack_pos]);
+ s->_executionStackPosChanged = true;
if (s->version >= SCI_VERSION_FTU_NEW_SCRIPT_HEADER)
restadjust = s->r_amp_rest;
@@ -1055,7 +1050,7 @@
xs_new = execute_method(s, 0, opparams[0], s_temp, xs->objp, xs->sp[0].offset, xs->sp);
restadjust = 0; // Used up the &rest adjustment
if (xs_new) // in case of error, keep old stack
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
break;
case 0x23: // calle
@@ -1068,21 +1063,21 @@
restadjust = 0; // Used up the &rest adjustment
if (xs_new) // in case of error, keep old stack
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
break;
case 0x24: // ret
do {
StackPtr old_sp2 = xs->sp;
StackPtr old_fp = xs->fp;
- ExecStack *old_xs = s->execution_stack + s->execution_stack_pos;
+ ExecStack *old_xs = &(s->_executionStack[s->execution_stack_pos]);
if (s->execution_stack_pos == s->execution_stack_base) { // Have we reached the base?
s->execution_stack_base = old_execution_stack_base; // Restore stack base
--(s->execution_stack_pos);
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
s->r_amp_rest = restadjust; // Update &rest
return; // "Hard" return
}
@@ -1098,8 +1093,8 @@
// Not reached the base, so let's do a soft return
--(s->execution_stack_pos);
xs = old_xs - 1;
- s->execution_stack_pos_changed = 1;
- xs = s->execution_stack + s->execution_stack_pos;
+ s->_executionStackPosChanged = true;
+ xs = &(s->_executionStack[s->execution_stack_pos]);
if (xs->sp == CALL_SP_CARRY // Used in sends to 'carry' the stack pointer
|| xs->type != EXEC_STACK_TYPE_CALL) {
@@ -1109,7 +1104,7 @@
} while (xs->type == EXEC_STACK_TYPE_VARSELECTOR);
// Iterate over all varselector accesses
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
xs_new = xs;
break;
@@ -1122,7 +1117,7 @@
xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp);
if (xs_new && xs_new != xs)
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
restadjust = 0;
@@ -1140,7 +1135,7 @@
xs_new = send_selector(s, xs->objp, xs->objp, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp);
if (xs_new && xs_new != xs)
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
restadjust = 0;
break;
@@ -1158,7 +1153,7 @@
xs_new = send_selector(s, r_temp, xs->objp, s_temp, (int)(opparams[1] >> 1) + (uint16)restadjust, xs->sp);
if (xs_new && xs_new != xs)
- s->execution_stack_pos_changed = 1;
+ s->_executionStackPosChanged = true;
restadjust = 0;
}
@@ -1457,12 +1452,12 @@
} // switch(opcode >> 1)
- if (s->execution_stack_pos_changed) // Force initialization
+ if (s->_executionStackPosChanged) // Force initialization
xs = xs_new;
#ifndef DISABLE_VALIDATIONS
- if (xs != s->execution_stack + s->execution_stack_pos) {
- sciprintf("Error: xs is stale (%d vs %d); last command was %02x\n", (int)(xs - s->execution_stack), s->execution_stack_pos, opnumber);
+ if (xs != &(s->_executionStack[s->execution_stack_pos])) {
+ sciprintf("Error: xs is stale (%d vs %d); last command was %02x\n", (int)(xs - &s->_executionStack[0]), s->execution_stack_pos, opnumber);
}
#endif
if (script_error_flag) {
@@ -2018,14 +2013,13 @@
EngineState *successor = NULL;
int game_is_finished = 0;
do {
- s->execution_stack_pos_changed = 0;
+ s->_executionStackPosChanged = false;
run_vm(s, (successor || restoring) ? 1 : 0);
if (s->restarting_flags & SCI_GAME_IS_RESTARTING_NOW) { // Restart was requested?
successor = NULL;
- free(s->execution_stack);
- s->execution_stack = NULL;
+ s->_executionStack.clear();
s->execution_stack_pos = -1;
- s->execution_stack_pos_changed = 0;
+ s->_executionStackPosChanged = false;
game_exit(s);
script_free_engine(s);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list