Changeset - r12022:f3eef0751aff
[Not reviewed]
master
0 15 0
rubidium - 15 years ago 2009-05-26 15:46:24
rubidium@openttd.org
(svn r16434) -Cleanup: remove some dead code; primarily stuff that can't be reached like break after returns or break after functions that never return (i.e. NOT_REACHED)
15 files changed with 30 insertions and 36 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/squirrel/sqapi.cpp
Show inline comments
 
@@ -829,7 +829,7 @@ SQRESULT sq_getdelegate(HSQUIRRELVM v,SQ
 
		}
 
		v->Push(SQObjectPtr(_delegable(self)->_delegate));
 
		break;
 
	default: return sq_throwerror(v,_SC("wrong type")); break;
 
	default: return sq_throwerror(v,_SC("wrong type"));
 
	}
 
	return SQ_OK;
 

	
src/bmp.cpp
Show inline comments
 
@@ -362,11 +362,11 @@ bool BmpReadBitmap(BmpBuffer *buffer, Bm
 
		case 4:  return BmpRead4(buffer, info, data);
 
		case 8:  return BmpRead8(buffer, info, data);
 
		case 24: return BmpRead24(buffer, info, data);
 
		default: NOT_REACHED(); return false;
 
		default: NOT_REACHED();
 
		}
 
	case 1:  return BmpRead8Rle(buffer, info, data); // 8-bit RLE compression
 
	case 2:  return BmpRead4Rle(buffer, info, data); // 4-bit RLE compression
 
	default: NOT_REACHED(); return false;
 
	default: NOT_REACHED();
 
	}
 
}
 

	
src/depot_gui.cpp
Show inline comments
 
@@ -541,7 +541,7 @@ struct DepotWindow : Window {
 
					case VEH_ROAD:     command = CMD_START_STOP_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_STOP_START_ROAD_VEHICLE); break;
 
					case VEH_SHIP:     command = CMD_START_STOP_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_STOP_START_SHIP);         break;
 
					case VEH_AIRCRAFT: command = CMD_START_STOP_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_STOP_START_AIRCRAFT);     break;
 
					default: NOT_REACHED(); command = 0;
 
					default: NOT_REACHED();
 
				}
 
				DoCommandP(v->tile, v->index, 0, command);
 
			} break;
 
@@ -991,7 +991,7 @@ struct DepotWindow : Window {
 
						case VEH_ROAD:     command = CMD_SELL_ROAD_VEH | CMD_MSG(STR_ERROR_CAN_T_SELL_ROAD_VEHICLE);       break;
 
						case VEH_SHIP:     command = CMD_SELL_SHIP | CMD_MSG(STR_ERROR_CAN_T_SELL_SHIP);                   break;
 
						case VEH_AIRCRAFT: command = CMD_SELL_AIRCRAFT | CMD_MSG(STR_ERROR_CAN_T_SELL_AIRCRAFT);           break;
 
						default: NOT_REACHED(); command = 0;
 
						default: NOT_REACHED();
 
					}
 

	
 
					if (!DoCommandP(v->tile, v->index, sell_cmd, command) && is_engine) _backup_orders_tile = 0;
src/gfx.cpp
Show inline comments
 
@@ -598,7 +598,7 @@ uint32 FormatStringLinebreaks(char *str,
 
				}
 
			} else {
 
				switch (c) {
 
					case '\0': return num + (size << 16); break;
 
					case '\0': return num + (size << 16);
 
					case SCC_SETX:  str++; break;
 
					case SCC_SETXY: str += 2; break;
 
					case SCC_TINYFONT: size = FS_SMALL; break;
src/industry_cmd.cpp
Show inline comments
 
@@ -2038,7 +2038,7 @@ static void ReportNewsProductionChangeIn
 
		case 0: ns = NS_INDUSTRY_NOBODY;  break;
 
		case 1: ns = NS_INDUSTRY_OTHER;   break;
 
		case 2: ns = NS_INDUSTRY_COMPANY; break;
 
		default: NOT_REACHED(); break;
 
		default: NOT_REACHED();
 
	}
 
	SetDParam(2, abs(percent));
 
	SetDParam(0, GetCargo(type)->name);
 
@@ -2233,7 +2233,7 @@ static void ChangeIndustryProduction(Ind
 
				case 0: ns = NS_INDUSTRY_NOBODY;  break;
 
				case 1: ns = NS_INDUSTRY_OTHER;   break;
 
				case 2: ns = NS_INDUSTRY_COMPANY; break;
 
				default: NOT_REACHED(); break;
 
				default: NOT_REACHED();
 
			}
 
		}
 
		/* Set parameters of news string */
src/newgrf.cpp
Show inline comments
 
