|
|
|
@ -10,6 +10,7 @@
|
|
|
|
|
#include "../newgrf_house.h"
|
|
|
|
|
#include "../newgrf_engine.h"
|
|
|
|
|
#include "../newgrf_roadtype.h"
|
|
|
|
|
#include "../newgrf_roadstop.h"
|
|
|
|
|
#include "../newgrf_cargo.h"
|
|
|
|
|
#include "../date_func.h"
|
|
|
|
|
#include "../timetable.h"
|
|
|
|
@ -1370,24 +1371,64 @@ static const NIFeature _nif_roadtype = {
|
|
|
|
|
new NIHRoadType(),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*** ***/
|
|
|
|
|
|
|
|
|
|
static const NIVariable _nif_roadstops[] = {
|
|
|
|
|
NIV(0x40, "test"),
|
|
|
|
|
NIV(0x40, "view/rotation"),
|
|
|
|
|
NIV(0x41, "stop type"),
|
|
|
|
|
NIV(0x42, "terrain type"),
|
|
|
|
|
NIV(0x43, "road type"),
|
|
|
|
|
NIV(0x44, "tram type"),
|
|
|
|
|
NIV(0x45, "town zone"),
|
|
|
|
|
NIV(0x46, "player info"),
|
|
|
|
|
NIV(0x48, "bitmask of accepted cargoes"),
|
|
|
|
|
NIV(0x60, "amount of cargo waiting"),
|
|
|
|
|
NIV(0x61, "time since last cargo pickup"),
|
|
|
|
|
NIV(0x62, "rating of cargo"),
|
|
|
|
|
NIV(0x63, "time spent on route"),
|
|
|
|
|
NIV(0x64, "information about last vehicle picking cargo up"),
|
|
|
|
|
NIV(0x65, "amount of cargo acceptance"),
|
|
|
|
|
NIV(0x69, "information about cargo accepted in the past"),
|
|
|
|
|
NIV_END(),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NIHRoadStop : public NIHelper {
|
|
|
|
|
bool IsInspectable(uint index) const override { return false; }
|
|
|
|
|
uint GetParent(uint index) const override { return UINT32_MAX; }
|
|
|
|
|
const void *GetInstance(uint index)const override { return nullptr; }
|
|
|
|
|
const void *GetSpec(uint index) const override { return nullptr; }
|
|
|
|
|
void SetStringParameters(uint index) const override { }
|
|
|
|
|
uint32 GetGRFID(uint index) const override { return 0; }
|
|
|
|
|
bool IsInspectable(uint index) const override { return GetRoadStopSpec(index) != nullptr; }
|
|
|
|
|
bool ShowSpriteDumpButton(uint index) const override { return true; }
|
|
|
|
|
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, BaseStation::GetByTile(index)->town->index); }
|
|
|
|
|
const void *GetInstance(uint index)const override { return nullptr; }
|
|
|
|
|
const void *GetSpec(uint index) const override { return GetRoadStopSpec(index); }
|
|
|
|
|
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
|
|
|
|
|
uint32 GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetRoadStopSpec(index)->grf_prop.grffile->grfid : 0; }
|
|
|
|
|
|
|
|
|
|
uint Resolve(uint index, uint var, uint param, GetVariableExtra *extra) const override
|
|
|
|
|
{
|
|
|
|
|
return UINT32_MAX;
|
|
|
|
|
int view = GetRoadStopDir(index);
|
|
|
|
|
if (IsDriveThroughStopTile(index)) view += 4;
|
|
|
|
|
RoadStopResolverObject ro(GetRoadStopSpec(index), BaseStation::GetByTile(index), index, nullptr, GetStationType(index), view);
|
|
|
|
|
return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, extra);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExtraInfo(uint index, NIExtraInfoOutput &output) const override
|
|
|
|
|
{
|
|
|
|
|
char buffer[1024];
|
|
|
|
|
output.print("Debug Info:");
|
|
|
|
|
const RoadStopSpec *spec = GetRoadStopSpec(index);
|
|
|
|
|
if (spec) {
|
|
|
|
|
uint class_id = RoadStopClass::Get(spec->cls_id)->global_id;
|
|
|
|
|
seprintf(buffer, lastof(buffer), " class ID: %c%c%c%c, spec ID: %u", class_id >> 24, class_id >> 16, class_id >> 8, class_id, spec->spec_id);
|
|
|
|
|
output.print(buffer);
|
|
|
|
|
seprintf(buffer, lastof(buffer), " spec: stop type: %u, draw mode: %u, cargo triggers: 0x" OTTD_PRINTFHEX64, spec->stop_type, spec->draw_mode, spec->cargo_triggers);
|
|
|
|
|
output.print(buffer);
|
|
|
|
|
|
|
|
|
|
const BaseStation *st = BaseStation::GetByTile(index);
|
|
|
|
|
seprintf(buffer, lastof(buffer), " stop random bits: %02X", st->GetRoadStopRandomBits(index));
|
|
|
|
|
output.print(buffer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* virtual */ void SpriteDump(uint index, std::function<void(const char *)> print) const override
|
|
|
|
|
{
|
|
|
|
|
extern void DumpRoadStopSpriteGroup(const BaseStation *st, const RoadStopSpec *spec, std::function<void(const char *)> print);
|
|
|
|
|
DumpRoadStopSpriteGroup(BaseStation::GetByTile(index), GetRoadStopSpec(index), std::move(print));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -1420,7 +1461,7 @@ static const NIFeature * const _nifeatures[] = {
|
|
|
|
|
&_nif_airporttile, // GSF_AIRPORTTILES
|
|
|
|
|
&_nif_roadtype, // GSF_ROADTYPES
|
|
|
|
|
&_nif_roadtype, // GSF_TRAMTYPES
|
|
|
|
|
&_nif_roadstop, // GSF_ROADSTATIONS
|
|
|
|
|
&_nif_roadstop, // GSF_ROADSTOPS
|
|
|
|
|
&_nif_town, // GSF_FAKE_TOWNS
|
|
|
|
|
&_nif_station_struct, // GSF_FAKE_STATION_STRUCT
|
|
|
|
|
};
|
|
|
|
|