Merge branch 'master' into jgrpp

Remove the viewport sign cache as this is now superseded by the kd tree
implementation

# Conflicts:
#	src/crashlog.cpp
#	src/lang/english.txt
#	src/misc.cpp
#	src/pathfinder/follow_track.hpp
#	src/pbs.cpp
#	src/rail_cmd.cpp
#	src/saveload/vehicle_sl.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/ship_cmd.cpp
#	src/station.cpp
#	src/station_base.h
#	src/station_cmd.cpp
#	src/table/settings.ini
#	src/thread/thread_morphos.cpp
#	src/town_cmd.cpp
#	src/train_cmd.cpp
#	src/viewport.cpp
#	src/waypoint.cpp
This commit is contained in:
Jonathan G Rennison
2019-03-12 18:00:36 +00:00
177 changed files with 3131 additions and 2247 deletions

View File

@@ -20,6 +20,7 @@
#include "pathfinder/yapf/yapf_cache.h"
#include "strings_func.h"
#include "viewport_func.h"
#include "viewport_kdtree.h"
#include "window_func.h"
#include "date_func.h"
#include "vehicle_func.h"
@@ -44,7 +45,6 @@ void Waypoint::UpdateVirtCoord()
this->sign.UpdatePosition(pt.x, pt.y - 32 * ZOOM_LVL_BASE, STR_VIEWPORT_WAYPOINT);
/* Recenter viewport */
InvalidateWindowData(WC_WAYPOINT_VIEW, this->index);
ViewportClearStationSignCache();
}
/**
@@ -239,11 +239,15 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
}
if (flags & DC_EXEC) {
bool need_sign_update = false;
if (wp == NULL) {
wp = new Waypoint(start_tile);
need_sign_update = true;
} else if (!wp->IsInUse()) {
/* Move existing (recently deleted) waypoint to the new location */
_viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(wp->index));
wp->xy = start_tile;
need_sign_update = true;
}
wp->owner = GetTileOwner(start_tile);
@@ -258,6 +262,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
if (wp->town == NULL) MakeDefaultName(wp);
wp->UpdateVirtCoord();
if (need_sign_update) _viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeWaypoint(wp->index));
byte map_spec_index = AllocateSpecToStation(spec, wp, true);
@@ -315,6 +320,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
wp = new Waypoint(tile);
} else {
/* Move existing (recently deleted) buoy to the new location */
_viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(wp->index));
wp->xy = tile;
InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);
}
@@ -333,6 +339,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
MarkTileDirtyByTile(tile);
wp->UpdateVirtCoord();
_viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeWaypoint(wp->index));
InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);
}