aboutsummaryrefslogtreecommitdiff
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
parent728abda9dc6fc8e65c7c0e0240a2e7d61a43a583 (diff)
invariant added as 'inv'
-rw-r--r--CMakeFiles/Progress/11
-rw-r--r--CMakeFiles/Progress/21
-rw-r--r--CMakeFiles/Progress/61
-rw-r--r--CMakeFiles/Progress/71
-rw-r--r--CMakeFiles/Progress/count.txt1
-rw-r--r--CMakeFiles/sdl_test.dir/CXX.includecache62
-rw-r--r--CMakeFiles/sdl_test.dir/game/ground.cpp.objbin368535 -> 357025 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/game/gst.cpp.objbin0 -> 622213 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/game/load.cpp.objbin0 -> 2292759 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/game/menu.cpp.objbin0 -> 182115 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/game/playercontrol.cpp.objbin0 -> 606459 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/game/tech.cpp.objbin0 -> 1490 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/game/view.cpp.objbin0 -> 17188 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/graphics/graphics.cpp.objbin397169 -> 397169 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/main.cpp.objbin467074 -> 475750 bytes
-rw-r--r--CMakeFiles/sdl_test.dir/objects.abin5511946 -> 5508432 bytes
-rw-r--r--build/sdl_test.exebin2480259 -> 2480762 bytes
-rw-r--r--game/ground.cpp14
-rw-r--r--game/ground.h5
-rw-r--r--game/gst.cpp99
-rw-r--r--game/gst.h15
-rw-r--r--game/load.cpp14
-rw-r--r--game/load.h2
-rw-r--r--game/playercontrol.cpp52
-rw-r--r--game/view.cpp2
-rw-r--r--graphics/graphics.cpp28
-rw-r--r--main.cpp69
27 files changed, 154 insertions, 213 deletions
diff --git a/CMakeFiles/Progress/1 b/CMakeFiles/Progress/1
deleted file mode 100644
index 7b4d68d..0000000
--- a/CMakeFiles/Progress/1
+++ /dev/null
@@ -1 +0,0 @@
-empty \ No newline at end of file
diff --git a/CMakeFiles/Progress/2 b/CMakeFiles/Progress/2
deleted file mode 100644
index 7b4d68d..0000000
--- a/CMakeFiles/Progress/2
+++ /dev/null
@@ -1 +0,0 @@
-empty \ No newline at end of file
diff --git a/CMakeFiles/Progress/6 b/CMakeFiles/Progress/6
deleted file mode 100644
index 7b4d68d..0000000
--- a/CMakeFiles/Progress/6
+++ /dev/null
@@ -1 +0,0 @@
-empty \ No newline at end of file
diff --git a/CMakeFiles/Progress/7 b/CMakeFiles/Progress/7
deleted file mode 100644
index 7b4d68d..0000000
--- a/CMakeFiles/Progress/7
+++ /dev/null
@@ -1 +0,0 @@
-empty \ No newline at end of file
diff --git a/CMakeFiles/Progress/count.txt b/CMakeFiles/Progress/count.txt
deleted file mode 100644
index 8351c19..0000000
--- a/CMakeFiles/Progress/count.txt
+++ /dev/null
@@ -1 +0,0 @@
-14
diff --git a/CMakeFiles/sdl_test.dir/CXX.includecache b/CMakeFiles/sdl_test.dir/CXX.includecache
index 824f336..72f0a59 100644
--- a/CMakeFiles/sdl_test.dir/CXX.includecache
+++ b/CMakeFiles/sdl_test.dir/CXX.includecache
@@ -630,8 +630,6 @@ vector
SDL2/SDL.h
-
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/constants.h
-
C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h
vector
-
@@ -642,28 +640,10 @@ iostream
../umath/vec2.h
C:/Users/jaksk/Desktop/dev/_cpp/age/umath/vec2.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/ground.cpp
-ground.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/ground.h
-gst.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h
-iostream
--
-algorithm
--
-
C:/Users/jaksk/Desktop/dev/_cpp/age/game/ground.h
entity.h
C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.cpp
-gst.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h
-map
--
-iostream
--
-
C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h
iostream
-
@@ -704,12 +684,6 @@ C:/Users/jaksk/Desktop/dev/_cpp/age/game/load.h
gst.h
C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.cpp
-iostream
--
-menu.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.h
-
C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.h
vector
-
@@ -1078,16 +1052,6 @@ vector
tech.h
C:/Users/jaksk/Desktop/dev/_cpp/age/game/tech.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/playercontrol.cpp
-iostream
--
-string
--
-playercontrol.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/playercontrol.h
-entity.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h
-
C:/Users/jaksk/Desktop/dev/_cpp/age/game/playercontrol.h
iostream
-
@@ -1100,10 +1064,6 @@ vector
functional
-
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/tech.cpp
-tech.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/tech.h
-
C:/Users/jaksk/Desktop/dev/_cpp/age/game/tech.h
vector
-
@@ -1126,10 +1086,6 @@ string
../umath/vec2.h
C:/Users/jaksk/Desktop/dev/_cpp/age/umath/vec2.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/view.cpp
-view.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/view.h
-
C:/Users/jaksk/Desktop/dev/_cpp/age/game/view.h
vector
-
@@ -1144,24 +1100,6 @@ C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/cam.h
vector
-
-C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/graphics.cpp
-algorithm
--
-iostream
--
-string
--
-math.h
--
-graphics.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/graphics.h
-../game/menu.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.h
-../game/tile.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/tile.h
-../game/constants.h
-C:/Users/jaksk/Desktop/dev/_cpp/age/game/constants.h
-
C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/graphics.h
vector
-
diff --git a/CMakeFiles/sdl_test.dir/game/ground.cpp.obj b/CMakeFiles/sdl_test.dir/game/ground.cpp.obj
index a0f1c78..dfa13e1 100644
--- a/CMakeFiles/sdl_test.dir/game/ground.cpp.obj
+++ b/CMakeFiles/sdl_test.dir/game/ground.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/game/gst.cpp.obj b/CMakeFiles/sdl_test.dir/game/gst.cpp.obj
new file mode 100644
index 0000000..03b1070
--- /dev/null
+++ b/CMakeFiles/sdl_test.dir/game/gst.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/game/load.cpp.obj b/CMakeFiles/sdl_test.dir/game/load.cpp.obj
new file mode 100644
index 0000000..9b284fb
--- /dev/null
+++ b/CMakeFiles/sdl_test.dir/game/load.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/game/menu.cpp.obj b/CMakeFiles/sdl_test.dir/game/menu.cpp.obj
new file mode 100644
index 0000000..a1d1697
--- /dev/null
+++ b/CMakeFiles/sdl_test.dir/game/menu.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj b/CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj
new file mode 100644
index 0000000..37123b3
--- /dev/null
+++ b/CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/game/tech.cpp.obj b/CMakeFiles/sdl_test.dir/game/tech.cpp.obj
new file mode 100644
index 0000000..28ecd10
--- /dev/null
+++ b/CMakeFiles/sdl_test.dir/game/tech.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/game/view.cpp.obj b/CMakeFiles/sdl_test.dir/game/view.cpp.obj
new file mode 100644
index 0000000..a9fcd8e
--- /dev/null
+++ b/CMakeFiles/sdl_test.dir/game/view.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/graphics/graphics.cpp.obj b/CMakeFiles/sdl_test.dir/graphics/graphics.cpp.obj
index 835676b..a44b33b 100644
--- a/CMakeFiles/sdl_test.dir/graphics/graphics.cpp.obj
+++ b/CMakeFiles/sdl_test.dir/graphics/graphics.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/main.cpp.obj b/CMakeFiles/sdl_test.dir/main.cpp.obj
index dd0521f..ee5598b 100644
--- a/CMakeFiles/sdl_test.dir/main.cpp.obj
+++ b/CMakeFiles/sdl_test.dir/main.cpp.obj
Binary files differ
diff --git a/CMakeFiles/sdl_test.dir/objects.a b/CMakeFiles/sdl_test.dir/objects.a
index 3cbf252..9b2f400 100644
--- a/CMakeFiles/sdl_test.dir/objects.a
+++ b/CMakeFiles/sdl_test.dir/objects.a
Binary files differ
diff --git a/build/sdl_test.exe b/build/sdl_test.exe
index 937671d..9cf847e 100644
--- a/build/sdl_test.exe
+++ b/build/sdl_test.exe
Binary files differ
diff --git a/game/ground.cpp b/game/ground.cpp
index 1cadd9b..5f58717 100644
--- a/game/ground.cpp
+++ b/game/ground.cpp
@@ -4,16 +4,12 @@
#include <iostream>
#include <algorithm>
-Ground::Ground (int sx, int sy) {
+void Ground::build (int sx, int sy) {
sizex = sx; sizey = sy;
tiles = new int[sx*sy];
for (int i=0; i<sx*sy; i++) tiles[i] = 0;
}
-Ground::~Ground () {
-
-}
-
int Ground::at(int x, int y) {
return x+y*sizex;
}
@@ -47,7 +43,7 @@ std::vector<int> Ground::move_area (Gst &gst, Entity &ent) {
std::vector<step> frontier { step { at(ent.x, ent.y), move_num } };
int maxcost = 99;
- if (gst.info_has_ability(ent.info, "Scout")) maxcost = 2;
+ if (gst.inv->info_has_ability(ent.info, "Scout")) maxcost = 2;
int iter=0;
for (; iter<10000; iter++) {
@@ -66,7 +62,7 @@ std::vector<int> Ground::move_area (Gst &gst, Entity &ent) {
for (int t : forward_star) {
if (!(std::find(visited.begin(), visited.end(), t) != visited.end())
&& !(std::find(frontier.begin(), frontier.end(), t) != frontier.end())) {
- int movecost = gst.tiles[gst.ground.tiles[t]].move_cost;
+ int movecost = gst.inv->tiles[tiles[t]].move_cost;
if (movecost > maxcost) movecost = maxcost;
int walkedm = maxf.m - movecost;
bool obstructed = false;
@@ -93,8 +89,8 @@ std::vector<int> Ground::move_area (Gst &gst, Entity &ent) {
std::vector<int> Ground::attack_targets (Gst &gst, Entity &ent) {
std::vector<int> attacks;
int range = gst.get_range(ent);
- bool builds = !gst.info_has_ability(ent.info, "Units Only");
- bool units = !gst.info_has_ability(ent.info, "Buildings Only");
+ bool builds = !gst.inv->info_has_ability(ent.info, "Units Only");
+ bool units = !gst.inv->info_has_ability(ent.info, "Buildings Only");
for (Entity &e : gst.entities) {
if (!units && e.info->unit == 1) continue;
if (!builds && e.info->unit == 0) continue;
diff --git a/game/ground.h b/game/ground.h
index ab8f0e8..d1a4f34 100644
--- a/game/ground.h
+++ b/game/ground.h
@@ -16,13 +16,14 @@ class Resource {
class Ground {
public:
- Ground (int sx, int sy);
- ~Ground ();
+ Ground () {}
int *tiles;
std::vector<Resource> resources;
+ void build (int sx, int sy);
+
int sizex;
int sizey;
int at (int x, int y);
diff --git a/game/gst.cpp b/game/gst.cpp
index 886dcc7..52dfe81 100644
--- a/game/gst.cpp
+++ b/game/gst.cpp
@@ -4,37 +4,39 @@
#include <iostream>
-Player& Gst::get_player (int id) {
- for (auto &player : players) {
- if (id == player.id) return player;
- }
-}
-
-Tech* Gst::get_tech (int id) {
+Tech* Inv::get_tech (int id) {
for (auto &tech : techs) {
if (id == tech.id) return &tech;
}
}
-EntityInfo* Gst::get_info (std::string name) {
+EntityInfo* Inv::get_info (std::string name) {
for (EntityInfo &info : infos) {
if (name == info.name) return &info;
}
}
-EntityInfo* Gst::get_info (int id) {
+EntityInfo* Inv::get_info (int id) {
for (EntityInfo &info : infos) {
if (id == info.id) return &info;
}
}
-bool Gst::info_has_ability (EntityInfo* info, std::string name) {
+bool Inv::info_has_ability (EntityInfo* info, std::string name) {
for (int ab : info->abilities) {
if (abilities[ab].name == name) return true;
}
return false;
}
+
+
+Player& Gst::get_player (int id) {
+ for (auto &player : players) {
+ if (id == player.id) return player;
+ }
+}
+
Entity& Gst::get_at (int x, int y) {
for (Entity &e : entities) {
if (e.x ==x && e.y == y) return e;
@@ -86,6 +88,8 @@ float Gst::get_type_bonus (Entity &atk, Entity &def) {
int Gst::get_vet_level (Entity &ent) { return std::min(3, ent.fights/3); }
std::vector<Bonus> Gst::get_bonuses (Entity &atk, Entity &def) {
+ auto &tiles = inv->tiles;
+ auto &ground = inv->ground;
std::vector<Bonus> bs;
if (tiles[ground.tiles[ground.at(atk.x, atk.y)]].attack_bonus != 0) {
@@ -116,35 +120,35 @@ std::vector<Bonus> Gst::get_bonuses (Entity &atk, Entity &def) {
bs.emplace_back(get_type_bonus(def, atk), Bonus::Id::type, false);
}*/
- if (info_has_ability(atk.info, "Causes Fear"))
+ if (inv->info_has_ability(atk.info, "Causes Fear"))
bs.emplace_back(-1.0f/3, Bonus::Id::ability, false);
- if (info_has_ability(def.info, "Causes Fear"))
+ if (inv->info_has_ability(def.info, "Causes Fear"))
bs.emplace_back(-1.0f/3, Bonus::Id::ability, true);
- if (info_has_ability(atk.info, "Anti-Cavalry"))
+ if (inv->info_has_ability(atk.info, "Anti-Cavalry"))
bs.emplace_back(4.0f/3, Bonus::Id::ability, true);
- if (info_has_ability(def.info, "Anti-Cavalry"))
+ if (inv->info_has_ability(def.info, "Anti-Cavalry"))
bs.emplace_back(4.0f/3, Bonus::Id::ability, false);
- if (info_has_ability(atk.info, "Desert Charge")
- && !info_has_ability(def.info, "Desert Charge")
+ if (inv->info_has_ability(atk.info, "Desert Charge")
+ && !inv->info_has_ability(def.info, "Desert Charge")
&& tiles[ground.tiles[ground.at(def.x, def.y)]].name == "Desert")
bs.emplace_back(1.0f/3, Bonus::Id::ability, true);
- if (info_has_ability(atk.info, "Plains Charge")
- && !info_has_ability(def.info, "Plains Charge")
+ if (inv->info_has_ability(atk.info, "Plains Charge")
+ && !inv->info_has_ability(def.info, "Plains Charge")
&& tiles[ground.tiles[ground.at(def.x, def.y)]].name == "Plains")
bs.emplace_back(1.0f/3, Bonus::Id::ability, true);
- if (info_has_ability(atk.info, "Woodsman")
- && !info_has_ability(def.info, "Woodsman")
+ if (inv->info_has_ability(atk.info, "Woodsman")
+ && !inv->info_has_ability(def.info, "Woodsman")
&& tiles[ground.tiles[ground.at(def.x, def.y)]].name == "Forest")
bs.emplace_back(1.0f/3, Bonus::Id::ability, true);
- if (info_has_ability(atk.info, "Volley") && atk.hp >= 50)
+ if (inv->info_has_ability(atk.info, "Volley") && atk.hp >= 50)
bs.emplace_back(1.0f/3, Bonus::Id::ability, true);
- if (info_has_ability(atk.info, "Frenzy"))
+ if (inv->info_has_ability(atk.info, "Frenzy"))
bs.emplace_back(1/atk.hp, Bonus::Id::ability, true);
Player &player_atk = players[atk.owner];
@@ -188,7 +192,7 @@ float Gst::get_damage (Entity &atk, Entity &def) {
bool Gst::get_first_strike (Entity &atk, Entity &def) {
bool fs { false };
- fs = info_has_ability(atk.info, "First Strike");
+ fs = inv->info_has_ability(atk.info, "First Strike");
return fs;
}
@@ -200,12 +204,12 @@ float clamp_hp (float hp) {
BattleResult Gst::battle_res (Entity &atk, Entity &def) {
BattleResult result { atk.hp, def.hp };
- bool first_strike_atk = info_has_ability(atk.info, "First Strike");
- bool first_strike_def = info_has_ability(def.info, "First Strike");
- bool skirmish_atk = info_has_ability(atk.info, "Skirmish");
- bool skirmish_def = info_has_ability(def.info, "Skirmish");
- bool anticav_atk = info_has_ability(atk.info, "Anti-Cavalry");
- bool anticav_def = info_has_ability(def.info, "Anti-Cavalry");
+ bool first_strike_atk = inv->info_has_ability(atk.info, "First Strike");
+ bool first_strike_def = inv->info_has_ability(def.info, "First Strike");
+ bool skirmish_atk = inv->info_has_ability(atk.info, "Skirmish");
+ bool skirmish_def = inv->info_has_ability(def.info, "Skirmish");
+ bool anticav_atk = inv->info_has_ability(atk.info, "Anti-Cavalry");
+ bool anticav_def = inv->info_has_ability(def.info, "Anti-Cavalry");
first_strike_atk = first_strike_atk
|| (skirmish_atk && def.info->range == 1);
first_strike_def = first_strike_def
@@ -225,32 +229,32 @@ BattleResult Gst::battle_res (Entity &atk, Entity &def) {
result.atk_hp = clamp_hp(
result.atk_hp - get_damage(def, atk, result.def_hp));
}
- if (!info_has_ability(atk.info, "No Counter"))
+ if (!inv->info_has_ability(atk.info, "No Counter"))
if (result.atk_hp > 0)
result.def_hp = clamp_hp(
result.def_hp - get_damage(atk, def, result.atk_hp));
} else {
result.def_hp = clamp_hp(
result.def_hp - get_damage(atk, def, result.atk_hp));
- if (!info_has_ability(def.info, "No Counter") && def_inrange)
+ if (!inv->info_has_ability(def.info, "No Counter") && def_inrange)
if (result.def_hp > 0)
result.atk_hp = clamp_hp(
result.atk_hp - get_damage(def, atk, result.def_hp));
}
- if (info_has_ability(atk.info, "Rapid Fire"))
+ if (inv->info_has_ability(atk.info, "Rapid Fire"))
if (result.def_hp > 0)
result.def_hp = clamp_hp(
result.def_hp - get_damage(atk, def, result.def_hp));
- if (info_has_ability(def.info, "Rapid Fire") && def_inrange)
+ if (inv->info_has_ability(def.info, "Rapid Fire") && def_inrange)
if (result.atk_hp > 0)
result.atk_hp = clamp_hp(
result.atk_hp - get_damage(def, atk, result.def_hp));
- if (result.atk_hp > 0 && info_has_ability(atk.info, "Zeal"))
+ if (result.atk_hp > 0 && inv->info_has_ability(atk.info, "Zeal"))
result.atk_hp = clamp_hp(result.atk_hp + 20);
- if (result.def_hp > 0 && info_has_ability(def.info, "Zeal"))
+ if (result.def_hp > 0 && inv->info_has_ability(def.info, "Zeal"))
result.def_hp = clamp_hp(result.def_hp + 20);
return result;
@@ -285,6 +289,8 @@ void Gst::clear_dead() {
int Gst::get_range (Entity &ent) {
int range = ent.info->range;
if (range > 1) {
+ auto &tiles = inv->tiles;
+ auto &ground = inv->ground;
range += tiles[ground.tiles[ground.at(ent.x, ent.y)]].range_bonus;
}
if (range < 1) range = 1;
@@ -306,7 +312,7 @@ void Gst::convert (Entity &atk, Entity &def) {
if (player.has_tech(53)) { amt += 0.10f; } // tech faith
// caution, randomness
std::uniform_real_distribution<float> odds(0, 1);
- float value = odds(engine);
+ float value = odds(inv->engine);
std::cout << value << " / " << amt << " odds\n";
if (value < amt) {
def.owner = atk.owner;
@@ -320,7 +326,7 @@ std::vector<int> Gst::get_possible_trains (Entity &ent) {
std::vector<int> trains;
if (ent.info->id == 107) { // market special case
std::vector<int> candidates;
- for (EntityInfo &info : infos) {
+ for (EntityInfo &info : inv->infos) {
if (info.id == 0) continue; // villager only in train_id
if (info.level > player.level) continue;
if (info.level < player.level && info.upgrade != -1) continue;
@@ -329,14 +335,14 @@ std::vector<int> Gst::get_possible_trains (Entity &ent) {
candidates.push_back(info.id);
}
}
- std::shuffle(candidates.begin(), candidates.end(), engine);
+ std::shuffle(candidates.begin(), candidates.end(), inv->engine);
// pick 3 cands at random
for (int i=0; i<3; i++) trains.push_back(candidates[i]);
return trains;
}
for (int id : ent.info->train_id) {
- auto info = get_info(id);
+ auto info = inv->get_info(id);
if (info->level > player.level) continue;
if (info->level < player.level && info->upgrade != -1) continue;
trains.push_back(id);
@@ -361,7 +367,7 @@ std::vector<int> Gst::get_possible_trains (Entity &ent) {
std::vector<int> Gst::get_possible_builds (Entity &ent) {
std::vector<int> builds;
for (int id : ent.info->build) {
- if (check_req_build(ent, get_info(id))) {
+ if (check_req_build(ent, inv->get_info(id))) {
builds.push_back(id);
}
}
@@ -370,6 +376,7 @@ std::vector<int> Gst::get_possible_builds (Entity &ent) {
bool Gst::check_req_build(Entity &ent, EntityInfo *info) {
+ auto &ground = inv->ground;
Player &player = players[ent.owner];
if (player.level < info->level) return false;
for (int id : info->adjacent) {
@@ -476,7 +483,7 @@ bool Gst::check_req_level (Player &player) {
}
std::map<int, int> lv_techs;
- for (int id : player.techs) lv_techs[get_tech(id)->level] ++;
+ for (int id : player.techs) lv_techs[inv->get_tech(id)->level] ++;
if (player.level == 0) {
if (lv_techs[0] >= 3) return true;
}
@@ -538,7 +545,7 @@ void Gst::level_upgrade (Player &player) {
for (Entity &e : entities) {
if (get_player(e.owner) == player) {
if (e.info->upgrade != -1 && e.info->level == player.level) {
- e.info = get_info(e.info->upgrade);
+ e.info = inv->get_info(e.info->upgrade);
}
}
}
@@ -548,7 +555,7 @@ void Gst::level_upgrade (Player &player) {
void Gst::update_tech_lookup (Player &player) {
player.tech_lookup.map_id.clear();
for (int i : player.techs) {
- Tech *tech = get_tech(i);
+ Tech *tech = inv->get_tech(i);
std::vector<int> ids { };
bool noaff = true;
if (tech->bonus.aff_id.size() > 0) {
@@ -556,7 +563,7 @@ void Gst::update_tech_lookup (Player &player) {
noaff = false;
} else {
if (tech->bonus.aff_level != -1) {
- for (EntityInfo info : infos) {
+ for (EntityInfo info : inv->infos) {
if (info.level == tech->bonus.aff_level) {
ids.push_back(info.id);
}
@@ -564,7 +571,7 @@ void Gst::update_tech_lookup (Player &player) {
noaff = false;
}
if (tech->bonus.aff_class.size() > 0) {
- for (EntityInfo info : infos) {
+ for (EntityInfo info : inv->infos) {
auto &cls = tech->bonus.aff_class;
if (std::find(cls.begin(), cls.end(),
info.ent_class) != cls.end())
@@ -575,7 +582,7 @@ void Gst::update_tech_lookup (Player &player) {
noaff = false;
}
}
- if (noaff) { for (auto info : infos) ids.push_back(info.id); }
+ if (noaff) { for (auto info : inv->infos) ids.push_back(info.id); }
for (int id : ids) {
player.tech_lookup.map_id[id] =
player.tech_lookup.map_id[id] + tech->bonus;
diff --git a/game/gst.h b/game/gst.h
index dc68b31..e86ddc5 100644
--- a/game/gst.h
+++ b/game/gst.h
@@ -56,13 +56,17 @@ class Inv {
std::vector<Tile> tiles;
Ground ground;
- private:
+ Tech* get_tech (int id);
+ EntityInfo* get_info (std::string name);
+ EntityInfo* get_info (int id);
+ bool info_has_ability (EntityInfo* info, std::string name);
+
std::default_random_engine engine = std::default_random_engine{};
-}
+};
class Gst {
public:
- Gst() { }
+ Gst(Inv *inv) : inv(inv) { }
Inv *inv;
@@ -73,10 +77,7 @@ class Gst {
int day { 0 };
Player& get_player (int id);
- Tech* get_tech (int id);
- EntityInfo* get_info (std::string name);
- EntityInfo* get_info (int id);
- bool info_has_ability (EntityInfo* info, std::string name);
+
Entity& get_at (int x, int y);
std::vector<float> get_cost (EntityInfo *info, Player &player);
float get_trade_rate (Player &player);
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
diff --git a/game/load.h b/game/load.h
index 4a28175..d9da659 100644
--- a/game/load.h
+++ b/game/load.h
@@ -3,6 +3,6 @@
#include "gst.h"
-void load_json (Gst &gst);
+void load_json (Inv &inv);
#endif \ No newline at end of file
diff --git a/game/playercontrol.cpp b/game/playercontrol.cpp
index 2aa9264..3fe178a 100644
--- a/game/playercontrol.cpp
+++ b/game/playercontrol.cpp
@@ -9,14 +9,14 @@ void open_unit_menu (Gst &gst, View &view, Fsm &fsm, int p) {
Player &player = gst.players[ent.owner];
view.menu_unit.options.clear();
if (ent.info->unit == 1) {
- if (gst.ground.move_area(gst, ent).size() > 0
+ if (gst.inv->ground.move_area(gst, ent).size() > 0
&& ent.moved == 0)
{
view.menu_unit.options.emplace_back("Move",
Menu_unit::Opts::move);
}
- if (gst.ground.attack_targets(gst, ent).size() > 0
- && (!gst.info_has_ability(ent.info, "No Move & Attack")
+ if (gst.inv->ground.attack_targets(gst, ent).size() > 0
+ && (!gst.inv->info_has_ability(ent.info, "No Move & Attack")
|| ent.moved == 0)) {
view.menu_unit.options.emplace_back("Attack",
Menu_unit::Opts::attack);
@@ -28,14 +28,14 @@ void open_unit_menu (Gst &gst, View &view, Fsm &fsm, int p) {
view.menu_unit.options.emplace_back("Build",
Menu_unit::Opts::build);
}
- if (gst.ground.heal_targets(gst, ent).size() > 0
- && (gst.info_has_ability(ent.info, "Heal")))
+ if (gst.inv->ground.heal_targets(gst, ent).size() > 0
+ && (gst.inv->info_has_ability(ent.info, "Heal")))
{
view.menu_unit.options.emplace_back("Heal",
Menu_unit::Opts::heal);
}
- if (gst.ground.convert_targets(gst, ent).size() > 0
- && (gst.info_has_ability(ent.info, "Convert")))
+ if (gst.inv->ground.convert_targets(gst, ent).size() > 0
+ && (gst.inv->info_has_ability(ent.info, "Convert")))
{
view.menu_unit.options.emplace_back("Convert",
Menu_unit::Opts::convert);
@@ -107,7 +107,7 @@ Player_control::Player_control () {
[](Gst &gst, View &view, Fsm &fsm, int p) {
view.menu_day.close();
view.menu_tech.tech_options.clear();
- for (Tech &tech : gst.techs) {
+ for (Tech &tech : gst.inv->techs) {
view.menu_tech.tech_options.emplace_back(tech.name, &tech);
}
view.menu_tech.open(view.res);
@@ -121,7 +121,7 @@ Player_control::Player_control () {
if (p == -1)
return menu_tech;
Player &player = gst.players[gst.turn];
- Tech *tech = gst.get_tech(p);
+ Tech *tech = gst.inv->get_tech(p);
if (!gst.check_req_tech(tech, player)) {
return menu_tech;
}
@@ -171,8 +171,7 @@ Player_control::Player_control () {
view.menu_train.options.clear();
auto trains = gst.get_possible_trains(ent);
for (int id : trains) {
- EntityInfo *info = gst.get_info(id);
- std::cout << id << " " << gst.get_info(id)->name << "\n";
+ EntityInfo *info = gst.inv->get_info(id);
Option opt { info->name, id };
opt.cost = gst.get_cost(info, player);
if (ent.info->id == 107) { // market
@@ -195,7 +194,7 @@ Player_control::Player_control () {
view.menu_train.close();
Entity &ent = gst.entities[view.selected_entity];
ent.done = true;
- Entity entb { ent.x, ent.y, gst.get_info(p), ent.owner };
+ Entity entb { ent.x, ent.y, gst.inv->get_info(p), ent.owner };
entb.building = -1;
entb.done = true;
entb.hp = 50;
@@ -215,9 +214,8 @@ Player_control::Player_control () {
Player &player = gst.players[ent.owner];
view.menu_build.options.clear();
for (int id : ent.info->build) {
- EntityInfo *info = gst.get_info(id);
+ EntityInfo *info = gst.inv->get_info(id);
if(!gst.check_req_build(ent, info)) continue;
- std::cout << id << " " << gst.get_info(id)->name << "\n";
Option opt { info->name, id };
opt.cost = gst.get_cost(info, player);
view.menu_build.options.push_back(opt);
@@ -233,7 +231,7 @@ Player_control::Player_control () {
std::cout << "building " << p << "\n";
Entity &ent = gst.entities[view.selected_entity];
ent.done = true;
- Entity entb { ent.x, ent.y, gst.get_info(p), ent.owner };
+ Entity entb { ent.x, ent.y, gst.inv->get_info(p), ent.owner };
entb.building = -1;
entb.done = true;
entb.hp = 50;
@@ -250,7 +248,7 @@ Player_control::Player_control () {
view.menu_unit.close();
std::cout << "move " << p << "\n";
Entity &ent = gst.entities[view.selected_entity];
- view.moves = gst.ground.move_area(gst, ent);
+ view.moves = gst.inv->ground.move_area(gst, ent);
return move;
}
);
@@ -260,8 +258,8 @@ Player_control::Player_control () {
std::cout << "moved to " << p << "\n";
Entity &ent = gst.entities[view.selected_entity];
view.moves.clear();
- ent.x = p % gst.ground.sizex;
- ent.y = p / gst.ground.sizex;
+ ent.x = p % gst.inv->ground.sizex;
+ ent.y = p / gst.inv->ground.sizex;
ent.moved = 1;
open_unit_menu(gst, view, fsm, p);
return menu_unit;
@@ -273,7 +271,7 @@ Player_control::Player_control () {
view.menu_unit.close();
std::cout << "attack " << p << "\n";
Entity &ent = gst.entities[view.selected_entity];
- view.attacks = gst.ground.attack_targets(gst, ent);
+ view.attacks = gst.inv->ground.attack_targets(gst, ent);
return attack;
}
);
@@ -282,8 +280,8 @@ Player_control::Player_control () {
[](Gst &gst, View &view, Fsm &fsm, int p) {
std::cout << "attacked " << p << "\n";
Entity &atk = gst.entities[view.selected_entity];
- int x = view.cursor_ground % gst.ground.sizex;
- int y = view.cursor_ground / gst.ground.sizex;
+ int x = view.cursor_ground % gst.inv->ground.sizex;
+ int y = view.cursor_ground / gst.inv->ground.sizex;
std::cout << "selg " << x << " " << y << "\n";
Entity &def = gst.get_at(x, y);
atk.done = true;
@@ -375,7 +373,7 @@ Player_control::Player_control () {
Player &player = gst.players[gst.turn];
view.menu_unit.close();
Entity &ent = gst.entities[view.selected_entity];
- view.heals = gst.ground.heal_targets(gst, ent);
+ view.heals = gst.inv->ground.heal_targets(gst, ent);
std::cout << "heal targeting " << p << "\n";
return target_heal;
}
@@ -385,8 +383,8 @@ Player_control::Player_control () {
[](Gst &gst, View &view, Fsm &fsm, int p) {
std::cout << "healed " << p << "\n";
Entity &atk = gst.entities[view.selected_entity];
- int x = view.cursor_ground % gst.ground.sizex;
- int y = view.cursor_ground / gst.ground.sizex;
+ int x = view.cursor_ground % gst.inv->ground.sizex;
+ int y = view.cursor_ground / gst.inv->ground.sizex;
std::cout << "selg " << x << " " << y << "\n";
Entity &def = gst.get_at(x, y);
atk.done = true;
@@ -402,7 +400,7 @@ Player_control::Player_control () {
Player &player = gst.players[gst.turn];
view.menu_unit.close();
Entity &ent = gst.entities[view.selected_entity];
- view.converts = gst.ground.convert_targets(gst, ent);
+ view.converts = gst.inv->ground.convert_targets(gst, ent);
std::cout << "convert targeting " << p << "\n";
return target_convert;
}
@@ -412,8 +410,8 @@ Player_control::Player_control () {
[](Gst &gst, View &view, Fsm &fsm, int p) {
std::cout << "converted " << p << "\n";
Entity &atk = gst.entities[view.selected_entity];
- int x = view.cursor_ground % gst.ground.sizex;
- int y = view.cursor_ground / gst.ground.sizex;
+ int x = view.cursor_ground % gst.inv->ground.sizex;
+ int y = view.cursor_ground / gst.inv->ground.sizex;
std::cout << "selg " << x << " " << y << "\n";
Entity &def = gst.get_at(x, y);
atk.done = true;
diff --git a/game/view.cpp b/game/view.cpp
index 78a9932..190bd53 100644
--- a/game/view.cpp
+++ b/game/view.cpp
@@ -1,7 +1,7 @@
#include "view.h"
void View::process (Gst &gst, vec2 cam, vec2 mouse, int *mheld) {
- Ground &gr = gst.ground;
+ Ground &gr = gst.inv->ground;
std::vector<Entity> &entities = gst.entities;
vec2 absmouse { mouse };
diff --git a/graphics/graphics.cpp b/graphics/graphics.cpp
index f14a328..fa0c9c8 100644
--- a/graphics/graphics.cpp
+++ b/graphics/graphics.cpp
@@ -199,16 +199,16 @@ void render_entity_info (Graphics *graphics, Gst &gst, vec2 pos, int i) {
graphics->backend.txt.render_text("Abilities", pos + vec2 { 10, 135 });
std::string abname;
for (int s=0; s<ent.info->abilities.size(); s++) {
- abname = gst.abilities[ent.info->abilities[s]].name;
+ abname = gst.inv->abilities[ent.info->abilities[s]].name;
graphics->backend.txt.render_text(abname,
pos + vec2 { 90, 135+s*10.0f });
}
}
void render_tile_info (Graphics *graphics, Gst &gst, vec2 pos, int i) {
- int x = i % gst.ground.sizex;
- int y = i / gst.ground.sizex;
- Tile &tile = gst.tiles[gst.ground.tiles[gst.ground.at(x,y)]];
+ int x = i % gst.inv->ground.sizex;
+ int y = i / gst.inv->ground.sizex;
+ Tile &tile = gst.inv->tiles[gst.inv->ground.tiles[gst.inv->ground.at(x,y)]];
int w = 200, h = 95;
graphics->backend.render_rect (
@@ -331,7 +331,8 @@ void render_attack_info (Graphics *graphics, Gst &gst, vec2 pos, int i, int j) {
(int)pos.y + 35, 32, 32
);
{
- Tile &tile = gst.tiles[gst.ground.tiles[gst.ground.at(atk.x,atk.y)]];
+ Tile &tile = gst.inv->tiles[gst.inv->ground.tiles[
+ gst.inv->ground.at(atk.x,atk.y)]];
graphics->backend.render_sprite (
(int)tile.spritebounds.x,
(int)tile.spritebounds.y-16, 16, 32,
@@ -351,7 +352,8 @@ void render_attack_info (Graphics *graphics, Gst &gst, vec2 pos, int i, int j) {
(int)pos.y + 35, 32, 32
);
{
- Tile &tile = gst.tiles[gst.ground.tiles[gst.ground.at(def.x,def.y)]];
+ Tile &tile = gst.inv->tiles[gst.inv->ground.tiles[
+ gst.inv->ground.at(def.x,def.y)]];
graphics->backend.render_sprite (
(int)tile.spritebounds.x,
(int)tile.spritebounds.y-16, 16, 32,
@@ -434,13 +436,13 @@ void render_attack_info (Graphics *graphics, Gst &gst, vec2 pos, int i, int j) {
void Graphics::render (Gst &gst, View &view)
{
- Ground &gr = gst.ground;
+ Ground &gr = gst.inv->ground;
std::vector<Entity> &entities = gst.entities;
vec2 res { (float)resx, (float)resy };
for (int y=0; y<gr.sizey; y++) {
for (int x=0; x<gr.sizex; x++) {
- Tile &tile = gst.tiles[gr.tiles[gr.at(x,y)]];
+ Tile &tile = gst.inv->tiles[gr.tiles[gr.at(x,y)]];
backend.render_sprite(
(int)tile.spritebounds.x,
(int)tile.spritebounds.y, 16, 16,
@@ -449,7 +451,7 @@ void Graphics::render (Gst &gst, View &view)
}
}
- for (Resource res : gst.ground.resources) {
+ for (Resource res : gr.resources) {
int x = res.pos % gr.sizex;
int y = res.pos / gr.sizex;
backend.render_sprite(
@@ -464,7 +466,7 @@ void Graphics::render (Gst &gst, View &view)
/* overlay */
for (int y=0; y<gr.sizey; y++) {
for (int x=0; x<gr.sizex; x++) {
- Tile &tile = gst.tiles[gr.tiles[gr.at(x,y)]];
+ Tile &tile = gst.inv->tiles[gr.tiles[gr.at(x,y)]];
backend.render_sprite(
(int)tile.spritebounds.x,
(int)tile.spritebounds.y-16, 16, 16,
@@ -492,7 +494,7 @@ void Graphics::render (Gst &gst, View &view)
int x = view.selected_ground % gr.sizex;
int y = view.selected_ground / gr.sizex;
vec2 pos { (float)x*32, (float)y*32 };
- Tile &tile = gst.tiles[gr.tiles[gr.at(x,y)]];
+ Tile &tile = gst.inv->tiles[gr.tiles[gr.at(x,y)]];
backend.render_sprite(
(int)tile.spritebounds.x,
(int)tile.spritebounds.y+256-16, 16, 32,
@@ -586,7 +588,7 @@ void Graphics::render (Gst &gst, View &view)
backend.txt.render_text(txtgold, pos + vec2 { res.x/2+10, 10 });
std::string txtres = "Researching: ";
if (player.researching != -1) {
- txtres += gst.get_tech(player.researching)->name;
+ txtres += gst.inv->get_tech(player.researching)->name;
} else { txtres += "None"; }
float reswidth = backend.txt.get_width(txtres);
backend.txt.render_text(txtres, pos + vec2 { res.x-reswidth-10, 10 });
@@ -602,7 +604,7 @@ void Graphics::render (Gst &gst, View &view)
if (view.hover_ground != -1) { info_ground = view.hover_ground; }
if (view.selected_entity != -1) {
int i = view.selected_entity;
- info_ground = gst.ground.at(entities[i].x, entities[i].y);
+ info_ground = gr.at(entities[i].x, entities[i].y);
}
if (view.selected_ground != -1) { info_ground = view.selected_ground; }
diff --git a/main.cpp b/main.cpp
index d56fd93..a3c40f1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -54,49 +54,52 @@ int main () {
Player_control control;
float ts = 16;
- Gst gst;
- gst.inv.ground { 15,15 };
- load_json(gst);
+ Inv inv;
+ inv.ground.build(15,15);
- gst.players.emplace_back(255, 0, 0, 0);
- gst.players[0].res = std::vector<float> { 1500, 1500 };
- gst.players.emplace_back(0, 0, 255, 1);
- gst.players[1].res = std::vector<float> { 1500, 1500 };
- gst.players[0].level = 2;
-
- gst.ground.tiles[1] = 1;
- gst.ground.tiles[8] = 1;
- gst.ground.tiles[11] = 2;
- gst.ground.tiles[12] = 2;
+ inv.ground.tiles[1] = 1;
+ inv.ground.tiles[8] = 1;
+ inv.ground.tiles[11] = 2;
+ inv.ground.tiles[12] = 2;
for (int i=0; i<2000; i+=37) {
- gst.ground.tiles[i%(gst.ground.sizex*gst.ground.sizey)] = 2;
- gst.ground.tiles[(i+1)%(gst.ground.sizex*gst.ground.sizey)] = 2;
+ inv.ground.tiles[i%(inv.ground.sizex*inv.ground.sizey)] = 2;
+ inv.ground.tiles[(i+1)%(inv.ground.sizex*inv.ground.sizey)] = 2;
}
for (int i=0; i<2000; i+=71) {
- gst.ground.tiles[i%(gst.ground.sizex*gst.ground.sizey)] = 1;
+ inv.ground.tiles[i%(inv.ground.sizex*inv.ground.sizey)] = 1;
}
- gst.ground.resources.emplace_back(gst.ground.at(3, 4), Resource::Type::gold);
- gst.ground.resources.emplace_back(gst.ground.at(4, 4), Resource::Type::food);
+ inv.ground.resources.emplace_back(inv.ground.at(3, 4), Resource::Type::gold);
+ inv.ground.resources.emplace_back(inv.ground.at(4, 4), Resource::Type::food);
+
+ Gst gst { &inv };
+
+ load_json(inv);
+
+ gst.players.emplace_back(255, 0, 0, 0);
+ gst.players[0].res = std::vector<float> { 1500, 1500 };
+ gst.players.emplace_back(0, 0, 255, 1);
+ gst.players[1].res = std::vector<float> { 1500, 1500 };
+ gst.players[0].level = 2;
- gst.entities.emplace_back(5, 1, gst.get_info("Town Center"), 0);
- gst.entities.emplace_back(6, 1, gst.get_info("Barracks"), 0);
- gst.entities.emplace_back(5, 0, gst.get_info("Stable"), 0);
- gst.entities.emplace_back(4, 1, gst.get_info("Market"), 0);
- gst.entities.emplace_back(1, 1, gst.get_info("Villager"), 0);
- gst.entities.emplace_back(2, 1, gst.get_info("Light Cavalry"), 0);
- gst.entities.emplace_back(4, 2, gst.get_info("Light Cavalry"), 1);
- gst.entities.emplace_back(10, 10, gst.get_info("Villager"), 1);
- gst.entities.emplace_back(1, 5, gst.get_info("Villager"), 1);
- gst.entities.emplace_back(2, 5, gst.get_info("Militia"), 1);
- gst.entities.emplace_back(0, 0, gst.get_info("Scout Cavalry"), 0);
- gst.entities.emplace_back(1, 0, gst.get_info("Persian War Elephants"), 0);
- gst.entities.emplace_back(0, 1, gst.get_info("Scorpions"), 1);
- gst.entities.emplace_back(1, 2, gst.get_info("Archers"), 1);
- gst.entities.emplace_back(4, 3, gst.get_info("Monks"), 0);
+ gst.entities.emplace_back(5, 1, inv.get_info("Town Center"), 0);
+ gst.entities.emplace_back(6, 1, inv.get_info("Barracks"), 0);
+ gst.entities.emplace_back(5, 0, inv.get_info("Stable"), 0);
+ gst.entities.emplace_back(4, 1, inv.get_info("Market"), 0);
+ gst.entities.emplace_back(1, 1, inv.get_info("Villager"), 0);
+ gst.entities.emplace_back(2, 1, inv.get_info("Light Cavalry"), 0);
+ gst.entities.emplace_back(4, 2, inv.get_info("Light Cavalry"), 1);
+ gst.entities.emplace_back(10, 10, inv.get_info("Villager"), 1);
+ gst.entities.emplace_back(1, 5, inv.get_info("Villager"), 1);
+ gst.entities.emplace_back(2, 5, inv.get_info("Militia"), 1);
+ gst.entities.emplace_back(0, 0, inv.get_info("Scout Cavalry"), 0);
+ gst.entities.emplace_back(1, 0, inv.get_info("Persian War Elephants"), 0);
+ gst.entities.emplace_back(0, 1, inv.get_info("Scorpions"), 1);
+ gst.entities.emplace_back(1, 2, inv.get_info("Archers"), 1);
+ gst.entities.emplace_back(4, 3, inv.get_info("Monks"), 0);
View view (vec2 { (float)graphics.resx, (float)graphics.resy });