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


C++ Site::get_site_object方法代码示例

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


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

示例1: next_day

//--------- Begin of function SiteArray::next_day ----------//
//
void SiteArray::next_day()
{
	if( info.game_date%30 == 0 )
	{
		generate_raw_site();		// check if we need to generate existing raw sites are being used up and if we need to generate new ones
	}

	//-- if there is any scroll or gold coins available, ask AI to get them --//

	if(scroll_count || gold_coin_count)
	{
		int aiGetSiteObject = (info.game_date%5 == 0);

		Site* sitePtr;
		Location *locPtr;

		for(int i=size(); i; i--)
		{
			if(is_deleted(i))
				continue;

			sitePtr = site_array[i];

			switch(sitePtr->site_type)
			{
				case SITE_SCROLL:
				case SITE_GOLD_COIN:
						locPtr = world.get_loc(sitePtr->map_x_loc, sitePtr->map_y_loc);

						//---- if the unit is standing on a scroll site -----//

						if(locPtr->has_unit(UNIT_LAND))
						{
							sitePtr->get_site_object( locPtr->unit_recno(UNIT_LAND) );
						}
						else if(aiGetSiteObject)
						{
							sitePtr->ai_get_site_object();
                  }
						break;
			}
		}
	}

	//-------- debug testing --------//

#ifdef DEBUG

	if( info.game_date%10 == 0 )
	{
		Site* sitePtr;
		Location* locPtr;

		for( int i=1 ; i<=size() ; i++ )
		{
			if( site_array.is_deleted(i) )
				continue;

			sitePtr = site_array[i];

			locPtr = world.get_loc( sitePtr->map_x_loc, sitePtr->map_y_loc );

			err_when( !locPtr->has_site() );
			err_when( locPtr->site_recno() != i );

			if( sitePtr->has_mine )
			{
				err_when( !locPtr->is_firm() );
				err_when( firm_array[locPtr->firm_recno()]->firm_id != FIRM_MINE );
			}
			else
			{
				err_when( locPtr->is_firm() || locPtr->is_town() );
			}
		}
	}
#endif
}
开发者ID:spippolatore,项目名称:7kaa,代码行数:80,代码来源:OSITE.cpp

示例2: next_day

//--------- Begin of function SiteArray::next_day ----------//
//
void SiteArray::next_day()
{
	if( info.game_date%30 == 0 )
	{
		generate_raw_site();		// check if we need to generate existing raw sites are being used up and if we need to generate new ones
	}

	//-- if there is any scroll or gold coins available, ask AI to get them --//

	// #### begin Gilbert 3/11 ######//
	if(scroll_count || gold_coin_count || item_count || weapon_blueprint_count )
	// #### end Gilbert 3/11 ######//
	{
		int aiGetSiteObject = (info.game_date%5 == 0);

		Site* sitePtr;
		Location *locPtr;

		for(int i=size(); i; i--)
		{
			if(is_deleted(i))
				continue;

			sitePtr = site_array[i];

			switch(sitePtr->site_type)
			{
				case SITE_SCROLL:
				case SITE_GOLD_COIN:
				case SITE_ITEM:
				case SITE_WEAPON_BLUEPRINT:
					locPtr = world.get_loc(sitePtr->map_x_loc, sitePtr->map_y_loc);

					//---- if the unit is standing on a scroll site -----//

					if(locPtr->unit_recno(UNIT_LAND))
					{
						// ####### begin Gilbert 25/5 ##########//
						int unitRecno = locPtr->unit_recno(UNIT_LAND);
						if( !unit_array.is_deleted(unitRecno) )
							sitePtr->get_site_object( unitRecno );
						// ####### end Gilbert 25/5 ##########//
					}
					else if(aiGetSiteObject)
					{
						sitePtr->ai_get_site_object();
               }
					break;
			}
		}
	}

	//-------- debug testing --------//

#ifdef DEBUG

	if( info.game_date%10 == 0 )
	{
		Site* sitePtr;
		Location* locPtr;

		for( int i=1 ; i<=size() ; i++ )
		{
			if( site_array.is_deleted(i) )
				continue;

			sitePtr = site_array[i];

			locPtr = world.get_loc( sitePtr->map_x_loc, sitePtr->map_y_loc );

			err_when( !locPtr->has_site() );
			err_when( locPtr->site_recno() != i );

			if( sitePtr->has_mine )
			{
				err_when( !locPtr->is_firm() );
				err_when( firm_array[locPtr->firm_recno()]->firm_id != FIRM_MINE
					&& firm_array[locPtr->firm_recno()]->firm_id != FIRM_ALCHEMY );
			}
			else
			{
				// disable because a mine can be upon more than one mine
				// err_when( locPtr->is_firm() || locPtr->is_town() );
			}
		}
	}
#endif
}
开发者ID:112212,项目名称:7k2,代码行数:90,代码来源:osite.cpp


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