src/misc.cpp
changeset 6091 c8827d9ae04a
parent 5971 b21fda7c7f1e
child 6201 bee01dc45e39
equal deleted inserted replaced
6090:dd413a1ccb6b 6091:c8827d9ae04a
    14 #include "saveload.h"
    14 #include "saveload.h"
    15 #include "engine.h"
    15 #include "engine.h"
    16 #include "vehicle_gui.h"
    16 #include "vehicle_gui.h"
    17 #include "variables.h"
    17 #include "variables.h"
    18 #include "ai/ai.h"
    18 #include "ai/ai.h"
    19 #include "table/landscape_const.h"
       
    20 #include "date.h"
    19 #include "date.h"
       
    20 #include "cargotype.h"
    21 
    21 
    22 char _name_array[512][32];
    22 char _name_array[512][32];
    23 
    23 
    24 #ifndef MERSENNE_TWISTER
    24 #ifndef MERSENNE_TWISTER
    25 
    25 
   235 }
   235 }
   236 
   236 
   237 // Calculate constants that depend on the landscape type.
   237 // Calculate constants that depend on the landscape type.
   238 void InitializeLandscapeVariables(bool only_constants)
   238 void InitializeLandscapeVariables(bool only_constants)
   239 {
   239 {
   240 	const CargoTypesValues *lpd;
   240 	if (only_constants) return;
   241 	uint i;
   241 
   242 	StringID str;
   242 	for (CargoID i = 0; i != NUM_CARGO; i++) {
   243 
   243 		_cargo_payment_rates[i] = GetCargo(i)->initial_payment;
   244 	lpd = &_cargo_types_base_values[_opt.landscape];
   244 		_cargo_payment_rates_frac[i] = 0;
   245 
       
   246 	for (i = 0; i != NUM_CARGO; i++) {
       
   247 		_cargoc.sprites[i] = lpd->sprites[i];
       
   248 
       
   249 		str = lpd->names[i];
       
   250 		_cargoc.names_s[i] = str;
       
   251 		_cargoc.names_long[i] = (str += 0x40);
       
   252 		_cargoc.names_short[i] = (str += 0x20);
       
   253 		_cargoc.weights[i] = lpd->weights[i];
       
   254 
       
   255 		if (!only_constants) {
       
   256 			_cargo_payment_rates[i] = lpd->initial_cargo_payment[i];
       
   257 			_cargo_payment_rates_frac[i] = 0;
       
   258 		}
       
   259 
       
   260 		_cargoc.transit_days_1[i] = lpd->transit_days_table_1[i];
       
   261 		_cargoc.transit_days_2[i] = lpd->transit_days_table_2[i];
       
   262 	}
   245 	}
   263 }
   246 }
   264 
   247 
   265 
   248 
   266 
   249