本文整理汇总了C++中SharedObjectTemplate::isSharedTangibleObjectTemplate方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedObjectTemplate::isSharedTangibleObjectTemplate方法的具体用法?C++ SharedObjectTemplate::isSharedTangibleObjectTemplate怎么用?C++ SharedObjectTemplate::isSharedTangibleObjectTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedObjectTemplate
的用法示例。
在下文中一共展示了SharedObjectTemplate::isSharedTangibleObjectTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: itemTemplateName
TEST_F(LuaMobileTest, LuaLootGroupsTest) {
// Verify loot group map loaded
ASSERT_EQ(LootGroupMap::ERROR_CODE, 0);
// Test Loot Items
HashTableIterator<String, Reference<LootItemTemplate*> > itemIter = lootGroupMap->itemTemplates.iterator();
while (itemIter.hasNext()) {
LootItemTemplate* lootItemTemplate = itemIter.next();
String itemTemplateName( lootItemTemplate->getTemplateName().toCharArray() );
// Make sure that no loot items have the same name as a loot group
EXPECT_FALSE( lootGroupMap->lootGroupExists(itemTemplateName) ) << "Loot item " << std::string(itemTemplateName.toCharArray()) << " has the same name as a loot group.";
// Verify that directObjectTemplate is valid
String directObjectTemplate = lootItemTemplate->getDirectObjectTemplate();
SharedObjectTemplate* templateObject = templateManager->getTemplate(directObjectTemplate.hashCode());
EXPECT_TRUE( templateObject != NULL && templateObject->isSharedTangibleObjectTemplate() ) << "directObjectTemplate is invalid in loot item " << std::string(itemTemplateName.toCharArray());
}
// Test Loot Groups
HashTableIterator<String, Reference<LootGroupTemplate*> > iter = lootGroupMap->groupTemplates.iterator();
while (iter.hasNext()) {
LootGroupTemplate* lootGroupTemplate = iter.next();
String groupTemplateName( lootGroupTemplate->getTemplateName().toCharArray() );
// Verify that group is not empty
EXPECT_TRUE( lootGroupTemplate->getLootGroupEntryForRoll(-1).length() > 0 ) << "No entries in loot group: " << std::string(groupTemplateName.toCharArray());
// Check loot group to make sure their chances total correctly
EXPECT_GT( lootGroupTemplate->getLootGroupEntryForRoll(10000000).length(), 0 ) << "Item total chance is less than 10000000: " << std::string(groupTemplateName.toCharArray());
EXPECT_EQ( lootGroupTemplate->getLootGroupEntryForRoll(10000001).length(), 0 ) << "Item total chance is greater than 10000000: " << std::string(groupTemplateName.toCharArray());
// Check that all loot group entries are valid
for( int i = 0; i < lootGroupTemplate->size(); i++ ){
Vector<String> parentGroups;
parentGroups.add(groupTemplateName);
String entryName = lootGroupTemplate->getLootGroupEntryAt(i);
checkLootGroupEntryRecursive(entryName, &parentGroups);
}
}
}
示例2: templateName
//.........这里部分代码省略.........
std::string mobName = mobile.toCharArray();
EXPECT_TRUE( CreatureTemplateManager::instance()->getTemplate(mobile) != NULL ) << "Mobile " << mobName << " in lair template " << templateName << " does not exist";
EXPECT_TRUE( weighting > 0 ) << "Mobile " << mobName << " in lair template " << templateName << " has a non positive weighting";
}
// Verify that boss mobiles exist and that their count is positive
VectorMap<String, int>* bossMobiles = lair->getBossMobiles();
for (int i = 0; i < bossMobiles->size(); i++) {
int count = bossMobiles->elementAt(i).getValue();
String bossMob = bossMobiles->elementAt(i).getKey();
std::string bossName = bossMob.toCharArray();
EXPECT_TRUE( CreatureTemplateManager::instance()->getTemplate(bossMob) != NULL ) << "Boss mobile " << bossName << " in lair template " << templateName << " does not exist";
EXPECT_TRUE( count > 0 ) << "Boss mobile " << bossName << " in lair template " << templateName << " has a non positive spawn count";
}
// Verify spawn limit is positive
int limit = lair->getSpawnLimit();
EXPECT_TRUE( limit > 0 ) << "Spawn limit in lair template " << templateName << " is not positive";
// Verify any configured buildings exist
int buildingCount = 0;
for(int i=0; i<=4; i++){
Vector<String>* buildings = lair->getBuildings( i );
if( buildings == NULL )
continue;
buildingCount += buildings->size();
for( int j=0; j < buildings->size(); j++ ){
String buildingTemplate = buildings->get(j);
std::string buildingStr = buildingTemplate.toCharArray();
SharedObjectTemplate* templateObject = templateManager->getTemplate(buildingTemplate.hashCode());
EXPECT_TRUE( templateObject != NULL && templateObject->isSharedTangibleObjectTemplate() ) << "Building template " << buildingStr << " in lair template " << templateName << " does not exist";
if( lair->getBuildingType() == LairTemplate::LAIR ){
EXPECT_TRUE( buildingTemplate.beginsWith( "object/tangible/lair/") ) << "Building template " << buildingStr << " in lair template " << templateName << " is not a child of object/tangible/lair/";
}
if( lair->getBuildingType() == LairTemplate::THEATER ){
EXPECT_TRUE( buildingTemplate.beginsWith( "object/building/poi/") ) << "Building template " << buildingStr << " in lair template " << templateName << " is not a child of object/building/poi/";
}
}
}
// Verify mission buildings exist and are lairs
String missionBuilding = lair->getMissionBuilding(10);
if (!missionBuilding.isEmpty()) {
std::string buildingStr = missionBuilding.toCharArray();
SharedObjectTemplate* templateObject = templateManager->getTemplate(missionBuilding.hashCode());
EXPECT_TRUE( templateObject != NULL && templateObject->isSharedTangibleObjectTemplate() ) << "Mission building template " << buildingStr << " in lair template " << templateName << " does not exist";
EXPECT_TRUE( missionBuilding.beginsWith( "object/tangible/lair/") ) << "Mission building template " << buildingStr << " in lair template " << templateName << " is not a child of object/tangible/lair/";
}
if( lair->getBuildingType() == LairTemplate::THEATER ){
EXPECT_TRUE( buildingCount > 0 ) << "There are no buildings configured in theater type lair template " << templateName;
}
if( lair->getBuildingType() == LairTemplate::NONE ){
EXPECT_TRUE( buildingCount == 0 ) << "There are buildings configured in 'none' type lair template " << templateName;
}
if( lair->getBuildingType() == LairTemplate::LAIR ){
EXPECT_TRUE( buildingCount > 0 ) << "There are no buildings configured in lair type lair template " << templateName;
}
}
// Test Spawn Groups
HashTableIterator<uint32, Reference<SpawnGroup*> > spawnIterator = CreatureTemplateManager::instance()->spawnGroupIterator();