src/newgrf.cpp
changeset 6439 99a5807852b1
parent 6433 84cd6e4262fd
child 6454 05179065897e
equal deleted inserted replaced
6438:15897108ca15 6439:99a5807852b1
  3656 		uint32 xor_mask = _engine_info[engine].refit_mask;
  3656 		uint32 xor_mask = _engine_info[engine].refit_mask;
  3657 		byte i;
  3657 		byte i;
  3658 
  3658 
  3659 		if (cargo_allowed[engine] != 0) {
  3659 		if (cargo_allowed[engine] != 0) {
  3660 			// Build up the list of cargo types from the set cargo classes.
  3660 			// Build up the list of cargo types from the set cargo classes.
  3661 			for (i = 0; i < lengthof(cargo_classes); i++) {
  3661 			for (i = 0; i < NUM_CARGO; i++) {
  3662 				if (HASBIT(cargo_allowed[engine], i)) mask |= cargo_classes[i];
  3662 				const CargoSpec *cs = GetCargo(i);
  3663 				if (HASBIT(cargo_disallowed[engine], i)) not_mask |= cargo_classes[i];
  3663 				if (cargo_allowed[engine]    & cs->classes) SETBIT(mask,     cs->bitnum);
       
  3664 				if (cargo_disallowed[engine] & cs->classes) SETBIT(not_mask, cs->bitnum);
  3664 			}
  3665 			}
  3665 		} else {
  3666 		} else {
  3666 			// Don't apply default refit mask to wagons or engines with no capacity
  3667 			// Don't apply default refit mask to wagons or engines with no capacity
  3667 			if (xor_mask == 0 && (
  3668 			if (xor_mask == 0 && (
  3668 						GetEngine(engine)->type != VEH_Train || (
  3669 						GetEngine(engine)->type != VEH_Train || (
  3671 						)
  3672 						)
  3672 					)) {
  3673 					)) {
  3673 				xor_mask = _default_refitmasks[GetEngine(engine)->type];
  3674 				xor_mask = _default_refitmasks[GetEngine(engine)->type];
  3674 			}
  3675 			}
  3675 		}
  3676 		}
  3676 		_engine_info[engine].refit_mask = ((mask & ~not_mask) ^ xor_mask) & _landscape_global_cargo_mask[_opt.landscape];
  3677 		_engine_info[engine].refit_mask = ((mask & ~not_mask) ^ xor_mask) & _cargo_mask;
  3677 	}
  3678 	}
  3678 }
  3679 }
  3679 
  3680 
  3680 /* Here we perform initial decoding of some special sprites (as are they
  3681 /* Here we perform initial decoding of some special sprites (as are they
  3681  * described at http://www.ttdpatch.net/src/newgrf.txt, but this is only a very
  3682  * described at http://www.ttdpatch.net/src/newgrf.txt, but this is only a very