WAGE: Implement handleInventoryCommand()
This commit is contained in:
parent
b066a592ee
commit
2dc5841fcc
3 changed files with 24 additions and 1 deletions
|
@ -483,4 +483,12 @@ const char *Chr::getDefiniteArticle(bool capitalize) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Chr::isWearing(Obj *obj) {
|
||||||
|
for (int i = 0; i < NUMBER_OF_ARMOR_TYPES; i++)
|
||||||
|
if (_armor[i] == obj)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Wage
|
} // End of namespace Wage
|
||||||
|
|
|
@ -229,6 +229,8 @@ public:
|
||||||
void wearObjs();
|
void wearObjs();
|
||||||
|
|
||||||
void resetState();
|
void resetState();
|
||||||
|
|
||||||
|
bool isWearing(Obj *obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Obj : public Designed {
|
class Obj : public Designed {
|
||||||
|
|
|
@ -1026,7 +1026,20 @@ void Script::appendObjNames(Common::String &str, ObjArray &objs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Script::handleInventoryCommand() {
|
void Script::handleInventoryCommand() {
|
||||||
warning("STUB: handleInventoryCommand");
|
Chr *player = _world->_player;
|
||||||
|
ObjArray objs;
|
||||||
|
|
||||||
|
for (ObjArray::const_iterator it = player->_inventory.begin(); it != player->_inventory.end(); ++it)
|
||||||
|
if (!player->isWearing(*it))
|
||||||
|
objs.push_back(*it);
|
||||||
|
|
||||||
|
if (!objs.size()) {
|
||||||
|
appendText("Your pack is empty.");
|
||||||
|
} else {
|
||||||
|
Common::String res("Your pack contains ");
|
||||||
|
appendObjNames(res, objs);
|
||||||
|
appendText(res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *armorMessages[] = {
|
static const char *armorMessages[] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue