aboutsummaryrefslogtreecommitdiff
path: root/game/load.cpp
diff options
context:
space:
mode:
authorjacopograndi <jak.sk8@hotmail.it>2021-08-30 14:48:06 +0200
committerjacopograndi <jak.sk8@hotmail.it>2021-08-30 14:48:06 +0200
commitfb5a98b72ab79949d1da7f75a3d6150c2906ef40 (patch)
tree9097b4e1f31e530874df9ab85be03f763fc4ef1b /game/load.cpp
parentace5c3f3093c50ff7fa6f8b281a377e3788abbd5 (diff)
gui: tech representation, menu, tile & unit info, attack info
Diffstat (limited to 'game/load.cpp')
-rw-r--r--game/load.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/game/load.cpp b/game/load.cpp
index d1a1722..5baae6c 100644
--- a/game/load.cpp
+++ b/game/load.cpp
@@ -41,6 +41,8 @@ void load_json (Gst &gst) {
Tile tile;
tile.name = it["name"];
tile.move_cost = it["move_cost"];
+ tile.defence_bonus = it["defence_bonus"];
+ tile.range_bonus = it["range_bonus"];
tile.spritebounds = vec2 { it["spritebounds"][0], it["spritebounds"][1] };
gst.tiles.push_back(tile);
}
@@ -88,4 +90,18 @@ void load_json (Gst &gst) {
ent.spritebounds = vec2 { it["spritebounds"][0], it["spritebounds"][1] };
gst.infos.push_back(ent);
}
+
+ std::ifstream file_techs("content/techs.json");
+ json j_techs; file_techs >> j_techs;
+ for (auto it : j_techs) {
+ Tech tech;
+ tech.name = it["name"];
+ tech.id = it["id"];
+ tech.level = it["level"];
+ tech.req_id = it["req_id"];
+ for (int i=0; i<it["cost"].size(); i++) {
+ tech.cost[i] = it["cost"][i];
+ }
+ gst.techs.push_back(tech);
+ }
} \ No newline at end of file