本文整理汇总了C++中Firm::cast_to_FirmAnimal方法的典型用法代码示例。如果您正苦于以下问题:C++ Firm::cast_to_FirmAnimal方法的具体用法?C++ Firm::cast_to_FirmAnimal怎么用?C++ Firm::cast_to_FirmAnimal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Firm
的用法示例。
在下文中一共展示了Firm::cast_to_FirmAnimal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
//.........这里部分代码省略.........