Skip to content

Commit 85e1c60

Browse files
committed
Save Entries Refresh Info Fix
- Remember the button that was actually clicked
1 parent 105f0c9 commit 85e1c60

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/games/cclcc/savemenu.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "../../inputsystem.h"
88
#include "../../vm/interface/input.h"
99
#include "../../ui/widgets/button.h"
10-
#include "../../ui/widgets/cclcc/saveentrybutton.h"
1110
#include "../../data/savesystem.h"
1211
#include "../../profile/game.h"
1312
#include "../../games/cclcc/savesystem.h"
@@ -35,7 +34,7 @@ void SaveMenu::MenuButtonOnClick(Widgets::Button* target) {
3534
ScrWork[SW_SAVEFILETYPE] = (int)saveType;
3635
ScrWork[SW_SAVEFILESTATUS] =
3736
SaveSystem::GetSaveStatus(saveType, ScrWork[SW_SAVEFILENO]);
38-
37+
ClickedSaveButton = static_cast<SaveEntryButton*>(target);
3938
ChoiceMade = true;
4039
SetFlag(SF_SAVEPROTECTED,
4140
SaveSystem::GetSaveFlags(saveType, ScrWork[SW_SAVEFILENO]) &
@@ -384,8 +383,8 @@ void SaveMenu::Render() {
384383
}
385384

386385
void SaveMenu::RefreshCurrentEntryInfo() {
387-
if (!CurrentlyFocusedElement) return;
388-
static_cast<SaveEntryButton*>(CurrentlyFocusedElement)->RefreshInfo();
386+
if (!ClickedSaveButton) return;
387+
ClickedSaveButton->RefreshInfo();
389388
}
390389

391390
} // namespace CCLCC

src/games/cclcc/savemenu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
#include "../../ui/widgets/button.h"
66
#include "../../ui/savemenu.h"
77
#include "../../profile/games/cclcc/savemenu.h"
8+
#include "../../ui/widgets/cclcc/saveentrybutton.h"
89

910
namespace Impacto {
1011
namespace UI {
1112
namespace CCLCC {
13+
using namespace Impacto::UI::Widgets::CCLCC;
1214

1315
class SaveMenu : public UI::SaveMenu {
1416
public:
@@ -28,6 +30,7 @@ class SaveMenu : public UI::SaveMenu {
2830
int PrevPage = 0;
2931
int CurrentPage = 0;
3032
Widgets::Group* MainItems[Profile::CCLCC::SaveMenu::Pages]{};
33+
SaveEntryButton* ClickedSaveButton = 0;
3134
Animation FadeAnimation;
3235
Animation PageAnimation;
3336
bool HasCleared = true;

src/games/chlcc/savemenu.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void SaveMenu::MenuButtonOnClick(Widgets::Button* target) {
3737
SetFlag(SF_SAVEPROTECTED,
3838
SaveSystem::GetSaveFlags(EntryType, ScrWork[SW_SAVEFILENO]) &
3939
SaveSystem::SaveFlagsMode::WriteProtect);
40+
ClickedSaveButton = static_cast<SaveEntryButton*>(target);
4041
ChoiceMade = true;
4142
}
4243
}
@@ -69,7 +70,7 @@ SaveMenu::SaveMenu() : UI::SaveMenu() {
6970
// Quick Save Pages initialization
7071

7172
for (int i = 0; i < Pages; i++) {
72-
MainItems = new Widgets::Group(this);
73+
Widgets::Group* MainItems = new Widgets::Group(this);
7374
MainItems->WrapFocus = false;
7475

7576
for (int j = 0; j < EntriesPerPage; j++) {
@@ -129,7 +130,7 @@ SaveMenu::SaveMenu() : UI::SaveMenu() {
129130
// Full Save Pages initialization
130131

131132
for (int i = 0; i < Pages; i++) {
132-
MainItems = new Widgets::Group(this);
133+
Widgets::Group* MainItems = new Widgets::Group(this);
133134
MainItems->WrapFocus = false;
134135

135136
for (int j = 0; j < EntriesPerPage; j++) {
@@ -541,9 +542,8 @@ void SaveMenu::UpdateTitles() {
541542
}
542543

543544
void SaveMenu::RefreshCurrentEntryInfo() {
544-
if (!CurrentlyFocusedElement) return;
545-
static_cast<SaveEntryButton*>(CurrentlyFocusedElement)
546-
->RefreshInfo(EntryType);
545+
if (!ClickedSaveButton) return;
546+
ClickedSaveButton->RefreshInfo(EntryType);
547547
}
548548

549549
} // namespace CHLCC

src/games/chlcc/savemenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class SaveMenu : public UI::SaveMenu {
4646
std::vector<Widgets::Group*> FullSavePages;
4747
std::vector<Widgets::Group*> QuickSavePages;
4848
std::vector<Widgets::Group*>* SavePages;
49-
Widgets::Group* MainItems;
49+
SaveEntryButton* ClickedSaveButton = 0;
5050
Animation MenuTransition;
5151
Animation TitleFade;
5252
Animation SelectDataTextFade;

0 commit comments

Comments
 (0)