From: <geo...@us...> - 2013-05-25 09:58:43
|
Revision: 6072 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=6072&view=rev Author: geoffthemedio Date: 2013-05-25 09:58:36 +0000 (Sat, 25 May 2013) Log Message: ----------- Implemented moderator fleet deletion by right-clicking fleet icons on the map (when the delete action is selected). Modified Paths: -------------- trunk/FreeOrion/UI/MapWnd.cpp Modified: trunk/FreeOrion/UI/MapWnd.cpp =================================================================== --- trunk/FreeOrion/UI/MapWnd.cpp 2013-05-25 09:50:36 UTC (rev 6071) +++ trunk/FreeOrion/UI/MapWnd.cpp 2013-05-25 09:58:36 UTC (rev 6072) @@ -3714,9 +3714,7 @@ net.SendMessage(ModeratorActionMessage(player_id, Moderator::RemoveStarlane(system_id, selected_system_id))); } - } - return; } @@ -3889,9 +3887,33 @@ SelectFleet(fleet_to_select_id); } -void MapWnd::FleetButtonRightClicked(const FleetButton* fleet_btn) -{} +void MapWnd::FleetButtonRightClicked(const FleetButton* fleet_btn) { + if (!fleet_btn) + return; + // get fleets represented by clicked button + const std::vector<int> btn_fleets = fleet_btn->Fleets(); + if (btn_fleets.empty()) { + Logger().errorStream() << "Clicked FleetButton contained no fleets!"; + return; + } + + if (ClientPlayerIsModerator()) { + ModeratorActionsWnd::ModeratorActionSetting mas = m_moderator_wnd->SelectedAction(); + ClientNetworking& net = HumanClientApp::GetApp()->Networking(); + int player_id = HumanClientApp::GetApp()->PlayerID(); + + if (mas == ModeratorActionsWnd::MAS_Destroy) { + for (std::vector<int>::const_iterator it = btn_fleets.begin(); + it != btn_fleets.end(); ++it) + { + net.SendMessage(ModeratorActionMessage(player_id, + Moderator::DestroyUniverseObject(*it))); + } + } + } +} + void MapWnd::SelectedFleetsChanged() { // get selected fleets std::set<int> selected_fleet_ids; |