src/industry_cmd.cpp
branchnoai
changeset 9869 6404afe43575
parent 9837 c9ec4f82e0d0
child 10142 56ee7da4ad56
equal deleted inserted replaced
9868:3998f2e73dda 9869:6404afe43575
   301 	/* DrawFoundation() modifes ti->z and ti->tileh */
   301 	/* DrawFoundation() modifes ti->z and ti->tileh */
   302 	if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
   302 	if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
   303 
   303 
   304 	DrawGroundSprite(image, pal);
   304 	DrawGroundSprite(image, pal);
   305 
   305 
       
   306 	/* If industries are transparent and invisible, do not draw the upper part */
       
   307 	if (IsInvisibilitySet(TO_INDUSTRIES)) return;
       
   308 
   306 	/* Add industry on top of the ground? */
   309 	/* Add industry on top of the ground? */
   307 	image = dits->building.sprite;
   310 	image = dits->building.sprite;
   308 	if (image != 0) {
   311 	if (image != 0) {
   309 		AddSortableSpriteToDraw(image,
   312 		AddSortableSpriteToDraw(image,
   310 			(HasBit(image, PALETTE_MODIFIER_COLOR) && dits->building.pal == PAL_NONE) ? GENERAL_SPRITE_COLOR(ind->random_color) : dits->building.pal,
   313 			(HasBit(image, PALETTE_MODIFIER_COLOR) && dits->building.pal == PAL_NONE) ? GENERAL_SPRITE_COLOR(ind->random_color) : dits->building.pal,
  1962 		 * We cannot check the first of shared orders only, since the first vehicle in such a chain
  1965 		 * We cannot check the first of shared orders only, since the first vehicle in such a chain
  1963 		 * may have a different cargo type.
  1966 		 * may have a different cargo type.
  1964 		 */
  1967 		 */
  1965 		const Order *o;
  1968 		const Order *o;
  1966 		FOR_VEHICLE_ORDERS(v, o) {
  1969 		FOR_VEHICLE_ORDERS(v, o) {
  1967 			if (o->type == OT_GOTO_STATION && !HasBit(o->flags, OF_TRANSFER)) {
  1970 			if (o->IsType(OT_GOTO_STATION) && !HasBit(o->GetUnloadType(), OF_TRANSFER)) {
  1968 				/* Vehicle visits a station to load or unload */
  1971 				/* Vehicle visits a station to load or unload */
  1969 				Station *st = GetStation(o->dest);
  1972 				Station *st = GetStation(o->GetDestination());
  1970 				if (!st->IsValid()) continue;
  1973 				if (!st->IsValid()) continue;
  1971 
  1974 
  1972 				/* Same cargo produced by industry is dropped here => not serviced by vehicle v */
  1975 				/* Same cargo produced by industry is dropped here => not serviced by vehicle v */
  1973 				if (HasBit(o->flags, OF_UNLOAD) && !c_accepts) break;
  1976 				if (HasBit(o->GetUnloadType(), OF_UNLOAD) && !c_accepts) break;
  1974 
  1977 
  1975 				if (stations.find(st) != stations.end()) {
  1978 				if (stations.find(st) != stations.end()) {
  1976 					if (v->owner == _local_player) return 2; // Player services industry
  1979 					if (v->owner == _local_player) return 2; // Player services industry
  1977 					result = 1; // Competitor services industry
  1980 					result = 1; // Competitor services industry
  1978 				}
  1981 				}