diff options
author | jacopograndi <jak.sk8@hotmail.it> | 2021-08-30 14:48:06 +0200 |
---|---|---|
committer | jacopograndi <jak.sk8@hotmail.it> | 2021-08-30 14:48:06 +0200 |
commit | fb5a98b72ab79949d1da7f75a3d6150c2906ef40 (patch) | |
tree | 9097b4e1f31e530874df9ab85be03f763fc4ef1b /game/playercontrol.cpp | |
parent | ace5c3f3093c50ff7fa6f8b281a377e3788abbd5 (diff) |
gui: tech representation, menu, tile & unit info, attack info
Diffstat (limited to 'game/playercontrol.cpp')
-rw-r--r-- | game/playercontrol.cpp | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/game/playercontrol.cpp b/game/playercontrol.cpp index 647f487..90e063e 100644 --- a/game/playercontrol.cpp +++ b/game/playercontrol.cpp @@ -63,23 +63,6 @@ Player_control::Player_control () { view.menu_day.close(); view.selected_ground = -1; gst.end_day(); - for (Entity &e : gst.entities) { - e.done = false; - e.moved = 0; - if (e.owner == gst.turn) { - Player &player = gst.players[e.owner]; - for (int i=0; i<player.res.size(); i++) { - player.res[i] += e.info->prod[i]; - } - // todo heal when on top of building - if (e.building < 0) { - e.building++; - if (e.building == 0) { - e.hp += 50; if (e.hp > 100) e.hp = 100; - } - } - } - } std::cout << "end day " << p << "\n"; return select; } @@ -93,6 +76,36 @@ Player_control::Player_control () { } ); fsm.arcs.emplace_back( + menu_day, opt, Menu_day::Opts::tech, + [](Gst &gst, View &view, Fsm &fsm, int p) { + view.menu_day.close(); + view.menu_tech.tech_options.clear(); + for (Tech &tech : gst.techs) { + view.menu_tech.tech_options.emplace_back(tech.name, &tech); + } + view.menu_tech.open(view.res); + std::cout << "tech screen " << "\n"; + return menu_tech; + } + ); + fsm.arcs.emplace_back( + menu_tech, opt, -1, + [](Gst &gst, View &view, Fsm &fsm, int p) { + view.menu_tech.close(); + view.selected_ground = -1; + std::cout << "selected tech " << p << "\n"; + return select; + } + ); + fsm.arcs.emplace_back( + menu_tech, back, -1, + [](Gst &gst, View &view, Fsm &fsm, int p) { + view.menu_tech.close(); + view.selected_ground = -1; + return select; + } + ); + fsm.arcs.emplace_back( select, sel_unit, -1, [](Gst &gst, View &view, Fsm &fsm, int p) { view.selected_entity = p; |