Skip to content

Commit

Permalink
Fixes tile formulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
hyper2snyper committed Jan 30, 2025
1 parent d23c8ce commit 21937a4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
10 changes: 6 additions & 4 deletions Backend/WorldData/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void LoadTerrain()
terrain.heightMax = results.GetFloat(4);
terrain.landType = results.GetString(5);
if (terrain.landType == "Ocean" && terrain.heightMax > oceanHeightMax) oceanHeightMax = terrain.heightMax;
if (terrain.landType == "Highland" && terrain.heightMin < highlandMin) highlandMin = terrain.heightMin;
if (terrain.landType == "Mountain" && terrain.heightMin < highlandMin) highlandMin = terrain.heightMin;
terrains.Add(terrain);
}

Expand Down Expand Up @@ -194,10 +194,12 @@ public void GenerateTiles()
{
for (int y = 0; y < TILE_SIZE; y++)
{
if (tileX * TILE_SIZE + x > MAP_PIXEL_WIDTH) continue;
if (tileY * TILE_SIZE + y > MAP_PIXEL_HEIGHT) continue;
int pixelPosX = (tileX * TILE_SIZE) + x;
int pixelPosY = (tileY * TILE_SIZE) + y;
if (pixelPosX > MAP_PIXEL_WIDTH) continue;
if (pixelPosY > MAP_PIXEL_HEIGHT) continue;

string landType = terrainMap[x, y].name;
string landType = terrainMap[pixelPosX, pixelPosY].name;
if (landTypes.ContainsKey(landType))
{
landTypes[landType]++;
Expand Down
6 changes: 2 additions & 4 deletions Backend/WorldData/Unit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ public Unit()

public override void SerializeFields()
{
SerializeField(health);
SerializeField("sssssaaaaa");

}

public override void DeserializeFields()
{
health = DeserializeField<int>();
string r = DeserializeField<string>();

}
}
}
6 changes: 0 additions & 6 deletions Backend/WorldData/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ public World()
ClientCommunicator.RegisterData<Bitmap>("WorldImage", map.worldImage);
ClientCommunicator.RegisterData<World>("World", map);

units.Add(new Unit());
units.Add(new Unit());
units.Add(new Unit());
units.Add(new Unit());
units.Add(new Unit());
units.Add(new Unit());

}

Expand Down
Binary file modified LocalData/BackendDatabase.db
Binary file not shown.

0 comments on commit 21937a4

Please sign in to comment.