summaryrefslogtreecommitdiff
path: root/src/command.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-01-12 18:00:39 +0000
committerfrosch <frosch@openttd.org>2014-01-12 18:00:39 +0000
commitba1779b978bb9640e278113c642b51517658c32f (patch)
treefe903b7ab298a455790b858a9346d307524cee45 /src/command.cpp
parent73c6565cf269608092d119e353df522e97c5db7a (diff)
downloadopenttd-ba1779b978bb9640e278113c642b51517658c32f.tar.xz
(svn r26241) -Codechange: Remember the GRFFile which filled the TextRefStack in the TextRefStack.
Diffstat (limited to 'src/command.cpp')
-rw-r--r--src/command.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/command.cpp b/src/command.cpp
index fe44dabde..543db30a1 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -571,7 +571,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, res.GetTextRefStackSize(), res.GetTextRefStack());
+ ShowErrorMessage(error_part1, res.GetErrorMessage(), WL_INFO, x, y, res.GetTextRefStackGRF(), res.GetTextRefStackSize(), res.GetTextRefStack());
}
} else if (estimate_only) {
ShowEstimatedCostOrIncome(res.GetCost(), x, y);
@@ -779,13 +779,15 @@ 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
+ * @param grffile NewGRF that provides the #TextRefStack
+ * @param num_registers number of entries to copy from the temporary NewGRF registers
*/
-void CommandCost::UseTextRefStack(uint num_registers)
+void CommandCost::UseTextRefStack(const GRFFile *grffile, uint num_registers)
{
extern TemporaryStorageArray<int32, 0x110> _temp_store;
assert(num_registers < lengthof(textref_stack));
+ this->textref_stack_grffile = grffile;
this->textref_stack_size = num_registers;
for (uint i = 0; i < num_registers; i++) {
textref_stack[i] = _temp_store.GetValue(0x100 + i);