This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
-- Scale world positions so every road segment (straight line between town centers)
-- is at least (1.2 world_units/sec) * (1.5 * 3600 sec) = 6480 units.
-- Method: uniform scale from centroid of towns 1..31; factor = 6480 / min_edge
-- where min_edge was ~870.54 (towns 8–2) before this migration.
-- Server recomputes road polylines and Distance in LoadRoadGraph from town coords.
-- Centroid and scale (derived from pre-migration layout including 000030 towns).
-- cx, cy = AVG(world_x), AVG(world_y) over ids 1..31 before scale.
DO$$
DECLARE
cxdoubleprecision:=5365.609677419355;
cydoubleprecision:=4259.612903225806;
sdoubleprecision:=6480.0/870.5435801842434;
BEGIN
UPDATEpublic.towns
SETworld_x=cx+(world_x-cx)*s,
world_y=cy+(world_y-cy)*s
WHEREidBETWEEN1AND31;
UPDATEpublic.heroes
SETposition_x=cx+(position_x-cx)*s,
position_y=cy+(position_y-cy)*s;
END$$;
-- Stored road.distance is overwritten at runtime; scale placeholders for any SQL/reporting.