Update to 12.0-beta1
This commit is contained in:
+23
-25
@@ -454,7 +454,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject &object, byte variable, b
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(grf, 1, "Unhandled station variable 0x%X", variable);
|
||||
Debug(grf, 1, "Unhandled station variable 0x{:X}", variable);
|
||||
|
||||
*available = false;
|
||||
return UINT_MAX;
|
||||
@@ -486,7 +486,7 @@ uint32 Waypoint::GetNewGRFVariable(const ResolverObject &object, byte variable,
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(grf, 1, "Unhandled station variable 0x%X", variable);
|
||||
Debug(grf, 1, "Unhandled station variable 0x{:X}", variable);
|
||||
|
||||
*available = false;
|
||||
return UINT_MAX;
|
||||
@@ -523,13 +523,13 @@ uint32 Waypoint::GetNewGRFVariable(const ResolverObject &object, byte variable,
|
||||
cargo = std::min(0xfffu, cargo);
|
||||
|
||||
if (cargo > this->station_scope.statspec->cargo_threshold) {
|
||||
if (group->num_loading > 0) {
|
||||
uint set = ((cargo - this->station_scope.statspec->cargo_threshold) * group->num_loading) / (4096 - this->station_scope.statspec->cargo_threshold);
|
||||
if (!group->loading.empty()) {
|
||||
uint set = ((cargo - this->station_scope.statspec->cargo_threshold) * (uint)group->loading.size()) / (4096 - this->station_scope.statspec->cargo_threshold);
|
||||
return group->loading[set];
|
||||
}
|
||||
} else {
|
||||
if (group->num_loaded > 0) {
|
||||
uint set = (cargo * group->num_loaded) / (this->station_scope.statspec->cargo_threshold + 1);
|
||||
if (!group->loaded.empty()) {
|
||||
uint set = (cargo * (uint)group->loaded.size()) / (this->station_scope.statspec->cargo_threshold + 1);
|
||||
return group->loaded[set];
|
||||
}
|
||||
}
|
||||
@@ -550,16 +550,16 @@ uint32 StationResolverObject::GetDebugID() const
|
||||
/**
|
||||
* Resolver for stations.
|
||||
* @param statspec Station (type) specification.
|
||||
* @param st Instance of the station.
|
||||
* @param base_station Instance of the station.
|
||||
* @param tile %Tile of the station.
|
||||
* @param callback Callback ID.
|
||||
* @param callback_param1 First parameter (var 10) of the callback.
|
||||
* @param callback_param2 Second parameter (var 18) of the callback.
|
||||
*/
|
||||
StationResolverObject::StationResolverObject(const StationSpec *statspec, BaseStation *st, TileIndex tile,
|
||||
StationResolverObject::StationResolverObject(const StationSpec *statspec, BaseStation *base_station, TileIndex tile,
|
||||
CallbackID callback, uint32 callback_param1, uint32 callback_param2)
|
||||
: ResolverObject(statspec->grf_prop.grffile, callback, callback_param1, callback_param2),
|
||||
station_scope(*this, statspec, st, tile), town_scope(nullptr)
|
||||
station_scope(*this, statspec, base_station, tile), town_scope(nullptr)
|
||||
{
|
||||
/* Invalidate all cached vars */
|
||||
_svc.valid = 0;
|
||||
@@ -572,8 +572,7 @@ StationResolverObject::StationResolverObject(const StationSpec *statspec, BaseSt
|
||||
} else if (Station::IsExpected(this->station_scope.st)) {
|
||||
const Station *st = Station::From(this->station_scope.st);
|
||||
/* Pick the first cargo that we have waiting */
|
||||
const CargoSpec *cs;
|
||||
FOR_ALL_CARGOSPECS(cs) {
|
||||
for (const CargoSpec *cs : CargoSpec::Iterate()) {
|
||||
if (this->station_scope.statspec->grf_prop.spritegroup[cs->Index()] != nullptr &&
|
||||
st->goods[cs->Index()].cargo.TotalCount() > 0) {
|
||||
ctype = cs->Index();
|
||||
@@ -738,7 +737,7 @@ void DeallocateSpecFromStation(BaseStation *st, byte specindex)
|
||||
|
||||
ETileArea area = ETileArea(st, INVALID_TILE, TA_WHOLE);
|
||||
/* Check all tiles over the station to check if the specindex is still in use */
|
||||
TILE_AREA_LOOP(tile, area) {
|
||||
for (TileIndex tile : area) {
|
||||
if (st->TileBelongsToRailStation(tile) && GetCustomStationSpecIndex(tile) == specindex) {
|
||||
return;
|
||||
}
|
||||
@@ -799,10 +798,10 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
|
||||
const NewGRFSpriteLayout *layout = nullptr;
|
||||
DrawTileSprites tmp_rail_layout;
|
||||
|
||||
if (statspec->renderdata == nullptr) {
|
||||
if (statspec->renderdata.empty()) {
|
||||
sprites = GetStationTileLayout(STATION_RAIL, tile + axis);
|
||||
} else {
|
||||
layout = &statspec->renderdata[(tile < statspec->tiles) ? tile + axis : (uint)axis];
|
||||
layout = &statspec->renderdata[(tile < statspec->renderdata.size()) ? tile + axis : (uint)axis];
|
||||
if (!layout->NeedsPreprocessing()) {
|
||||
sprites = layout;
|
||||
layout = nullptr;
|
||||
@@ -813,8 +812,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
|
||||
/* Sprite layout which needs preprocessing */
|
||||
bool separate_ground = HasBit(statspec->flags, SSF_SEPARATE_GROUND);
|
||||
uint32 var10_values = layout->PrepareLayout(total_offset, rti->fallback_railtype, 0, 0, separate_ground);
|
||||
uint8 var10;
|
||||
FOR_EACH_SET_BIT(var10, var10_values) {
|
||||
for (uint8 var10 : SetBitIterator(var10_values)) {
|
||||
uint32 var10_relocation = GetCustomStationRelocation(statspec, nullptr, INVALID_TILE, var10);
|
||||
layout->ProcessRegisters(var10, var10_relocation, separate_ground);
|
||||
}
|
||||
@@ -922,7 +920,7 @@ void AnimateStationTile(TileIndex tile)
|
||||
StationAnimationBase::AnimateTile(ss, BaseStation::GetByTile(tile), tile, HasBit(ss->flags, SSF_CB141_RANDOM_BITS));
|
||||
}
|
||||
|
||||
void TriggerStationAnimation(BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type)
|
||||
void TriggerStationAnimation(BaseStation *st, TileIndex trigger_tile, StationAnimationTrigger trigger, CargoID cargo_type)
|
||||
{
|
||||
/* List of coverage areas for each animation trigger */
|
||||
static const TriggerArea tas[] = {
|
||||
@@ -930,17 +928,17 @@ void TriggerStationAnimation(BaseStation *st, TileIndex tile, StationAnimationTr
|
||||
};
|
||||
|
||||
/* Get Station if it wasn't supplied */
|
||||
if (st == nullptr) st = BaseStation::GetByTile(tile);
|
||||
if (st == nullptr) st = BaseStation::GetByTile(trigger_tile);
|
||||
|
||||
/* Check the cached animation trigger bitmask to see if we need
|
||||
* to bother with any further processing. */
|
||||
if (!HasBit(st->cached_anim_triggers, trigger)) return;
|
||||
|
||||
uint16 random_bits = Random();
|
||||
ETileArea area = ETileArea(st, tile, tas[trigger]);
|
||||
ETileArea area = ETileArea(st, trigger_tile, tas[trigger]);
|
||||
|
||||
/* Check all tiles over the station to check if the specindex is still in use */
|
||||
TILE_AREA_LOOP(tile, area) {
|
||||
for (TileIndex tile : area) {
|
||||
if (st->TileBelongsToRailStation(tile)) {
|
||||
const StationSpec *ss = GetStationSpec(tile);
|
||||
if (ss != nullptr && HasBit(ss->animation.triggers, trigger)) {
|
||||
@@ -959,11 +957,11 @@ void TriggerStationAnimation(BaseStation *st, TileIndex tile, StationAnimationTr
|
||||
/**
|
||||
* Trigger station randomisation
|
||||
* @param st station being triggered
|
||||
* @param tile specific tile of platform to trigger
|
||||
* @param trigger_tile specific tile of platform to trigger
|
||||
* @param trigger trigger type
|
||||
* @param cargo_type cargo type causing trigger
|
||||
*/
|
||||
void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigger trigger, CargoID cargo_type)
|
||||
void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRandomTrigger trigger, CargoID cargo_type)
|
||||
{
|
||||
/* List of coverage areas for each animation trigger */
|
||||
static const TriggerArea tas[] = {
|
||||
@@ -971,7 +969,7 @@ void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigg
|
||||
};
|
||||
|
||||
/* Get Station if it wasn't supplied */
|
||||
if (st == nullptr) st = Station::GetByTile(tile);
|
||||
if (st == nullptr) st = Station::GetByTile(trigger_tile);
|
||||
|
||||
/* Check the cached cargo trigger bitmask to see if we need
|
||||
* to bother with any further processing. */
|
||||
@@ -979,7 +977,7 @@ void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigg
|
||||
if (cargo_type != CT_INVALID && !HasBit(st->cached_cargo_triggers, cargo_type)) return;
|
||||
|
||||
uint32 whole_reseed = 0;
|
||||
ETileArea area = ETileArea(st, tile, tas[trigger]);
|
||||
ETileArea area = ETileArea(st, trigger_tile, tas[trigger]);
|
||||
|
||||
CargoTypes empty_mask = 0;
|
||||
if (trigger == SRT_CARGO_TAKEN) {
|
||||
@@ -996,7 +994,7 @@ void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigg
|
||||
uint32 used_triggers = 0;
|
||||
|
||||
/* Check all tiles over the station to check if the specindex is still in use */
|
||||
TILE_AREA_LOOP(tile, area) {
|
||||
for (TileIndex tile : area) {
|
||||
if (st->TileBelongsToRailStation(tile)) {
|
||||
const StationSpec *ss = GetStationSpec(tile);
|
||||
if (ss == nullptr) continue;
|
||||
|
||||
Reference in New Issue
Block a user