(svn r19251) -Codechange: add a contructor to GRFError and use it to allocating errors more uniform.

-Fix: some grf error messages didn't free the previous error messages, creating a memory leak
This commit is contained in:
yexo
2010-02-25 15:54:40 +00:00
parent 14d28c5e69
commit 2c1b7410f3
3 changed files with 36 additions and 45 deletions

View File

@@ -13,6 +13,7 @@
#define NEWGRF_CONFIG_H
#include "strings_type.h"
#include "core/alloc_type.hpp"
/** GRF config bit flags */
enum GCF_Flags {
@@ -55,7 +56,10 @@ struct GRFIdentifier {
};
/** Information about why GRF had problems during initialisation */
struct GRFError {
struct GRFError : ZeroedMemoryAllocator {
GRFError(StringID severity, StringID message = 0);
~GRFError();
char *custom_message; ///< Custom message (if present)
char *data; ///< Additional data for message and custom_message
StringID message; ///< Default message