本文整理汇总了C++中Status::aquire_collectable方法的典型用法代码示例。如果您正苦于以下问题:C++ Status::aquire_collectable方法的具体用法?C++ Status::aquire_collectable怎么用?C++ Status::aquire_collectable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::aquire_collectable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: move
//.........这里部分代码省略.........
monster->attack_object(player)) {
if (!monster->get_invisible()) {
player->set_hit(monster, m_db->get_status());
}
}
if (player->attack_object(monster)) {
monster->set_hit(player, m_db->get_status());
}
if (monster->get_action() == Actor::HitPerished) {
perished.push_back(monster);
}
}
// Handle item objects
else if (object_type == Object::TypeItem) {
Item *item = (Item *) object;
item->move(m_map);
// Check if player picked up item
if (player->check_collision(item)) {
Status *status = m_db->get_status();
status->aquire_item(item);
item->aquire(this);
item->set_reused(true);
perished.push_back(item);
}
}
// Handle collectable objects
else if (object_type == Object::TypeCollectable) {
Collectable *collectable = (Collectable *) object;
collectable->move(m_map);
// Check if player picked up the collectable
if (player->check_collision(collectable)) {
Status *status = m_db->get_status();
status->aquire_collectable(collectable);
perished.push_back(collectable);
}
}
// Handle curse objects
else if (object_type == Object::TypeCurse) {
Curse *curse = (Curse *) object;
curse->move(m_map);
if (player->check_collision(curse)) {
player->set_morph(new Morph("human_to_salamander.xml",
m_media,
player->get_x(),
player->get_y(),
player->get_dir()));
player->set_warp(new Area(curse));
perished.push_back(curse);
}
}
// Handle chest objects
else if (object_type == Object::TypeChest) {
Chest *chest = (Chest *) object;
if (chest->is_open(player)) {
Object *released_object = chest->release_object();
if (released_object) {
released_object->set_x(chest->get_x());
released_object->set_y(chest->get_y());
released_object->set_reference(player->get_front(),
player->get_y());
m_objects.push_back(released_object);
}
}
}
}
}
// Remove all perished objects
for (int i = 0; i < perished.size(); i++) {
// If monster drop object
if (perished[i]->get_type() == Object::TypeMonster) {
Monster *monster = (Monster *) perished[i];
Object *released_object = monster->release_object();
if (released_object) {
released_object->set_x(monster->get_x());
released_object->set_y(monster->get_y());
released_object->set_reference(player->get_front(),
player->get_y());
m_objects.push_back(released_object);
}
}
m_objects.remove(perished[i]);
if (!perished[i]->get_reused()) {
delete perished[i];
}
}
return result;
}