summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/newgrf_commons.cpp6
-rw-r--r--src/newgrf_commons.h4
-rw-r--r--src/newgrf_industries.cpp2
-rw-r--r--src/newgrf_industrytiles.cpp2
-rw-r--r--src/newgrf_station.cpp2
-rw-r--r--src/object_cmd.cpp2
6 files changed, 10 insertions, 8 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp
index 679642ff4..81228866d 100644
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -473,16 +473,16 @@ uint32 GetCompanyInfo(CompanyID owner, const Livery *l)
/**
* Get the error message from a shape/location/slope check callback result.
* @param cb_res Callback result to translate. If bit 10 is set this is a standard error message, otherwise a NewGRF provided string.
- * @param grfid grfID to use to resolve a custom error message.
+ * @param grffile NewGRF to use to resolve a custom error message.
* @param default_error Error message to use for the generic error.
* @return CommandCost indicating success or the error message.
*/
-CommandCost GetErrorMessageFromLocationCallbackResult(uint16 cb_res, uint32 grfid, StringID default_error)
+CommandCost GetErrorMessageFromLocationCallbackResult(uint16 cb_res, const GRFFile *grffile, StringID default_error)
{
CommandCost res;
if (cb_res < 0x400) {
- res = CommandCost(GetGRFStringID(grfid, 0xD000 + cb_res));
+ res = CommandCost(GetGRFStringID(grffile->grfid, 0xD000 + cb_res));
} else {
switch (cb_res) {
case 0x400: return res; // No error.
diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h
index 3e8434748..a9cc50659 100644
--- a/src/newgrf_commons.h
+++ b/src/newgrf_commons.h
@@ -22,6 +22,8 @@
#include "direction_type.h"
#include "company_type.h"
+struct GRFFile;
+
/** Context for tile accesses */
enum TileContext {
TCX_NORMAL, ///< Nothing special.
@@ -297,7 +299,7 @@ uint32 GetTerrainType(TileIndex tile, TileContext context = TCX_NORMAL);
TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets = true, Axis axis = INVALID_AXIS);
uint32 GetNearbyTileInformation(TileIndex tile, bool grf_version8);
uint32 GetCompanyInfo(CompanyID owner, const struct Livery *l = NULL);
-CommandCost GetErrorMessageFromLocationCallbackResult(uint16 cb_res, uint32 grfid, StringID default_error);
+CommandCost GetErrorMessageFromLocationCallbackResult(uint16 cb_res, const GRFFile *grffile, StringID default_error);
void ErrorUnknownCallbackResult(uint32 grfid, uint16 cbid, uint16 cb_res);
bool ConvertBooleanCallback(const struct GRFFile *grffile, uint16 cbid, uint16 cb_res);
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index ffc677d02..dfc615b29 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -531,7 +531,7 @@ CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uin
uint16 result = group->GetCallbackResult();
if (result == CALLBACK_FAILED) return CommandCost();
- return GetErrorMessageFromLocationCallbackResult(result, indspec->grf_prop.grffile->grfid, STR_ERROR_SITE_UNSUITABLE);
+ return GetErrorMessageFromLocationCallbackResult(result, indspec->grf_prop.grffile, STR_ERROR_SITE_UNSUITABLE);
}
/**
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 965c55d49..7e31c1bc4 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -256,7 +256,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
- return GetErrorMessageFromLocationCallbackResult(callback_res, its->grf_prop.grffile->grfid, STR_ERROR_SITE_UNSUITABLE);
+ return GetErrorMessageFromLocationCallbackResult(callback_res, its->grf_prop.grffile, STR_ERROR_SITE_UNSUITABLE);
}
/* Simple wrapper for GetHouseCallback to keep the animation unified. */
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 4bfb125d6..9cdded620 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -680,7 +680,7 @@ CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_til
/* The meaning of bit 10 is inverted for a grf version < 8. */
if (statspec->grf_prop.grffile->grf_version < 8) ToggleBit(cb_res, 10);
- return GetErrorMessageFromLocationCallbackResult(cb_res, statspec->grf_prop.grffile->grfid, STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
+ return GetErrorMessageFromLocationCallbackResult(cb_res, statspec->grf_prop.grffile, STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
}
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 4c3b38bdb..05efae0a2 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -270,7 +270,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
} else {
/* The meaning of bit 10 is inverted for a grf version < 8. */
if (spec->grf_prop.grffile->grf_version < 8) ToggleBit(callback, 10);
- CommandCost ret = GetErrorMessageFromLocationCallbackResult(callback, spec->grf_prop.grffile->grfid, STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
+ CommandCost ret = GetErrorMessageFromLocationCallbackResult(callback, spec->grf_prop.grffile, STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
if (ret.Failed()) return ret;
}
}