File diff r27420:b37b70eb3169 → r27421:e8c2cdc1e8e6
src/newgrf_engine.cpp
Show inline comments
 
@@ -955,25 +955,25 @@ static uint32 VehicleGetVariable(Vehicle
 
}
 

	
 
/* virtual */ uint32 VehicleScopeResolver::GetVariable(byte variable, uint32 parameter, bool *available) const
 
{
 
	if (this->v == nullptr) {
 
		/* Vehicle does not exist, so we're in a purchase list */
 
		switch (variable) {
 
			case 0x43: return GetCompanyInfo(_current_company, LiveryHelper(this->self_type, nullptr)); // Owner information
 
			case 0x46: return 0;               // Motion counter
 
			case 0x47: { // Vehicle cargo info
 
				const Engine *e = Engine::Get(this->self_type);
 
				CargoID cargo_type = e->GetDefaultCargoType();
 
				if (cargo_type != CT_INVALID) {
 
				if (IsValidCargoID(cargo_type)) {
 
					const CargoSpec *cs = CargoSpec::Get(cargo_type);
 
					return (cs->classes << 16) | (cs->weight << 8) | this->ro.grffile->cargo_map[cargo_type];
 
				} else {
 
					return 0x000000FF;
 
				}
 
			}
 
			case 0x48: return Engine::Get(this->self_type)->flags; // Vehicle Type Info
 
			case 0x49: return TimerGameCalendar::year; // 'Long' format build year
 
			case 0x4B: return TimerGameCalendar::date; // Long date of last service
 
			case 0x92: return ClampTo<uint16_t>(TimerGameCalendar::date - DAYS_TILL_ORIGINAL_BASE_YEAR); // Date of last service
 
			case 0x93: return GB(ClampTo<uint16_t>(TimerGameCalendar::date - DAYS_TILL_ORIGINAL_BASE_YEAR), 8, 8);
 
			case 0xC4: return Clamp(TimerGameCalendar::year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; // Build year