Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Railtypetable does not work as intended #8301

Open
George-VB opened this issue Aug 31, 2020 · 7 comments
Open

Railtypetable does not work as intended #8301

George-VB opened this issue Aug 31, 2020 · 7 comments
Labels
component: NewGRF This issue is related to NewGRFs needs triage This issue needs further investigation before it becomes actionable

Comments

@George-VB
Copy link

George-VB commented Aug 31, 2020

Version

20200821-master-g9340fe9c7c

Expected

A train recognizes railtype as specified in Railtypetable

Got

A train does not recognize railtype as specified in Railtypetable

Steps

Create a game with xUSSR rails and xUSSR set addon. Build an AC depot. Build e320 train. look at the trains power. In case it is 8K - it failed to recognize the track. In case 26K - it got success.

Details:

xUSSR rails specifies the AC track as ERA(0-4).

xUSSR train set add-on specifies table as
SAAA: [BAAA, BABA, BACA, BADA, BAEA, SAAA, SABA, SACA, SADA, SAEA, ERA0],
SBAA: [BBAA, BBBA, BBCA, BBDA, BBEA, SBAA, SBBA, SBCA, SBDA, SBEA, ERA1],
SCAA: [BCAA, BCBA, BCCA, BCDA, BCEA, SCAA, SCBA, SCCA, SCDA, SCEA, ERA2],
SDAA: [BDAA, BDBA, BDCA, BDDA, BDEA, SDAA, SDBA, SDCA, SDDA, SDEA, ERA3],
SEAA: [BEAA, BEBA, BECA, BEDA, BEEA, SEAA, SEBA, SECA, SEDA, SEEA, ERA4],
and checks rails as
((current_railtype == SAAA) ||
(current_railtype == SBAA) ||
(current_railtype == SCAA) ||
(current_railtype == SDAA) ||
(current_railtype == SEAA))

It is intended, that ERA(0-4) rail is interpreted as S*AA rail and the check would return true. But it does not.

In case I put all the labels in the Railtypetable directly, and not as alternatives, NMLC ends with error when I hit limit of 64 labels (not rails in game).

@Eddi-z
Copy link
Contributor

Eddi-z commented Aug 31, 2020

So, i haven't checked any of this, but here is what i think is happening:

SAAA: [BAAA, BABA, BACA, BADA, BAEA, SAAA, SABA, SACA, SADA, SAEA, ERA0],

see, in this line, you have the identifier "SAAA" both on the left and on the right side, which means, it is both the name of a specific railtype label, and of this whole group, so in this line:

((current_railtype == SAAA) ||

nmlc cannot know whether you meant the specific railtype label, or the group.

try renaming the group, to make this distinction clear

@Eddi-z
Copy link
Contributor

Eddi-z commented Aug 31, 2020

what could also be wrong is the following: the identifier SAAA has a value of "index into the RTT", so if your check requires a railtype label, instead of an index...

@George-VB
Copy link
Author

George-VB commented Aug 31, 2020

railtypetable-advanced.zip
I've changed it to
TYPE_SAAA: [BAAA, BABA, BACA, BADA, BAEA, SAAA, SABA, SACA, SADA, SAEA, ERA0],
but it didn't help. for_test2 folder contains updated file

@Eddi-z
Copy link
Contributor

Eddi-z commented Sep 1, 2020

well, the next step would be to look at the generated NFO code. (pass --nfo=filename to nmlc)

@George-VB
Copy link
Author

well, the next step would be to look at the generated NFO code. (pass --nfo=filename to nmlc)

what should we find there?

@Eddi-z
Copy link
Contributor

Eddi-z commented Sep 1, 2020

the questions we need to answer are:

  1. what's actually happening
  2. is it a bug in
    a. your understanding
    b. nmlc
    c. nfo specs
    d. the game

@George-VB
Copy link
Author

George-VB commented Sep 1, 2020

the questions we need to answer are:

  1. what's actually happening
  2. is it a bug in
    a. your understanding
    b. nmlc
    c. nfo specs
    d. the game

here goes the NML, NFO, GRF files
unfortunately I'm not familiar with NFO code for railtables, so I could not understand what is wrong
in NML e320_power has correct (imho) code to use e320_AC_power (26K+ hp)
But in game it has only 8K (e320_15DC_power)

xussrset.zip

@TrueBrain TrueBrain added component: NewGRF This issue is related to NewGRFs needs triage This issue needs further investigation before it becomes actionable labels Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: NewGRF This issue is related to NewGRFs needs triage This issue needs further investigation before it becomes actionable
Projects
None yet
Development

No branches or pull requests

3 participants