src/economy.cpp
changeset 6417 26acff62d001
parent 6324 ebf3649bd88f
child 6437 59e4ad70c837
equal deleted inserted replaced
6416:be4399248c60 6417:26acff62d001
    31 #include "newgrf_engine.h"
    31 #include "newgrf_engine.h"
    32 #include "newgrf_sound.h"
    32 #include "newgrf_sound.h"
    33 #include "newgrf_callbacks.h"
    33 #include "newgrf_callbacks.h"
    34 #include "unmovable.h"
    34 #include "unmovable.h"
    35 #include "date.h"
    35 #include "date.h"
       
    36 #include "cargotype.h"
    36 
    37 
    37 // Score info
    38 // Score info
    38 const ScoreInfo _score_info[] = {
    39 const ScoreInfo _score_info[] = {
    39 	{ SCORE_VEHICLES,        120, 100 },
    40 	{ SCORE_VEHICLES,        120, 100 },
    40 	{ SCORE_STATIONS,         80, 100 },
    41 	{ SCORE_STATIONS,         80, 100 },
   805 	TileIndex tile;
   806 	TileIndex tile;
   806 	TileIndex tile2;
   807 	TileIndex tile2;
   807 	Pair tp;
   808 	Pair tp;
   808 
   809 
   809 	/* if mode is false, use the singular form */
   810 	/* if mode is false, use the singular form */
   810 	SetDParam(0, _cargoc.names_s[s->cargo_type] + (mode ? 0 : 32));
   811 	const CargoSpec *cs = GetCargo(s->cargo_type);
       
   812 	SetDParam(0, mode ? cs->name_plural : cs->name);
   811 
   813 
   812 	if (s->age < 12) {
   814 	if (s->age < 12) {
   813 		if (s->cargo_type != CT_PASSENGERS && s->cargo_type != CT_MAIL) {
   815 		if (s->cargo_type != CT_PASSENGERS && s->cargo_type != CT_MAIL) {
   814 			SetDParam(1, STR_INDUSTRY);
   816 			SetDParam(1, STR_INDUSTRY);
   815 			SetDParam(2, s->from);
   817 			SetDParam(2, s->from);
  1085 }
  1087 }
  1086 
  1088 
  1087 int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type)
  1089 int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type)
  1088 {
  1090 {
  1089 	CargoID cargo = cargo_type;
  1091 	CargoID cargo = cargo_type;
       
  1092 	const CargoSpec *cs = GetCargo(cargo_type);
  1090 	byte f;
  1093 	byte f;
  1091 
  1094 
  1092 	/* zero the distance if it's the bank and very short transport. */
  1095 	/* zero the distance if it's the bank and very short transport. */
  1093 	if (_opt.landscape == LT_NORMAL && cargo == CT_VALUABLES && dist < 10)
  1096 	if (_opt.landscape == LT_NORMAL && cargo == CT_VALUABLES && dist < 10)
  1094 		dist = 0;
  1097 		dist = 0;
  1095 
  1098 
  1096 	f = 255;
  1099 	f = 255;
  1097 	if (transit_days > _cargoc.transit_days_1[cargo]) {
  1100 	if (transit_days > cs->transit_days[0]) {
  1098 		transit_days -= _cargoc.transit_days_1[cargo];
  1101 		transit_days -= cs->transit_days[0];
  1099 		f -= transit_days;
  1102 		f -= transit_days;
  1100 
  1103 
  1101 		if (transit_days > _cargoc.transit_days_2[cargo]) {
  1104 		if (transit_days > cs->transit_days[1]) {
  1102 			transit_days -= _cargoc.transit_days_2[cargo];
  1105 			transit_days -= cs->transit_days[1];
  1103 
  1106 
  1104 			if (f < transit_days) {
  1107 			if (f < transit_days) {
  1105 				f = 0;
  1108 				f = 0;
  1106 			} else {
  1109 			} else {
  1107 				f -= transit_days;
  1110 				f -= transit_days;