stwe / MDCII

An unofficial project making from scratch to create an editable Anno 1602 world.
GNU General Public License v2.0
7 stars 2 forks source link

Cod-Reader writes wrong gfx values in the json #16

Closed stwe closed 1 year ago

stwe commented 1 year ago

I think the GFX value 112 here is wrong.

cod

In my opinion is 3064 correct.

stwe commented 1 year ago

eventually the expression "+112" will be misinterpreted

codplus

siredmar commented 1 year ago

Can you search the cod file for the constant IDWOHN and check if it was defined (and what value it hast) and how often this is used?

siredmar commented 1 year ago

I checked with a NINA version of Anno 1602. The constant IDWOHN is defined as IDWOHN = 20601

This means that the value for IDWOHN+20 is correct (20621).

How do you calculate the value of 3064?

stwe commented 1 year ago

Sorry, I mean the GFX value. That should be 3064. The reader writes the wrong GFX value. But it's also good to know that IDWOHN fits. What GFX do you have for the ID?

siredmar commented 1 year ago

This issue is potentially fixed in https://github.com/siredmar/mdcii-engine/commit/520762b846d0181148f7635bf1bde74d3dd2d2ec

The problem was, that relative constant increments (and decrements) were not handled by the cod_parser. Constant assignments are in this format: CONSTANT = The "@" is a marker for a relative assignment followed by the increment (+|-)(number). So they are completely rewriting the value of that constant. Don't know why they didn't use a variable in the first place.

Relative constant assignment: @GFXNR = +112

Relative variable assignment: @GFXNR: +112

Well, this should be fixed. I'd be nice if you tested this if the change has some side effects i didn't see.

stwe commented 1 year ago

@siredmar It looks like the problem has been fixed. Thanks for the support. What is new is that the GFX values for rotated public buildings (e.g. Tavern, Market-Place) are not correct. But this can have many other reasons. Otherwise everything looks very good.