summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/industry_cmd.cpp11
-rw-r--r--src/newgrf_industries.cpp4
-rw-r--r--src/newgrf_industries.h2
-rw-r--r--src/newgrf_industrytiles.cpp4
-rw-r--r--src/newgrf_industrytiles.h2
5 files changed, 14 insertions, 9 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index b24774253..37bd52d89 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1321,10 +1321,11 @@ bool IsSlopeRefused(Slope current, Slope refused)
* @param itspec_index The index of the itsepc to build/fund
* @param type Type of the industry.
* @param initial_random_bits The random bits the industry is going to have after construction.
+ * @param founder Industry founder
* @param [out] custom_shape_check Perform custom check for the site.
* @return Failed or succeeded command.
*/
-static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, uint itspec_index, int type, uint16 initial_random_bits, bool *custom_shape_check = NULL)
+static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, uint itspec_index, int type, uint16 initial_random_bits, Owner founder, bool *custom_shape_check = NULL)
{
bool refused_slope = false;
bool custom_shape = false;
@@ -1356,7 +1357,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
if (HasBit(its->callback_mask, CBM_INDT_SHAPE_CHECK)) {
custom_shape = true;
- CommandCost ret = PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index, initial_random_bits);
+ CommandCost ret = PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index, initial_random_bits, founder);
if (ret.Failed()) return ret;
} else {
Slope tileh = GetTileSlope(cur_tile, NULL);
@@ -1708,11 +1709,11 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
*ip = NULL;
- CommandCost ret = CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, random_initial_bits, &custom_shape_check);
+ CommandCost ret = CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, random_initial_bits, founder, &custom_shape_check);
if (ret.Failed()) return ret;
if (HasBit(GetIndustrySpec(type)->callback_mask, CBM_IND_LOCATION)) {
- ret = CheckIfCallBackAllowsCreation(tile, type, itspec_index, random_var8f, random_initial_bits);
+ ret = CheckIfCallBackAllowsCreation(tile, type, itspec_index, random_var8f, random_initial_bits, founder);
} else {
ret = _check_new_industry_procs[indspec->check_proc](tile);
}
@@ -1811,7 +1812,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
do {
if (--count < 0) return ret;
if (--num < 0) num = indspec->num_table - 1;
- ret = CheckIfIndustryTilesAreFree(tile, itt[num], num, it, random_initial_bits);
+ ret = CheckIfIndustryTilesAreFree(tile, itt[num], num, it, random_initial_bits, _current_company);
} while (ret.Failed());
ret = CreateNewIndustryHelper(tile, it, flags, indspec, num, random_var8f, random_initial_bits, _current_company, &ind);
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 55b606d62..47239a0d6 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -453,9 +453,10 @@ uint32 IndustryLocationGetVariable(const ResolverObject *object, byte variable,
* @param layout Layout number.
* @param seed Seed for the random generator.
* @param initial_random_bits The random bits the industry is going to have after construction.
+ * @param founder Industry founder
* @return Succeeded or failed command.
*/
-CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint layout, uint32 seed, uint16 initial_random_bits)
+CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint layout, uint32 seed, uint16 initial_random_bits, Owner founder)
{
const IndustrySpec *indspec = GetIndustrySpec(type);
@@ -470,6 +471,7 @@ CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uin
ind.selected_layout = layout;
ind.town = ClosestTownFromTile(tile, UINT_MAX);
ind.random = initial_random_bits;
+ ind.founder = founder;
NewIndustryResolver(&object, tile, &ind, type);
object.GetVariable = IndustryLocationGetVariable;
diff --git a/src/newgrf_industries.h b/src/newgrf_industries.h
index 82ae619fb..cf3418b83 100644
--- a/src/newgrf_industries.h
+++ b/src/newgrf_industries.h
@@ -37,7 +37,7 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile);
uint32 GetIndustryIDAtOffset(TileIndex new_tile, const Industry *i, uint32 cur_grfid);
void IndustryProductionCallback(Industry *ind, int reason);
-CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint layout, uint32 seed, uint16 initial_random_bits);
+CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint layout, uint32 seed, uint16 initial_random_bits, Owner founder);
bool CheckIfCallBackAllowsAvailability(IndustryType type, IndustryAvailabilityCallType creation_type);
IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32 grf_id);
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index c29823855..4ab1d4e91 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -258,9 +258,10 @@ extern bool IsSlopeRefused(Slope current, Slope refused);
* @param gfx Gfx of the tile.
* @param itspec_index Layout.
* @param initial_random_bits Random bits of industry after construction
+ * @param founder Industry founder
* @return Suceeded or failed command.
*/
-CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index, uint16 initial_random_bits)
+CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index, uint16 initial_random_bits, Owner founder)
{
Industry ind;
ind.index = INVALID_INDUSTRY;
@@ -268,6 +269,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind
ind.location.w = 0;
ind.type = type;
ind.random = initial_random_bits;
+ ind.founder = founder;
uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, itspec_index, gfx, &ind, ind_tile);
if (callback_res == CALLBACK_FAILED) {
diff --git a/src/newgrf_industrytiles.h b/src/newgrf_industrytiles.h
index 7b8d64224..86a625359 100644
--- a/src/newgrf_industrytiles.h
+++ b/src/newgrf_industrytiles.h
@@ -27,7 +27,7 @@ enum IndustryAnimationTrigger {
bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds);
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
-CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index, uint16 initial_random_bits);
+CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index, uint16 initial_random_bits, Owner founder);
void AnimateNewIndustryTile(TileIndex tile);
bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32 random = Random());