1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-25 13:14:19 +01:00

(svn r22654) [1.1] -Backport from trunk:

- Fix: Switching from a red to a white highlight (by switching to another tool) without switching the highlight mode (HT_RECT etc.) did not mark the selection dirty [FS#4670] (r22649)
- Fix: [NewGRF] Parameters from NewGRFs were not properly parsed in all cases [FS#4599] (r22648, r22630, r22629, r22628, r22627)
- Fix: GetSection() does not return a LockPart [FS#4678] (r22645)
- Fix: [NewGRF] Disallow building NewObjects on water tiles owned by another company (r22643)
This commit is contained in:
rubidium
2011-07-10 20:35:31 +00:00
parent 3a39cea23b
commit 4f8053e559
38 changed files with 376 additions and 227 deletions

View File

@@ -530,7 +530,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
/* Only show the error when it's for us. */
StringID error_part1 = GB(cmd, 16, 16);
if (estimate_only || (IsLocalCompany() && error_part1 != 0 && my_cmd)) {
ShowErrorMessage(error_part1, res.GetErrorMessage(), WL_INFO, x, y);
ShowErrorMessage(error_part1, res.GetErrorMessage(), WL_INFO, x, y, res.GetTextRefStackSize(), res.GetTextRefStack());
}
} else if (estimate_only) {
ShowEstimatedCostOrIncome(res.GetCost(), x, y);
@@ -735,3 +735,25 @@ void CommandCost::AddCost(const CommandCost &ret)
this->success = false;
}
}
/**
* Values to put on the #TextRefStack for the error message.
* There is only one static instance of the array, just like there is only one
* instance of normal DParams.
*/
uint32 CommandCost::textref_stack[16];
/**
* Activate usage of the NewGRF #TextRefStack for the error message.
* @param number of entries to copy from the temporary NewGRF registers
*/
void CommandCost::UseTextRefStack(uint num_registers)
{
extern TemporaryStorageArray<int32, 0x110> _temp_store;
assert(num_registers < lengthof(textref_stack));
this->textref_stack_size = num_registers;
for (uint i = 0; i < num_registers; i++) {
textref_stack[i] = _temp_store.Get(0x100 + i);
}
}