summaryrefslogtreecommitdiff
path: root/src/game/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r--src/game/game.cpp46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp
index a74a906..086b926 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -161,6 +161,10 @@ void state_t::select(rectf_t rect, int type)
unit->say("Я готов.", false);
break;
+ case unit_t::UNIT_BUILDER:
+ unit->say("Gotowy na rozkaz.", false);
+ break;
+
default:
break;
}
@@ -179,13 +183,15 @@ enum {
COMMAND_REPL_SOLDIER,
COMMAND_REPL_SCIENTIST,
+ COMMAND_REPL_BUILDER,
COMMAND_GATHER
};
bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
{
- bool soldiers = false, repls = false, rockets = false, scientists = false;
+ bool soldiers = false, repls = false, rockets = false,
+ scientists = false, builders = false;
items.clear();
@@ -207,6 +213,10 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
scientists = true;
break;
+ case unit_t::UNIT_BUILDER:
+ builders = true;
+ break;
+
case unit_t::UNIT_REPL:
repls = true;
break;
@@ -215,7 +225,7 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
}
}
- if (soldiers || scientists) {
+ if (soldiers || scientists || builders) {
items.push_back((interface::pie_item_t){"Move", COMMAND_MOVE});
items.push_back((interface::pie_item_t){"Stop", COMMAND_STOP});
}
@@ -229,9 +239,13 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
if (scientists)
items.push_back((interface::pie_item_t){"Gather", COMMAND_GATHER});
+ if (builders)
+ items.push_back((interface::pie_item_t){"TODO", -1});
+
if (repls) {
items.push_back((interface::pie_item_t){"Spawn a soldier", COMMAND_REPL_SOLDIER});
items.push_back((interface::pie_item_t){"Spawn a scientist", COMMAND_REPL_SCIENTIST});
+ items.push_back((interface::pie_item_t){"Spawn a builder", COMMAND_REPL_BUILDER});
}
return true;
@@ -308,6 +322,25 @@ static void command_scientist(unit_scientist_t *scientist, v2f_t x, int number)
}
}
+static void command_builder(unit_builder_t *builder, v2f_t x, int number)
+{
+ switch (number) {
+ case COMMAND_MOVE:
+ if (!builder->start_moving(x))
+ builder->say("Nie ma tam drogi.", false);
+ else {
+ builder->move_marker = std::make_unique<fx_move_marker_t>(builder->game, builder->move.path.back());
+ builder->say("W drodze.", false);
+ }
+ break;
+
+ case COMMAND_STOP:
+ builder->stop_moving();
+ builder->say("Stop.", false);
+ break;
+ }
+}
+
static void command_repl(unit_repl_t *repl, v2f_t x, int number)
{
switch (number) {
@@ -318,6 +351,10 @@ static void command_repl(unit_repl_t *repl, v2f_t x, int number)
case COMMAND_REPL_SCIENTIST:
repl->activate(unit_t::UNIT_SCIENTIST);
break;
+
+ case COMMAND_REPL_BUILDER:
+ repl->activate(unit_t::UNIT_BUILDER);
+ break;
}
}
@@ -349,6 +386,11 @@ void state_t::command(v2f_t x, int number)
x, number);
break;
+ case unit_t::UNIT_BUILDER:
+ command_builder(dynamic_cast<unit_builder_t*>(unit),
+ x, number);
+ break;
+
case unit_t::UNIT_REPL:
command_repl(dynamic_cast<unit_repl_t*>(unit),
x, number);