summaryrefslogtreecommitdiff
path: root/src/core/pool_func.hpp
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-02-13 09:01:49 +0000
committerGitHub <noreply@github.com>2019-02-13 09:01:49 +0000
commitc0c8fb25fb84d498207713f89720e38a98f16435 (patch)
tree0dc517d9edc2c103829c3867376bf0716182a954 /src/core/pool_func.hpp
parent830ed6be6114b2b1ed6680c3acc422cd8a849874 (diff)
downloadopenttd-c0c8fb25fb84d498207713f89720e38a98f16435.tar.xz
Change: Use SlErrorCorrupt() on pool index error when loading a savegame, instead of terminating. (#7219)
Diffstat (limited to 'src/core/pool_func.hpp')
-rw-r--r--src/core/pool_func.hpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp
index 5569addbd..64af17564 100644
--- a/src/core/pool_func.hpp
+++ b/src/core/pool_func.hpp
@@ -152,18 +152,20 @@ DEFINE_POOL_METHOD(void *)::GetNew(size_t size)
* @param size size of item
* @param index index of item
* @return pointer to allocated item
- * @note usererror() on failure! (index out of range or already used)
+ * @note SlErrorCorruptFmt() on failure! (index out of range or already used)
*/
DEFINE_POOL_METHOD(void *)::GetNew(size_t size, size_t index)
{
+ extern void NORETURN SlErrorCorruptFmt(const char *format, ...);
+
if (index >= Tmax_size) {
- usererror("failed loading savegame: %s index " PRINTF_SIZE " out of range (" PRINTF_SIZE ")", this->name, index, Tmax_size);
+ SlErrorCorruptFmt("%s index " PRINTF_SIZE " out of range (" PRINTF_SIZE ")", this->name, index, Tmax_size);
}
if (index >= this->size) this->ResizeFor(index);
if (this->data[index] != NULL) {
- usererror("failed loading savegame: %s index " PRINTF_SIZE " already in use", this->name, index);
+ SlErrorCorruptFmt("%s index " PRINTF_SIZE " already in use", this->name, index);
}
return this->AllocateItem(size, index);