This week saw the completion of my minimap modifications and some work with rails.

Minimap

The final set of minimap modifications are now complete. Icons for city centres now hang around the edge of the map even when the city moves out of view. This way it is much easier to navigate back to a city that you've already discovered. Implementing this was simple. All I needed to do was take the position of the icon on the map space and clamp it down to map size. The result looks something like this.

Priority System for Rails

Issue #43 and #15 had something in common: the module had many possible choices for the block to be placed so it couldn't place the "right one". The solution was simple, tell the module what this "right one" is. So I implemented a priority system.

Different block types in the block family are defined by the sides on which they are connected. Simple definition of a sloped rail would be a TOP side and a FRONT side. The module maintains a map of all such block types and all their horizontal rotations. If a player tries to place a rail block, the module searches this map for an appropriate block. The problem was that situations like the one in #43 are not represented in this map.

This is where my priority system comes in. If a situation is not in the map, look for the closest situation. I check if a block type is possible. Consider the example in #43. It has a TOP and a FRONT, so a slope is possible. It also has a RIGHT, so a curve is also possible. But my system defines slopes to be of greater priority than curves, so it will return a slope.

Here starts my relevant code.

Relevant PRs

To Do

Minor changes to the PRs have to be made as requested in reviews. If required, I may also change the priority order of rails to better suit the game.
I will now move on to connecting my cities with rails. StaticCities connects cities with roads. I need to adapt that system to DynamicCities and just replace road blocks with rail blocks.