예제 #1
0
파일: oun_act.cpp 프로젝트: mecirt/7k2
//--------- Begin of function Unit::is_in_order_place ---------//
//
// [int] extraLoc - 1 if called by is_next_to_order_place()
//					     in a normal call, this is not passed.
//
int Unit::is_in_order_place(int extraLoc)
{
	if( cur_order.mode == UNIT_BUILD_FIRM ||
		 cur_order.mode == UNIT_SETTLE_TOWN )
	{
		// ###### begin Gilbert 4/11 ######//
//		return next_x_loc() >= cur_order.loc_x-extraLoc &&
//				 next_x_loc() <= cur_order.place_loc_x2()+extraLoc &&		// either inside the building site or just next to it
//				 next_y_loc() >= cur_order.loc_y-extraLoc &&
//				 next_y_loc() <= cur_order.place_loc_y2()+extraLoc;
		return m.area_distance( obj_loc_x1(), obj_loc_y1(), obj_loc_x2(), obj_loc_y2(),
			cur_order.loc_x, cur_order.loc_y, 
			cur_order.place_loc_x2(), cur_order.place_loc_y2() ) <= extraLoc;
		// ###### end Gilbert 4/11 ######//
	}
	else if( cur_order.mode == UNIT_ASSIGN )
	{
		BaseObj* baseObj = base_obj_array[cur_order.para];

		// ###### begin Gilbert 4/11 ######//
//		return next_x_loc() >= baseObj->obj_loc_x1()-extraLoc &&
//				 next_x_loc() <= baseObj->obj_loc_x2()+extraLoc &&
//				 next_y_loc() >= baseObj->obj_loc_y1()-extraLoc &&
//				 next_y_loc() <= baseObj->obj_loc_y2()+extraLoc;
		return area_distance(baseObj) <= extraLoc;
		// ###### end Gilbert 4/11 ######//
	}
	// ####### begin Gilbert 19/2 #######//
	else if( cur_order.mode == UNIT_GO_CAST_POWER )
	{
		return m.area_distance( obj_loc_x1(), obj_loc_y1(), obj_loc_x2(), obj_loc_y2(),
			cur_order.loc_x, cur_order.loc_y, cur_order.loc_x, cur_order.loc_y ) <= extraLoc;
	}
	// ####### end Gilbert 19/2 #######//
	else
	{
		err_here();
		return 0;
	}
}
예제 #2
0
파일: oun_proc.cpp 프로젝트: 112212/7k2
// -------- begin of function Unit::visit_area --------//
//
// called by preprocess
//
void Unit::visit_area()
{
	if( config.fog_of_war && is_visible() )
	{
		if( explore_for_player() )
		{
			world.visit(obj_loc_x1(), obj_loc_y1(), obj_loc_x2(), obj_loc_y2(),
				unit_res[unit_id]->visual_range + item.ability(ITEM_ABILITY_SCOUT_RANGE),
				unit_res[unit_id]->visual_extend);
		}

		// ----- visit small area when showing attacker path -------//

		else if( cur_order.mode == UNIT_ATTACK
			&& nation_array.player_recno && god_res[GOD_JAPANESE]->nation_prayer_count(nation_array.player_recno)
			&& !base_obj_array.is_deleted(cur_order.para)
			&& base_obj_array[cur_order.para]->nation_recno == nation_array.player_recno )
		{
			world.visit(obj_loc_x1(), obj_loc_y1(), obj_loc_x2(), obj_loc_y2(),
				1, 1 );
		}
	}
}