mirror of https://github.com/OpenTTD/OpenTTD
Codechange: [OSX] Drain autoreleased objects in each game loop cycle.
parent
8aaf4ea098
commit
60f30036f1
|
@ -203,6 +203,7 @@ bool CocoaSetupApplication()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Become the front process, important when start from the command line. */
|
/* Become the front process, important when start from the command line. */
|
||||||
|
[ [ NSApplication sharedApplication ] setActivationPolicy:NSApplicationActivationPolicyRegular ];
|
||||||
[ [ NSApplication sharedApplication ] activateIgnoringOtherApps:YES ];
|
[ [ NSApplication sharedApplication ] activateIgnoringOtherApps:YES ];
|
||||||
|
|
||||||
/* Set up the menubar */
|
/* Set up the menubar */
|
||||||
|
@ -247,6 +248,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@autoreleasepool {
|
||||||
NSAlert *alert = [ [ NSAlert alloc ] init ];
|
NSAlert *alert = [ [ NSAlert alloc ] init ];
|
||||||
[ alert setAlertStyle: NSCriticalAlertStyle ];
|
[ alert setAlertStyle: NSCriticalAlertStyle ];
|
||||||
[ alert setMessageText:[ NSString stringWithUTF8String:title ] ];
|
[ alert setMessageText:[ NSString stringWithUTF8String:title ] ];
|
||||||
|
@ -254,8 +256,9 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||||
[ alert addButtonWithTitle: [ NSString stringWithUTF8String:buttonLabel ] ];
|
[ alert addButtonWithTitle: [ NSString stringWithUTF8String:buttonLabel ] ];
|
||||||
[ alert runModal ];
|
[ alert runModal ];
|
||||||
[ alert release ];
|
[ alert release ];
|
||||||
|
}
|
||||||
|
|
||||||
if (!wasstarted && VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop();
|
if (!wasstarted && VideoDriver::GetInstance() != nullptr) VideoDriver::GetInstance()->Stop();
|
||||||
|
|
||||||
_cocoa_video_dialog = false;
|
_cocoa_video_dialog = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -609,6 +609,8 @@ void VideoDriver_Cocoa::GameLoop()
|
||||||
this->Draw(true);
|
this->Draw(true);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
|
uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
|
||||||
InteractiveRandom(); // randomness
|
InteractiveRandom(); // randomness
|
||||||
|
|
||||||
|
@ -662,6 +664,7 @@ void VideoDriver_Cocoa::GameLoop()
|
||||||
this->Draw();
|
this->Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
uint32 et = GetTick();
|
uint32 et = GetTick();
|
||||||
|
|
Loading…
Reference in New Issue