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


C++ Town::kill_town_people方法代码示例

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


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

示例1: hit_building

//------- Begin of function Tornado::hit_building -----//
//	building means firm or town
//
void Tornado::hit_building()
{
	short damageXLoc = damage_x_loc();
	short damageYLoc = damage_y_loc();
	if( damageXLoc < 0 || damageXLoc >= world.max_x_loc ||
		damageYLoc < 0 || damageYLoc >= world.max_y_loc)
		return;

	Location* locPtr = world.get_loc(damageXLoc, damageYLoc);

	// ##### begin Gilbert 30/10 #####//
	if(locPtr->is_firm() )
//		&& firm_res[(firmPtr=firm_array[locPtr->firm_recno()])->firm_id]->buildable )
	{
		Firm *firmPtr = firm_array[locPtr->firm_recno()];
		firmPtr->hit_points -= attack_damage*2;
		if( firmPtr->hit_points <= 0)
		{
			firmPtr->hit_points = (float) 0;

			se_res.sound(firmPtr->center_x, firmPtr->center_y, 1,
				'F', firmPtr->firm_id, "DIE" );

			firm_array.del_firm(locPtr->firm_recno());
		}
	}

	if( locPtr->is_town() )
	{
		Town *townPtr = town_array[locPtr->town_recno()];
		if( (life_time % 30) == 0 ) 
			townPtr->kill_town_people(0);
	}
	// ##### end Gilbert 30/10 #####//
}
开发者ID:Cap-Man,项目名称:7kaa,代码行数:38,代码来源:OTORNADO.cpp

示例2: hit_building

//------- Begin of function Tornado::hit_building -----//
//	building means firm or town
//
void Tornado::hit_building()
{
	short damageXLoc = damage_x_loc();
	short damageYLoc = damage_y_loc();
	if( damageXLoc < 0 || damageXLoc >= world.max_x_loc ||
		damageYLoc < 0 || damageYLoc >= world.max_y_loc)
		return;

	Location* locPtr = world.get_loc(damageXLoc, damageYLoc);

	if(locPtr->is_firm() )
//		&& firm_res[(firmPtr=firm_array[locPtr->firm_recno()])->firm_id]->buildable )
	{
		Firm *firmPtr = firm_array[locPtr->firm_recno()];
		firmPtr->hit_points -= attack_damage*2;

		if( !damage_player_flag && firmPtr->is_own() )
		{
			damage_player_flag = 1;
			// add news message
			news_array.tornado_hit(sprite_recno);
		}

		if( firmPtr->hit_points <= 0)
		{
			firmPtr->hit_points = (float) 0;

			se_res.sound(firmPtr->center_x, firmPtr->center_y, 1,
				'F', firmPtr->firm_id, "DIE" );

			firm_array.del_firm(locPtr->firm_recno());
		}
	}

	if( locPtr->is_town() )
	{
		Town *townPtr = town_array[locPtr->town_recno()];

		if( !damage_player_flag && townPtr->is_own() )
		{
			damage_player_flag = 1;
			// add news message
			news_array.tornado_hit(sprite_recno);
		}

		if( townPtr->hit_points > 0.0f )
		{
			townPtr->hit_points -= attack_damage*2;
			if( townPtr->hit_points <= 0 )
			{
				townPtr->hit_points = (float) 0;
			}
		}
		else
		{
			// ###### begin Gilbert 10/2 #######//
			if( (life_time % 10) == 0 ) 
				townPtr->kill_town_people(0);
			// ###### end Gilbert 10/2 #######//
		}
	}
}
开发者ID:112212,项目名称:7k2,代码行数:65,代码来源:otornado.cpp


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