src/industry_cmd.cpp
changeset 8517 a185893bcb61
parent 8516 4b3cba59c003
child 8596 c3404405f3f5
equal deleted inserted replaced
8516:4b3cba59c003 8517:a185893bcb61
  2135 		}
  2135 		}
  2136 	}
  2136 	}
  2137 
  2137 
  2138 	/* Increase if needed */
  2138 	/* Increase if needed */
  2139 	while (mul-- != 0 && i->prod_level < PRODLEVEL_MAXIMUM) {
  2139 	while (mul-- != 0 && i->prod_level < PRODLEVEL_MAXIMUM) {
  2140 		i->prod_level <<= 1;
  2140 		i->prod_level = min(i->prod_level * 2, PRODLEVEL_MAXIMUM);
  2141 		i->production_rate[0] = min(i->production_rate[0] * 2, 0xFF);
  2141 		i->production_rate[0] = min(i->production_rate[0] * 2, 0xFF);
  2142 		i->production_rate[1] = min(i->production_rate[1] * 2, 0xFF);
  2142 		i->production_rate[1] = min(i->production_rate[1] * 2, 0xFF);
  2143 		if (str == STR_NULL) str = indspec->production_up_text;
  2143 		if (str == STR_NULL) str = indspec->production_up_text;
  2144 	}
  2144 	}
  2145 
  2145 
  2146 	/* Decrease if needed */
  2146 	/* Decrease if needed */
  2147 	while (div-- != 0 && !closeit) {
  2147 	while (div-- != 0 && !closeit) {
  2148 		if (i->prod_level == PRODLEVEL_MINIMUM) {
  2148 		if (i->prod_level == PRODLEVEL_MINIMUM) {
  2149 			closeit = true;
  2149 			closeit = true;
  2150 		} else {
  2150 		} else {
  2151 			i->prod_level >>= 1;
  2151 			i->prod_level = max(i->prod_level / 2, (int)PRODLEVEL_MINIMUM); // typecast to int required to please MSVC
  2152 			i->production_rate[0] = (i->production_rate[0] + 1) >> 1;
  2152 			i->production_rate[0] = (i->production_rate[0] + 1) / 2;
  2153 			i->production_rate[1] = (i->production_rate[1] + 1) >> 1;
  2153 			i->production_rate[1] = (i->production_rate[1] + 1) / 2;
  2154 			if (str == STR_NULL) str = indspec->production_down_text;
  2154 			if (str == STR_NULL) str = indspec->production_down_text;
  2155 		}
  2155 		}
  2156 	}
  2156 	}
  2157 
  2157 
  2158 	/* Increase or Decreasing the production level if needed */
  2158 	/* Increase or Decreasing the production level if needed */