bool stalker_movement_manager_obstacles::simulate_path_navigation	()
{
	Fvector							current_position = object().Position();
	Fvector							previous_position = current_position;
	u32								current_travel_point = 0;
	while (!detail().completed(current_position,!detail().state_patrol_path(),current_travel_point)) {
		m_static_obstacles.on_before_query	();
		m_static_obstacles.query			(current_position,previous_position);
		
		if (!m_static_obstacles.process_query(false)) {
			m_last_fail_time		= Device.dwTimeGlobal;
			m_failed_to_build_path	= true;
			restore_current_state	();
			return					(false);
		}

		if (m_static_obstacles.need_path_to_rebuild())
			return					(false);

//		float						dist_to_target;
//		Fvector						dir_to_target;
//		float						distance;
//		current_position			= path_position(1.f,current_position,check_time_delta,current_travel_point,distance,dist_to_target,dir_to_target);
		previous_position			= current_position;
		current_position			= predict_position(check_time_delta,current_position,current_travel_point,1.f);
	}

	return							(true);
}
示例#2
0
// Add status NAME/VALUE to history
void UndoBuffer::add_status(const string& name, const string& value)
{
    if (locked)
	return;

#if LOG_UNDO_BUFFER
    std::clog << "Adding " << name << " = " << quote(value) << "\n";
#endif

    collector[name] = value;

    if (!collector.has_command() && 
	!collector.has_pos() && 
	!collector.has_state())
	return;			// Not enough stuff yet

    restore_current_state();

    if (force_new_entry || history.size() == 0)
    {
	collector[UB_SOURCE] = current_source;
	add_entry(collector);

	force_new_entry = false;
    }
    else
    {
	// Replace last entry with collector
	history[history.size() - 1] = collector;
    }

    done();
}