src/newgrf_station.cpp
changeset 6460 705fbddbf3dc
parent 6451 e576c71bfc09
child 6481 85ad87daf4b0
equal deleted inserted replaced
6459:bd2721f73d2a 6460:705fbddbf3dc
   407 			return value;
   407 			return value;
   408 		}
   408 		}
   409 		case 0x49: return GetPlatformInfoHelper(tile, false, true, false);
   409 		case 0x49: return GetPlatformInfoHelper(tile, false, true, false);
   410 
   410 
   411 		/* Variables which use the parameter */
   411 		/* Variables which use the parameter */
   412 		case 0x60: return GB(st->goods[parameter].waiting_acceptance, 0, 12);
   412 		/* Variables 0x60 to 0x65 are handled separately below */
   413 		case 0x61: return st->goods[parameter].days_since_pickup;
       
   414 		case 0x62: return st->goods[parameter].rating;
       
   415 		case 0x63: return st->goods[parameter].enroute_time;
       
   416 		case 0x64: return st->goods[parameter].last_speed | (st->goods[parameter].last_age << 8);
       
   417 		case 0x65: return GB(st->goods[parameter].waiting_acceptance, 12, 4);
       
   418 
   413 
   419 		/* General station properties */
   414 		/* General station properties */
   420 		case 0x82: return 50;
   415 		case 0x82: return 50;
   421 		case 0x84: return st->string_id;
   416 		case 0x84: return st->string_id;
   422 		case 0x86: return 0;
   417 		case 0x86: return 0;
   428 		case 0xF6: return st->airport_flags;
   423 		case 0xF6: return st->airport_flags;
   429 		case 0xF7: return GB(st->airport_flags, 8, 8);
   424 		case 0xF7: return GB(st->airport_flags, 8, 8);
   430 		case 0xFA: return max(st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
   425 		case 0xFA: return max(st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
   431 	}
   426 	}
   432 
   427 
       
   428 	/* Handle cargo variables with parameter, 0x60 to 0x65 */
       
   429 	if (variable >= 0x60 && variable <= 0x65) {
       
   430 		CargoID c = GetCargoTranslation(parameter, object->u.station.statspec->grffile);
       
   431 
       
   432 		if (c == CT_INVALID) return 0;
       
   433 		const GoodsEntry *ge = &st->goods[c];
       
   434 
       
   435 		switch (variable) {
       
   436 			case 0x60: return GB(ge->waiting_acceptance, 0, 12);
       
   437 			case 0x61: return ge->days_since_pickup;
       
   438 			case 0x62: return ge->rating;
       
   439 			case 0x63: return ge->enroute_time;
       
   440 			case 0x64: return ge->last_speed | (ge->last_age << 8);
       
   441 			case 0x65: return GB(ge->waiting_acceptance, 12, 4);
       
   442 		}
       
   443 	}
       
   444 
   433 	/* Handle cargo variables (deprecated) */
   445 	/* Handle cargo variables (deprecated) */
   434 	if (variable >= 0x8C && variable <= 0xEC) {
   446 	if (variable >= 0x8C && variable <= 0xEC) {
   435 		const GoodsEntry *g = &st->goods[GB(variable - 0x8C, 3, 4)];
   447 		const GoodsEntry *g = &st->goods[GB(variable - 0x8C, 3, 4)];
   436 		switch (GB(variable - 0x8C, 0, 3)) {
   448 		switch (GB(variable - 0x8C, 0, 3)) {
   437 			case 0: return g->waiting_acceptance;
   449 			case 0: return g->waiting_acceptance;