From 87fdac7918d776a4c11b3880eef64b09b334aa1c Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Tue, 4 Jan 2022 18:36:24 +0100 Subject: linux build config and imgs --- game/playercontrol.cpp | 37 +++++++++++++++++++------------------ game/playercontrol.h | 10 +++++----- 2 files changed, 24 insertions(+), 23 deletions(-) (limited to 'game') diff --git a/game/playercontrol.cpp b/game/playercontrol.cpp index dad5b2a..9d854ef 100644 --- a/game/playercontrol.cpp +++ b/game/playercontrol.cpp @@ -67,7 +67,7 @@ void open_unit_menu (Gst &gst, View &view, Fsm &fsm, int p) { Player_control::Player_control () { fsm.arcs.emplace_back( - select, sel_ground, -1, + sel, sel_ground, -1, [](Gst &gst, View &view, Fsm &fsm, int p) { view.selected_ground = p; std::cout << "selected ground " << p << "\n"; @@ -91,7 +91,7 @@ Player_control::Player_control () { view.selected_ground = -1; gst.end_day(); std::cout << "end day " << p << "\n"; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -99,7 +99,7 @@ Player_control::Player_control () { [](Gst &gst, View &view, Fsm &fsm, int p) { view.menu_day.close(); view.selected_ground = -1; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -133,7 +133,7 @@ Player_control::Player_control () { view.menu_tech.close(); view.selected_ground = -1; std::cout << "selected tech " << p << "\n"; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -141,11 +141,11 @@ Player_control::Player_control () { [](Gst &gst, View &view, Fsm &fsm, int p) { view.menu_tech.close(); view.selected_ground = -1; - return select; + return sel; } ); fsm.arcs.emplace_back( - select, sel_unit, -1, + sel, sel_unit, -1, [](Gst &gst, View &view, Fsm &fsm, int p) { view.selected_entity = p; open_unit_menu(gst, view, fsm, p); @@ -158,7 +158,7 @@ Player_control::Player_control () { [](Gst &gst, View &view, Fsm &fsm, int p) { view.selected_entity = -1; view.menu_unit.close(); - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -202,7 +202,7 @@ Player_control::Player_control () { Player &player = gst.players[gst.turn]; player.pay(cost); view.selected_entity = -1; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -239,7 +239,7 @@ Player_control::Player_control () { Player &player = gst.players[gst.turn]; player.pay(gst.get_cost(entb.info, player)); view.selected_entity = -1; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -288,7 +288,7 @@ Player_control::Player_control () { gst.battle(atk, def); view.attacks.clear(); view.selected_entity = -1; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -313,6 +313,7 @@ Player_control::Player_control () { return menu_trade; } ); + /* fsm.arcs.emplace_back( menu_trade, opt, -1, [](Gst &gst, View &view, Fsm &fsm, int p) { @@ -327,7 +328,7 @@ Player_control::Player_control () { gst.entities[view.selected_entity].done = true; view.selected_entity = -1; std::cout << "done trading " << p << "\n"; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -355,7 +356,7 @@ Player_control::Player_control () { gst.entities[view.selected_entity].done = true; view.selected_entity = -1; std::cout << "aged up " << p << "\n"; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -364,7 +365,7 @@ Player_control::Player_control () { view.menu_age_up.close(); view.selected_entity = -1; std::cout << "closed ageup " << p << "\n"; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -391,7 +392,7 @@ Player_control::Player_control () { gst.heal(atk, def); view.heals.clear(); view.selected_entity = -1; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -418,7 +419,7 @@ Player_control::Player_control () { gst.convert(atk, def); view.converts.clear(); view.selected_entity = -1; - return select; + return sel; } ); fsm.arcs.emplace_back( @@ -428,9 +429,9 @@ Player_control::Player_control () { gst.entities[view.selected_entity].done = true; view.selected_entity = -1; std::cout << "done " << p << "\n"; - return select; + return sel; } - ); + ); */ } void Player_control::process (Gst &gst, View &view) { @@ -446,4 +447,4 @@ void Player_control::process (Gst &gst, View &view) { if (view.opt != -1) { fsm.transition(gst, view, fsm, opt, view.opt); } -} \ No newline at end of file +} diff --git a/game/playercontrol.h b/game/playercontrol.h index d6b1fd7..bfcbb97 100644 --- a/game/playercontrol.h +++ b/game/playercontrol.h @@ -8,9 +8,8 @@ #include #include - enum pc_state { - select, + sel, move, attack, train, @@ -46,6 +45,7 @@ enum pc_action { }; + class Fsm; using lambda = std::function; @@ -58,12 +58,12 @@ class Arc { pc_action act; int p; - lambda f; + lambda f; }; class Fsm { public: - Fsm() { state = select; } + Fsm() { state = sel; } void transition (Gst &gst, View &view, Fsm &fsm, pc_action act, int p) { std::cout << "> transitioning from " << state << " with " << act << std::endl; @@ -89,4 +89,4 @@ class Player_control { Fsm fsm; }; -#endif \ No newline at end of file +#endif -- cgit v1.2.3-54-g00ecf