mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-06-19 03:29:26 +01:00
Add: [NewGRF] Train property to set multiple track types for an engine.
This commit is contained in:
parent
67cf8729c4
commit
b7cd4d6fc4
@ -328,6 +328,29 @@ ChangeInfoResult RailVehicleChangeInfo(uint first, uint last, int prop, ByteRead
|
|||||||
e->badges = ReadBadgeList(buf, GSF_TRAINS);
|
e->badges = ReadBadgeList(buf, GSF_TRAINS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x34: { // List of track types
|
||||||
|
uint8_t count = buf.ReadByte();
|
||||||
|
|
||||||
|
_gted[e->index].railtypelabels.clear();
|
||||||
|
while (count--) {
|
||||||
|
uint8_t tracktype = buf.ReadByte();
|
||||||
|
|
||||||
|
if (tracktype < _cur_gps.grffile->railtype_list.size()) {
|
||||||
|
_gted[e->index].railtypelabels.push_back(_cur_gps.grffile->railtype_list[tracktype]);
|
||||||
|
} else {
|
||||||
|
switch (tracktype) {
|
||||||
|
case 0: _gted[e->index].railtypelabels.push_back(rvi->engclass >= 2 ? RAILTYPE_LABEL_ELECTRIC : RAILTYPE_LABEL_RAIL); break;
|
||||||
|
case 1: _gted[e->index].railtypelabels.push_back(RAILTYPE_LABEL_MONO); break;
|
||||||
|
case 2: _gted[e->index].railtypelabels.push_back(RAILTYPE_LABEL_MAGLEV); break;
|
||||||
|
default:
|
||||||
|
GrfMsg(1, "RailVehicleChangeInfo: Invalid track type {} specified, ignoring", tracktype);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ret = CommonVehicleChangeInfo(ei, prop, buf);
|
ret = CommonVehicleChangeInfo(ei, prop, buf);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user