From a110ec1767c393b521d5bf69aea7271080ec83ff Mon Sep 17 00:00:00 2001 From: Koncord Date: Tue, 27 Jun 2017 21:59:05 +0800 Subject: [PATCH] [Client] Update GUIController to C++11 --- apps/openmw/mwmp/GUIController.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwmp/GUIController.cpp b/apps/openmw/mwmp/GUIController.cpp index ff451cc1a..f119a29f1 100644 --- a/apps/openmw/mwmp/GUIController.cpp +++ b/apps/openmw/mwmp/GUIController.cpp @@ -98,15 +98,15 @@ void mwmp::GUIController::showDialogList(const mwmp::BasePlayer::GUIMessageBox & std::string buf; - for (size_t i = 0; i < guiMessageBox.data.size(); i++) + for(const auto &data : guiMessageBox.data) { - if (guiMessageBox.data[i] == '\n') + if (data == '\n') { list.push_back(buf); buf.erase(); continue; } - buf += guiMessageBox.data[i]; + buf += data; } list.push_back(buf); @@ -373,13 +373,11 @@ void mwmp::GUIController::setGlobalMapMarkerTooltip(MWGui::MapWindow *mapWindow, void mwmp::GUIController::updateGlobalMapMarkerTooltips(MWGui::MapWindow *mapWindow) { - std::map, MyGUI::Widget*>::iterator widgetIt = mapWindow->mGlobalMapMarkers.begin(); - for (; widgetIt != mapWindow->mGlobalMapMarkers.end(); ++widgetIt) + for(const auto &widget : mapWindow->mGlobalMapMarkers) { - int x = widgetIt->first.first; - int y = widgetIt->first.second; - MyGUI::Widget* markerWidget = widgetIt->second; - setGlobalMapMarkerTooltip(mapWindow, markerWidget, x, y); + const int x = widget.first.first; + const int y = widget.first.second; + setGlobalMapMarkerTooltip(mapWindow, widget.second, x, y); } }