src/newgrf_industries.cpp
changeset 7922 a7e266f966d9
parent 7860 5cdd0d914013
child 7928 63e18de69e50
equal deleted inserted replaced
7921:3437fdd5c0a8 7922:a7e266f966d9
   313 		case 0xA5: return GB(industry->last_month_transported[0], 8, 8);
   313 		case 0xA5: return GB(industry->last_month_transported[0], 8, 8);
   314 
   314 
   315 		case 0xA6: return industry->type;
   315 		case 0xA6: return industry->type;
   316 		case 0xA7: return industry->founder;
   316 		case 0xA7: return industry->founder;
   317 		case 0xA8: return industry->random_color;
   317 		case 0xA8: return industry->random_color;
   318 		case 0xA9: return clamp(0, industry->last_prod_year - 1920, 255);
   318 		case 0xA9: return Clamp(0, industry->last_prod_year - 1920, 255);
   319 		case 0xAA: return industry->counter;
   319 		case 0xAA: return industry->counter;
   320 		case 0xAB: return GB(industry->counter, 8, 8);
   320 		case 0xAB: return GB(industry->counter, 8, 8);
   321 		case 0xAC: return industry->was_cargo_delivered;
   321 		case 0xAC: return industry->was_cargo_delivered;
   322 
   322 
   323 		case 0xB0: return clamp(0, industry->construction_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 65535); // Date when built since 1920 (in days)
   323 		case 0xB0: return Clamp(0, industry->construction_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 65535); // Date when built since 1920 (in days)
   324 		case 0xB3: return industry->construction_type; // Construction type
   324 		case 0xB3: return industry->construction_type; // Construction type
   325 		case 0xB4: return clamp(0, industry->last_cargo_accepted_at - DAYS_TILL_ORIGINAL_BASE_YEAR, 65535); // Date last cargo accepted since 1920 (in days)
   325 		case 0xB4: return Clamp(0, industry->last_cargo_accepted_at - DAYS_TILL_ORIGINAL_BASE_YEAR, 65535); // Date last cargo accepted since 1920 (in days)
   326 	}
   326 	}
   327 
   327 
   328 	DEBUG(grf, 1, "Unhandled industry property 0x%X", variable);
   328 	DEBUG(grf, 1, "Unhandled industry property 0x%X", variable);
   329 
   329 
   330 	*available = false;
   330 	*available = false;
   513 		if (group == NULL || group->type != SGT_INDUSTRY_PRODUCTION) break;
   513 		if (group == NULL || group->type != SGT_INDUSTRY_PRODUCTION) break;
   514 
   514 
   515 		bool deref = (group->g.indprod.version == 1);
   515 		bool deref = (group->g.indprod.version == 1);
   516 
   516 
   517 		for (uint i = 0; i < 3; i++) {
   517 		for (uint i = 0; i < 3; i++) {
   518 			ind->incoming_cargo_waiting[i] = clamp(ind->incoming_cargo_waiting[i] - DerefIndProd(group->g.indprod.substract_input[i], deref), 0, 0xFFFF);
   518 			ind->incoming_cargo_waiting[i] = Clamp(ind->incoming_cargo_waiting[i] - DerefIndProd(group->g.indprod.substract_input[i], deref), 0, 0xFFFF);
   519 		}
   519 		}
   520 		for (uint i = 0; i < 2; i++) {
   520 		for (uint i = 0; i < 2; i++) {
   521 			ind->produced_cargo_waiting[i] = clamp(ind->produced_cargo_waiting[i] + DerefIndProd(group->g.indprod.add_output[i], deref), 0, 0xFFFF);
   521 			ind->produced_cargo_waiting[i] = Clamp(ind->produced_cargo_waiting[i] + DerefIndProd(group->g.indprod.add_output[i], deref), 0, 0xFFFF);
   522 		}
   522 		}
   523 
   523 
   524 		int32 again = DerefIndProd(group->g.indprod.again, deref);
   524 		int32 again = DerefIndProd(group->g.indprod.again, deref);
   525 		if (again == 0) break;
   525 		if (again == 0) break;
   526 
   526