Merge branch 'master' into cpp-11
# Conflicts: # config.lib # projects/openttd_vs100.vcxproj # projects/openttd_vs100.vcxproj.filters # projects/openttd_vs80.vcproj # projects/openttd_vs90.vcproj # src/saveload/saveload.cpp
This commit is contained in:
@@ -125,7 +125,7 @@ static inline T *ReallocT(T *t_ptr, size_t num_elements)
|
||||
/* Ensure the size does not overflow. */
|
||||
CheckAllocationConstraints<T>(num_elements);
|
||||
|
||||
t_ptr = (T*)realloc(t_ptr, num_elements * sizeof(T));
|
||||
t_ptr = (T*)realloc(static_cast<void *>(t_ptr), num_elements * sizeof(T));
|
||||
if (t_ptr == NULL) ReallocError(num_elements * sizeof(T));
|
||||
return t_ptr;
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ struct Backup {
|
||||
{
|
||||
/* We cannot assert here, as missing restoration is 'normal' when exceptions are thrown.
|
||||
* Exceptions are especially used to abort world generation. */
|
||||
DEBUG(misc, 0, "%s:%d: Backupped value was not restored!", this->file, this->line);
|
||||
DEBUG(misc, 0, "%s:%d: Backed-up value was not restored!", this->file, this->line);
|
||||
this->Restore();
|
||||
}
|
||||
}
|
||||
|
@@ -302,6 +302,7 @@ static inline bool HasAtMostOneBit(T value)
|
||||
template <typename T>
|
||||
static inline T ROL(const T x, const uint8 n)
|
||||
{
|
||||
if (n == 0) return x;
|
||||
return (T)(x << n | x >> (sizeof(x) * 8 - n));
|
||||
}
|
||||
|
||||
@@ -317,6 +318,7 @@ static inline T ROL(const T x, const uint8 n)
|
||||
template <typename T>
|
||||
static inline T ROR(const T x, const uint8 n)
|
||||
{
|
||||
if (n == 0) return x;
|
||||
return (T)(x >> n | x << (sizeof(x) * 8 - n));
|
||||
}
|
||||
|
||||
|
@@ -26,15 +26,22 @@
|
||||
#define TTD_BIG_ENDIAN 1
|
||||
|
||||
/* Windows has always LITTLE_ENDIAN */
|
||||
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
|
||||
#define TTD_ENDIAN TTD_LITTLE_ENDIAN
|
||||
#if defined(_WIN32) || defined(__OS2__)
|
||||
# define TTD_ENDIAN TTD_LITTLE_ENDIAN
|
||||
#elif defined(OSX)
|
||||
# include <sys/types.h>
|
||||
# if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
|
||||
# define TTD_ENDIAN TTD_LITTLE_ENDIAN
|
||||
# else
|
||||
# define TTD_ENDIAN TTD_BIG_ENDIAN
|
||||
# endif
|
||||
#elif !defined(TESTING)
|
||||
/* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
|
||||
#if defined(STRGEN) || defined(SETTINGSGEN)
|
||||
#include "endian_host.h"
|
||||
#else
|
||||
#include "endian_target.h"
|
||||
#endif
|
||||
#endif /* WIN32 || __OS2__ || WIN64 */
|
||||
# include <sys/param.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define TTD_ENDIAN TTD_LITTLE_ENDIAN
|
||||
# else
|
||||
# define TTD_ENDIAN TTD_BIG_ENDIAN
|
||||
# endif
|
||||
#endif /* _WIN32 || __OS2__ */
|
||||
|
||||
#endif /* ENDIAN_TYPE_HPP */
|
||||
|
@@ -159,7 +159,7 @@ public:
|
||||
|
||||
/**
|
||||
* Erase a row, replacing it with the last one.
|
||||
* @param x Position of the row.
|
||||
* @param y Position of the row.
|
||||
*/
|
||||
void EraseRow(uint y)
|
||||
{
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
|
||||
/**
|
||||
* Remove columns from the matrix while preserving the order of other columns.
|
||||
* @param x First column to remove.
|
||||
* @param y First column to remove.
|
||||
* @param count Number of consecutive columns to remove.
|
||||
*/
|
||||
void EraseRowPreservingOrder(uint y, uint count = 1)
|
||||
@@ -210,8 +210,8 @@ public:
|
||||
/**
|
||||
* Set the size to a specific width and height, preserving item positions
|
||||
* as far as possible in the process.
|
||||
* @param width Target width.
|
||||
* @param height Target height.
|
||||
* @param new_width Target width.
|
||||
* @param new_height Target height.
|
||||
*/
|
||||
inline void Resize(uint new_width, uint new_height)
|
||||
{
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
/**
|
||||
* Get column "number" (const)
|
||||
*
|
||||
* @param X Position of the column.
|
||||
* @param x Position of the column.
|
||||
* @return Column at "number".
|
||||
*/
|
||||
inline const T *operator[](uint x) const
|
||||
@@ -309,7 +309,7 @@ public:
|
||||
/**
|
||||
* Get column "number" (const)
|
||||
*
|
||||
* @param X Position of the column.
|
||||
* @param x Position of the column.
|
||||
* @return Column at "number".
|
||||
*/
|
||||
inline T *operator[](uint x)
|
||||
|
Reference in New Issue
Block a user