Add object mapped variables for slope after foundation applied
This commit is contained in:
@@ -79,6 +79,8 @@ extern const GRFPropertyMapDefinition _grf_action0_remappable_properties[] = {
|
|||||||
|
|
||||||
/** Action14 Action2 remappable variable list */
|
/** Action14 Action2 remappable variable list */
|
||||||
extern const GRFVariableMapDefinition _grf_action2_remappable_variables[] = {
|
extern const GRFVariableMapDefinition _grf_action2_remappable_variables[] = {
|
||||||
|
GRFVariableMapDefinition(GSF_OBJECTS, A2VRI_OBJECT_FOUNDATION_SLOPE, "object_foundation_tile_slope"),
|
||||||
|
GRFVariableMapDefinition(GSF_OBJECTS, A2VRI_OBJECT_FOUNDATION_SLOPE_CHANGE, "object_foundation_change_tile_slope"),
|
||||||
GRFVariableMapDefinition(),
|
GRFVariableMapDefinition(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -39,6 +39,8 @@ enum Action0RemapPropertyIds {
|
|||||||
|
|
||||||
|
|
||||||
enum Action2VariableRemapIds {
|
enum Action2VariableRemapIds {
|
||||||
|
A2VRI_OBJECT_FOUNDATION_SLOPE = 0x100,
|
||||||
|
A2VRI_OBJECT_FOUNDATION_SLOPE_CHANGE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Action14 feature definition */
|
/** Action14 feature definition */
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include "water.h"
|
#include "water.h"
|
||||||
#include "clear_func.h"
|
#include "clear_func.h"
|
||||||
#include "newgrf_animation_base.h"
|
#include "newgrf_animation_base.h"
|
||||||
|
#include "newgrf_extension.h"
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
@@ -263,6 +264,12 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid,
|
|||||||
/* Object view */
|
/* Object view */
|
||||||
case 0x48: return this->view;
|
case 0x48: return this->view;
|
||||||
|
|
||||||
|
case A2VRI_OBJECT_FOUNDATION_SLOPE:
|
||||||
|
return GetTileSlope(this->tile);
|
||||||
|
|
||||||
|
case A2VRI_OBJECT_FOUNDATION_SLOPE_CHANGE:
|
||||||
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disallow the rest:
|
* Disallow the rest:
|
||||||
* 0x40: Relative position is passed as parameter during construction.
|
* 0x40: Relative position is passed as parameter during construction.
|
||||||
@@ -333,6 +340,21 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid,
|
|||||||
|
|
||||||
/* Count of object, distance of closest instance */
|
/* Count of object, distance of closest instance */
|
||||||
case 0x64: return GetCountAndDistanceOfClosestInstance(parameter, this->ro.grffile->grfid, this->tile, this->obj);
|
case 0x64: return GetCountAndDistanceOfClosestInstance(parameter, this->ro.grffile->grfid, this->tile, this->obj);
|
||||||
|
|
||||||
|
case A2VRI_OBJECT_FOUNDATION_SLOPE: {
|
||||||
|
extern Foundation GetFoundation_Object(TileIndex tile, Slope tileh);
|
||||||
|
Slope slope = GetTileSlope(this->tile);
|
||||||
|
ApplyFoundationToSlope(GetFoundation_Object(this->tile, slope), &slope);
|
||||||
|
return slope;
|
||||||
|
}
|
||||||
|
|
||||||
|
case A2VRI_OBJECT_FOUNDATION_SLOPE_CHANGE: {
|
||||||
|
extern Foundation GetFoundation_Object(TileIndex tile, Slope tileh);
|
||||||
|
Slope slope = GetTileSlope(this->tile);
|
||||||
|
Slope orig_slope = slope;
|
||||||
|
ApplyFoundationToSlope(GetFoundation_Object(this->tile, slope), &slope);
|
||||||
|
return slope ^ orig_slope;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unhandled:
|
unhandled:
|
||||||
|
@@ -566,7 +566,7 @@ CommandCost CmdBuildObjectArea(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Foundation GetFoundation_Object(TileIndex tile, Slope tileh);
|
Foundation GetFoundation_Object(TileIndex tile, Slope tileh);
|
||||||
|
|
||||||
static void DrawTile_Object(TileInfo *ti, DrawTileProcParams params)
|
static void DrawTile_Object(TileInfo *ti, DrawTileProcParams params)
|
||||||
{
|
{
|
||||||
@@ -670,7 +670,7 @@ static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Foundation GetFoundation_Object(TileIndex tile, Slope tileh)
|
Foundation GetFoundation_Object(TileIndex tile, Slope tileh)
|
||||||
{
|
{
|
||||||
if (tileh == SLOPE_FLAT) return FOUNDATION_NONE;
|
if (tileh == SLOPE_FLAT) return FOUNDATION_NONE;
|
||||||
switch (GetObjectEffectiveFoundationType(tile)) {
|
switch (GetObjectEffectiveFoundationType(tile)) {
|
||||||
|
Reference in New Issue
Block a user