do not do estimate in regular fund/adv if shift is pressed (fixes #22)
This commit is contained in:
@@ -555,15 +555,18 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
|
||||
* However, in case of incoming network commands or
|
||||
* map generation we do want to execute. */
|
||||
bool estimate_only = false;
|
||||
switch (_command_proc_table[cmd & CMD_ID_MASK].type) {
|
||||
case CMDT_LANDSCAPE_CONSTRUCTION:
|
||||
case CMDT_VEHICLE_CONSTRUCTION:
|
||||
estimate_only = _shift_pressed && IsLocalCompany() &&
|
||||
!_generating_world && !(cmd & CMD_NETWORK_COMMAND);
|
||||
break;
|
||||
default:
|
||||
break; // just to silence warnings
|
||||
if (!(cmd & CMD_NO_ESTIMATE)) {
|
||||
switch (_command_proc_table[cmd & CMD_ID_MASK].type) {
|
||||
case CMDT_LANDSCAPE_CONSTRUCTION:
|
||||
case CMDT_VEHICLE_CONSTRUCTION:
|
||||
estimate_only = _shift_pressed && IsLocalCompany() &&
|
||||
!_generating_world && !(cmd & CMD_NETWORK_COMMAND);
|
||||
break;
|
||||
default:
|
||||
break; // just to silence warnings
|
||||
}
|
||||
}
|
||||
cmd &= ~CMD_NO_ESTIMATE;
|
||||
|
||||
/* We're only sending the command, so don't do
|
||||
* fancy things for 'success'. */
|
||||
|
||||
@@ -372,6 +372,7 @@ DECLARE_ENUM_AS_BIT_SET(DoCommandFlag)
|
||||
*/
|
||||
enum FlaggedCommands {
|
||||
CMD_NETWORK_COMMAND = 0x0100, ///< execute the command without sending it on the network
|
||||
CMD_NO_ESTIMATE = 0x0200, ///< execute command instead of doing estimate even if shift is pressed
|
||||
CMD_FLAGS_MASK = 0xFF00, ///< mask for all command flags
|
||||
CMD_ID_MASK = 0x00FF, ///< mask for the command ID
|
||||
};
|
||||
|
||||
@@ -861,7 +861,7 @@ static void DoRegularFunding(Town *t)
|
||||
|
||||
CompanyByte old = _current_company;
|
||||
_current_company = _local_company;
|
||||
DoCommandP(t->xy, t->index, HK_FUND, CMD_DO_TOWN_ACTION);
|
||||
DoCommandP(t->xy, t->index, HK_FUND, CMD_DO_TOWN_ACTION | CMD_NO_ESTIMATE);
|
||||
_current_company = old;
|
||||
}
|
||||
}
|
||||
@@ -892,7 +892,7 @@ static void DoRegularAdvertising(Town *t) {
|
||||
|
||||
CompanyByte old = _current_company;
|
||||
_current_company = _local_company;
|
||||
DoCommandP(t->xy, t->index, HK_LADVERT, CMD_DO_TOWN_ACTION);
|
||||
DoCommandP(t->xy, t->index, HK_LADVERT, CMD_DO_TOWN_ACTION | CMD_NO_ESTIMATE);
|
||||
_current_company = old;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user