本文整理汇总了C++中ObjArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjArray::size方法的具体用法?C++ ObjArray::size怎么用?C++ ObjArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjArray
的用法示例。
在下文中一共展示了ObjArray::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: regenWeaponsMenu
void Gui::regenWeaponsMenu() {
if (_engine->_world->_weaponMenuDisabled)
return;
_menu->clearSubMenu(_weaponsMenuId);
Chr *player = _engine->_world->_player;
ObjArray *weapons = player->getWeapons(true);
bool empty = true;
for (uint i = 0; i < weapons->size(); i++) {
Obj *obj = (*weapons)[i];
if (obj->_type == Obj::REGULAR_WEAPON ||
obj->_type == Obj::THROW_WEAPON ||
obj->_type == Obj::MAGICAL_OBJECT) {
Common::String command(obj->_operativeVerb);
command += " ";
command += obj->_name;
_menu->addMenuSubItem(_weaponsMenuId, command.c_str(), kMenuActionCommand, 0, 0, true);
empty = false;
}
}
delete weapons;
if (empty)
_menu->addMenuSubItem(_weaponsMenuId, "You have no weapons", 0, 0, 0, false);
}
示例2: createWeaponsMenu
void Menu::createWeaponsMenu(MenuItem *menu) {
Chr *player = _gui->_engine->_world->_player;
ObjArray *weapons = player->getWeapons(true);
for (uint i = 0; i < weapons->size(); i++) {
Obj *obj = (*weapons)[i];
if (obj->_type == Obj::REGULAR_WEAPON ||
obj->_type == Obj::THROW_WEAPON ||
obj->_type == Obj::MAGICAL_OBJECT) {
Common::String command(obj->_operativeVerb);
command += " ";
command += obj->_name;
menu->subitems.push_back(new MenuSubItem(command.c_str(), kMenuActionCommand, 0, 0, true));
}
}
delete weapons;
if (menu->subitems.empty())
menu->subitems.push_back(new MenuSubItem("You have no weapons", 0, 0, 0, false));
}