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


C++ Firm::cast_to_FirmMonsterFortress方法代码示例

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


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

示例1: return_camp

//----------- Begin of function Unit::return_camp -----------//
//
// Order this unit to return to the camp. For ordering many
// units to return to a camp, UnitArray::return_camp() should
// be called instead.
//
int Unit::return_camp()
{
	if( !home_camp_firm_recno )
		return 0;

	err_when( firm_array.is_deleted(home_camp_firm_recno) );

	Firm* firmPtr = firm_array[home_camp_firm_recno];

	if( firmPtr->region_id != region_id() )
		return 0;

	err_when( !firmPtr->cast_to_FirmCamp() && !firmPtr->cast_to_FirmMonsterFortress() );
	err_when( firmPtr->nation_recno != nation_recno );

	//--------- assign now ---------//

	// ##### begin Gilbert 2/6 #########//
	assign(firmPtr->loc_x1, firmPtr->loc_y1, -1, true);

//	force_move_flag = 1;
	// ##### end Gilbert 2/6 #########//

	return cur_action != SPRITE_IDLE;
}
开发者ID:mecirt,项目名称:7k2,代码行数:31,代码来源:oun_act.cpp

示例2: catch_spy

//-------- Begin of function SpyArray::catch_spy ------//
//
// <int> spyPlace - either SPY_TOWN or SPY_FIRM
// <int> spyPlacePara - town_recno or firm_recno
//
int SpyArray::catch_spy(int spyPlace, int spyPlacePara)
{
	int nationRecno, totalPop;

	if( spyPlace == SPY_TOWN )
	{
		Town* townPtr = town_array[spyPlacePara];

		nationRecno = townPtr->nation_recno;
		totalPop    = townPtr->population;
	}
	else if( spyPlace == SPY_FIRM )
	{
		Firm* firmPtr = firm_array[spyPlacePara];

		nationRecno = firmPtr->nation_recno;
		if( firmPtr->cast_to_FirmCamp() )
		{
			FirmCamp *firmCamp = firmPtr->cast_to_FirmCamp();
			totalPop    = firmCamp->soldier_count + (firmCamp->overseer_recno>0);
		}
		else if( firmPtr->cast_to_FirmWork() )
		{
			FirmWork *firmWork = firmPtr->cast_to_FirmWork();
			totalPop    = firmWork->worker_count;
		}
		else if( firmPtr->cast_to_FirmTrain() )
		{
			totalPop = firmPtr->cast_to_FirmTrain()->trainee_count;
			return 0;		// don't catch spy
		}
		else if( firmPtr->cast_to_FirmInn() )
		{
			totalPop = firmPtr->cast_to_FirmInn()->inn_unit_count;
			return 0;		// don't catch spy
		}
		else if( firmPtr->cast_to_FirmMarket() )
		{
			totalPop = 0;
			return 0;
		}
		else if( firmPtr->cast_to_FirmMonsterTrain() )
		{
			totalPop = firmPtr->cast_to_FirmMonsterTrain()->trainee_count;
			return 0;		// don't catch spy
		}
		else if( firmPtr->cast_to_FirmMonsterAlchemy() )
		{
			totalPop = 0;
			return 0;
		}
		else if( firmPtr->cast_to_FirmLishorr() )
		{
			totalPop = 0;
			return 0;
		}
		else if( firmPtr->cast_to_FirmMonsterFortress() )
		{
			FirmMonsterFortress *firmMonsterFortress = firmPtr->cast_to_FirmMonsterFortress();
			totalPop = firmMonsterFortress->archer_count + firmMonsterFortress->extra_builder_count;
		}
		else if( firmPtr->cast_to_FirmAnimal() )
		{
			totalPop = 0;
			return 0;
		}
		else if( firmPtr->cast_to_FirmIncubator() )
		{
			totalPop = 0;
			return 0;
		}
		else if( firmPtr->cast_to_FirmMagic() )
		{
			totalPop = 0;
			return 0;
		}
		else if( firmPtr->cast_to_FirmOffensive() )
		{
			totalPop = 0;
			return 0;
		}
		else if( firmPtr->cast_to_FirmOffensive2() )
		{
			totalPop = 0;
			return 0;
		}
		else
		{
			err_here();
			totalPop = 0;
		}
	}
	else
		err_here();

//.........这里部分代码省略.........
开发者ID:mecirt,项目名称:7k2,代码行数:101,代码来源:ospya.cpp


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