b-casey / OpenSMACX

A project to decompile SMAC/X to C++ with the long term goal of creating a full open source clone.
GNU General Public License v3.0
52 stars 4 forks source link

Terraforming flags #15

Closed tnevolin closed 4 years ago

tnevolin commented 4 years ago

These flags have nothing to do with land/sea. Instead they provide map items bits those need to be set and removed for given terraforming action to take place, correspondigly. Probably should rename them to reflect this and help others.

Although, to be honest, I am not entirely sure how they get distinguished between land/sea improvements. Probably by assuming that improvements have same flag on land and sea and that removed improvement are superset of incompatible land/sea improvements even if certain sea improvements are disables and never can be at sea.

https://github.com/b-casey/OpenSMACX/blob/53c114db88fa12f5261be3430c2495417ce6e517/src/terraforming.h#L57

DrazharLn commented 4 years ago

Full excerpt:

https://github.com/b-casey/OpenSMACX/blob/53c114db88fa12f5261be3430c2495417ce6e517/src/terraforming.h#L57-L78

E.g. if a mine is added to a tile t, then the items field should be updated like this:

t.items = (t.items & !0x81E00050) | 0x10
b-casey commented 4 years ago

Good catch! I made the erroneous assumption it was related to land/sea because that struct is split between the two for a lot of the other values. These values are all hardcoded into binary for rulesterraforming struct. I see now that they all translate to BIT* map enum. Corrected the misleading code and added more clarity in latest push.