src/newgrf_engine.cpp
branchnoai
changeset 9869 6404afe43575
parent 9837 c9ec4f82e0d0
child 10355 ee4b5f7a5bf2
equal deleted inserted replaced
9868:3998f2e73dda 9869:6404afe43575
   346 		case HANGAR:
   346 		case HANGAR:
   347 			return (v->cur_speed > 0) ? AMA_TTDP_LANDING_TO_HANGAR : AMA_TTDP_IN_HANGAR;
   347 			return (v->cur_speed > 0) ? AMA_TTDP_LANDING_TO_HANGAR : AMA_TTDP_IN_HANGAR;
   348 
   348 
   349 		case TERM1:
   349 		case TERM1:
   350 		case HELIPAD1:
   350 		case HELIPAD1:
   351 			return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD1 : AMA_TTDP_LANDING_TO_PAD1;
   351 			return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD1 : AMA_TTDP_LANDING_TO_PAD1;
   352 
   352 
   353 		case TERM2:
   353 		case TERM2:
   354 		case HELIPAD2:
   354 		case HELIPAD2:
   355 			return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD2 : AMA_TTDP_LANDING_TO_PAD2;
   355 			return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD2 : AMA_TTDP_LANDING_TO_PAD2;
   356 
   356 
   357 		case TERM3:
   357 		case TERM3:
   358 		case TERM4:
   358 		case TERM4:
   359 		case TERM5:
   359 		case TERM5:
   360 		case TERM6:
   360 		case TERM6:
   361 		case TERM7:
   361 		case TERM7:
   362 		case TERM8:
   362 		case TERM8:
   363 		case HELIPAD3:
   363 		case HELIPAD3:
   364 		case HELIPAD4:
   364 		case HELIPAD4:
   365 			return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD3 : AMA_TTDP_LANDING_TO_PAD3;
   365 			return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD3 : AMA_TTDP_LANDING_TO_PAD3;
   366 
   366 
   367 		case TAKEOFF:      // Moving to takeoff position
   367 		case TAKEOFF:      // Moving to takeoff position
   368 		case STARTTAKEOFF: // Accelerating down runway
   368 		case STARTTAKEOFF: // Accelerating down runway
   369 		case ENDTAKEOFF:   // Ascent
   369 		case ENDTAKEOFF:   // Ascent
   370 		case HELITAKEOFF:
   370 		case HELITAKEOFF:
   377 		case LANDING:    // Descent
   377 		case LANDING:    // Descent
   378 		case ENDLANDING: // On the runway braking
   378 		case ENDLANDING: // On the runway braking
   379 		case HELILANDING:
   379 		case HELILANDING:
   380 		case HELIENDLANDING:
   380 		case HELIENDLANDING:
   381 			/* @todo Need to check terminal we're landing to. Is it known yet? */
   381 			/* @todo Need to check terminal we're landing to. Is it known yet? */
   382 			return (v->current_order.type == OT_GOTO_DEPOT) ?
   382 			return (v->current_order.IsType(OT_GOTO_DEPOT)) ?
   383 				AMA_TTDP_LANDING_TO_HANGAR : AMA_TTDP_LANDING_TO_PAD1;
   383 				AMA_TTDP_LANDING_TO_HANGAR : AMA_TTDP_LANDING_TO_PAD1;
   384 
   384 
   385 		default:
   385 		default:
   386 			return AMA_TTDP_IN_HANGAR;
   386 			return AMA_TTDP_IN_HANGAR;
   387 	}
   387 	}
   679 	switch (variable - 0x80) {
   679 	switch (variable - 0x80) {
   680 		case 0x00: return v->type;
   680 		case 0x00: return v->type;
   681 		case 0x01: return MapOldSubType(v);
   681 		case 0x01: return MapOldSubType(v);
   682 		case 0x04: return v->index;
   682 		case 0x04: return v->index;
   683 		case 0x05: return GB(v->index, 8, 8);
   683 		case 0x05: return GB(v->index, 8, 8);
   684 		case 0x0A: return PackOrder(&v->current_order);
   684 		case 0x0A: return v->current_order.Pack();
   685 		case 0x0B: return GB(PackOrder(&v->current_order), 8, 8);
   685 		case 0x0B: return GB(v->current_order.Pack(), 8, 8);
   686 		case 0x0C: return v->num_orders;
   686 		case 0x0C: return v->num_orders;
   687 		case 0x0D: return v->cur_order_index;
   687 		case 0x0D: return v->cur_order_index;
   688 		case 0x10: return v->load_unload_time_rem;
   688 		case 0x10: return v->load_unload_time_rem;
   689 		case 0x11: return GB(v->load_unload_time_rem, 8, 8);
   689 		case 0x11: return GB(v->load_unload_time_rem, 8, 8);
   690 		case 0x12: return max(v->date_of_last_service - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
   690 		case 0x12: return max(v->date_of_last_service - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
   809 		if (group->g.real.num_loading > 0) return group->g.real.loading[0];
   809 		if (group->g.real.num_loading > 0) return group->g.real.loading[0];
   810 		if (group->g.real.num_loaded  > 0) return group->g.real.loaded[0];
   810 		if (group->g.real.num_loaded  > 0) return group->g.real.loaded[0];
   811 		return NULL;
   811 		return NULL;
   812 	}
   812 	}
   813 
   813 
   814 	bool in_motion = v->First()->current_order.type != OT_LOADING;
   814 	bool in_motion = !v->First()->current_order.IsType(OT_LOADING);
   815 
   815 
   816 	totalsets = in_motion ? group->g.real.num_loaded : group->g.real.num_loading;
   816 	totalsets = in_motion ? group->g.real.num_loaded : group->g.real.num_loading;
   817 
   817 
   818 	if (v->cargo.Count() >= v->cargo_cap || totalsets == 1) {
   818 	if (v->cargo.Count() >= v->cargo_cap || totalsets == 1) {
   819 		set = totalsets - 1;
   819 		set = totalsets - 1;