|
@@ -428,57 +428,57 @@ void FixOldWaypoints(void)
|
|
|
Waypoint *wp;
|
|
|
|
|
|
/* Convert the old 'town_or_string', to 'string' / 'town' / 'town_cn' */
|
|
|
FOR_ALL_WAYPOINTS(wp) {
|
|
|
if (wp->xy == 0)
|
|
|
continue;
|
|
|
|
|
|
wp->town_index = ClosestTownFromTile(wp->xy, (uint)-1)->index;
|
|
|
wp->town_cn = 0;
|
|
|
if (wp->string & 0xC000) {
|
|
|
wp->town_cn = wp->string & 0x3F;
|
|
|
wp->string = STR_NULL;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void InitializeWaypoints(void)
|
|
|
{
|
|
|
CleanPool(&_waypoint_pool);
|
|
|
AddBlockToPool(&_waypoint_pool);
|
|
|
}
|
|
|
|
|
|
static const SaveLoad _waypoint_desc[] = {
|
|
|
SLE_CONDVAR(Waypoint, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
|
|
|
SLE_CONDVAR(Waypoint, xy, SLE_UINT32, 6, 255),
|
|
|
SLE_CONDVAR(Waypoint, town_index, SLE_UINT16, 12, 255),
|
|
|
SLE_CONDVAR(Waypoint, town_cn, SLE_UINT8, 12, 255),
|
|
|
SLE_CONDVAR(Waypoint, xy, SLE_UINT32, 6, SL_MAX_VERSION),
|
|
|
SLE_CONDVAR(Waypoint, town_index, SLE_UINT16, 12, SL_MAX_VERSION),
|
|
|
SLE_CONDVAR(Waypoint, town_cn, SLE_UINT8, 12, SL_MAX_VERSION),
|
|
|
SLE_VAR(Waypoint, string, SLE_UINT16),
|
|
|
SLE_VAR(Waypoint, deleted, SLE_UINT8),
|
|
|
|
|
|
SLE_CONDVAR(Waypoint, build_date, SLE_UINT16, 3, 255),
|
|
|
SLE_CONDVAR(Waypoint, localidx, SLE_UINT8, 3, 255),
|
|
|
SLE_CONDVAR(Waypoint, grfid, SLE_UINT32, 17, 255),
|
|
|
SLE_CONDVAR(Waypoint, build_date, SLE_UINT16, 3, SL_MAX_VERSION),
|
|
|
SLE_CONDVAR(Waypoint, localidx, SLE_UINT8, 3, SL_MAX_VERSION),
|
|
|
SLE_CONDVAR(Waypoint, grfid, SLE_UINT32, 17, SL_MAX_VERSION),
|
|
|
|
|
|
SLE_END()
|
|
|
};
|
|
|
|
|
|
static void Save_WAYP(void)
|
|
|
{
|
|
|
Waypoint *wp;
|
|
|
|
|
|
FOR_ALL_WAYPOINTS(wp) {
|
|
|
if (wp->xy != 0) {
|
|
|
SlSetArrayIndex(wp->index);
|
|
|
SlObject(wp, _waypoint_desc);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void Load_WAYP(void)
|
|
|
{
|
|
|
int index;
|
|
|
|
|
|
while ((index = SlIterateArray()) != -1) {
|
|
|
Waypoint *wp;
|
|
|
|
|
|
if (!AddBlockIfNeeded(&_waypoint_pool, index))
|