Fix #6169. variable was defined in class but treated as local to function in parts. This meant it wasn't being cleared properly when view was recreated (eg. changing language).

This commit is contained in:
Sacha 2014-05-28 17:04:26 +10:00
parent 06fda72701
commit 5394eb29c8
2 changed files with 4 additions and 5 deletions

View file

@ -40,10 +40,11 @@ static std::vector<std::string> cheatList;
static CWCheatEngine *cheatEngine2;
static std::deque<bool> bEnableCheat;
std::vector<std::string> CwCheatScreen::CreateCodeList() {
void CwCheatScreen::CreateCodeList() {
cheatEngine2 = new CWCheatEngine();
cheatList = cheatEngine2->GetCodesList();
bEnableCheat.clear();
formattedList_.clear();
for (size_t i = 0; i < cheatList.size(); i++) {
if (cheatList[i].substr(0, 3) == "_C1") {
formattedList_.push_back(cheatList[i].substr(4));
@ -55,15 +56,13 @@ std::vector<std::string> CwCheatScreen::CreateCodeList() {
}
}
delete cheatEngine2;
return formattedList_;
}
void CwCheatScreen::CreateViews() {
using namespace UI;
std::vector<std::string> formattedList_;
I18NCategory *k = GetI18NCategory("CwCheats");
I18NCategory *d = GetI18NCategory("Dialog");
formattedList_ = CreateCodeList();
CreateCodeList();
g_Config.bReloadCheats = true;
root_ = new LinearLayout(ORIENT_HORIZONTAL);
Margins actionMenuMargins(50, -15, 15, 0);

View file

@ -34,7 +34,7 @@ extern std::string gameTitle;
class CwCheatScreen : public UIDialogScreenWithBackground {
public:
CwCheatScreen() {}
std::vector<std::string> CreateCodeList();
void CreateCodeList();
std::ifstream is;
std::ofstream os;
void processFileOn(std::string activatedCheat);