Warning: crashes! Confirmation dialog will also show estimated cost

This commit is contained in:
Sergii Pylypenko
2016-05-16 22:15:41 +03:00
parent f7b1a0abd3
commit 96501e9f08
5 changed files with 75 additions and 16 deletions

View File

@@ -28,6 +28,7 @@
#include "object_base.h"
#include "string_func.h"
#include "tilehighlight_func.h"
#include "build_confirmation_func.h"
#include "table/strings.h"
@@ -553,11 +554,18 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
* However, in case of incoming network commands,
* map generation or the pause button we do want
* to execute. */
bool estimate_only = _shift_pressed && IsLocalCompany() &&
bool estimate_only = (_shift_pressed || ConfirmationWindowEstimatingCost()) &&
IsLocalCompany() &&
!_generating_world &&
!(cmd & CMD_NETWORK_COMMAND) &&
(cmd & CMD_ID_MASK) != CMD_PAUSE;
if (ConfirmationWindowEstimatingCost() && !estimate_only) {
// We cannot estimate cost, so abort the command - it will be repeated by confirmation dialog later
ShowEstimatedCostOrIncome(0, 0, 0);
return false;
}
/* We're only sending the command, so don't do
* fancy things for 'success'. */
bool only_sending = _networking && !(cmd & CMD_NETWORK_COMMAND);