MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / launchSelectedButtonPressed

Method launchSelectedButtonPressed

source/modes/MenuModeReplay.cpp:121–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121bool 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
162bool MenuModeReplay::deleteSelectedButtonPressed(const CEGUI::EventArgs&)
163{

Callers

nothing calls this directly

Calls 4

getGuiSheetMethod · 0.80
setTextMethod · 0.80
showMethod · 0.80
replayMethod · 0.45

Tested by

no test coverage detected