mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
SLUDGE: Move FastArray getter to struct FastArrayHandler
This commit is contained in:
parent
399ff4788c
commit
dc18ec2fd0
@ -350,12 +350,8 @@ bool continueFunction(LoadedFunction *fun) {
|
||||
return false;
|
||||
Variable *grab =
|
||||
(fun->stack->thisVar.varType == SVT_FASTARRAY) ?
|
||||
fastArrayGetByIndex(
|
||||
fun->stack->thisVar.varData.fastArray,
|
||||
ii) :
|
||||
stackGetByIndex(
|
||||
fun->stack->thisVar.varData.theStack->first,
|
||||
ii);
|
||||
fun->stack->thisVar.varData.fastArray->fastArrayGetByIndex(ii) :
|
||||
stackGetByIndex(fun->stack->thisVar.varData.theStack->first, ii);
|
||||
|
||||
trimStack(fun->stack);
|
||||
|
||||
@ -414,8 +410,7 @@ bool continueFunction(LoadedFunction *fun) {
|
||||
int ii;
|
||||
if (!fun->reg.getValueType(ii, SVT_INT))
|
||||
return false;
|
||||
Variable *v = fastArrayGetByIndex(
|
||||
fun->stack->thisVar.varData.fastArray, ii);
|
||||
Variable *v = fun->stack->thisVar.varData.fastArray->fastArrayGetByIndex(ii);
|
||||
if (v == NULL)
|
||||
return fatal("Not within bounds of fast array.");
|
||||
if (!v->copyFrom(fun->stack->next->thisVar))
|
||||
|
@ -380,10 +380,10 @@ bool Variable::copyFrom(const Variable &from) {
|
||||
return copyMain(from);
|
||||
}
|
||||
|
||||
Variable *fastArrayGetByIndex(FastArrayHandler *vS, uint theIndex) {
|
||||
if ((int)theIndex >= vS->size)
|
||||
Variable *FastArrayHandler::fastArrayGetByIndex(uint theIndex) {
|
||||
if ((int)theIndex >= size)
|
||||
return NULL;
|
||||
return &vS->fastVariables[theIndex];
|
||||
return &fastVariables[theIndex];
|
||||
}
|
||||
|
||||
bool Variable::makeFastArraySize(int size) {
|
||||
|
@ -48,6 +48,8 @@ struct FastArrayHandler {
|
||||
struct Variable *fastVariables;
|
||||
int size;
|
||||
int timesUsed;
|
||||
|
||||
Variable *fastArrayGetByIndex(uint theIndex);
|
||||
};
|
||||
|
||||
struct StackHandler {
|
||||
@ -131,8 +133,6 @@ bool stackSetByIndex(VariableStack *, uint, const Variable &);
|
||||
Variable *stackGetByIndex(VariableStack *, uint);
|
||||
bool getSavedGamesStack(StackHandler *sH, const Common::String &ext);
|
||||
|
||||
Variable *fastArrayGetByIndex(FastArrayHandler *vS, uint theIndex);
|
||||
|
||||
// load & save
|
||||
void saveStack(VariableStack *vs, Common::WriteStream *stream);
|
||||
VariableStack *loadStack(Common::SeekableReadStream *stream, VariableStack **last);
|
||||
|
Loading…
Reference in New Issue
Block a user