void Beam::move(){
   alive = check_life();
   if(alive){
       location+=speed;
   }
}
示例#2
0
	void think()
	{
		if (!marker_attached_to()->value())
		{
			g1_map_piece_class::think();
			stagger=0;                // I want bridges to be in a straight line

			if (!alive())
			{
				return;
			}


			//g1_object_class *mark=0;
			int bridgers_found=0;

			mark=0;
			g1_object_chain_class * chain=g1_get_map()->cell((int)x, (int)y)->get_obj_list();
			for (g1_object_chain_class * c=chain; c; c=c->next)
			{
				if (g1_path_object_class::cast(c->object))
				{
					mark=c->object;
				}
			}


			if (mark.valid() && mark.get()->vars->get(bridgeable_spot)==yes.get())
			{
				g1_camera_event cev;
				cev.type=G1_WATCH_IDLE;
				cev.follow_object=this;
				g1_current_view_state()->suggest_camera_event(cev);

				unoccupy_location();

				unlink();
				set_flag(CAN_DRIVE_ON, 1);
				set_flag(DANGEROUS,0);

				x=mark->x;
				y=mark->y;
				h=mark->h;

				mark->vars->get(bridgeable_spot)=already_attached.get();
				vars->get(marker_attached_to)=new li_g1_ref(mark->global_id);
				set_flag(CAN_DRIVE_ON, 1);

				occupy_location();

				pitch = roll = 0;
				groundpitch = 0;
				groundroll = 0;
				grab_old();

			}
		}
		else if (!check_life())
		{
			unoccupy_location();
			request_remove();
		}
	}