Codechange: Store the rail type of rail engines as a RailTypes bitmask.

This commit is contained in:
Michael Lutz
2025-06-13 21:01:31 +02:00
parent 0715903b24
commit 3ac1a2f1e4
27 changed files with 184 additions and 87 deletions

View File

@@ -1333,10 +1333,10 @@ bool AfterLoadGame()
RailType min_rail = RAILTYPE_ELECTRIC;
for (Train *v : Train::Iterate()) {
RailType rt = RailVehInfo(v->engine_type)->railtype;
RailTypes rts = RailVehInfo(v->engine_type)->railtypes;
v->railtype = rt;
if (rt == RAILTYPE_ELECTRIC) min_rail = RAILTYPE_RAIL;
v->railtypes = rts;
if (rts.Test(RAILTYPE_ELECTRIC)) min_rail = RAILTYPE_RAIL;
}
/* .. so we convert the entire map from normal to elrail (so maintain "fairness") */