1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Tests: Add schematic unittests

Improve schematic file-saving interface
Add ability to create temporary test files
This commit is contained in:
kwolekr 2015-05-08 00:05:08 -04:00
parent 33c11415bf
commit 2dba29ebf2
8 changed files with 329 additions and 32 deletions

View file

@ -85,26 +85,14 @@ enum SchematicFormatType {
class Schematic : public ObjDef, public NodeResolver {
public:
std::vector<content_t> c_nodes;
u32 flags;
v3s16 size;
MapNode *schemdata;
u8 *slice_probs;
Schematic();
virtual ~Schematic();
virtual void resolveNodeNames();
void updateContentIds();
void blitToVManip(v3s16 p, MMVManip *vm,
Rotation rot, bool force_placement);
bool loadSchematicFromFile(const std::string &filename, INodeDefManager *ndef,
StringMap *replace_names);
bool saveSchematicToFile(const std::string &filename);
StringMap *replace_names=NULL);
bool saveSchematicToFile(const std::string &filename, INodeDefManager *ndef);
bool getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2);
bool deserializeFromMts(std::istream *is, std::vector<std::string> *names);
@ -112,11 +100,18 @@ public:
bool serializeToLua(std::ostream *os, const std::vector<std::string> &names,
bool use_comments, u32 indent_spaces);
void placeStructure(Map *map, v3s16 p, u32 flags,
Rotation rot, bool force_placement);
void blitToVManip(v3s16 p, MMVManip *vm, Rotation rot, bool force_place);
void placeStructure(Map *map, v3s16 p, u32 flags, Rotation rot, bool force_place);
void applyProbabilities(v3s16 p0,
std::vector<std::pair<v3s16, u8> > *plist,
std::vector<std::pair<s16, u8> > *splist);
std::vector<content_t> c_nodes;
u32 flags;
v3s16 size;
MapNode *schemdata;
u8 *slice_probs;
};
class SchematicManager : public ObjDefManager {