1 /***************************************************************************
2 * Mechanized Assault and Exploration Reloaded Projectfile *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
19
20 #include "ui/graphical/game/control/mouseaction/mouseactionactivatefinished.h"
21 #include "ui/graphical/game/widgets/gamemapwidget.h"
22 #include "ui/graphical/game/unitselection.h"
23 #include "game/data/map/map.h"
24 #include "game/data/units/building.h"
25 #include "input/mouse/mouse.h"
26 #include "input/mouse/cursor/mousecursorsimple.h"
27
28 //------------------------------------------------------------------------------
executeLeftClick(cGameMapWidget & gameMapWidget,const cMap & map,const cPosition & mapPosition,cUnitSelection & unitSelection,bool changeAllowed) const29 bool cMouseActionActivateFinished::executeLeftClick (cGameMapWidget& gameMapWidget, const cMap& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
30 {
31 const auto selectedBuilding = unitSelection.getSelectedBuilding();
32
33 if (!selectedBuilding) return false;
34
35 gameMapWidget.triggeredExitFinishedUnit (*selectedBuilding, mapPosition);
36
37 return true;
38 }
39
40 //------------------------------------------------------------------------------
doesChangeState() const41 bool cMouseActionActivateFinished::doesChangeState() const
42 {
43 return true;
44 }
45
46 //------------------------------------------------------------------------------
isSingleAction() const47 bool cMouseActionActivateFinished::isSingleAction() const
48 {
49 return true;
50 }
51