vehicle_gui.c
changeset 2611 65b5313bc525
parent 2569 2851becf6330
child 2617 a9e1a187de99
equal deleted inserted replaced
2610:044cb4ffc6f7 2611:65b5313bc525
   224 		 * it with the bitmask of available cargo on the current landscape, and
   224 		 * it with the bitmask of available cargo on the current landscape, and
   225 		 * where the bits are set: those are available */
   225 		 * where the bits are set: those are available */
   226 		cmask = 0;
   226 		cmask = 0;
   227 		u = v;
   227 		u = v;
   228 		do {
   228 		do {
   229 			if (_engine_refit_masks[u->engine_type] != 0) { // newgrf custom refit mask
   229 			cmask |= _engine_info[u->engine_type].refit_mask;
   230 				cmask |= _engine_refit_masks[u->engine_type];
       
   231 			} else if (u->cargo_cap != 0) {
       
   232 				// rail wagons cant be refitted by default
       
   233 				if (v->type != VEH_Train || !(RailVehInfo(u->engine_type)->flags & RVI_WAGON))
       
   234 					cmask |= _default_refitmasks[v->type - VEH_Train];
       
   235 			}
       
   236 			u = u->next;
   230 			u = u->next;
   237 		} while (v->type == VEH_Train && u != NULL);
   231 		} while (v->type == VEH_Train && u != NULL);
   238 
       
   239 		cmask &= _landscape_global_cargo_mask[_opt_ptr->landscape];
       
   240 
   232 
   241 		/* Check which cargo has been selected from the refit window and draw list */
   233 		/* Check which cargo has been selected from the refit window and draw list */
   242 		for (cid = 0; cmask != 0; cmask >>= 1, cid++) {
   234 		for (cid = 0; cmask != 0; cmask >>= 1, cid++) {
   243 			if (HASBIT(cmask, 0)) // vehicle is refittable to this cargo
   235 			if (HASBIT(cmask, 0)) // vehicle is refittable to this cargo
   244 				show_cargo(_local_cargo_id_ctype[cid]);
   236 				show_cargo(_local_cargo_id_ctype[cid]);