mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
SLUDGE: Move save game getter to StackHandler
This commit is contained in:
parent
fa72209845
commit
8ead8de284
@ -215,7 +215,7 @@ builtIn(getMatchingFiles) {
|
||||
fun->reg.varData.theStack->first = NULL;
|
||||
fun->reg.varData.theStack->last = NULL;
|
||||
fun->reg.varData.theStack->timesUsed = 1;
|
||||
if (!getSavedGamesStack(fun->reg.varData.theStack, newText))
|
||||
if (!fun->reg.varData.theStack->getSavedGamesStack(newText))
|
||||
return BR_ERROR;
|
||||
return BR_CONTINUE;
|
||||
}
|
||||
|
@ -144,8 +144,7 @@ int StackHandler::getStackSize() const {
|
||||
return r;
|
||||
}
|
||||
|
||||
bool getSavedGamesStack(StackHandler *sH, const Common::String &ext) {
|
||||
|
||||
bool StackHandler::getSavedGamesStack(const Common::String &ext) {
|
||||
// Make pattern
|
||||
uint len = ext.size();
|
||||
Common::String pattern = "*";
|
||||
@ -161,10 +160,10 @@ bool getSavedGamesStack(StackHandler *sH, const Common::String &ext) {
|
||||
for (it = sa.begin(); it != sa.end(); ++it) {
|
||||
(*it).erase((*it).size() - len, len);
|
||||
newName.makeTextVar((*it));
|
||||
if (!addVarToStack(newName, sH->first))
|
||||
if (!addVarToStack(newName, first))
|
||||
return false;
|
||||
if (sH->last == NULL)
|
||||
sH->last = sH->first;
|
||||
if (last == NULL)
|
||||
last = first;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -58,6 +58,7 @@ struct StackHandler {
|
||||
int timesUsed;
|
||||
|
||||
int getStackSize() const;
|
||||
bool getSavedGamesStack(const Common::String &ext);
|
||||
};
|
||||
|
||||
union VariableData {
|
||||
@ -137,7 +138,6 @@ bool addVarToStack(const Variable &va, VariableStack *&thisStack);
|
||||
bool addVarToStackQuick(Variable &va, VariableStack *&thisStack);
|
||||
void trimStack(VariableStack *&stack);
|
||||
int deleteVarFromStack(const Variable &va, VariableStack *&thisStack, bool allOfEm = false);
|
||||
bool getSavedGamesStack(StackHandler *sH, const Common::String &ext);
|
||||
|
||||
// load & save
|
||||
void saveStack(VariableStack *vs, Common::WriteStream *stream);
|
||||
|
Loading…
x
Reference in New Issue
Block a user