Support for opening saves/scenarios in Windows by dropping them on the app icon
This commit is contained in:
@@ -23,8 +23,8 @@ extern fs::path file_in_mem;
|
||||
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*) sender;
|
||||
@end
|
||||
|
||||
void set_up_apple_events(); // Suppress "no prototype" warning
|
||||
void set_up_apple_events() {
|
||||
void set_up_apple_events(int argc, char* argv[]); // Suppress "no prototype" warning
|
||||
void set_up_apple_events(int, char*[]) {
|
||||
AppleEventHandler* aeHandler = [[AppleEventHandler alloc] init];
|
||||
[[NSApplication sharedApplication] setDelegate: aeHandler];
|
||||
}
|
||||
|
@@ -54,14 +54,14 @@ void Handle_Activate();
|
||||
void Handle_Update();
|
||||
void Mouse_Pressed();
|
||||
bool verify_restore_quit(std::string dlog);
|
||||
void set_up_apple_events();
|
||||
void set_up_apple_events(int argc, char* argv[]);
|
||||
extern bool cur_scen_is_mac;
|
||||
extern fs::path progDir;
|
||||
short specials_res_id;
|
||||
char start_name[256];
|
||||
|
||||
//MW specified return type was 'void', changed to ISO C style for Carbonisation -jmr
|
||||
int main(int /*argc*/, char* argv[]) {
|
||||
int main(int argc, char* argv[]) {
|
||||
try {
|
||||
init_directories(argv[0]);
|
||||
init_menubar();
|
||||
@@ -72,7 +72,7 @@ int main(int /*argc*/, char* argv[]) {
|
||||
init_graph_tool();
|
||||
init_snd_tool();
|
||||
|
||||
set_up_apple_events();
|
||||
set_up_apple_events(argc, argv);
|
||||
|
||||
cDialog::init();
|
||||
redraw_screen();
|
||||
|
@@ -170,3 +170,21 @@ LRESULT CALLBACK menuProc(HWND handle, UINT message, WPARAM wParam, LPARAM lPara
|
||||
}
|
||||
return CallWindowProc(reinterpret_cast<WNDPROC>(mainProc), handle, message, wParam, lParam);
|
||||
}
|
||||
|
||||
#include "fileio.hpp"
|
||||
#include "pc.fileio.hpp"
|
||||
|
||||
extern bool party_in_scen, scen_items_loaded;
|
||||
extern fs::path file_in_mem;
|
||||
void set_up_apple_events(int argc, char* argv[]) {
|
||||
if(argc > 1) {
|
||||
if(load_party(argv[1], univ)) {
|
||||
file_in_mem = argv[1];
|
||||
party_in_scen = !univ.party.scen_name.empty();
|
||||
if(!party_in_scen) load_base_item_defs();
|
||||
scen_items_loaded = true;
|
||||
update_item_menu();
|
||||
menu_activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user