| 119 | } |
| 120 | |
| 121 | bool MenuModeReplay::launchSelectedButtonPressed(const CEGUI::EventArgs&) |
| 122 | { |
| 123 | CEGUI::Window* tmpWin = getModeManager().getGui().getGuiSheet(Gui::replayMenu)->getChild(Gui::REM_LIST_REPLAYS); |
| 124 | CEGUI::Listbox* replaySelectList = static_cast<CEGUI::Listbox*>(tmpWin); |
| 125 | |
| 126 | if(replaySelectList->getSelectedCount() == 0) |
| 127 | { |
| 128 | tmpWin = getModeManager().getGui().getGuiSheet(Gui::replayMenu)->getChild(Gui::REM_TEXT_LOADING); |
| 129 | tmpWin->setText("Please select a replay first."); |
| 130 | tmpWin->show(); |
| 131 | return true; |
| 132 | } |
| 133 | |
| 134 | tmpWin = getModeManager().getGui().getGuiSheet(Gui::replayMenu)->getChild(Gui::REM_TEXT_LOADING); |
| 135 | tmpWin->setText("Loading..."); |
| 136 | tmpWin->show(); |
| 137 | |
| 138 | CEGUI::ListboxItem* selItem = replaySelectList->getFirstSelectedItem(); |
| 139 | int id = selItem->getID(); |
| 140 | |
| 141 | std::string mapDescription; |
| 142 | std::string errorMsg; |
| 143 | if(!checkReplayValid(mFilesList[id], mapDescription, errorMsg)) |
| 144 | { |
| 145 | tmpWin->setText("Error: trying to launch invalid replay!"); |
| 146 | tmpWin->show(); |
| 147 | return true; |
| 148 | } |
| 149 | |
| 150 | const std::string& replayFile = mFilesList[id]; |
| 151 | if(!ODClient::getSingleton().replay(replayFile)) |
| 152 | { |
| 153 | OD_LOG_ERR("Could not launch replay !!!"); |
| 154 | tmpWin = getModeManager().getGui().getGuiSheet(Gui::replayMenu)->getChild(Gui::REM_TEXT_LOADING); |
| 155 | tmpWin->setText("Error: Couldn't launch replay!"); |
| 156 | tmpWin->show(); |
| 157 | return true; |
| 158 | } |
| 159 | return true; |
| 160 | } |
| 161 | |
| 162 | bool MenuModeReplay::deleteSelectedButtonPressed(const CEGUI::EventArgs&) |
| 163 | { |
nothing calls this directly
no test coverage detected