本文整理汇总了C++中Status::aquire_item方法的典型用法代码示例。如果您正苦于以下问题:C++ Status::aquire_item方法的具体用法?C++ Status::aquire_item怎么用?C++ Status::aquire_item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::aquire_item方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: move
Area* Shop::move(int key)
{
Area *area = 0;
void *data = 0;
bool rejected = false;
int input = get_input_keydown(key);
if (input & PRESS_DOWN) {
data = m_menu->advance_pointer(Menu::DirectionDown);
m_media->play_sound("advance.wav");
}
else if (input & PRESS_UP) {
data = m_menu->advance_pointer(Menu::DirectionUp);
m_media->play_sound("advance.wav");
}
else if (input & PRESS_ENTER) {
if (m_menu->get_option() == 4) {
m_media->play_sound("select.wav");
area = new Area(m_src.c_str(), m_sx, m_sy);
}
else {
Item *item = (Item *) m_menu->get_data();
if (item) {
Status *status = m_db->get_status();
if (status->pay_gold(item->get_attribute("price"))) {
m_menu->replace_option("Sold out!");
item->aquire(m_db);
status->aquire_item(item);
m_media->play_sound("select.wav");
}
else {
m_media->play_sound("reject.wav");
rejected = true;
}
}
else {
m_media->play_sound("reject.wav");
rejected = true;
}
}
}
if (data) {
Item *item = (Item *) data;
static char str[12];
Color color;
sprintf(str, "%06d Gold", item->get_attribute("price"));
Status *status = m_db->get_status();
if (status->get_gold() < item->get_attribute("price")) {
color.set_named(Color::Red);
}
else {
color.set_named(Color::White);
}
m_price_text->replace_line(str, color);
}
else if (!rejected) {
static char str[12];
Color color(Color::White);
sprintf(str, "000000 Gold");
m_price_text->replace_line(str, color);
}
return area;
}
示例2: move
//.........这里部分代码省略.........
}
}
}
// 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)) {
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));