mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Refactor decoration-related code
Split up ModApiMapgen::l_register_decoration() Define and make use of CONTAINS() and ARRLEN() macros
This commit is contained in:
parent
7c6da2f384
commit
1cb6ea6346
7 changed files with 158 additions and 142 deletions
|
@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "../irr_v3d.h"
|
||||
#include "../irr_aabb3d.h"
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
|
||||
// Calculate the borders of a "d-radius" cube
|
||||
void getFacePositions(std::list<v3s16> &list, u16 d);
|
||||
|
@ -139,6 +140,9 @@ inline v3s16 arealim(v3s16 p, s16 d)
|
|||
return p;
|
||||
}
|
||||
|
||||
#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end())
|
||||
|
||||
// The naive swap performs better than the xor version
|
||||
#define SWAP(t, x, y) do { \
|
||||
t temp = x; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue