The problem was that if either string was empty, their respective canvas variables would not be set and
result in a type_error being thrown.
With this change, the canvas variable is always set, even if it's just an empty string.
It was in theory possible to spot the first village from the map edge, in which case Rorthin might not appear if his target location was randomized to be a border hex, so instead we just always move him to the hex north of Delfador.
There were a lot of problems with the code, some actual bugs and some just bad form, so I rewrote and restructured most of it. The only major change is the removal of the unpredictable Skeleton spawn landmine when Delfador steps on the enemy castle (was MEMOIRS_SURPRISE_3).
This was only used in one place and made the sdl/utils.cpp file
depend on the WFL (formula) engine, which is undesirable.
Since it was only used in one place, the implementation was
moved to that one place instead.
replacing some [while] with [repeat] or [random_placement]
Adding terrain= attribute to the variable generated by [random_placement] this mkaes it easier to use [random_placement] as a replacement for [store_locations] + [while] since [store_locations] also generates the [terrain] attribute:
This (should) allow sdl/utils.hpp to be modified without a huge rebuild, since a number
of widely used headers included that file simply for the surface class type.
This is the only place it's used, and it's no longer an SDL-related util now that we have color_t. It could
potentially become part of color_t, but I'd have to think about it.
This also removes the sdl/utils.hpp dependency.
In 8041a0964e7b the label format was changed to an RGB string, but still passed around verbatim.
This is a quick fix that converts the color into a hex string. The color should probably be stored
as color_t internally, but I'm not sure what to do with the areas that involve formulas operating
on the string.
This is done by ignoring shroud for path finding (while still taking
hidden units into account correctly), consistent with default Wesnoth
AI behavior.
Prior to the color_t conversion, labels were written to savefiles with an alpha key, despite alpha not
being accepted in color=. Because of this, this enables the loading of older saves without an exception
throwing.