Skip to content

Commit

Permalink
Fixed Add/Remove tile in client
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed Nov 30, 2023
1 parent 8b7dfc7 commit 0a16ed1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Client/CentrEDClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,12 @@ public IEnumerable<StaticTile> GetStaticTiles(int x, int y)

public void Add(StaticTile tile)
{
NetState.Send(new InsertStaticPacket(tile));
Landscape.AddTile(tile);

Check warning on line 198 in Client/CentrEDClient.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest, CentrED)

Dereference of a possibly null reference.

Check warning on line 198 in Client/CentrEDClient.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, CentrED)

Dereference of a possibly null reference.

Check warning on line 198 in Client/CentrEDClient.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest, CentrED)

Dereference of a possibly null reference.
}

public void Remove(StaticTile tile)
{
NetState.Send(new DeleteStaticPacket(tile));
Landscape.RemoveTile(tile);

Check warning on line 203 in Client/CentrEDClient.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest, CentrED)

Dereference of a possibly null reference.

Check warning on line 203 in Client/CentrEDClient.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, CentrED)

Dereference of a possibly null reference.
}

public void Send(Packet p)
Expand Down
10 changes: 10 additions & 0 deletions Shared/BaseLandscape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ public Block GetBlock(ushort x, ushort y)
return result;
}

public void AddTile(StaticTile tile)
{
OnStaticTileAdded(tile);
}

public void RemoveTile(StaticTile tile)
{
OnStaticTileRemoved(tile);
}

protected void InternalSetLandId(LandTile tile, ushort newId)
{
tile._id = newId;
Expand Down

0 comments on commit 0a16ed1

Please sign in to comment.