diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/pool_func.hpp | 3 | ||||
-rw-r--r-- | src/fios.h | 3 | ||||
-rw-r--r-- | src/heightmap.cpp | 10 | ||||
-rw-r--r-- | src/network/core/tcp_game.cpp | 2 | ||||
-rw-r--r-- | src/network/network_internal.h | 4 | ||||
-rw-r--r-- | src/newgrf_config.cpp | 3 | ||||
-rw-r--r-- | src/newgrf_text.cpp | 2 | ||||
-rw-r--r-- | src/order_gui.cpp | 6 | ||||
-rw-r--r-- | src/saveload/station_sl.cpp | 2 | ||||
-rw-r--r-- | src/script/script_info.hpp | 1 | ||||
-rw-r--r-- | src/script/script_instance.cpp | 1 | ||||
-rw-r--r-- | src/script/script_storage.hpp | 3 | ||||
-rw-r--r-- | src/station_base.h | 1 |
13 files changed, 28 insertions, 13 deletions
diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp index eafd057ee..4648f50d1 100644 --- a/src/core/pool_func.hpp +++ b/src/core/pool_func.hpp @@ -35,6 +35,9 @@ DEFINE_POOL_METHOD(inline)::Pool(const char *name) : first_free(0), first_unused(0), items(0), +#ifdef OTTD_ASSERT + checked(0), +#endif /* OTTD_ASSERT */ cleaning(false), data(NULL), alloc_cache(NULL) diff --git a/src/fios.h b/src/fios.h index 38067d348..43a018f26 100644 --- a/src/fios.h +++ b/src/fios.h @@ -41,7 +41,8 @@ struct LoadCheckData { struct LoggedAction *gamelog_action; ///< Gamelog actions uint gamelog_actions; ///< Number of gamelog actions - LoadCheckData() : error_data(NULL), grfconfig(NULL), gamelog_action(NULL) + LoadCheckData() : error_data(NULL), grfconfig(NULL), + grf_compatibility(GLC_NOT_FOUND), gamelog_action(NULL), gamelog_actions(0) { this->Clear(); } diff --git a/src/heightmap.cpp b/src/heightmap.cpp index 2f6d14e56..50cfd6e22 100644 --- a/src/heightmap.cpp +++ b/src/heightmap.cpp @@ -46,9 +46,11 @@ static void ReadHeightmapPNGImageData(byte *map, png_structp png_ptr, png_infop uint x, y; byte gray_palette[256]; png_bytep *row_pointers = NULL; + bool has_palette = png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE; + uint channels = png_get_channels(png_ptr, info_ptr); /* Get palette and convert it to grayscale */ - if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) { + if (has_palette) { int i; int palette_size; png_color *palette; @@ -79,11 +81,11 @@ static void ReadHeightmapPNGImageData(byte *map, png_structp png_ptr, png_infop for (x = 0; x < png_get_image_width(png_ptr, info_ptr); x++) { for (y = 0; y < png_get_image_height(png_ptr, info_ptr); y++) { byte *pixel = &map[y * png_get_image_width(png_ptr, info_ptr) + x]; - uint x_offset = x * png_get_channels(png_ptr, info_ptr); + uint x_offset = x * channels; - if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) { + if (has_palette) { *pixel = gray_palette[row_pointers[y][x_offset]]; - } else if (png_get_channels(png_ptr, info_ptr) == 3) { + } else if (channels == 3) { *pixel = RGBToGrayscale(row_pointers[y][x_offset + 0], row_pointers[y][x_offset + 1], row_pointers[y][x_offset + 2]); } else { diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp index 54d222495..d263b28e4 100644 --- a/src/network/core/tcp_game.cpp +++ b/src/network/core/tcp_game.cpp @@ -26,7 +26,7 @@ * Create a new socket for the game connection. * @param s The socket to connect with. */ -NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) : info(NULL), +NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) : info(NULL), client_id(INVALID_CLIENT_ID), last_frame(_frame_counter), last_frame_server(_frame_counter), last_packet(_realtime_tick) { this->sock = s; diff --git a/src/network/network_internal.h b/src/network/network_internal.h index e46f20792..29d4fafd6 100644 --- a/src/network/network_internal.h +++ b/src/network/network_internal.h @@ -155,9 +155,9 @@ bool IsNetworkCompatibleVersion(const char *version); */ struct CommandPacket : CommandContainer { /** Make sure the pointer is NULL. */ - CommandPacket() : next(NULL) {} + CommandPacket() : next(NULL), company(INVALID_COMPANY), frame(0), my_cmd(false) {} CommandPacket *next; ///< the next command packet (if in queue) - CompanyByte company; ///< company that is executing the command + CompanyID company; ///< company that is executing the command uint32 frame; ///< the frame in which this packet is executed bool my_cmd; ///< did the command originate from "me" }; diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index d327da550..5ac8ba4df 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -226,7 +226,8 @@ GRFParameterInfo::GRFParameterInfo(uint nr) : def_value(0), param_nr(nr), first_bit(0), - num_bit(32) + num_bit(32), + complete_labels(false) {} /** diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 9cb1c1898..596f11e87 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -882,7 +882,7 @@ struct TextRefStack { byte position; bool used; - TextRefStack() : used(false) {} + TextRefStack() : position(0), used(false) {} TextRefStack(const TextRefStack &stack) : position(stack.position), diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 0645ecb68..8123013a4 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -349,8 +349,10 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) { - Order order; - order.next = NULL; + /* Hack-ish; unpack order 0, so everything gets initialised with either zero + * or a suitable default value for the variable. Then also override the index + * as it is not coming from a pool, so would be initialised. */ + Order order(0); order.index = 0; /* check depot first */ diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index d01c0f3c6..7da2d3bad 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -241,7 +241,7 @@ std::list<CargoPacket *> _packets; uint32 _num_dests; struct FlowSaveLoad { - FlowSaveLoad() : via(0), share(0) {} + FlowSaveLoad() : source(0), via(0), share(0), restricted(false) {} StationID source; StationID via; uint32 share; diff --git a/src/script/script_info.hpp b/src/script/script_info.hpp index 4ed160726..ae341a7d8 100644 --- a/src/script/script_info.hpp +++ b/src/script/script_info.hpp @@ -32,6 +32,7 @@ static const int MAX_GET_SETTING_OPS = 100000; class ScriptInfo : public SimpleCountedObject { public: ScriptInfo() : + engine(NULL), SQ_instance(NULL), main_script(NULL), tar_file(NULL), diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp index 33a0c4d10..7e4766fdb 100644 --- a/src/script/script_instance.cpp +++ b/src/script/script_instance.cpp @@ -49,6 +49,7 @@ static void PrintFunc(bool error_msg, const SQChar *message) ScriptInstance::ScriptInstance(const char *APIName) : engine(NULL), + versionAPI(NULL), controller(NULL), storage(NULL), instance(NULL), diff --git a/src/script/script_storage.hpp b/src/script/script_storage.hpp index 50e2b8dd5..8fe1e1732 100644 --- a/src/script/script_storage.hpp +++ b/src/script/script_storage.hpp @@ -76,6 +76,9 @@ public: new_vehicle_id (0), new_sign_id (0), new_group_id (0), + new_goal_id (0), + new_story_page_id (0), + new_story_page_element_id(0), /* calback_value (can't be set) */ road_type (INVALID_ROADTYPE), rail_type (INVALID_RAILTYPE), diff --git a/src/station_base.h b/src/station_base.h index 0e6edc7e0..63a2ca5e5 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -206,6 +206,7 @@ struct GoodsEntry { rating(INITIAL_STATION_RATING), last_speed(0), last_age(255), + amount_fract(0), link_graph(INVALID_LINK_GRAPH), node(INVALID_NODE), max_waiting_cargo(0) |