(svn r11691) -Codechange: move+rename helpers.hpp and only include it when it is really needed.
--- a/src/ai/ai.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/ai/ai.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -5,7 +5,7 @@
#include "../variables.h"
#include "../command_func.h"
#include "../network/network.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
#include "ai.h"
#include "default/default.h"
--- a/src/ai/default/default.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/ai/default/default.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -25,7 +25,6 @@
#include "../../variables.h"
#include "../../bridge.h"
#include "../../date.h"
-#include "../../helpers.hpp"
#include "../../tunnelbridge_map.h"
#include "default.h"
--- a/src/airport.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/airport.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -11,6 +11,7 @@
#include "airport_movement.h"
#include "date.h"
#include "core/bitmath_func.hpp"
+#include "core/alloc_func.hpp"
/* Uncomment this to print out a full report of the airport-structure
* You should either use
--- a/src/aystar.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/aystar.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -21,7 +21,7 @@
#include "stdafx.h"
#include "openttd.h"
#include "aystar.h"
-#include "helpers.hpp"
+#include "core/alloc_func.hpp"
int _aystar_stats_open_size;
int _aystar_stats_closed_size;
--- a/src/blitter/32bpp_anim.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/blitter/32bpp_anim.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -1,7 +1,7 @@
/* $Id$ */
#include "../stdafx.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
#include "../gfx_func.h"
#include "../zoom_func.h"
#include "../debug.h"
--- a/src/blitter/8bpp_optimized.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/blitter/8bpp_optimized.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -5,7 +5,7 @@
#include "../stdafx.h"
#include "../zoom_func.h"
#include "../debug.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
#include "8bpp_optimized.hpp"
static FBlitter_8bppOptimized iFBlitter_8bppOptimized;
--- a/src/bmp.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/bmp.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -3,9 +3,9 @@
/** @file bmp.cpp */
#include "stdafx.h"
-#include "helpers.hpp"
#include "bmp.h"
#include "core/bitmath_func.hpp"
+#include "core/alloc_func.hpp"
void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file)
{
--- a/src/console.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/console.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -15,10 +15,10 @@
#include <stdarg.h>
#include <string.h>
#include "console.h"
-#include "helpers.hpp"
#include "network/network.h"
#include "network/network_data.h"
#include "network/network_server.h"
+#include "core/alloc_func.hpp"
#define ICON_BUFFER 79
#define ICON_HISTORY_SIZE 20
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/core/alloc_func.hpp Tue Dec 25 09:48:53 2007 +0000
@@ -0,0 +1,84 @@
+/* $Id$ */
+
+/** @file alloc_func.hpp Functions related to the allocation of memory */
+
+#ifndef ALLOC_FUNC_HPP
+#define ALLOC_FUNC_HPP
+
+/**
+ * Simplified allocation function that allocates the specified number of
+ * elements of the given type. It also explicitly casts it to the requested
+ * type.
+ * @note throws an error when there is no memory anymore.
+ * @note the memory contains garbage data (i.e. possibly non-zero values).
+ * @param T the type of the variable(s) to allocation.
+ * @param num_elements the number of elements to allocate of the given type.
+ * @return NULL when num_elements == 0, non-NULL otherwise.
+ */
+template <typename T> FORCEINLINE T* MallocT(size_t num_elements)
+{
+ /*
+ * MorphOS cannot handle 0 elements allocations, or rather that always
+ * returns NULL. So we do that for *all* allocations, thus causing it
+ * to behave the same on all OSes.
+ */
+ if (num_elements == 0) return NULL;
+
+ T *t_ptr = (T*)malloc(num_elements * sizeof(T));
+ if (t_ptr == NULL) error("Out of memory. Cannot allocate %i bytes", num_elements * sizeof(T));
+ return t_ptr;
+}
+
+/**
+ * Simplified allocation function that allocates the specified number of
+ * elements of the given type. It also explicitly casts it to the requested
+ * type.
+ * @note throws an error when there is no memory anymore.
+ * @note the memory contains all zero values.
+ * @param T the type of the variable(s) to allocation.
+ * @param num_elements the number of elements to allocate of the given type.
+ * @return NULL when num_elements == 0, non-NULL otherwise.
+ */
+template <typename T> FORCEINLINE T* CallocT(size_t num_elements)
+{
+ /*
+ * MorphOS cannot handle 0 elements allocations, or rather that always
+ * returns NULL. So we do that for *all* allocations, thus causing it
+ * to behave the same on all OSes.
+ */
+ if (num_elements == 0) return NULL;
+
+ T *t_ptr = (T*)calloc(num_elements, sizeof(T));
+ if (t_ptr == NULL) error("Out of memory. Cannot allocate %i bytes", num_elements * sizeof(T));
+ return t_ptr;
+}
+
+/**
+ * Simplified reallocation function that allocates the specified number of
+ * elements of the given type. It also explicitly casts it to the requested
+ * type. It extends/shrinks the memory allocation given in t_ptr.
+ * @note throws an error when there is no memory anymore.
+ * @note the memory contains all zero values.
+ * @param T the type of the variable(s) to allocation.
+ * @param t_ptr the previous allocation to extend/shrink.
+ * @param num_elements the number of elements to allocate of the given type.
+ * @return NULL when num_elements == 0, non-NULL otherwise.
+ */
+template <typename T> FORCEINLINE T* ReallocT(T *t_ptr, size_t num_elements)
+{
+ /*
+ * MorphOS cannot handle 0 elements allocations, or rather that always
+ * returns NULL. So we do that for *all* allocations, thus causing it
+ * to behave the same on all OSes.
+ */
+ if (num_elements == 0) {
+ free(t_ptr);
+ return NULL;
+ }
+
+ t_ptr = (T*)realloc(t_ptr, num_elements * sizeof(T));
+ if (t_ptr == NULL) error("Out of memory. Cannot reallocate %i bytes", num_elements * sizeof(T));
+ return t_ptr;
+}
+
+#endif /* ALLOC_FUNC_HPP */
--- a/src/core/math_func.hpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/core/math_func.hpp Tue Dec 25 09:48:53 2007 +0000
@@ -211,4 +211,16 @@
return (uint)(x - min) < (max - min);
}
+/**
+ * Type safe swap operation
+ * @param a variable to swap with b
+ * @param b variable to swap with a
+ */
+template<typename T> void Swap(T& a, T& b)
+{
+ T t = a;
+ a = b;
+ b = t;
+}
+
#endif /* MATH_FUNC_HPP */
--- a/src/fileio.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/fileio.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -10,6 +10,7 @@
#include "variables.h"
#include "debug.h"
#include "fios.h"
+#include "core/alloc_func.hpp"
#ifdef WIN32
#include <windows.h>
#else
--- a/src/fileio.h Tue Dec 25 01:29:54 2007 +0000
+++ b/src/fileio.h Tue Dec 25 09:48:53 2007 +0000
@@ -5,7 +5,6 @@
#ifndef FILEIO_H
#define FILEIO_H
-#include "helpers.hpp"
#include <map>
#include <string>
--- a/src/fios.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/fios.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -10,10 +10,10 @@
#include "variables.h"
#include "functions.h"
#include "heightmap.h"
-#include "helpers.hpp"
#include "table/strings.h"
#include "fios.h"
#include "fileio.h"
+#include "core/alloc_func.hpp"
#include <sys/types.h>
#include <sys/stat.h>
--- a/src/fontcache.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/fontcache.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -11,10 +11,10 @@
#include "spritecache.h"
#include "string.h"
#include "fontcache.h"
-#include "helpers.hpp"
#include "spriteloader/spriteloader.hpp"
#include "blitter/factory.hpp"
#include "gfx_func.h"
+#include "core/alloc_func.hpp"
#ifdef WITH_FREETYPE
--- a/src/graph_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/graph_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -13,9 +13,9 @@
#include "economy_func.h"
#include "variables.h"
#include "date.h"
-#include "helpers.hpp"
#include "cargotype.h"
#include "strings_func.h"
+#include "core/alloc_func.hpp"
/* Bitmasks of player and cargo indices that shouldn't be drawn. */
static uint _legend_excluded_players;
--- a/src/group_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/group_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -18,10 +18,10 @@
#include "train.h"
#include "date.h"
#include "group.h"
-#include "helpers.hpp"
#include "viewport.h"
#include "debug.h"
#include "strings_func.h"
+#include "core/alloc_func.hpp"
struct Sorting {
--- a/src/heightmap.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/heightmap.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -14,8 +14,8 @@
#include "gui.h"
#include "saveload.h"
#include "bmp.h"
-#include "helpers.hpp"
#include "gfx_func.h"
+#include "core/alloc_func.hpp"
/**
* Convert RGB colors to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue
--- a/src/helpers.hpp Tue Dec 25 01:29:54 2007 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/* $Id$ */
-
-/** @file helpers.hpp */
-
-#ifndef HELPERS_HPP
-#define HELPERS_HPP
-
-/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
-* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
-template <typename T> FORCEINLINE T* MallocT(size_t num_elements)
-{
- T *t_ptr = (T*)malloc(num_elements * sizeof(T));
- if (t_ptr == NULL && num_elements != 0) error("Out of memory. Cannot allocate %i bytes", num_elements * sizeof(T));
- return t_ptr;
-}
-/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
-* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
-template <typename T> FORCEINLINE T* CallocT(size_t num_elements)
-{
- T *t_ptr = (T*)calloc(num_elements, sizeof(T));
- if (t_ptr == NULL && num_elements != 0) error("Out of memory. Cannot allocate %i bytes", num_elements * sizeof(T));
- return t_ptr;
-}
-/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
-* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
-template <typename T> FORCEINLINE T* ReallocT(T* t_ptr, size_t num_elements)
-{
- t_ptr = (T*)realloc(t_ptr, num_elements * sizeof(T));
- if (t_ptr == NULL && num_elements != 0) error("Out of memory. Cannot reallocate %i bytes", num_elements * sizeof(T));
- return t_ptr;
-}
-
-
-/** type safe swap operation */
-template<typename T> void Swap(T& a, T& b)
-{
- T t = a;
- a = b;
- b = t;
-}
-
-#endif /* HELPERS_HPP */
--- a/src/industry_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/industry_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -17,7 +17,6 @@
#include "industry.h"
#include "town.h"
#include "variables.h"
-#include "helpers.hpp"
#include "cargotype.h"
#include "newgrf.h"
#include "newgrf_callbacks.h"
--- a/src/landscape.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/landscape.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -22,6 +22,7 @@
#include "tgp.h"
#include "genworld.h"
#include "tile_cmd.h"
+#include "core/alloc_func.hpp"
extern const TileTypeProcs
_tile_type_clear_procs,
--- a/src/livery.h Tue Dec 25 01:29:54 2007 +0000
+++ b/src/livery.h Tue Dec 25 09:48:53 2007 +0000
@@ -5,7 +5,6 @@
#ifndef LIVERY_H
#define LIVERY_H
-#include "helpers.hpp"
/* List of different livery schemes. */
enum LiveryScheme {
--- a/src/map.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/map.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -7,9 +7,9 @@
#include "debug.h"
#include "functions.h"
#include "map.h"
-#include "helpers.hpp"
#include "direction_func.h"
#include "core/bitmath_func.hpp"
+#include "core/alloc_func.hpp"
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* VStudio 2005 is stupid! */
/* Why the hell is that not in all MSVC headers?? */
--- a/src/misc/blob.hpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/misc/blob.hpp Tue Dec 25 09:48:53 2007 +0000
@@ -2,8 +2,10 @@
/** @file blob.hpp */
-#ifndef BLOB_HPP
-#define BLOB_HPP
+#ifndef BLOB_HPP
+#define BLOB_HPP
+
+#include "../core/alloc_func.hpp"
/** Type-safe version of memcpy().
* @param d destination buffer
--- a/src/network/core/packet.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/network/core/packet.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -8,7 +8,6 @@
#include "../../stdafx.h"
#include "../../string.h"
-#include "../../helpers.hpp"
#include "packet.h"
--- a/src/network/core/tcp.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/network/core/tcp.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -16,7 +16,6 @@
#include "../network_data.h"
#include "packet.h"
#include "tcp.h"
-#include "../../helpers.hpp"
/** Very ugly temporary hack !!! */
void NetworkTCPSocketHandler::Initialize()
--- a/src/network/core/udp.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/network/core/udp.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -10,6 +10,7 @@
#include "../../debug.h"
#include "../../core/bitmath_func.hpp"
#include "../../core/math_func.hpp"
+#include "../../core/alloc_func.hpp"
#include "packet.h"
#include "udp.h"
--- a/src/network/network_client.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/network/network_client.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -19,7 +19,7 @@
#include "../console.h"
#include "../variables.h"
#include "../ai/ai.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
#include "../fileio.h"
#include "../md5.h"
#include "../strings_func.h"
--- a/src/network/network_data.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/network/network_data.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -9,7 +9,7 @@
#include "network_client.h"
#include "../command_func.h"
#include "../callback_table.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
// Add a command to the local command queue
void NetworkAddCommandQueue(NetworkTCPSocketHandler *cs, CommandPacket *cp)
--- a/src/network/network_gamelist.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/network/network_gamelist.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -10,7 +10,7 @@
#include "../stdafx.h"
#include "../debug.h"
#include "../newgrf_config.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
#include "core/game.h"
#include "network_udp.h"
#include "network_gamelist.h"
--- a/src/network/network_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/network/network_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -26,7 +26,6 @@
#include "../string.h"
#include "../town.h"
#include "../newgrf.h"
-#include "../helpers.hpp"
#define BGC 5
#define BTC 15
--- a/src/network/network_server.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/network/network_server.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -23,7 +23,7 @@
#include "../station.h"
#include "../variables.h"
#include "../genworld.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
#include "../fileio.h"
// This file handles all the server-commands
--- a/src/newgrf.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -33,7 +33,6 @@
#include "newgrf_house.h"
#include "newgrf_sound.h"
#include "newgrf_spritegroup.h"
-#include "helpers.hpp"
#include "table/town_land.h"
#include "cargotype.h"
#include "industry.h"
--- a/src/newgrf.h Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf.h Tue Dec 25 09:48:53 2007 +0000
@@ -8,7 +8,6 @@
#include "station.h"
#include "town.h"
#include "newgrf_config.h"
-#include "helpers.hpp"
#include "cargotype.h"
#include "industry.h"
--- a/src/newgrf_config.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_config.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -13,7 +13,6 @@
#include "network/network_data.h"
#include "newgrf.h"
#include "newgrf_config.h"
-#include "helpers.hpp"
#include "fileio.h"
#include "fios.h"
--- a/src/newgrf_engine.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_engine.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -19,7 +19,6 @@
#include "newgrf_spritegroup.h"
#include "newgrf_cargo.h"
#include "date.h"
-#include "helpers.hpp"
#include "cargotype.h"
--- a/src/newgrf_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -13,7 +13,6 @@
#include "table/sprites.h"
#include "newgrf.h"
#include "newgrf_config.h"
-#include "helpers.hpp"
#include "strings_func.h"
/** Parse an integerlist string and set each found value
--- a/src/newgrf_station.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_station.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -19,7 +19,6 @@
#include "newgrf_station.h"
#include "newgrf_spritegroup.h"
#include "date.h"
-#include "helpers.hpp"
#include "cargotype.h"
#include "town_map.h"
#include "newgrf_town.h"
--- a/src/newgrf_station.h Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_station.h Tue Dec 25 09:48:53 2007 +0000
@@ -8,7 +8,6 @@
#include "engine.h"
#include "newgrf_callbacks.h"
#include "newgrf_cargo.h"
-#include "helpers.hpp"
enum StationClassID {
STAT_CLASS_BEGIN = 0, ///< the lowest valid value
--- a/src/newgrf_storage.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_storage.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -3,7 +3,6 @@
/** @file newgrf_storage.cpp Functionality related to the temporary and persistent storage arrays for NewGRFs. */
#include "stdafx.h"
-#include "helpers.hpp"
#include "newgrf_storage.h"
#include <set>
--- a/src/newgrf_storage.h Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_storage.h Tue Dec 25 09:48:53 2007 +0000
@@ -5,6 +5,8 @@
#ifndef NEWGRF_STORAGE_H
#define NEWGRF_STORAGE_H
+#include "core/alloc_func.hpp"
+
/**
* Base class for all NewGRF storage arrays. Nothing fancy, only here
* so we have a generalised class to use.
--- a/src/newgrf_text.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_text.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -18,7 +18,6 @@
#include "newgrf.h"
#include "newgrf_text.h"
#include "table/control_codes.h"
-#include "helpers.hpp"
#include "date.h"
#include "strings_func.h"
--- a/src/newgrf_townname.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/newgrf_townname.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -11,6 +11,7 @@
#include "table/strings.h"
#include "newgrf_townname.h"
#include "string.h"
+#include "core/alloc_func.hpp"
static GRFTownName *_grf_townnames = NULL;
--- a/src/oldpool.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/oldpool.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -7,7 +7,7 @@
#include "debug.h"
#include "functions.h"
#include "oldpool.h"
-#include "helpers.hpp"
+#include "core/alloc_func.hpp"
/**
* Clean a pool in a safe way (does free all blocks)
--- a/src/openttd.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/openttd.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -9,7 +9,6 @@
#include "driver.h"
#include "saveload.h"
#include "map.h"
-#include "helpers.hpp"
#include "openttd.h"
#include "table/strings.h"
--- a/src/openttd.h Tue Dec 25 01:29:54 2007 +0000
+++ b/src/openttd.h Tue Dec 25 09:48:53 2007 +0000
@@ -8,7 +8,6 @@
#define VARDEF extern
#endif
-#include "helpers.hpp"
#include "strings_type.h"
#include "map.h"
--- a/src/order_cmd.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/order_cmd.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -20,6 +20,7 @@
#include "cargotype.h"
#include "aircraft.h"
#include "strings_func.h"
+#include "core/alloc_func.hpp"
DEFINE_OLD_POOL_GENERIC(Order, Order)
--- a/src/queue.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/queue.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -5,7 +5,7 @@
#include "stdafx.h"
#include "openttd.h"
#include "queue.h"
-#include "helpers.hpp"
+#include "core/alloc_func.hpp"
/*
--- a/src/saveload.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/saveload.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -29,6 +29,7 @@
#include "window_func.h"
#include "strings_func.h"
#include "gfx_func.h"
+#include "core/alloc_func.hpp"
#include <list>
extern const uint16 SAVEGAME_VERSION = 83;
--- a/src/screenshot.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/screenshot.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -12,11 +12,11 @@
#include "variables.h"
#include "date.h"
#include "string.h"
-#include "helpers.hpp"
#include "blitter/factory.hpp"
#include "fileio.h"
#include "strings_func.h"
#include "zoom_func.h"
+#include "core/alloc_func.hpp"
char _screenshot_format_name[8];
uint _num_screenshot_formats;
--- a/src/settings.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/settings.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -40,7 +40,6 @@
#include "date.h"
#include "rail.h"
#include "train.h"
-#include "helpers.hpp"
#include "news.h"
#include "window_func.h"
#include "strings_func.h"
--- a/src/settings_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/settings_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -22,7 +22,6 @@
#include "settings.h"
#include "vehicle.h"
#include "date.h"
-#include "helpers.hpp"
#include "newgrf_townname.h"
#include "strings_func.h"
--- a/src/signs_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/signs_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -14,9 +14,9 @@
#include "signs.h"
#include "debug.h"
#include "variables.h"
-#include "helpers.hpp"
#include "command_func.h"
#include "strings_func.h"
+#include "core/alloc_func.hpp"
static const Sign **_sign_sort;
static uint _num_sign_sort;
--- a/src/sound.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/sound.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -13,9 +13,9 @@
#include "viewport.h"
#include "fileio.h"
#include "newgrf_sound.h"
-#include "helpers.hpp"
#include "fios.h"
#include "window_gui.h"
+#include "core/alloc_func.hpp"
static uint _file_count;
static FileEntry *_files;
--- a/src/sound/win32_s.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/sound/win32_s.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -5,7 +5,7 @@
#include "../driver.h"
#include "../functions.h"
#include "../mixer.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
#include "win32_s.h"
#include <windows.h>
#include <mmsystem.h>
--- a/src/spritecache.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/spritecache.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -11,8 +11,8 @@
#include "spritecache.h"
#include "table/sprites.h"
#include "fileio.h"
-#include "helpers.hpp"
#include "spriteloader/grf.hpp"
+#include "core/alloc_func.hpp"
#ifdef WITH_PNG
#include "spriteloader/png.hpp"
#endif /* WITH_PNG */
--- a/src/spriteloader/grf.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/spriteloader/grf.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -6,6 +6,7 @@
#include "../gfx_func.h"
#include "../fileio.h"
#include "../debug.h"
+#include "../core/alloc_func.hpp"
#include "grf.hpp"
bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, const char *filename, uint8 file_slot, uint32 file_pos)
--- a/src/spriteloader/png.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/spriteloader/png.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -9,6 +9,7 @@
#include "../fileio.h"
#include "../variables.h"
#include "../debug.h"
+#include "../core/alloc_func.hpp"
#include "png.hpp"
#include <png.h>
--- a/src/station.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/station.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -28,7 +28,6 @@
#include "newgrf_station.h"
#include "yapf/yapf.h"
#include "date.h"
-#include "helpers.hpp"
#include "cargotype.h"
#include "roadveh.h"
#include "station_gui.h"
--- a/src/station_cmd.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/station_cmd.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -34,7 +34,6 @@
#include "newgrf_station.h"
#include "yapf/yapf.h"
#include "date.h"
-#include "helpers.hpp"
#include "misc/autoptr.hpp"
#include "road_type.h"
#include "road_internal.h" /* For drawing catenary/checking road removal */
--- a/src/station_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/station_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -20,11 +20,11 @@
#include "date.h"
#include "vehicle.h"
#include "table/sprites.h"
-#include "helpers.hpp"
#include "cargotype.h"
#include "station_gui.h"
#include "station.h"
#include "strings_func.h"
+#include "core/alloc_func.hpp"
typedef int CDECL StationSortListingTypeFunction(const void*, const void*);
--- a/src/strgen/strgen.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/strgen/strgen.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -3,7 +3,7 @@
#include "../stdafx.h"
#include "../string.h"
#include "../table/control_codes.h"
-#include "../helpers.hpp"
+#include "../core/alloc_func.hpp"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
--- a/src/string.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/string.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -7,8 +7,8 @@
#include "functions.h"
#include "string.h"
#include "table/control_codes.h"
-#include "helpers.hpp"
#include "debug.h"
+#include "core/alloc_func.hpp"
#include <stdarg.h>
#include <ctype.h> // required for tolower()
--- a/src/strings.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/strings.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -23,7 +23,6 @@
#include "date.h"
#include "industry.h"
#include "fileio.h"
-#include "helpers.hpp"
#include "cargotype.h"
#include "group.h"
#include "debug.h"
--- a/src/texteff.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/texteff.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -20,6 +20,7 @@
#include "video/video_driver.hpp"
#include "transparency.h"
#include "strings_func.h"
+#include "core/alloc_func.hpp"
enum {
MAX_TEXTMESSAGE_LENGTH = 200,
--- a/src/tgp.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/tgp.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -15,7 +15,7 @@
#include "tgp.h"
#include "console.h"
#include "genworld.h"
-#include "helpers.hpp"
+#include "core/alloc_func.hpp"
/*
*
--- a/src/thread.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/thread.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -4,8 +4,8 @@
#include "stdafx.h"
#include "thread.h"
+#include "core/alloc_func.hpp"
#include <stdlib.h>
-#include "helpers.hpp"
#if defined(__AMIGA__) || defined(PSP) || defined(NO_THREADS)
OTTDThread *OTTDCreateThread(OTTDThreadFunc function, void *arg) { return NULL; }
--- a/src/town.h Tue Dec 25 01:29:54 2007 +0000
+++ b/src/town.h Tue Dec 25 09:48:53 2007 +0000
@@ -8,7 +8,6 @@
#include "oldpool.h"
#include "player.h"
#include "functions.h"
-#include "helpers.hpp"
enum {
HOUSE_NO_CLASS = 0,
--- a/src/town_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/town_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -17,9 +17,9 @@
#include "player.h"
#include "network/network.h"
#include "variables.h"
-#include "helpers.hpp"
#include "strings_func.h"
#include "economy_func.h"
+#include "core/alloc_func.hpp"
enum TownAuthorityWidget {
TWA_CLOSEBOX = 0,
--- a/src/vehicle.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/vehicle.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -38,7 +38,6 @@
#include "newgrf_callbacks.h"
#include "newgrf_engine.h"
#include "newgrf_sound.h"
-#include "helpers.hpp"
#include "group.h"
#include "order.h"
#include "strings_func.h"
--- a/src/vehicle_gui.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/vehicle_gui.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -28,7 +28,6 @@
#include "aircraft.h"
#include "roadveh.h"
#include "depot.h"
-#include "helpers.hpp"
#include "cargotype.h"
#include "group.h"
#include "group_gui.h"
--- a/src/video/dedicated_v.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/video/dedicated_v.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -14,6 +14,7 @@
#include "../genworld.h"
#include "../fileio.h"
#include "../blitter/factory.hpp"
+#include "../core/alloc_func.hpp"
#include "dedicated_v.h"
#ifdef BEOS_NET_SERVER
--- a/src/win32.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/win32.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "debug.h"
#include "functions.h"
-#include "helpers.hpp"
#include "saveload.h"
#include "string.h"
#include "gfx_func.h"
@@ -22,6 +21,7 @@
#include "win32.h"
#include "fios.h" // opendir/readdir/closedir
#include "fileio.h"
+#include "core/alloc_func.hpp"
#include <ctype.h>
#include <tchar.h>
#include <errno.h>
--- a/src/window.cpp Tue Dec 25 01:29:54 2007 +0000
+++ b/src/window.cpp Tue Dec 25 09:48:53 2007 +0000
@@ -14,10 +14,10 @@
#include "variables.h"
#include "table/sprites.h"
#include "genworld.h"
-#include "helpers.hpp"
#include "blitter/factory.hpp"
#include "window_gui.h"
#include "zoom_func.h"
+#include "core/alloc_func.hpp"
/* delta between mouse cursor and upper left corner of dragged window */
static Point _drag_delta;