Mac PC Editor: Remove I menus in favour of Party -> Add Item
Also rename the menus to match Mac.
This commit is contained in:
@@ -94,7 +94,6 @@ int main(int argc, char* argv[]) {
|
||||
cDialog::init();
|
||||
redraw_screen();
|
||||
menu_activate();
|
||||
update_item_menu();
|
||||
|
||||
handle_events();
|
||||
|
||||
@@ -249,7 +248,6 @@ void handle_menu_choice(eMenu item_hit) {
|
||||
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();
|
||||
@@ -369,8 +367,13 @@ void handle_menu_choice(eMenu item_hit) {
|
||||
}
|
||||
cStringChoice dlog(strings, "Add which item?");
|
||||
auto choice = dlog.show(all_items.size());
|
||||
if(choice < all_items.size())
|
||||
handle_item_menu(all_items[choice]);
|
||||
if(choice < all_items.size()) {
|
||||
cItem store_i = all_items[choice];
|
||||
store_i.ident = true;
|
||||
if(!univ.party[current_active_pc].give_item(store_i,GIVE_ALLOW_OVERLOAD))
|
||||
showError("Sorry, that PC has no free inventory slots left! You'll have to either drop something or give it to a different PC.");
|
||||
else redraw_screen();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eMenu::EDIT_TRAITS:
|
||||
@@ -393,14 +396,6 @@ void handle_menu_choice(eMenu item_hit) {
|
||||
}
|
||||
}
|
||||
|
||||
void handle_item_menu(cItem& item) {
|
||||
cItem store_i = item;
|
||||
store_i.ident = true;
|
||||
if(!univ.party[current_active_pc].give_item(store_i,GIVE_ALLOW_OVERLOAD))
|
||||
showError("Sorry, that PC has no free inventory slots left! You'll have to either drop something or give it to a different PC.");
|
||||
else redraw_screen();
|
||||
}
|
||||
|
||||
bool verify_restore_quit(std::string dlog) {
|
||||
std::string choice;
|
||||
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#define BoE_pc_menus_h
|
||||
|
||||
void init_menubar();
|
||||
void update_item_menu();
|
||||
void menu_activate();
|
||||
|
||||
namespace sf { class Event; };
|
||||
@@ -30,7 +29,6 @@ enum class eMenu {
|
||||
EDIT_DAY, LEAVE_TOWN, RESET_TOWNS, ADD_OUT_MAPS, ADD_TOWN_MAPS, LEAVE_SCENARIO, SET_SDF,
|
||||
};
|
||||
|
||||
void handle_item_menu(class cItem& item);
|
||||
void handle_menu_choice(eMenu item_hit);
|
||||
|
||||
#endif
|
||||
|
@@ -15,9 +15,6 @@ void init_menubar() {
|
||||
menu_ptr.reset(new OpenBoEPCEditMenu(mainPtr));
|
||||
}
|
||||
|
||||
void update_item_menu() {
|
||||
}
|
||||
|
||||
void menu_activate() {
|
||||
menu_ptr->update_for_editor_state(!file_in_mem.empty(), party_in_scen);
|
||||
}
|
||||
|
@@ -93,9 +93,6 @@ void menu_activate() {
|
||||
}
|
||||
}
|
||||
|
||||
void update_item_menu() {
|
||||
}
|
||||
|
||||
bool menuBarProcessEvent(const sf::Event&) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -16,8 +16,7 @@ enum {
|
||||
FILE_MENU_POS = 0,
|
||||
PARTY_MENU_POS = 1,
|
||||
SCEN_MENU_POS = 2,
|
||||
ITEMS_MENU_POS = 3,
|
||||
HELP_MENU_POS = 7,
|
||||
HELP_MENU_POS = 3,
|
||||
};
|
||||
|
||||
extern sf::RenderWindow mainPtr;
|
||||
@@ -110,27 +109,6 @@ void init_menubar() {
|
||||
accel.build();
|
||||
}
|
||||
|
||||
void update_item_menu() {
|
||||
if(menuHandle == NULL) return;
|
||||
auto& item_list = univ.scenario.scen_items;
|
||||
int per_menu = 1 + (item_list.size() - 1) / 4;
|
||||
int per_col = 1 + (per_menu - 1) / 4;
|
||||
for(int j = 0; j < 4; j++) {
|
||||
HMENU items_menu = GetSubMenu(menuHandle, ITEMS_MENU_POS + j);
|
||||
while(GetMenuItemCount(items_menu)) RemoveMenu(items_menu, 0, MF_BYPOSITION);
|
||||
if(!scen_items_loaded) {
|
||||
AppendMenuA(items_menu, MF_STRING | MF_GRAYED, 1000, "Items Not Loaded");
|
||||
} else for(int i = 0; i < per_menu && i + j * per_menu < item_list.size(); i++) {
|
||||
cItem& item = item_list[i + j * per_menu];
|
||||
UINT flags = MF_STRING | MF_ENABLED;
|
||||
if(i % per_col == 0) flags |= MF_MENUBARBREAK;
|
||||
AppendMenuA(items_menu, flags, 1000 + j * per_menu + i, item.full_name.c_str());
|
||||
EnableMenuItem(items_menu, i, MF_BYPOSITION | (item.variety != eItemType::NO_ITEM ? MF_ENABLED : MF_GRAYED));
|
||||
}
|
||||
}
|
||||
DrawMenuBar(mainPtr.getSystemHandle());
|
||||
}
|
||||
|
||||
void menu_activate() {
|
||||
if(menuHandle == NULL) return;
|
||||
HMENU file_menu = GetSubMenu(menuHandle, FILE_MENU_POS);
|
||||
@@ -158,9 +136,7 @@ LRESULT CALLBACK menuProc(HWND handle, UINT message, WPARAM wParam, LPARAM lPara
|
||||
}
|
||||
if(message == WM_COMMAND) {
|
||||
int cmd = LOWORD(wParam);
|
||||
if(cmd >= 1000) { // Item menus
|
||||
handle_item_menu(univ.scenario.scen_items[cmd - 1000]);
|
||||
} else handle_menu_choice(menuChoices[cmd]);
|
||||
handle_menu_choice(menuChoices[cmd]);
|
||||
} else if(message == WM_SETCURSOR) {
|
||||
// Windows resets the cursor to an arrow whenever the mouse moves, unless we do this.
|
||||
// Note: By handling this message, sf::Window::setMouseCursorVisible() will NOT work.
|
||||
@@ -189,7 +165,6 @@ void set_up_apple_events(int argc, char* argv[]) {
|
||||
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