当前位置: 首页>>代码示例>>C++>>正文


C++ Spell::setSound方法代码示例

本文整理汇总了C++中Spell::setSound方法的典型用法代码示例。如果您正苦于以下问题:C++ Spell::setSound方法的具体用法?C++ Spell::setSound怎么用?C++ Spell::setSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spell的用法示例。


在下文中一共展示了Spell::setSound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initMagic


//.........这里部分代码省略.........
		}
		float red = static_cast<float>( strtod( strtok( line, "," ), NULL ) );
		float green = static_cast<float>( strtod( strtok( NULL, "," ), NULL ) );
		float blue = static_cast<float>( strtod( strtok( NULL, "," ), NULL ) );
		strcpy( symbol, node->getValueAsString( "symbol" ) );

		current = new MagicSchool( name, displayName, notes, skill, resistSkill, alignment, red, green, blue, symbol );

		strcpy( line, node->getValueAsString( "deity_description" ) );
		if ( strlen( line ) ) current->addToDeityDescription( line );

		schools[schoolCount++] = current;
		string nameStr = name;
		schoolMap[nameStr] = current;

		vector<ConfigNode*> *vv = node->getChildrenByName( "low_donate" );
		for ( unsigned int i = 0; vv && i < vv->size(); i++ ) {
			ConfigNode *node2 = ( *vv )[i];
			current->lowDonate.push_back( node2->getValueAsString( "text" ) );
		}
		vv = node->getChildrenByName( "neutral_donate" );
		for ( unsigned int i = 0; vv && i < vv->size(); i++ ) {
			ConfigNode *node2 = ( *vv )[i];
			current->neutralDonate.push_back( node2->getValueAsString( "text" ) );
		}
		vv = node->getChildrenByName( "high_donate" );
		for ( unsigned int i = 0; vv && i < vv->size(); i++ ) {
			ConfigNode *node2 = ( *vv )[i];
			current->highDonate.push_back( node2->getValueAsString( "text" ) );
		}

		vv = node->getChildrenByName( "spell" );
		for ( unsigned int i = 0; vv && i < vv->size(); i++ ) {
			ConfigNode *node2 = ( *vv )[i];

			strcpy( name, node2->getValueAsString( "name" ) );
			strcpy( displayName, node2->getValueAsString( "display_name" ) );
			strcpy( symbol, node2->getValueAsString( "symbol" ) );
			int level = node2->getValueAsInt( "level" );
			int mp = node2->getValueAsInt( "mp" );
			int exp = node2->getValueAsInt( "mp" );
			int failureRate = node2->getValueAsInt( "failureRate" );
			strcpy( dice, node2->getValueAsString( "action" ) );
			
			int distance = node2->getValueAsInt( "distance" );
			if ( distance < static_cast<int>( MIN_DISTANCE ) )
				distance = static_cast<int>( MIN_DISTANCE );
			int targetType = ( !strcmp( node2->getValueAsString( "targetType" ), "single" ) ? SINGLE_TARGET : GROUP_TARGET );
			int speed = node2->getValueAsInt( "speed" );
			int effect = Constants::getEffectByName( node2->getValueAsString( "effect" ) );
			strcpy( targetTypeStr, node2->getValueAsString( "target" ) );
			bool creatureTarget = ( strchr( targetTypeStr, 'C' ) != NULL );
			bool locationTarget = ( strchr( targetTypeStr, 'L' ) != NULL );
			bool itemTarget = ( strchr( targetTypeStr, 'I' ) != NULL );
			bool partyTarget = ( strchr( targetTypeStr, 'P' ) != NULL );
			bool doorTarget = ( strchr( targetTypeStr, 'D' ) != NULL );
			strcpy( line, node2->getValueAsString( "icon" ) );
			int iconTileX = atoi( strtok( line, "," ) ) - 1;
			int iconTileY = atoi( strtok( NULL, "," ) ) - 1;

			// Friendly/Hostile marker
			bool friendly = node2->getValueAsBool( "friendly" );

			int stateModPrereq = -1;
			strcpy( line, node2->getValueAsString( "prerequisite" ) );
			if ( strlen( line ) ) {
				// is it a potion state mod?
				int n = Constants::getPotionSkillByName( line );
				if ( n == -1 ) {
					StateMod *mod = StateMod::getStateModByName( line );
					if ( !mod ) {
						cerr << "Can't find state mod: >" << line << "<" << endl;
						exit( 1 );
					}
					n = mod->getIndex();
				}
				stateModPrereq = n;
				if ( stateModPrereq == -1 ) {
					cerr << "Error: spell=" << name << endl;
					cerr << "\tCan't understand prereq for spell: " << line << endl;
				}
			}

			currentSpell = new Spell( name, displayName, symbol, level, mp, exp, failureRate,
			                          dice, distance, targetType, speed, effect,
			                          creatureTarget, locationTarget, itemTarget, partyTarget, doorTarget,
			                          current, iconTileX, iconTileY,
			                          friendly, stateModPrereq );
			current->addSpell( currentSpell );

			strcpy( line, node2->getValueAsString( "sound" ) );
			if ( strlen( line ) ) currentSpell->setSound( line );

			strcpy( line, node2->getValueAsString( "notes" ) );
			if ( strlen( notes ) ) currentSpell->addNotes( line );
		}
	}

	delete config;
}
开发者ID:q4a,项目名称:scourge,代码行数:101,代码来源:spell.cpp


注:本文中的Spell::setSound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。