Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

(Yet another) Attempt at a karte_t refactor

Started by ceeac, September 25, 2019, 09:05:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


So, I have been thinking of doing yet another attempt at refactoring karte_t. My intention is to separate physical map properties like terrain, vehicles, cities etc. from the rest of the members of karte_t.
This first work-in-progress patch just moves these "physical map properties" to a separate map_t class and moves sync_list_t to separate h/cc files.

I am aware that there are now two classes named "map"; map_t seemed fitting, however renaming karte_t to world_t, or game_t as suggested in [this](,13960.msg138441.html#msg138441) comment is a huge task and I do not want to do it without prior discussion.

Some further things I want to do (in no particular order):

  • Move terraformer_t to its own h/cc file. terraformer_t seems to not be tightly coupled to karte_t so this should be easy to do.
  • Move terrain generation functions to map_t (e.g. create_rivers())
  • Move terraforming stuff to map_t (like raise_to, lower_to)

Since this is a rather large patch already, I created a branch to be able to view smaller individual commits:


That's looking pretty good, I like it.

I'm just a bit puzzled on why there's now an include for cstring in macros.h. None of the changes seem to require that.


Maybe call the actual map information "terrain_t" and leave map_t to the actual map to orient on the terrain. I would also put all terrain related into this and not make another terraforming class.

If we do this, I am afraid almost no patch from experimental will be able to be backported and vice versa though.