src/vehicle_gui.cpp
changeset 6676 30aea9ac89bc
parent 6585 7da94b26498a
child 6719 4cc327ad39d5
child 6919 339210ecccd3
equal deleted inserted replaced
6675:5e9d65c32e60 6676:30aea9ac89bc
   207 
   207 
   208 		/* Skip this engine if it has no capacity */
   208 		/* Skip this engine if it has no capacity */
   209 		if (u->cargo_cap == 0) continue;
   209 		if (u->cargo_cap == 0) continue;
   210 
   210 
   211 		/* Loop through all cargos in the refit mask */
   211 		/* Loop through all cargos in the refit mask */
   212 		for (CargoID cid = 0; cid != NUM_CARGO && num_lines < max_lines; cid++) {
   212 		for (CargoID cid = 0; cid < NUM_CARGO && num_lines < max_lines; cid++) {
   213 			/* Skip cargo type if it's not listed */
   213 			/* Skip cargo type if it's not listed */
   214 			if (!HASBIT(cmask, cid)) continue;
   214 			if (!HASBIT(cmask, cid)) continue;
   215 
   215 
   216 			/* Check the vehicle's callback mask for cargo suffixes */
   216 			/* Check the vehicle's callback mask for cargo suffixes */
   217 			if (HASBIT(callbackmask, CBM_CARGO_SUFFIX)) {
   217 			if (HASBIT(callbackmask, CBM_CARGO_SUFFIX)) {
   614 	const Vehicle* vb = *(const Vehicle**)b;
   614 	const Vehicle* vb = *(const Vehicle**)b;
   615 	const Vehicle* v;
   615 	const Vehicle* v;
   616 	AcceptedCargo cargoa;
   616 	AcceptedCargo cargoa;
   617 	AcceptedCargo cargob;
   617 	AcceptedCargo cargob;
   618 	int r = 0;
   618 	int r = 0;
   619 	int i;
       
   620 
   619 
   621 	memset(cargoa, 0, sizeof(cargoa));
   620 	memset(cargoa, 0, sizeof(cargoa));
   622 	memset(cargob, 0, sizeof(cargob));
   621 	memset(cargob, 0, sizeof(cargob));
   623 	for (v = va; v != NULL; v = v->next) cargoa[v->cargo_type] += v->cargo_cap;
   622 	for (v = va; v != NULL; v = v->next) cargoa[v->cargo_type] += v->cargo_cap;
   624 	for (v = vb; v != NULL; v = v->next) cargob[v->cargo_type] += v->cargo_cap;
   623 	for (v = vb; v != NULL; v = v->next) cargob[v->cargo_type] += v->cargo_cap;
   625 
   624 
   626 	for (i = 0; i < NUM_CARGO; i++) {
   625 	for (CargoID i = 0; i < NUM_CARGO; i++) {
   627 		r = cargoa[i] - cargob[i];
   626 		r = cargoa[i] - cargob[i];
   628 		if (r != 0) break;
   627 		if (r != 0) break;
   629 	}
   628 	}
   630 
   629 
   631 	VEHICLEUNITNUMBERSORTER(r, va, vb);
   630 	VEHICLEUNITNUMBERSORTER(r, va, vb);