本文整理汇总了C++中Status::check_item方法的典型用法代码示例。如果您正苦于以下问题:C++ Status::check_item方法的具体用法?C++ Status::check_item怎么用?C++ Status::check_item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::check_item方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: move
Area* World::move(Player *player,
int clip_x, int clip_y, int clip_w, int clip_h)
{
Area *result = 0;
if (!player->is_morphing()) {
result = player->get_warp();
}
player->move(m_map);
int window_width = clip_w - clip_x;
if (m_lock_x) {
m_map->set_x(m_lock_x, window_width);
}
else {
int map_x = player->get_x() - window_width / 2 + m_offset_x;
if (map_x < 0) {
map_x = 0;
}
m_map->set_x(map_x, window_width);
}
int window_height = clip_h - clip_y;
if (m_lock_y) {
m_map->set_y(m_lock_y, window_height);
}
else {
int map_y = player->get_y() - window_height / 2 + m_offset_y;
if (map_y < 0) {
map_y = 0;
}
m_map->set_y(map_y, window_height);
}
std::vector<Object*> perished;
for (std::list<Object*>::iterator it = m_objects.begin();
it != m_objects.end();
++it) {
Object *object = *it;
if (object->get_visible(m_map, clip_x, clip_y, clip_w, clip_h)) {
Object::Type object_type = object->get_type();
// Handle area objects
if (object_type == Object::TypeArea) {
Area *area = (Area *) object;
if (area->is_over(player)) {
if (area->is_locked()) {
// Check if the player has the key
Status *status = m_db->get_status();
Item *item = status->check_item(area->get_data());
if (item) {
if (area->unlock(this, item)) {
status->remove_item(item);
}
}
}
else {
area->move(m_map);
if (area->is_open()) {
result = area;
}
}
}
}
// Handle monster object
else if (object_type == Object::TypeMonster) {
Monster *monster = (Monster *) object;
monster->move(m_map);
monster->set_reference(player->get_front(), player->get_y());
if (player->check_collision(monster) ||
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)) {
//.........这里部分代码省略.........