@@ -5060,7 +5060,7 @@ static void GRFImportBlock(byte *buf, in
 

	
 
	switch (_grf_data_type) {
 
		case GDT_SOUND: ImportGRFSound(buf, len - 1); break;
 
		default: NOT_REACHED(); break;
 
		default: NOT_REACHED();
 
	}
 
}
 

	
 
@@ -5277,7 +5277,7 @@ static void GRFDataBlock(byte *buf, int 
 

	
 
	switch (_grf_data_type) {
 
		case GDT_SOUND: LoadGRFSound(buf, len - name_len - 2); break;
 
		default: NOT_REACHED(); break;
 
		default: NOT_REACHED();
 
	}
 
}
 

	
src/newgrf_spritegroup.cpp
Show inline comments
 
@@ -157,7 +157,7 @@ const SpriteGroup *DeterministicSpriteGr
 
			case DSG_SIZE_BYTE:  value = EvalAdjustT<uint8,  int8> (adjust, object, last_value, value); break;
 
			case DSG_SIZE_WORD:  value = EvalAdjustT<uint16, int16>(adjust, object, last_value, value); break;
 
			case DSG_SIZE_DWORD: value = EvalAdjustT<uint32, int32>(adjust, object, last_value, value); break;
 
			default: NOT_REACHED(); break;
 
			default: NOT_REACHED();
 
		}
 
		last_value = value;
 
	}
src/saveload/saveload.cpp
Show inline comments
 
@@ -488,9 +488,6 @@ int64 ReadValue(const void *ptr, VarType
 
		case SLE_VAR_NULL:return 0;
 
		default: NOT_REACHED();
 
	}
 

	
 
	/* useless, but avoids compiler warning this way */
 
	return 0;
 
}
 

	
 
