diff options
author | Eugene Sandulenko | 2016-01-21 14:53:03 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-02-14 17:12:51 +0100 |
commit | b066a592ee394b01823d4c94245f27de0ae49799 (patch) | |
tree | c8f139e2bfa3c8b497c0c106a784e58b178c81ab /engines | |
parent | 3cdc17be949ba72ee185f2c33e1f1949a08a0054 (diff) | |
download | scummvm-rg350-b066a592ee394b01823d4c94245f27de0ae49799.tar.gz scummvm-rg350-b066a592ee394b01823d4c94245f27de0ae49799.tar.bz2 scummvm-rg350-b066a592ee394b01823d4c94245f27de0ae49799.zip |
WAGE: Implement handleStatusCommand()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wage/script.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp index 578267f75f..71f2cec21b 100644 --- a/engines/wage/script.cpp +++ b/engines/wage/script.cpp @@ -1029,8 +1029,47 @@ void Script::handleInventoryCommand() { warning("STUB: handleInventoryCommand"); } +static const char *armorMessages[] = { + "Head protection:", + "Chest protection:", + "Shield protection:", // TODO: check message + "Magical protection:" +}; + void Script::handleStatusCommand() { - warning("STUB: handleStatusCommand"); + Chr *player = _world->_player; + char buf[512]; + + snprintf(buf, 512, "Character name: %s%s", player->getDefiniteArticle(false), player->_name.c_str()); + appendText(buf); + snprintf(buf, 512, "Experience: %d", player->_context._experience); + appendText(buf); + + int wealth = 0; + for (ObjArray::const_iterator it = player->_inventory.begin(); it != player->_inventory.end(); ++it) + wealth += (*it)->_value; + + snprintf(buf, 512, "Wealth: %d", wealth); + appendText(buf); + + for (int i = 0; i < Chr::NUMBER_OF_ARMOR_TYPES; i++) { + if (player->_armor[i] != NULL) { + snprintf(buf, 512, "%s %s", armorMessages[i], player->_armor[i]->_name.c_str()); + appendText(buf); + } + } + + for (ObjArray::const_iterator it = player->_inventory.begin(); it != player->_inventory.end(); ++it) { + int uses = (*it)->_numberOfUses; + + if (uses > 0) { + snprintf(buf, 512, "Your %s has %d uses left.", (*it)->_name.c_str(), uses); + } + } + + printPlayerCondition(player); + + _callbacks->_commandWasQuick = true; } void Script::handleRestCommand() { |