From d198dd25af201aaacc7782f4bd36d2cfa5f0c05b Mon Sep 17 00:00:00 2001 From: cflip Date: Thu, 3 Mar 2022 20:30:10 -0700 Subject: Keep list of all vehicles in Level class Newly created vehicles are now to be added to the Level, which automatically updates and renders them. This infrastructure will be needed for depth sorting and eventually level saving. --- src/level.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/level.h') diff --git a/src/level.h b/src/level.h index 897daa5..e915da3 100644 --- a/src/level.h +++ b/src/level.h @@ -3,6 +3,9 @@ #include "bitmap.h" #include #include +#include + +class Train; class Level { public: @@ -13,13 +16,18 @@ public: void set(int x, int y, uint8_t tile); bool inBounds(int x, int y) const { return x >= 0 && x < m_width && y >= 0 && y < m_height; } + void update(); void draw(Bitmap& bitmap, int xo, int yo); + + void addVehicle(Train&); void toggleTile(int x, int y); private: Bitmap& m_tileSprites; int m_width, m_height; uint8_t* m_tiles; + + std::vector m_vehicles; }; enum RailDirection { -- cgit v1.2.3