/** Write the value of a setting
 
@@ -1488,8 +1485,6 @@ static size_t ReferenceToInt(const void 
 
		case REF_ORDERLIST:     return ((const   OrderList*)obj)->index + 1;
 
		default: NOT_REACHED();
 
	}
 

	
 
	return 0; // avoid compiler warning
 
}
 

	
 
/**
src/saveload/vehicle_sl.cpp
Show inline comments
 
@@ -149,7 +149,7 @@ void ConvertOldMultiheadToNew()
 
							SetTrainWagon(u);
 
							SetFreeWagon(u);
 
							break;
 
						default: NOT_REACHED(); break;
 
						default: NOT_REACHED();
 
					}
 
				}
 
			}
src/settings.cpp
Show inline comments
 
@@ -378,7 +378,7 @@ static void Write_ValidateSetting(void *
 
			}
 
			case SLE_VAR_I64:
 
			case SLE_VAR_U64:
 
			default: NOT_REACHED(); break;
 
			default: NOT_REACHED();
 
		}
 
	}
 

	
 
@@ -451,7 +451,7 @@ static void ini_load_settings(IniFile *i
 
					*(char**)ptr = p == NULL ? NULL : strdup((const char*)p);
 
					break;
 
				case SLE_VAR_CHAR: if (p != NULL) *(char*)ptr = *(char*)p; break;
 
				default: NOT_REACHED(); break;
 
				default: NOT_REACHED();
 
			}
 
			break;
 

	
 
@@ -463,7 +463,7 @@ static void ini_load_settings(IniFile *i
 
			}
 
			break;
 
		}
 
		default: NOT_REACHED(); break;
 
		default: NOT_REACHED();
 
		}
 
	}
 
}
src/tree_cmd.cpp
Show inline comments
 
@@ -302,7 +302,7 @@ void GenerateTrees()
 
	switch (_settings_game.game_creation.tree_placer) {
 
		case TP_ORIGINAL: i = _settings_game.game_creation.landscape == LT_ARCTIC ? 15 : 6; break;
 
		case TP_IMPROVED: i = _settings_game.game_creation.landscape == LT_ARCTIC ?  4 : 2; break;
 
		default: NOT_REACHED(); return;
 
		default: NOT_REACHED();
 
	}
 

	
 
	total = ScaleByMapSize(1000);
src/unmovable_cmd.cpp
Show inline comments
 
@@ -176,7 +176,7 @@ static void DrawTile_Unmovable(TileInfo 
 
{
 

	
 
	switch (GetUnmovableType(ti->tile)) {
 
		default: NOT_REACHED(); break;
 
		default: NOT_REACHED();
 
		case UNMOVABLE_TRANSMITTER:
 
		case UNMOVABLE_LIGHTHOUSE: {
 
			const DrawTileSeqStruct *dtu = &_draw_tile_transmitterlighthouse_data[GetUnmovableType(ti->tile)];
src/vehicle.cpp
Show inline comments
 
@@ -1066,7 +1066,7 @@ void VehicleEnterDepot(Vehicle *v)
 
					case VEH_ROAD:     string = STR_NEWS_ROAD_VEHICLE_IS_WAITING;   break;
 
					case VEH_SHIP:     string = STR_NEWS_SHIP_IS_WAITING;  break;
 
					case VEH_AIRCRAFT: string = STR_NEWS_AIRCRAFT_IS_WAITING;    break;
 
					default: NOT_REACHED(); string = STR_EMPTY; // Set the string to something to avoid a compiler warning
 
					default: NOT_REACHED();
 
				}
 

	
 
				SetDParam(0, v->index);
src/vehicle_gui.cpp
Show inline comments
 
@@ -906,7 +906,7 @@ struct VehicleListWindow : public BaseVe
 
					case VEH_ROAD:     this->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_ROAD_CAPTION;     break;
 
					case VEH_SHIP:     this->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_SHIP_CAPTION;     break;
 
					case VEH_AIRCRAFT: this->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_AIRCRAFT_CAPTION; break;
 
					default: NOT_REACHED(); break;
 
					default: NOT_REACHED();
 
				}
 
				break;
 

	
 
@@ -920,7 +920,7 @@ struct VehicleListWindow : public BaseVe
 
					case VEH_ROAD:     this->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_ROAD_VEHICLES; break;
 
					case VEH_SHIP:     this->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_SHIPS;         break;
 
					case VEH_AIRCRAFT: this->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_AIRCRAFT;      break;
 
					default: NOT_REACHED(); break;
 
					default: NOT_REACHED();
 
				}
 
				break;
 

	
 
@@ -930,10 +930,10 @@ struct VehicleListWindow : public BaseVe
 
					case VEH_ROAD:     this->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_ROADVEH_DEPOT;  break;
 
					case VEH_SHIP:     this->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_SHIP_DEPOT;     break;
 
					case VEH_AIRCRAFT: this->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_AIRCRAFT_DEPOT; break;
 
					default: NOT_REACHED(); break;
 
					default: NOT_REACHED();
 
				}
 
				break;
 
			default: NOT_REACHED(); break;
 
			default: NOT_REACHED();
 
		}
 

	
 
		switch (this->vehicle_type) {
 
@@ -963,7 +963,7 @@ struct VehicleListWindow : public BaseVe
 
			case VEH_ROAD:     this->sorting = &_sorting.roadveh; break;
 
			case VEH_SHIP:     this->sorting = &_sorting.ship; break;
 
			case VEH_AIRCRAFT: this->sorting = &_sorting.aircraft; break;
 
			default: NOT_REACHED(); break;
 
			default: NOT_REACHED();
 
		}
 

	
 
		this->vehicles.SetListing(*this->sorting);
 
@@ -1024,7 +1024,7 @@ struct VehicleListWindow : public BaseVe
 
					case VEH_ROAD:     SetDParam(0, STR_DEPOT_ROAD_CAPTION);     break;
 
					case VEH_SHIP:     SetDParam(0, STR_DEPOT_SHIP_CAPTION);     break;
 
					case VEH_AIRCRAFT: SetDParam(0, STR_DEPOT_AIRCRAFT_CAPTION); break;
 
					default: NOT_REACHED(); break;
 
					default: NOT_REACHED();
 
				}
 
				if (this->vehicle_type == VEH_AIRCRAFT) {
 
					SetDParam(1, index); // Airport name
 
@@ -1033,7 +1033,7 @@ struct VehicleListWindow : public BaseVe
 
				}
 
				SetDParam(2, this->vscroll.count);
 
				break;
 
			default: NOT_REACHED(); break;
 
			default: NOT_REACHED();
 
		}
 

	
 
		/* Hide the widgets that we will not use in this window
 
@@ -1393,12 +1393,11 @@ struct VehicleDetailsWindow : Window {
 
	{
 
		switch (vehicle_type) {
 
			default: NOT_REACHED();
 
			case VEH_TRAIN:    return _settings_game.vehicle.servint_trains   != 0; break;
 
			case VEH_ROAD:     return _settings_game.vehicle.servint_roadveh  != 0; break;
 
			case VEH_SHIP:     return _settings_game.vehicle.servint_ships    != 0; break;
 
			case VEH_AIRCRAFT: return _settings_game.vehicle.servint_aircraft != 0; break;
 
			case VEH_TRAIN:    return _settings_game.vehicle.servint_trains   != 0;
 
			case VEH_ROAD:     return _settings_game.vehicle.servint_roadveh  != 0;
 
			case VEH_SHIP:     return _settings_game.vehicle.servint_ships    != 0;
 
			case VEH_AIRCRAFT: return _settings_game.vehicle.servint_aircraft != 0;
 
		}
 
		return false; // kill a compiler warning
 
	}
 

	
 
	/**
src/vehiclelist.cpp
Show inline comments
 
@@ -144,7 +144,7 @@ void GenerateVehicleSortList(VehicleList
 
			}
 
			break;
 

	
 
		default: NOT_REACHED(); break;
 
		default: NOT_REACHED();
 
	}
 

	
 
	list->Compact();
0 comments (0 inline, 0 general)