From fa318825ef0404816728f733484caa1bc23afa53 Mon Sep 17 00:00:00 2001 From: hovertank3d Date: Fri, 14 Nov 2025 20:05:59 +0100 Subject: george droid --- include/file/world.hpp | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 include/file/world.hpp (limited to 'include/file/world.hpp') diff --git a/include/file/world.hpp b/include/file/world.hpp new file mode 100644 index 0000000..300a3e0 --- /dev/null +++ b/include/file/world.hpp @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "file/metadata.hpp" +#include "util/bitset.hpp" +#include "util/io.hpp" +#include "version.hpp" + +namespace file { + +class world { + int32_t version; + // metadata meta; + + std::vector positions; + bitset<0> importance; + + int32_t seed; + std::array guid; + int32_t worldID; + int32_t world_left; + int32_t world_right; + int32_t world_top; + int32_t world_botton; + int32_t height; + int32_t width; + +public: + void load_header(std::ifstream& f) + { + } + + world(std::string filename) + { + if (!std::filesystem::exists(filename)) { + throw std::runtime_error("file not found"); + } + auto rw = io::serialized_io(io::file_io { filename }); + + rw.read(version); + if (version <= 88 || version > terraria_version) { + throw std::runtime_error("invalid world file version"); + } + std::cout << version << std::endl; + metadata meta; + + rw.read(meta); + + if (meta.ftype != filetype::World) { + throw std::runtime_error("expected world file"); + } + } +}; + +} \ No newline at end of file -- cgit v1.2.3