本文整理汇总了C++中monster::is_hallucination方法的典型用法代码示例。如果您正苦于以下问题:C++ monster::is_hallucination方法的具体用法?C++ monster::is_hallucination怎么用?C++ monster::is_hallucination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monster
的用法示例。
在下文中一共展示了monster::is_hallucination方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
bool Creature_tracker::add( monster &critter )
{
if( critter.type->id.is_null() ) { // Don't wanna spawn null monsters o.O
return false;
}
if( critter.type->has_flag( MF_VERMIN ) ) {
// Don't spawn vermin, they aren't implemented yet
return false;
}
const int critter_id = mon_at( critter.pos() );
if( critter_id != -1 ) {
// We can spawn stuff on hallucinations, but we need to kill them first
if( monsters_list[critter_id]->is_hallucination() ) {
monsters_list[critter_id]->die( nullptr );
// But don't remove - that would change the monster order and could segfault
} else if( critter.is_hallucination() ) {
return false;
} else {
debugmsg( "add_zombie: there's already a monster at %d,%d,%d",
critter.posx(), critter.posy(), critter.posz() );
return false;
}
}
if( MonsterGroupManager::monster_is_blacklisted( critter.type->id ) ) {
return false;
}
monsters_by_location[critter.pos()] = monsters_list.size();
monsters_list.push_back( new monster( critter ) );
return true;
}
示例2: add
bool Creature_tracker::add( monster &critter )
{
if( critter.type->id.is_null() ) { // Don't want to spawn null monsters o.O
return false;
}
if( critter.type->has_flag( MF_VERMIN ) ) {
// Don't spawn vermin, they aren't implemented yet
return false;
}
if( const std::shared_ptr<monster> existing_mon_ptr = find( critter.pos() ) ) {
// We can spawn stuff on hallucinations, but we need to kill them first
if( existing_mon_ptr->is_hallucination() ) {
existing_mon_ptr->die( nullptr );
// But don't remove - that would change the monster order and could segfault
} else if( critter.is_hallucination() ) {
return false;
} else {
debugmsg( "add_zombie: there's already a monster at %d,%d,%d",
critter.posx(), critter.posy(), critter.posz() );
return false;
}
}
if( MonsterGroupManager::monster_is_blacklisted( critter.type->id ) ) {
return false;
}
monsters_list.emplace_back( std::make_shared<monster>( critter ) );
monsters_by_location[critter.pos()] = monsters_list.back();
return true;
}