src/train_gui.cpp
changeset 6350 04b19f551aec
parent 6259 471b91a4b1d8
child 6422 6679df1c05ba
equal deleted inserted replaced
6349:908a23fd464f 6350:04b19f551aec
   369 	byte det_tab = WP(w, traindetails_d).tab;
   369 	byte det_tab = WP(w, traindetails_d).tab;
   370 	const Vehicle *v;
   370 	const Vehicle *v;
   371 	const Vehicle *u;
   371 	const Vehicle *u;
   372 	AcceptedCargo act_cargo;
   372 	AcceptedCargo act_cargo;
   373 	AcceptedCargo max_cargo;
   373 	AcceptedCargo max_cargo;
   374 	uint i;
       
   375 	int num;
   374 	int num;
   376 	int x;
   375 	int x;
   377 	int y;
   376 	int y;
   378 	int sel;
   377 	int sel;
   379 
   378 
   380 	num = 0;
   379 	num = 0;
   381 	u = v = GetVehicle(w->window_number);
   380 	u = v = GetVehicle(w->window_number);
   382 	if (det_tab == 3) { // Total cargo tab
   381 	if (det_tab == 3) { // Total cargo tab
   383 		for (i = 0; i < lengthof(act_cargo); i++) {
   382 		for (CargoID i = 0; i < lengthof(act_cargo); i++) {
   384 			act_cargo[i] = 0;
   383 			act_cargo[i] = 0;
   385 			max_cargo[i] = 0;
   384 			max_cargo[i] = 0;
   386 		}
   385 		}
   387 
   386 
   388 		do {
   387 		do {
   391 		} while ((u = u->next) != NULL);
   390 		} while ((u = u->next) != NULL);
   392 
   391 
   393 		/* Set scroll-amount seperately from counting, as to not compute num double
   392 		/* Set scroll-amount seperately from counting, as to not compute num double
   394 		 * for more carriages of the same type
   393 		 * for more carriages of the same type
   395 		 */
   394 		 */
   396 		for (i = 0; i != NUM_CARGO; i++) {
   395 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   397 			if (max_cargo[i] > 0) num++; // only count carriages that the train has
   396 			if (max_cargo[i] > 0) num++; // only count carriages that the train has
   398 		}
   397 		}
   399 		num++; // needs one more because first line is description string
   398 		num++; // needs one more because first line is description string
   400 	} else {
   399 	} else {
   401 		do {
   400 		do {
   490 			if (v == NULL) return;
   489 			if (v == NULL) return;
   491 		}
   490 		}
   492 	} else {
   491 	} else {
   493 		// draw total cargo tab
   492 		// draw total cargo tab
   494 		DrawString(x, y + 2, STR_013F_TOTAL_CAPACITY_TEXT, 0);
   493 		DrawString(x, y + 2, STR_013F_TOTAL_CAPACITY_TEXT, 0);
   495 		for (i = 0; i != NUM_CARGO; i++) {
   494 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   496 			if (max_cargo[i] > 0 && --sel < 0 && sel > -w->vscroll.cap) {
   495 			if (max_cargo[i] > 0 && --sel < 0 && sel > -w->vscroll.cap) {
   497 				y += 14;
   496 				y += 14;
   498 				SetDParam(0, i);            // {CARGO} #1
   497 				SetDParam(0, i);            // {CARGO} #1
   499 				SetDParam(1, act_cargo[i]); // {CARGO} #2
   498 				SetDParam(1, act_cargo[i]); // {CARGO} #2
   500 				SetDParam(2, i);            // {SHORTCARGO} #1
   499 				SetDParam(2, i);            // {SHORTCARGO} #1