Add object mapped variables for slope after foundation applied

This commit is contained in:
Jonathan G Rennison
2022-01-24 01:18:35 +00:00
parent 33dc6c9688
commit acc9dffab7
4 changed files with 28 additions and 2 deletions

View File

@@ -22,6 +22,7 @@
#include "water.h"
#include "clear_func.h"
#include "newgrf_animation_base.h"
#include "newgrf_extension.h"
#include "safeguards.h"
@@ -263,6 +264,12 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid,
/* Object 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:
* 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 */
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: