diff options
author | June McEnroe <june@causal.agency> | 2019-01-04 16:27:40 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-01-04 16:27:40 -0500 |
commit | bb7cdbc24e8c588bc0960e5f4e6f49a336f73fe2 (patch) | |
tree | 1a3886b30493415e83b67139afb7c9a5745df91d /torus.h | |
parent | Call cap_enter in client and server (diff) | |
parent | Re-create help page (diff) | |
download | torus-bb7cdbc24e8c588bc0960e5f4e6f49a336f73fe2.tar.gz torus-bb7cdbc24e8c588bc0960e5f4e6f49a336f73fe2.zip |
Merge branch 'backport'
Diffstat (limited to '')
-rw-r--r-- | torus.h | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/torus.h b/torus.h index 41c662b..b9d842f 100644 --- a/torus.h +++ b/torus.h @@ -57,7 +57,7 @@ static const wchar_t CP437[256] = ( ); enum { - CellRows = 24, + CellRows = 25, CellCols = 80, }; static const size_t CellsSize = sizeof(uint8_t[CellRows][CellCols]); @@ -74,24 +74,50 @@ struct Meta { }; struct Tile { - alignas(4096) uint8_t cells[CellRows][CellCols]; - uint8_t colors[CellRows][CellCols]; - struct Meta meta; + alignas(4096) + time_t createTime; + time_t modifyTime; + alignas(16) uint8_t cells[CellRows][CellCols]; + alignas(16) uint8_t colors[CellRows][CellCols]; + uint32_t modifyCount; + uint32_t accessCount; + time_t accessTime; }; static_assert(4096 == sizeof(struct Tile), "struct Tile is page-sized"); +static inline struct Meta tileMeta(const struct Tile *tile) { + return (struct Meta) { + .createTime = tile->createTime, + .modifyTime = tile->modifyTime, + .accessTime = tile->accessTime, + .modifyCount = tile->modifyCount, + .accessCount = tile->accessCount, + }; +} + enum { - TileRows = 64, - TileCols = 64, + TileRows = 512, + TileCols = 512, }; static const size_t TilesSize = sizeof(struct Tile[TileRows][TileCols]); -static const uint32_t TileInitX = TileCols / 2; -static const uint32_t TileInitY = TileRows / 2; +static const uint32_t TileInitX = 0; +static const uint32_t TileInitY = 0; + +static const struct { + uint32_t tileX; + uint32_t tileY; +} Ports[] = { + { TileInitX, TileInitY }, + { TileCols * 3 / 4, TileRows * 3 / 4 }, // NW + { TileCols * 1 / 4, TileRows * 3 / 4 }, // NE + { TileCols * 1 / 4, TileRows * 1 / 4 }, // SE + { TileCols * 3 / 4, TileRows * 1 / 4 }, // SW +}; enum { - MapRows = 7, - MapCols = 7, + MapRows = 11, + MapCols = 11, }; struct Map { @@ -137,6 +163,7 @@ struct ClientMessage { ClientFlip, ClientPut, ClientMap, + ClientTele, } type; union { struct { @@ -147,5 +174,6 @@ struct ClientMessage { uint8_t color; uint8_t cell; } put; + uint8_t port; }; }; |