-
Notifications
You must be signed in to change notification settings - Fork 1
Remove TileInstance and just pass around TileId instead #11
Description
TileInstance was originally setup so that we could try to take advantage of Rust's ownership system when moving tiles around with the hope of avoiding bugs that could result from accidentally duplicating a tile. However, in practice a lot of communication around tiles is based around TileId. This is especially common around client/server communication, where we always send a TileId rather than a full TileInstance in order to minimize bandwidth usage. With the addition of tile::by_id() it's now possible to look up the value of a tile with just its ID, making TileInstance effectively pointless.
At this point we should remove TileInstance and just use TileId everywhere, using tile::by_id() to lookup the value of the tile in the cases where it is needed. In practice it may still be convenient to keep TileInstance so that we can have a concept of a combine (ID + value) pair when referring to a tile, but we should largely remove from the public APIs of the different components of the game.