Do not update viewport signs when running headlessly
This commit is contained in:
@@ -236,6 +236,7 @@ static inline RailType UpdateRailType(RailType rt, RailType min)
|
|||||||
*/
|
*/
|
||||||
void UpdateAllVirtCoords()
|
void UpdateAllVirtCoords()
|
||||||
{
|
{
|
||||||
|
if (IsHeadless()) return;
|
||||||
UpdateAllStationVirtCoords();
|
UpdateAllStationVirtCoords();
|
||||||
UpdateAllSignVirtCoords();
|
UpdateAllSignVirtCoords();
|
||||||
UpdateAllTownVirtCoords();
|
UpdateAllTownVirtCoords();
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include "strings_func.h"
|
#include "strings_func.h"
|
||||||
#include "core/pool_func.hpp"
|
#include "core/pool_func.hpp"
|
||||||
#include "viewport_kdtree.h"
|
#include "viewport_kdtree.h"
|
||||||
|
#include "network/network.h"
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ Sign::~Sign()
|
|||||||
*/
|
*/
|
||||||
void Sign::UpdateVirtCoord()
|
void Sign::UpdateVirtCoord()
|
||||||
{
|
{
|
||||||
|
if (IsHeadless()) return;
|
||||||
Point pt = RemapCoords(this->x, this->y, this->z);
|
Point pt = RemapCoords(this->x, this->y, this->z);
|
||||||
|
|
||||||
if (_viewport_sign_kdtree_valid && this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeSign(this->index));
|
if (_viewport_sign_kdtree_valid && this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeSign(this->index));
|
||||||
|
@@ -508,6 +508,7 @@ void Station::UpdateCargoHistory()
|
|||||||
*/
|
*/
|
||||||
void Station::UpdateVirtCoord()
|
void Station::UpdateVirtCoord()
|
||||||
{
|
{
|
||||||
|
if (IsHeadless()) return;
|
||||||
Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
|
Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
|
||||||
|
|
||||||
pt.y -= 32 * ZOOM_LVL_BASE;
|
pt.y -= 32 * ZOOM_LVL_BASE;
|
||||||
@@ -546,6 +547,7 @@ void Station::MoveSign(TileIndex new_xy)
|
|||||||
/** Update the virtual coords needed to draw the station sign for all stations. */
|
/** Update the virtual coords needed to draw the station sign for all stations. */
|
||||||
void UpdateAllStationVirtCoords()
|
void UpdateAllStationVirtCoords()
|
||||||
{
|
{
|
||||||
|
if (IsHeadless()) return;
|
||||||
for (BaseStation *st : BaseStation::Iterate()) {
|
for (BaseStation *st : BaseStation::Iterate()) {
|
||||||
st->UpdateVirtCoord();
|
st->UpdateVirtCoord();
|
||||||
}
|
}
|
||||||
|
@@ -533,6 +533,7 @@ static bool IsCloseToTown(TileIndex tile, uint dist)
|
|||||||
/** Resize the sign (label) of the town after it changes population. */
|
/** Resize the sign (label) of the town after it changes population. */
|
||||||
void Town::UpdateVirtCoord()
|
void Town::UpdateVirtCoord()
|
||||||
{
|
{
|
||||||
|
if (IsHeadless()) return;
|
||||||
this->UpdateLabel();
|
this->UpdateLabel();
|
||||||
Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
|
Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
|
||||||
|
|
||||||
@@ -550,6 +551,7 @@ void Town::UpdateVirtCoord()
|
|||||||
/** Update the virtual coords needed to draw the town sign for all towns. */
|
/** Update the virtual coords needed to draw the town sign for all towns. */
|
||||||
void UpdateAllTownVirtCoords()
|
void UpdateAllTownVirtCoords()
|
||||||
{
|
{
|
||||||
|
if (IsHeadless()) return;
|
||||||
for (Town *t : Town::Iterate()) {
|
for (Town *t : Town::Iterate()) {
|
||||||
t->UpdateVirtCoord();
|
t->UpdateVirtCoord();
|
||||||
}
|
}
|
||||||
|
@@ -5037,7 +5037,7 @@ void RebuildViewportKdtree()
|
|||||||
/* Reset biggest size sign seen */
|
/* Reset biggest size sign seen */
|
||||||
_viewport_sign_maxwidth = 0;
|
_viewport_sign_maxwidth = 0;
|
||||||
|
|
||||||
if (_network_dedicated) {
|
if (IsHeadless()) {
|
||||||
_viewport_sign_kdtree_valid = false;
|
_viewport_sign_kdtree_valid = false;
|
||||||
_viewport_sign_kdtree.Build<ViewportSignKdtreeItem*>(nullptr, nullptr);
|
_viewport_sign_kdtree.Build<ViewportSignKdtreeItem*>(nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
void Waypoint::UpdateVirtCoord()
|
void Waypoint::UpdateVirtCoord()
|
||||||
{
|
{
|
||||||
|
if (IsHeadless()) return;
|
||||||
Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
|
Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
|
||||||
if (_viewport_sign_kdtree_valid && this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index));
|
if (_viewport_sign_kdtree_valid && this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user