Fixed up building enemies and items using componentsin the JSON.

This commit is contained in:
Zed A. Shaw 2025-01-09 14:01:40 -05:00
parent 9ce4fbd552
commit 222b39c403
13 changed files with 76 additions and 60 deletions

View file

@ -10,8 +10,15 @@ namespace matrix {
using std::vector, std::queue, std::array;
using std::min, std::max, std::floor;
typedef vector<int> Row;
typedef vector<Row> Matrix;
template<typename T>
using BaseRow = vector<T>;
template<typename T>
using Base = vector<BaseRow<T>>;
using Row = vector<int>;
using Matrix = vector<Row>;
/*
* Just a quick thing to reset a matrix to a value.
@ -40,6 +47,17 @@ namespace matrix {
return mat.size();
}
template<typename T>
inline Base<T> make_base(size_t width, size_t height) {
Base<T> result(height, BaseRow<T>(width));
return result;
}
inline Matrix make(size_t width, size_t height) {
Matrix result(height, Row(width));
return result;
}
inline size_t next_x(size_t x, size_t width) {
return (x + 1) * ((x + 1) < width);
}