start implementing scenario editor launch function
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
bool cur_scen_is_mac = true;
|
||||
extern cCustomGraphics spec_scen_g;
|
||||
extern fs::path tempDir, scenDir, progDir;
|
||||
extern std::string last_load_file;
|
||||
|
||||
void load_spec_graphics_v1(fs::path scen_file);
|
||||
void load_spec_graphics_v2(int num_sheets);
|
||||
@@ -160,10 +161,19 @@ bool load_scenario(fs::path file_to_load, cScenario& scenario, bool only_header)
|
||||
showError("That is not a Blades of Exile scenario.");
|
||||
return false;
|
||||
} else try {
|
||||
if(fname.substr(dot) == ".boes")
|
||||
return load_scenario_v2(file_to_load, scenario, only_header);
|
||||
else if(fname.substr(dot) == ".exs")
|
||||
return load_scenario_v1(file_to_load, scenario, only_header);
|
||||
if(fname.substr(dot) == ".boes"){
|
||||
if(load_scenario_v2(file_to_load, scenario, only_header)){
|
||||
last_load_file = file_to_load.string();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}else if(fname.substr(dot) == ".exs"){
|
||||
if(load_scenario_v1(file_to_load, scenario, only_header)){
|
||||
last_load_file = file_to_load.string();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} catch(std::exception& x) {
|
||||
showError("There was an error loading the scenario. The details of the error are given below; you may be able to decompress the scenario package, fix the error, and repack it.", x.what());
|
||||
return false;
|
||||
|
||||
@@ -16,6 +16,7 @@ extern void update_item_menu();
|
||||
void load_base_item_defs();
|
||||
|
||||
extern fs::path progDir;
|
||||
std::string last_load_file = "Blades of Exile Save";
|
||||
|
||||
void leave_town() {
|
||||
univ.party.town_num = 200;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include "cli.hpp"
|
||||
|
||||
@@ -85,10 +87,17 @@ extern void set_up_apple_events();
|
||||
std::unordered_map<std::string, std::shared_ptr <iEventListener>> event_listeners;
|
||||
cDrawableManager drawable_mgr;
|
||||
|
||||
fs::path scenedit_dir;
|
||||
fs::path game_dir;
|
||||
fs::path game_binary;
|
||||
|
||||
void launch_scenario() {
|
||||
|
||||
}
|
||||
|
||||
//Changed to ISO C specified argument and return type.
|
||||
int main(int argc, char* argv[]) {
|
||||
try {
|
||||
|
||||
init_scened(argc, argv);
|
||||
|
||||
if(ae_loading)
|
||||
@@ -218,8 +227,24 @@ static void process_args(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
void init_game_paths(std::string binary_path) {
|
||||
fs::path path = binary_path;
|
||||
scenedit_dir = path.parent_path();
|
||||
game_dir = scenedit_dir;
|
||||
#ifdef SFML_SYSTEM_MACOS
|
||||
// Get the directory containing the app bundle
|
||||
game_dir = game_dir/".."/".."/"..";
|
||||
game_binary = game_dir/"Blades of Exile.app"/"Contents"/"MacOS"/"Blades of Exile";
|
||||
#elif SFML_SYSTEM_WINDOWS
|
||||
game_binary = game_dir/"Blades of Exile.exe";
|
||||
#elif SFML_SYSTEM_LINUX
|
||||
game_binary = game_dir/"Blades of Exile";
|
||||
#endif
|
||||
}
|
||||
|
||||
void init_scened(int argc, char* argv[]) {
|
||||
init_directories(argv[0]);
|
||||
init_game_paths(argv[0]);
|
||||
sync_prefs();
|
||||
adjust_windows(mainPtr, mainView);
|
||||
//init_menubar();
|
||||
@@ -425,6 +450,9 @@ void handle_menu_choice(eMenu item_hit) {
|
||||
editKey.k = key_selectall;
|
||||
isEdit = true;
|
||||
break;
|
||||
case eMenu::LAUNCH:
|
||||
launch_scenario();
|
||||
break;
|
||||
case eMenu::TOWN_CREATE:
|
||||
if(scenario.towns.size() >= 200) {
|
||||
showError("You have reached the limit of 200 towns you can have in one scenario.");
|
||||
|
||||
Reference in New Issue
Block a user