Ensure fake coordinates are not negative modulo

Closes #736 prob shouldn't have base acres instead of sea...
This commit is contained in:
Kurt
2026-02-02 02:52:56 -06:00
parent e54814d0d3
commit 9bd47f505a

View File

@@ -283,10 +283,16 @@ private static void GetViewTerrain1(LayerTerrain t, LayerPositionConfig cfg, int
for (int tileX = 0; tileX < TilesPerViewport; tileX++)
{
var actX = relX + tileX;
var acreTemplate = t.GetAcreTemplate(actX, actY);
if (!cfg.IsCoordinateValidRelative(actX, actY))
{
// Fill tile's square with a solid color.
var acreTemplate = t.GetAcreTemplate(actX, actY);
// Ensure coordinates are positive (for modulo later).
if (actX < 0)
actX += TilesPerViewport;
if (actY < 0)
actY += TilesPerViewport;
for (int pixelY = 0; pixelY < TileScale; pixelY++)
{
var index = (tileY * TileScale + pixelY) * (TilesPerViewport * TileScale) + tileX * TileScale;
@@ -303,7 +309,6 @@ private static void GetViewTerrain1(LayerTerrain t, LayerPositionConfig cfg, int
else
{
// Fill tile's square from terrain data.
var acreTemplate = t.GetAcreTemplate(actX, actY);
var tile = t.GetTile(actX, actY);
for (int pixelY = 0; pixelY < TileScale; pixelY++)
{