Populate item menus in PC editor (they're not functional yet though)
This commit is contained in:
@@ -217,11 +217,11 @@ short init_data(short flag)
|
||||
}
|
||||
|
||||
void load_base_item_defs(){
|
||||
fs::path basePath = progDir/"Scenario Editor"/"BoE Bases"/"bladbase.exs";
|
||||
load_scenario(basePath, true);
|
||||
fs::path basePath = progDir/"data"/"BoE Bases"/"bladbase.exs";
|
||||
scen_items_loaded = load_scenario(basePath, true);
|
||||
}
|
||||
|
||||
bool load_scen_item_defs(std::string scen_name){
|
||||
fs::path scenPath = progDir/"Blades of Exile Scenarios"/(scen_name + ".exs");
|
||||
fs::path scenPath = progDir/"Blades of Exile Scenarios"/scen_name;
|
||||
return load_scenario(scenPath, true);
|
||||
}
|
||||
|
@@ -9,3 +9,5 @@ short init_data(short flag);
|
||||
//void save_prefs();
|
||||
void remove_party_from_scen();
|
||||
void init_directories();
|
||||
void load_base_item_defs();
|
||||
bool load_scen_item_defs(std::string scen_name);
|
||||
|
@@ -227,8 +227,14 @@ void handle_file_menu(int item_hit)
|
||||
if(verify_restore_quit(true)){
|
||||
file = nav_get_party();
|
||||
if(!file.empty()) {
|
||||
if(load_party(file))
|
||||
if(load_party(file)) {
|
||||
file_in_mem = file;
|
||||
party_in_scen = !univ.party.scen_name.empty();
|
||||
if(party_in_scen && load_scen_item_defs(univ.party.scen_name))
|
||||
scen_items_loaded = true;
|
||||
else load_base_item_defs();
|
||||
update_item_menu();
|
||||
}
|
||||
}
|
||||
menu_activate();
|
||||
}
|
||||
|
@@ -527,6 +527,7 @@
|
||||
<object class="NSMenu" key="NSSubmenu" id="13814608">
|
||||
<string key="NSTitle">Items 2</string>
|
||||
<array class="NSMutableArray" key="NSMenuItems"/>
|
||||
<bool key="NSNoAutoenable">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="978930519">
|
||||
@@ -540,6 +541,7 @@
|
||||
<object class="NSMenu" key="NSSubmenu" id="31045861">
|
||||
<string key="NSTitle">Items 3</string>
|
||||
<array class="NSMutableArray" key="NSMenuItems"/>
|
||||
<bool key="NSNoAutoenable">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="1010608296">
|
||||
@@ -553,6 +555,7 @@
|
||||
<object class="NSMenu" key="NSSubmenu" id="188992829">
|
||||
<string key="NSTitle">Items 4</string>
|
||||
<array class="NSMutableArray" key="NSMenuItems"/>
|
||||
<bool key="NSNoAutoenable">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="391199113">
|
||||
|
@@ -25,6 +25,7 @@ extern void handle_item_menu(int item_hit);
|
||||
|
||||
extern cScenario scenario;
|
||||
extern fs::path file_in_mem;
|
||||
extern bool scen_items_loaded;
|
||||
MenuHandle menu_bar_handle;
|
||||
MenuHandle apple_menu, file_menu, reg_menu, extra_menu, items_menu[4];
|
||||
|
||||
@@ -75,6 +76,7 @@ void init_menubar() {
|
||||
for(int i = 0; i < [extra_menu numberOfItems]; i++)
|
||||
setMenuCallback([extra_menu itemAtIndex: i], handler, @selector(specMenu:), i + 1);
|
||||
|
||||
update_item_menu();
|
||||
menu_activate();
|
||||
}
|
||||
|
||||
@@ -91,11 +93,15 @@ void update_item_menu() {
|
||||
cItemRec(& item_list)[400] = scenario.scen_items;
|
||||
for(int j = 0; j < 4; j++){
|
||||
[items_menu[j] removeAllItems];
|
||||
for(int i = 0; i < 100; i++) {
|
||||
if(!scen_items_loaded) {
|
||||
[[items_menu[j] addItemWithTitle: @"Items Not Loaded" action: @selector(itemMenu:) keyEquivalent: @""] setEnabled: NO];
|
||||
} else for(int i = 0; i < 100; i++) {
|
||||
ItemWrapper* item = [ItemWrapper withItem: i + 100 * j];
|
||||
NSString* item_name = [NSString stringWithCString: item_list[i + j * 100].full_name.c_str() encoding: NSASCIIStringEncoding];
|
||||
NSMenuItem* choice = [items_menu[j] addItemWithTitle: item_name action: @selector(itemMenu:) keyEquivalent: nil];
|
||||
NSMenuItem* choice = [items_menu[j] addItemWithTitle: item_name action: @selector(itemMenu:) keyEquivalent: @""];
|
||||
[choice setTarget: targ];
|
||||
// TODO: Also disable gold or food
|
||||
[choice setEnabled: [item item].variety > 0];
|
||||
[choice setRepresentedObject: item];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user