Skip to content

Commit f857edc

Browse files
committed
Ensuring guiScreen is updated before guiSelectedRowChanged can fire
1 parent 10a5377 commit f857edc

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/Core/Entities/PlayerEntity.m

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8876,7 +8876,9 @@ - (void) setGuiToGameOptionsScreen
88768876

88778877
[[UNIVERSE gameView] clearMouse];
88788878
[[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
8879-
8879+
8880+
gui_screen = GUI_SCREEN_GAMEOPTIONS;
8881+
88808882
// GUI stuff
88818883
{
88828884
#define OO_SETACCESSCONDITIONFORROW(condition, row) \
@@ -9139,7 +9141,6 @@ - (void) setGuiToGameOptionsScreen
91399141
/* ends */
91409142

91419143
[self setShowDemoShips:NO];
9142-
gui_screen = GUI_SCREEN_GAMEOPTIONS;
91439144

91449145
[self setShowDemoShips:NO];
91459146
[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
@@ -9155,6 +9156,8 @@ - (void) setGuiToLoadSaveScreen
91559156

91569157
[[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
91579158

9159+
gui_screen = GUI_SCREEN_OPTIONS;
9160+
91589161
if ([self status] == STATUS_DOCKED)
91599162
{
91609163
if ([self dockedStation] == nil) [self setDockedAtMainStation];
@@ -9232,7 +9235,6 @@ - (void) setGuiToLoadSaveScreen
92329235
[[UNIVERSE gameView] clearMouse];
92339236

92349237
[self setShowDemoShips:NO];
9235-
gui_screen = GUI_SCREEN_OPTIONS;
92369238

92379239
[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
92389240

@@ -9439,6 +9441,8 @@ - (void) setGuiToEquipShipScreen:(int)skipParam selectingFacingFor:(NSString *)e
94399441
BOOL weaponMounted = NO;
94409442
BOOL guiChanged = (gui_screen != GUI_SCREEN_EQUIP_SHIP);
94419443

9444+
gui_screen = GUI_SCREEN_EQUIP_SHIP;
9445+
94429446
[gui clearAndKeepBackground:!guiChanged];
94439447
[gui setTitle:DESC(@"equip-title")];
94449448

@@ -9685,7 +9689,6 @@ - (void) setGuiToEquipShipScreen:(int)skipParam selectingFacingFor:(NSString *)e
96859689

96869690
chosen_weapon_facing = WEAPON_FACING_NONE;
96879691
[self setShowDemoShips:NO];
9688-
gui_screen = GUI_SCREEN_EQUIP_SHIP;
96899692

96909693
[self setShowDemoShips:NO];
96919694
[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
@@ -9752,7 +9755,9 @@ - (void) setGuiToInterfacesScreen:(int)skip
97529755
NSDictionary *interfaces = [[self dockedStation] localInterfaces];
97539756
NSArray *interfaceKeys = [interfaces keysSortedByValueUsingSelector:@selector(interfaceCompare:)]; // sorts by category, then title
97549757
int i;
9755-
9758+
9759+
OOGUIScreenID oldScreen = gui_screen;
9760+
97569761
// GUI stuff
97579762
{
97589763
GuiDisplayGen *gui = [UNIVERSE gui];
@@ -9763,6 +9768,8 @@ - (void) setGuiToInterfacesScreen:(int)skip
97639768
[gui clearAndKeepBackground:!guiChanged];
97649769
[gui setTitle:DESC(@"interfaces-title")];
97659770

9771+
gui_screen = GUI_SCREEN_INTERFACES;
9772+
97669773

97679774
OOGUITabSettings tab_stops;
97689775
tab_stops[0] = 0;
@@ -9856,8 +9863,6 @@ - (void) setGuiToInterfacesScreen:(int)skip
98569863

98579864
[self setShowDemoShips:NO];
98589865

9859-
OOGUIScreenID oldScreen = gui_screen;
9860-
gui_screen = GUI_SCREEN_INTERFACES;
98619866
[self noteGUIDidChangeFrom:oldScreen to:gui_screen];
98629867

98639868
[self setShowDemoShips:NO];

src/Core/Entities/PlayerEntityLoadSave.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ - (void) setGuiToScenarioScreen:(int)page
259259
++row;
260260
}
261261

262+
gui_screen = GUI_SCREEN_NEWGAME;
263+
262264
[gui setSelectableRange:NSMakeRange(start_row - 2,3 + row - start_row)];
263265
[gui setSelectedRow:start_row];
264266
[self showScenarioDetails];
265-
266-
gui_screen = GUI_SCREEN_NEWGAME;
267267

268268
if (guiChanged)
269269
{

0 commit comments

Comments
 (0)