From 61b3e890750006ff5cae5d8d78f42cd28a620c1d Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 23 Nov 2014 23:08:16 +0000 Subject: Allow adding faction wingmen. --- src/game/base/game.cc | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'src') 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]"); } } -- cgit v1.2.3