Separated BuildingsData to a singleton as RoadLinesData
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <core/io/config_file.h>
|
||||
class VoxelViewer;
|
||||
class VoxelLodTerrain;
|
||||
class BuildingsData;
|
||||
class StreamWorld : public Spatial {
|
||||
GDCLASS(StreamWorld, Spatial)
|
||||
private:
|
||||
@@ -15,30 +16,6 @@ private:
|
||||
VoxelLodTerrain *terrain;
|
||||
Node *current_scene;
|
||||
ConfigFile config;
|
||||
/* Per-building information */
|
||||
struct building {
|
||||
String id;
|
||||
int pattern_id;
|
||||
Vector<int> residents, workers, guests;
|
||||
Vector<Transform> doors;
|
||||
String key;
|
||||
Transform xform;
|
||||
AABB aabb;
|
||||
int worktime[2];
|
||||
bool generated;
|
||||
static void from_dict(struct building *b,
|
||||
const Dictionary &dict,
|
||||
const String &key);
|
||||
Dictionary to_dict() const;
|
||||
};
|
||||
/* Scene objects data */
|
||||
struct scene_data {
|
||||
Ref<PackedScene> packed_scene;
|
||||
String path;
|
||||
Ref<ResourceInteractiveLoader> loader;
|
||||
std::vector<int> buildings;
|
||||
};
|
||||
HashMap<String, struct scene_data> scenes;
|
||||
HashMap<int, Node *> item_nodes;
|
||||
using tile_key_t = std::tuple<int, int>;
|
||||
struct tile_hash : public std::unary_function<key_t, std::size_t> {
|
||||
@@ -49,19 +26,9 @@ private:
|
||||
};
|
||||
using tile_map_t = std::unordered_map<const tile_key_t,
|
||||
std::vector<int>, tile_hash>;
|
||||
/* Data for each building type */
|
||||
HashMap<String, String> building_data;
|
||||
/* Data for each building in a world */
|
||||
std::vector<struct building> buildings;
|
||||
Vector3 eye;
|
||||
tile_map_t tiles;
|
||||
tile_map_t loaded_tiles;
|
||||
struct checkpoint_data {
|
||||
HashMap<String, String> building_data;
|
||||
std::vector<struct building> buildings;
|
||||
};
|
||||
std::vector<struct checkpoint_data> undo_log;
|
||||
int undo_log_size;
|
||||
|
||||
int world_extent;
|
||||
int tile_size;
|
||||
@@ -69,8 +36,6 @@ private:
|
||||
bool initialized;
|
||||
int current_x, current_z;
|
||||
void _notification(int which);
|
||||
void read_buildings_json(const String &buildings_path);
|
||||
void save_buildings_json(const String &buildings_path);
|
||||
void create_tilemap();
|
||||
void update_view();
|
||||
void viewer_dead();
|
||||
@@ -81,12 +46,10 @@ private:
|
||||
void unload_building(int id);
|
||||
void request_item(int type, int item);
|
||||
void update_items();
|
||||
void filter_generated_stuff();
|
||||
void remove_generated_stuff();
|
||||
void remove_building(int index);
|
||||
void checkpoint();
|
||||
void undo();
|
||||
void remove_generated_stuff();
|
||||
void place_zebras();
|
||||
void undo();
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user