Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2014-11-23 23:08:16 +0000
committerStijn Buys <ingar@osirion.org>2014-11-23 23:08:16 +0000
commit61b3e890750006ff5cae5d8d78f42cd28a620c1d (patch)
treef9ddeea4cb46cee7d00c70fc2e8014dc360f1434 /src/game
parenta6f1fd5ac67993d84de03f66b96f2e88353b9db4 (diff)
Allow adding faction wingmen.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/game.cc46
1 files changed, 35 insertions, 11 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index fda1d70..da7e6db 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -616,9 +616,9 @@ void Game::func_give(core::Player *player, const std::string &args)
} else if (str.compare("reputation") == 0) {
std::string labelstr;
- Faction *faction= 0;
+ Faction *faction = 0;
if (!(is >> labelstr)) {
- player->send("Usage: give reputation [string] [int]");
+ player->send("Usage: give reputation [faction label] [value]");
return;
} else {
aux::to_label(labelstr);
@@ -652,7 +652,7 @@ void Game::func_give(core::Player *player, const std::string &args)
float reputation;
if (!(is >> reputation)) {
- player->send("Usage: give reputation [string] [int]");
+ player->send("Usage: give reputation [faction] [value]");
return;
}
@@ -665,16 +665,15 @@ void Game::func_give(core::Player *player, const std::string &args)
player->send(msgstr.str().c_str());
} else {
- player->send("Usage: give cargo [string] [int]");
- player->send(" give credits [int]");
- player->send(" give reputation [string] [int]");
- player->send(" give ship [string]");
- player->send(" give weapon [string] [int]");
+ player->send("Usage: give cargo [cargo label] [amount]");
+ player->send(" give credits [amount]");
+ player->send(" give reputation [faction label] [value]");
+ player->send(" give ship [ship label]");
+ player->send(" give weapon [weapon label] [amount]");
return;
}
}
-// cheats
void Game::func_wingmen(core::Player *player, const std::string &args)
{
if (!Game::g_devel->value()) {
@@ -697,9 +696,34 @@ void Game::func_wingmen(core::Player *player, const std::string &args)
aux::to_label(str);
if (str.compare("add") == 0) {
- if (NPC::add_wingman(ship)) {
- player->send("Wingman standing by!");
+ Faction *faction = 0;
+ int amount = 1;
+
+ if (is >> str) {
+ aux::to_label(str);
+ faction = Faction::find(str);
+ if (!faction) {
+ player->send("^WUnknown faction '" + str + "'");
+ return;
+ }
+ if ( !(is >> amount)) {
+ amount = 1;
+ }
}
+
+ for (int count = 0; count < amount; ++count) {
+ NPC *npc = NPC::add_wingman(ship);
+ if (npc) {
+ if (faction) {
+ faction->apply(npc);
+ player->send(faction->name() + " wingman standing by!");
+ } else {
+ player->send("Wingman standing by!");
+ }
+ }
+ }
+ } else {
+ player->send("Usage: wingmen add [faction label] [amount]");
}
}