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


C++ MemberInfo::setGuildTitle方法代码示例

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


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

示例1: load

void cGuild::load( const QSqlQuery& result )
{
	serial_ = result.value( 0 ).toInt();
	name_ = result.value( 1 ).toString();
	abbreviation_ = result.value( 2 ).toString();
	charta_ = result.value( 3 ).toString();
	website_ = result.value( 4 ).toString();
	alignment_ = ( eAlignment ) result.value( 5 ).toInt();
	leader_ = dynamic_cast<P_PLAYER>( World::instance()->findChar( result.value( 6 ).toInt() ) );
	founded_.setTime_t( result.value( 7 ).toInt() );
	guildstone_ = World::instance()->findItem( result.value( 8 ).toInt() );

	// Load members and canidates
	QSqlQuery members( QString( "SELECT player,showsign,guildtitle,joined FROM guilds_members WHERE guild = %1" ).arg( serial_ ) );

	while ( members.next() )
	{
		P_PLAYER player = dynamic_cast<P_PLAYER>( World::instance()->findChar( members.value( 0 ).toInt() ) );

		if ( player )
		{
			player->setGuild( this );
			members_.append( player );

			MemberInfo* info = new MemberInfo;
			info->setShowSign( members.value( 1 ).toInt() != 0 );
			info->setGuildTitle( members.value( 2 ).toString() );
			info->setJoined( members.value( 3 ).toInt() );
			memberinfo_.insert( player, info );
		}
	}

	QSqlQuery canidates( QString( "SELECT player FROM guilds_canidates WHERE guild = %1" ).arg( serial_ ) );

	while ( canidates.next() )
	{
		P_PLAYER player = dynamic_cast<P_PLAYER>( World::instance()->findChar( canidates.value( 0 ).toInt() ) );

		if ( player )
		{
			player->setGuild( this );
			canidates_.append( player );
		}
	}

	// Clear the leader if he's not a member of the guild
	if ( !members_.contains( leader_ ) )
	{
		leader_ = 0;
	}

	Guilds::instance()->registerGuild( this );

	QSqlQuery allies( QString( "SELECT ally FROM guilds_allies WHERE guild = %1" ).arg( serial_ ) );

	while ( allies.next() )
	{
		allies_.append( allies.value( 0 ).toInt() );
	}

	QSqlQuery enemies( QString( "SELECT enemy FROM guilds_enemies WHERE guild = %1" ).arg( serial_ ) );

	while ( enemies.next() )
	{
		enemies_.append( enemies.value( 0 ).toInt() );
	}
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:67,代码来源:guilds.cpp


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