Build confirmation window, for each build action on the map

This commit is contained in:
Sergii Pylypenko
2016-04-06 23:34:28 +03:00
parent a474c233e0
commit a7a8e35968
10 changed files with 204 additions and 1 deletions

View File

@@ -84,6 +84,7 @@
#include "linkgraph/linkgraph_gui.h"
#include "viewport_sprite_sorter.h"
#include "bridge_map.h"
#include "build_confirmation_func.h"
#include <map>
@@ -2163,6 +2164,7 @@ static void PlaceObject()
w = _thd.GetCallbackWnd();
if (w != NULL) w->OnPlaceObject(pt, TileVirtXY(pt.x, pt.y));
HideBuildConfirmationWindow();
}
@@ -3139,6 +3141,7 @@ EventState VpHandlePlaceSizingDrag()
/* while dragging execute the drag procedure of the corresponding window (mostly VpSelectTilesWithMethod() ) */
if (_left_button_down) {
HideBuildConfirmationWindow();
w->OnPlaceDrag(_thd.select_method, _thd.select_proc, GetTileBelowCursor());
return ES_HANDLED;
}
@@ -3161,10 +3164,19 @@ EventState VpHandlePlaceSizingDrag()
SetTileSelectSize(1, 1);
place_mouseup:
w->OnPlaceMouseUp(_thd.select_method, _thd.select_proc, _thd.selend, TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y));
ShowBuildConfirmationWindow();
return ES_HANDLED;
}
void ConfirmPlacingObject()
{
Window *w = _thd.GetCallbackWnd();
if (w == NULL) ResetObjectToPlace();
w->OnPlaceMouseUp(_thd.select_method, _thd.select_proc, _thd.selend, TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y));
}
/**
* Change the cursor and mouse click/drag handling to a mode for performing special operations like tile area selection, object placement, etc.
* @param icon New shape of the mouse cursor.
@@ -3202,6 +3214,7 @@ void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowC
* place or not properly reset the original selection. */
_thd.window_class = WC_INVALID;
if (w != NULL) w->OnPlaceObjectAbort();
HideBuildConfirmationWindow();
}
/* Mark the old selection dirty, in case the selection shape or colour changes */