summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/ai_instance.cpp2
-rw-r--r--src/saveload/saveload.h2
-rw-r--r--src/screenshot.cpp2
-rw-r--r--src/vehicle.cpp4
4 files changed, 5 insertions, 5 deletions
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp
index 1cae588f7..dbc8970b1 100644
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -511,7 +511,7 @@ static const uint AISAVE_MAX_DEPTH = 25; ///< The maximum recursive depth for it
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;
}
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index 0090b6be3..db3af4dd9 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -514,7 +514,7 @@ static inline bool IsNumericType(VarType conv)
*/
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);
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index dcf35127c..9cee75820 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -275,7 +275,7 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user
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);
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index dd7186fc6..69c40975b 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -480,8 +480,8 @@ CommandCost TunnelBridgeIsFree(TileIndex tile, TileIndex endtile, const Vehicle
* 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();