void Command_Processor::Select_Venue() { Menu* menu = new Menu("Select Venue"); for (int i = 0; i < *nr_venues; ++i) { menu->Add_Command(venues[i]->Name()); } menu->Add_Command("Cancel"); const string* venue_name = menu->Get_Command(); // Find venue with this name for (int i = 0; i <= *nr_venues; ++i) { if (i < *nr_venues) { if (venues[i]->Name() == *venue_name) { selected_venue = venues[i]; command_state = State_Selected; return; } } else { command_state = Initial; return; } } // Should never reach this point. cout << "Error in Command_Processor::Select_Venue()\n"; }
void CommandProcessor::Create_Menus(Venue **venues, int num_venues) { // Menu for Initial command state Menu* menu = new Menu("Enter command number"); menu->Add_Command("Select Venue"); menu->Add_Command("Quit"); menus[Initial] = menu; // Menu for Venue Selected menu = new Menu("Select Venue"); for (int i = 0; i < num_venues; i++) { menu->Add_Command(venues[i]->Name()); } menu->Add_Command("Cancel"); menus[Venue_Option] = menu; menu = new Menu("Enter command number"); menu->Add_Command("Display Venue"); menu->Add_Command("Select Show"); menu->Add_Command("Change Venue"); menu->Add_Command("Quit"); menus[Venue_Selected] = menu; }
void CommandProcessor::Select_Venue() { Menu* menu = new Menu("Select Venue"); for (int i = 0; i < nr_venues; ++i) { menu->Add_Command(venues[i]->Name()); } const string* venue_name = menu->Get_Command(); // Find Venue with this name for (int i = 0; i < nr_venues; ++i) { if (venues[i]->Name() == *venue_name) { selected_venue = venues[i]; //command_state = Venue_Selected; command_state = Venue_Option; return; } } // Should never reach this point. cout << "Error in Command_Processor::Select_State()\n"; }
void Command_Processor::Create_Menus() { // Menu for Initial command state Menu* menu = new Menu("Enter command number"); menu->Add_Command("Select Venue"); menu->Add_Command("Quit"); menus[0] = menu; // Menu for Venue Selected menu = new Menu("Enter command number"); menu->Add_Command("Display Venue"); menu->Add_Command("Select Show"); menu->Add_Command("Change Venue"); menu->Add_Command("Quit"); menus[1] = menu; }