diff options
Diffstat (limited to 'src/game/base/faction.cc')
-rw-r--r-- | src/game/base/faction.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/game/base/faction.cc b/src/game/base/faction.cc index 5b89e8c..07c0a3a 100644 --- a/src/game/base/faction.cc +++ b/src/game/base/faction.cc @@ -9,6 +9,8 @@ #include "core/range.h" #include "base/faction.h" +#include <iomanip> + #include <cassert> namespace game { @@ -18,7 +20,24 @@ Faction *Faction::faction_default = 0; void func_list_faction(const std::string &args) { - Faction::list(); + if (args.size()) + { + std::istringstream is(args); + std::string label; + + if (is >> label) { + aux::to_label(label); + Faction *faction = Faction::find(label); + if (!faction) { + con_warn << "Unknown faction '" << label << "'" << std::endl; + } else { + faction->print(); + } + } + } else { + Faction::list(); + return; + } } Faction *Faction::find(const std::string & label) @@ -35,6 +54,16 @@ void Faction::list() core::Info::list(faction_infotype); } +void Faction::print() const +{ + core::Info::print(); + + con_print << " ^BFaction repution" << std::endl; + for (core::Reputation::FactionReps::const_iterator rip = reputation().factionreps().begin(); rip != reputation().factionreps().end(); ++rip) { + con_print << " ^B" << std::setw(4) << (*rip)->reputation() << " ^N" << (*rip)->faction()->label() << std::endl; + } +} + bool Faction::init() { // initialize faction InfoType |