aboutsummaryrefslogtreecommitdiff
path: root/game/load.cpp
diff options
context:
space:
mode:
authorjacopograndi <jak.sk8@hotmail.it>2021-09-05 23:00:42 +0200
committerjacopograndi <jak.sk8@hotmail.it>2021-09-05 23:00:42 +0200
commit522a43d16e812e10ff69747ee916918b4bd29f2f (patch)
tree3a9b9cb7a5d103252099d0eabb3c8d6ab8803550 /game/load.cpp
parent728abda9dc6fc8e65c7c0e0240a2e7d61a43a583 (diff)
invariant added as 'inv'
Diffstat (limited to 'game/load.cpp')
-rw-r--r--game/load.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/game/load.cpp b/game/load.cpp
index 4b58ff0..9f58c7d 100644
--- a/game/load.cpp
+++ b/game/load.cpp
@@ -32,8 +32,8 @@ std::vector<Ability> load_abilities () {
return abs;
}
-void load_json (Gst &gst) {
- gst.abilities = load_abilities();
+void load_json (Inv &inv) {
+ inv.abilities = load_abilities();
std::ifstream file_tiles("content/tiles.json");
json j_tiles; file_tiles >> j_tiles;
@@ -44,7 +44,7 @@ void load_json (Gst &gst) {
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);
+ inv.tiles.push_back(tile);
}
std::ifstream file_ents("content/entities.json");
@@ -86,8 +86,8 @@ void load_json (Gst &gst) {
it["class"].get<std::string>());
for (auto ab : it["abilities"]) {
int index = 0;
- for (int i=0; i<gst.abilities.size(); i++) {
- if (gst.abilities[i].name == ab) { index = i; break; }
+ for (int i=0; i<inv.abilities.size(); i++) {
+ if (inv.abilities[i].name == ab) { index = i; break; }
}
ent.abilities.push_back(index);
}
@@ -96,7 +96,7 @@ void load_json (Gst &gst) {
if (it.contains("defence_bonus")) {
ent.defence_bonus = it["defence_bonus"];
}
- gst.infos.push_back(ent);
+ inv.infos.push_back(ent);
}
std::ifstream file_techs("content/techs.json");
@@ -147,6 +147,6 @@ void load_json (Gst &gst) {
}
std::cout << tech.id << tech.bonus.to_string() << std::endl;
- gst.techs.push_back(tech);
+ inv.techs.push_back(tech);
}
} \ No newline at end of file