Changeset - r18349:58c028e927a9
[Not reviewed]
master
0 4 0
rubidium - 13 years ago 2011-11-12 08:37:12
rubidium@openttd.org
(svn r23195) -Codechange: if we really need to cast away constness, use const_cast
4 files changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_instance.cpp
Show inline comments
 
@@ -511,7 +511,7 @@ static const uint AISAVE_MAX_DEPTH = 25;
 
			if (!test) {
 
				_ai_sl_byte = (byte)len;
 
				SlObject(NULL, _ai_byte);
 
				SlArray((void*)buf, len, SLE_CHAR);
 
				SlArray(const_cast<char *>(buf), len, SLE_CHAR);
 
			}
 
			return true;
 
		}
src/saveload/saveload.h
Show inline comments
 
@@ -514,7 +514,7 @@ static inline bool IsNumericType(VarType
 
 */
 
static inline void *GetVariableAddress(const void *object, const SaveLoad *sld)
 
{
 
	return (byte*)(sld->global ? NULL : object) + (ptrdiff_t)sld->address;
 
	return const_cast<byte *>((const byte*)(sld->global ? NULL : object) + (ptrdiff_t)sld->address);
 
}
 

	
 
int64 ReadValue(const void *ptr, VarType conv);
src/screenshot.cpp
Show inline comments
 
@@ -275,7 +275,7 @@ static bool MakePNGImage(const char *nam
 
	f = fopen(name, "wb");
 
	if (f == NULL) return false;
 

	
 
	png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (void *)name, png_my_error, png_my_warning);
 
	png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, const_cast<char *>(name), png_my_error, png_my_warning);
 

	
 
	if (png_ptr == NULL) {
 
		fclose(f);
src/vehicle.cpp
Show inline comments
 
@@ -480,8 +480,8 @@ CommandCost TunnelBridgeIsFree(TileIndex
 
	 * error message only (which may be different for different machines).
 
	 * Such a message does not affect MP synchronisation.
 
	 */
 
	Vehicle *v = VehicleFromPos(tile, (void *)ignore, &GetVehicleTunnelBridgeProc, true);
 
	if (v == NULL) v = VehicleFromPos(endtile, (void *)ignore, &GetVehicleTunnelBridgeProc, true);
 
	Vehicle *v = VehicleFromPos(tile, const_cast<Vehicle *>(ignore), &GetVehicleTunnelBridgeProc, true);
 
	if (v == NULL) v = VehicleFromPos(endtile, const_cast<Vehicle *>(ignore), &GetVehicleTunnelBridgeProc, true);
 

	
 
	if (v != NULL) return_cmd_error(STR_ERROR_TRAIN_IN_THE_WAY + v->type);
 
	return CommandCost();
0 comments (0 inline, 0 general)