src/train_gui.cpp
changeset 8320 6ffad7a5d242
parent 8149 eb78fb69096f
child 8602 9e75e594a068
equal deleted inserted replaced
8319:434ce8c1e463 8320:6ffad7a5d242
   122 			SetDParam(1, v->cargo.Count());
   122 			SetDParam(1, v->cargo.Count());
   123 			SetDParam(2, v->cargo.Source());
   123 			SetDParam(2, v->cargo.Source());
   124 			SetDParam(3, _patches.freight_trains);
   124 			SetDParam(3, _patches.freight_trains);
   125 			str = FreightWagonMult(v->cargo_type) > 1 ? STR_FROM_MULT : STR_8813_FROM;
   125 			str = FreightWagonMult(v->cargo_type) > 1 ? STR_FROM_MULT : STR_8813_FROM;
   126 		}
   126 		}
   127 		DrawString(x, y, str, 0);
   127 		DrawString(x, y, str, TC_FROMSTRING);
   128 	}
   128 	}
   129 }
   129 }
   130 
   130 
   131 static void TrainDetailsInfoTab(const Vehicle *v, int x, int y)
   131 static void TrainDetailsInfoTab(const Vehicle *v, int x, int y)
   132 {
   132 {
   133 	if (RailVehInfo(v->engine_type)->railveh_type == RAILVEH_WAGON) {
   133 	if (RailVehInfo(v->engine_type)->railveh_type == RAILVEH_WAGON) {
   134 		SetDParam(0, v->engine_type);
   134 		SetDParam(0, v->engine_type);
   135 		SetDParam(1, v->value);
   135 		SetDParam(1, v->value);
   136 		DrawString(x, y, STR_882D_VALUE, 0x10);
   136 		DrawString(x, y, STR_882D_VALUE, TC_BLACK);
   137 	} else {
   137 	} else {
   138 		SetDParam(0, v->engine_type);
   138 		SetDParam(0, v->engine_type);
   139 		SetDParam(1, v->build_year);
   139 		SetDParam(1, v->build_year);
   140 		SetDParam(2, v->value);
   140 		SetDParam(2, v->value);
   141 		DrawString(x, y, STR_882C_BUILT_VALUE, 0x10);
   141 		DrawString(x, y, STR_882C_BUILT_VALUE, TC_BLACK);
   142 	}
   142 	}
   143 }
   143 }
   144 
   144 
   145 static void TrainDetailsCapacityTab(const Vehicle *v, int x, int y)
   145 static void TrainDetailsCapacityTab(const Vehicle *v, int x, int y)
   146 {
   146 {
   147 	if (v->cargo_cap != 0) {
   147 	if (v->cargo_cap != 0) {
   148 		SetDParam(0, v->cargo_type);
   148 		SetDParam(0, v->cargo_type);
   149 		SetDParam(1, v->cargo_cap);
   149 		SetDParam(1, v->cargo_cap);
   150 		SetDParam(2, _patches.freight_trains);
   150 		SetDParam(2, _patches.freight_trains);
   151 		DrawString(x, y, FreightWagonMult(v->cargo_type) > 1 ? STR_CAPACITY_MULT : STR_013F_CAPACITY, 0);
   151 		DrawString(x, y, FreightWagonMult(v->cargo_type) > 1 ? STR_CAPACITY_MULT : STR_013F_CAPACITY, TC_FROMSTRING);
   152 	}
   152 	}
   153 }
   153 }
   154 
   154 
   155 int GetTrainDetailsWndVScroll(VehicleID veh_id, byte det_tab)
   155 int GetTrainDetailsWndVScroll(VehicleID veh_id, byte det_tab)
   156 {
   156 {
   238 			act_cargo[u->cargo_type] += u->cargo.Count();
   238 			act_cargo[u->cargo_type] += u->cargo.Count();
   239 			max_cargo[u->cargo_type] += u->cargo_cap;
   239 			max_cargo[u->cargo_type] += u->cargo_cap;
   240 		}
   240 		}
   241 
   241 
   242 		/* draw total cargo tab */
   242 		/* draw total cargo tab */
   243 		DrawString(x, y + 2, STR_013F_TOTAL_CAPACITY_TEXT, 0);
   243 		DrawString(x, y + 2, STR_013F_TOTAL_CAPACITY_TEXT, TC_FROMSTRING);
   244 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   244 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   245 			if (max_cargo[i] > 0 && --vscroll_pos < 0 && vscroll_pos > -vscroll_cap) {
   245 			if (max_cargo[i] > 0 && --vscroll_pos < 0 && vscroll_pos > -vscroll_cap) {
   246 				y += 14;
   246 				y += 14;
   247 				SetDParam(0, i);            // {CARGO} #1
   247 				SetDParam(0, i);            // {CARGO} #1
   248 				SetDParam(1, act_cargo[i]); // {CARGO} #2
   248 				SetDParam(1, act_cargo[i]); // {CARGO} #2
   249 				SetDParam(2, i);            // {SHORTCARGO} #1
   249 				SetDParam(2, i);            // {SHORTCARGO} #1
   250 				SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
   250 				SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
   251 				SetDParam(4, _patches.freight_trains);
   251 				SetDParam(4, _patches.freight_trains);
   252 				DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_013F_TOTAL_CAPACITY, 0);
   252 				DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_013F_TOTAL_CAPACITY, TC_FROMSTRING);
   253 			}
   253 			}
   254 		}
   254 		}
   255 		SetDParam(0, v->cargo.FeederShare());
   255 		SetDParam(0, v->cargo.FeederShare());
   256 		DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, 0);
   256 		DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING);
   257 	}
   257 	}
   258 }
   258 }