本文整理汇总了C++中GlobalObject::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ GlobalObject::GetCount方法的具体用法?C++ GlobalObject::GetCount怎么用?C++ GlobalObject::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobalObject
的用法示例。
在下文中一共展示了GlobalObject::GetCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
void TreasureSupervisor::Initialize(MapTreasure* treasure) {
if (!treasure) {
IF_PRINT_WARNING(MAP_DEBUG) << "function argument was NULL" << std::endl;
return;
}
_treasure = treasure;
MapMode::CurrentInstance()->PushState(STATE_TREASURE);
// Construct the object list, including any drunes that were contained within the treasure
if (_treasure->_drunes != 0) {
_list_options.AddOption(MakeUnicodeString("<img/icons/drunes.png> Drunes<R>" + NumberToString(_treasure->_drunes)));
_coins_snd.Play();
}
else {
_items_snd.Play();
}
for (uint32 i = 0; i < _treasure->_objects_list.size(); i++) {
if (_treasure->_objects_list[i]->GetCount() > 1) {
_list_options.AddOption(MakeUnicodeString("<" + _treasure->_objects_list[i]->GetIconImage().GetFilename() + "> ") +
_treasure->_objects_list[i]->GetName() +
MakeUnicodeString("<R>x" + NumberToString(_treasure->_objects_list[i]->GetCount())));
}
else {
_list_options.AddOption(MakeUnicodeString("<" + _treasure->_objects_list[i]->GetIconImage().GetFilename() + "> ") +
_treasure->_objects_list[i]->GetName());
}
}
for (uint32 i = 0; i < _list_options.GetNumberOptions(); i++) {
_list_options.GetEmbeddedImage(i)->SetDimensions(30.0f, 30.0f);
}
_action_options.SetSelection(0);
_action_options.SetCursorState(VIDEO_CURSOR_STATE_VISIBLE);
_list_options.SetSelection(0);
_list_options.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN);
_selection = ACTION_SELECTED;
_action_window.Show();
_list_window.Show();
// Immediately add the drunes and objects to the player's inventory
GlobalManager->AddDrunes(_treasure->_drunes);
for (uint32 i = 0; i < _treasure->_objects_list.size(); ++i) {
GlobalObject* obj = _treasure->_objects_list[i];
if (!obj)
continue;
if (!GlobalManager->IsObjectInInventory(obj->GetID())) {
// Pass a copy to the inventory, the treasure object will delete its content on destruction.
hoa_global::GlobalObject* obj_copy = GlobalCreateNewObject(obj->GetID(), obj->GetCount());
GlobalManager->AddToInventory(obj_copy);
}
else {
GlobalManager->IncrementObjectCount(obj->GetID(), obj->GetCount());
}
}
} // void TreasureSupervisor::Initialize(MapTreasure* treasure)