src/train_gui.cpp
changeset 7506 e52d89f5c7c1
parent 7498 ce6588257e8d
child 7545 9a4834d48970
equal deleted inserted replaced
7505:94a7391e0377 7506:e52d89f5c7c1
   325 }
   325 }
   326 
   326 
   327 static void TrainDetailsCargoTab(const Vehicle *v, int x, int y)
   327 static void TrainDetailsCargoTab(const Vehicle *v, int x, int y)
   328 {
   328 {
   329 	if (v->cargo_cap != 0) {
   329 	if (v->cargo_cap != 0) {
   330 		uint num = v->cargo_count;
       
   331 		StringID str = STR_8812_EMPTY;
   330 		StringID str = STR_8812_EMPTY;
   332 
   331 
   333 		if (num != 0) {
   332 		if (!v->cargo.Empty()) {
   334 			SetDParam(0, v->cargo_type);
   333 			SetDParam(0, v->cargo_type);
   335 			SetDParam(1, num);
   334 			SetDParam(1, v->cargo.Count());
   336 			SetDParam(2, v->cargo_source);
   335 			SetDParam(2, v->cargo.Source());
   337 			SetDParam(3, _patches.freight_trains);
   336 			SetDParam(3, _patches.freight_trains);
   338 			str = FreightWagonMult(v->cargo_type) > 1 ? STR_FROM_MULT : STR_8813_FROM;
   337 			str = FreightWagonMult(v->cargo_type) > 1 ? STR_FROM_MULT : STR_8813_FROM;
   339 		}
   338 		}
   340 		DrawString(x, y, str, 0);
   339 		DrawString(x, y, str, 0);
   341 	}
   340 	}
   385 			act_cargo[i] = 0;
   384 			act_cargo[i] = 0;
   386 			max_cargo[i] = 0;
   385 			max_cargo[i] = 0;
   387 		}
   386 		}
   388 
   387 
   389 		do {
   388 		do {
   390 			act_cargo[u->cargo_type] += u->cargo_count;
   389 			act_cargo[u->cargo_type] += u->cargo.Count();
   391 			max_cargo[u->cargo_type] += u->cargo_cap;
   390 			max_cargo[u->cargo_type] += u->cargo_cap;
   392 		} while ((u = u->next) != NULL);
   391 		} while ((u = u->next) != NULL);
   393 
   392 
   394 		/* Set scroll-amount seperately from counting, as to not compute num double
   393 		/* Set scroll-amount seperately from counting, as to not compute num double
   395 		 * for more carriages of the same type
   394 		 * for more carriages of the same type
   502 				SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
   501 				SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
   503 				SetDParam(4, _patches.freight_trains);
   502 				SetDParam(4, _patches.freight_trains);
   504 				DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_013F_TOTAL_CAPACITY, 0);
   503 				DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_013F_TOTAL_CAPACITY, 0);
   505 			}
   504 			}
   506 		}
   505 		}
   507 		SetDParam(0, v->cargo_feeder_share);
   506 		SetDParam(0, v->cargo.FeederShare());
   508 		DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, 0);
   507 		DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, 0);
   509 	}
   508 	}
   510 }
   509 }
   511 
   510 
   512 static void TrainDetailsWndProc(Window *w, WindowEvent *e)
   511 static void TrainDetailsWndProc(Window *w, WindowEvent *e)