← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-uninitialized_variables2 into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-986611-cppcheck-uninitialized_variables2 into lp:widelands.

Commit message:
Fixed a bunch of "Member variable is not initialized in the constructor" warnings from cppcheck. Some code style tweaks to ManagementData.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #986611 in widelands: "Issues reported by cppcheck"
  https://bugs.launchpad.net/widelands/+bug/986611

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-uninitialized_variables2/+merge/329170
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-986611-cppcheck-uninitialized_variables2 into lp:widelands.
=== modified file 'src/ai/ai_help_structs.cc'
--- src/ai/ai_help_structs.cc	2017-07-25 20:56:04 +0000
+++ src/ai/ai_help_structs.cc	2017-08-17 06:10:54 +0000
@@ -221,6 +221,9 @@
      enemy_accessible_(false),
      enemy_wh_nearby(false),
      unowned_land_nearby(0),
+	  enemy_owned_land_nearby(0U),
+	  unowned_buildable_spots_nearby(0U),
+	  nearest_buildable_spot_nearby(0U),
      near_border(false),
      unowned_mines_spots_nearby(0),
      unowned_iron_mines_nearby(false),
@@ -246,11 +249,13 @@
      military_in_constr_nearby(0),
      own_military_presence(0),
      enemy_military_presence(0),
+	  enemy_military_sites(0),
      ally_military_presence(0),
      military_stationed(0),
      unconnected_nearby(false),
      military_unstationed(0),
      own_non_military_nearby(0),
+	  defense_msite_allowed(false),
      is_portspace(Widelands::ExtendedBool::kUnset),
      port_nearby(false),
      portspace_nearby(Widelands::ExtendedBool::kUnset),
@@ -308,25 +313,6 @@
 	return is(BuildingAttribute::kBuildable) && p.is_building_type_allowed(id);
 }
 
-// Computer player does not get notification messages about enemy militarysites
-// and warehouses, so following is collected based on observation
-// It is conventient to have some information preserved, like nearby minefields,
-// when it was attacked, whether it is warehouse and so on
-// Also AI test more such targets when considering attack and calculated score is
-// is stored in the observer
-EnemySiteObserver::EnemySiteObserver()
-   : is_warehouse(false),
-     attack_soldiers_strength(0),
-     defenders_strength(0),
-     stationed_soldiers(0),
-     last_time_seen(0),
-     last_tested(0),
-     score(0),
-     mines_nearby(Widelands::ExtendedBool::kUnset),
-     last_time_attacked(0),
-     attack_counter(0) {
-}
-
 // as all mines have 3 levels, AI does not know total count of mines per mined material
 // so this observer will be used for this
 MineTypesObserver::MineTypesObserver()
@@ -341,13 +327,6 @@
 	type = etype;
 }
 
-ManagementData::ManagementData() {
-	score = 1;
-	primary_parent = 255;
-	next_neuron_id = 0;
-	performance_change = 0;
-	AiDnaHandler ai_dna_handler();
-}
 
 // Initialization of neuron. Neuron is defined by curve (type) and weight [-kWeightRange,
 // kWeightRange]
@@ -558,9 +537,9 @@
 		}
 	}
 
-	_persistent_data->neuron_weights.clear();
-	_persistent_data->neuron_functs.clear();
-	_persistent_data->f_neurons.clear();
+	persistent_data->neuron_weights.clear();
+	persistent_data->neuron_functs.clear();
+	persistent_data->f_neurons.clear();
 
 	for (uint16_t i = 0; i < kNeuronPoolSize; i += 1) {
 		const DnaParent dna_donor = ((std::rand() % kSecondParentProbability) > 0) ?
@@ -569,12 +548,12 @@
 
 		switch (dna_donor) {
 		case DnaParent::kPrimary:
-			_persistent_data->neuron_weights.push_back(input_weights_P1[i]);
-			_persistent_data->neuron_functs.push_back(input_func_P1[i]);
+			persistent_data->neuron_weights.push_back(input_weights_P1[i]);
+			persistent_data->neuron_functs.push_back(input_func_P1[i]);
 			break;
 		case DnaParent::kSecondary:
-			_persistent_data->neuron_weights.push_back(input_weights_P2[i]);
-			_persistent_data->neuron_functs.push_back(input_func_P2[i]);
+			persistent_data->neuron_weights.push_back(input_weights_P2[i]);
+			persistent_data->neuron_functs.push_back(input_func_P2[i]);
 			break;
 		default:
 			log("Invalid dna_donor for neurons\n");
@@ -588,10 +567,10 @@
 		                               DnaParent::kSecondary;
 		switch (dna_donor) {
 		case DnaParent::kPrimary:
-			_persistent_data->f_neurons.push_back(f_neurons_P1[i]);
+			persistent_data->f_neurons.push_back(f_neurons_P1[i]);
 			break;
 		case DnaParent::kSecondary:
-			_persistent_data->f_neurons.push_back(f_neurons_P2[i]);
+			persistent_data->f_neurons.push_back(f_neurons_P2[i]);
 			break;
 		default:
 			log("Invalid dna_donor for f-neurons\n");
@@ -599,9 +578,9 @@
 		}
 	}
 
-	_persistent_data->magic_numbers_size = kMagicNumbersSize;
-	_persistent_data->neuron_pool_size = kNeuronPoolSize;
-	_persistent_data->f_neuron_pool_size = kFNeuronPoolSize;
+	persistent_data->magic_numbers_size = kMagicNumbersSize;
+	persistent_data->neuron_pool_size = kNeuronPoolSize;
+	persistent_data->f_neuron_pool_size = kFNeuronPoolSize;
 }
 // Decides if mutation takes place and how intensive it will be
 MutatingIntensity ManagementData::do_mutate(const uint8_t is_preferred,
@@ -691,12 +670,12 @@
 					if (std::rand() % 4 == 0) {
 						assert(!neuron_curves.empty());
 						item.set_type(std::rand() % neuron_curves.size());
-						_persistent_data->neuron_functs[item.get_id()] = item.get_type();
+						persistent_data->neuron_functs[item.get_id()] = item.get_type();
 					} else {
 						int16_t new_value = shift_weight_value(
 						   item.get_weight(), mutating_intensity == MutatingIntensity::kAgressive);
 						item.set_weight(new_value);
-						_persistent_data->neuron_weights[item.get_id()] = item.get_weight();
+						persistent_data->neuron_weights[item.get_id()] = item.get_weight();
 					}
 					log("      Neuron %2d: weight: %4d -> %4d, new curve: %d   %s\n", item.get_id(),
 					    old_value, item.get_weight(), item.get_type(),
@@ -732,7 +711,7 @@
 				}
 
 				if (changed_bits) {
-					_persistent_data->f_neurons[item.get_id()] = item.get_int();
+					persistent_data->f_neurons[item.get_id()] = item.get_int();
 					log("      F-Neuron %2d: new value: %13ul, changed bits: %2d   %s\n", item.get_id(),
 					    item.get_int(), changed_bits,
 					    (preferred_f_neurons.count(item.get_id()) > 0) ? "aggressive" : "");
@@ -747,23 +726,23 @@
 // Now we copy persistent to local
 void ManagementData::copy_persistent_to_local() {
 
-	assert(_persistent_data->neuron_weights.size() == kNeuronPoolSize);
-	assert(_persistent_data->neuron_functs.size() == kNeuronPoolSize);
+	assert(persistent_data->neuron_weights.size() == kNeuronPoolSize);
+	assert(persistent_data->neuron_functs.size() == kNeuronPoolSize);
 	neuron_pool.clear();
 	for (uint32_t i = 0; i < kNeuronPoolSize; i = i + 1) {
 		neuron_pool.push_back(
-		   Neuron(_persistent_data->neuron_weights[i], _persistent_data->neuron_functs[i], i));
+		   Neuron(persistent_data->neuron_weights[i], persistent_data->neuron_functs[i], i));
 	}
 
-	assert(_persistent_data->f_neurons.size() == kFNeuronPoolSize);
+	assert(persistent_data->f_neurons.size() == kFNeuronPoolSize);
 	f_neuron_pool.clear();
 	for (uint32_t i = 0; i < kFNeuronPoolSize; i = i + 1) {
-		f_neuron_pool.push_back(FNeuron(_persistent_data->f_neurons[i], i));
+		f_neuron_pool.push_back(FNeuron(persistent_data->f_neurons[i], i));
 	}
 
-	_persistent_data->magic_numbers_size = kMagicNumbersSize;
-	_persistent_data->neuron_pool_size = kNeuronPoolSize;
-	_persistent_data->f_neuron_pool_size = kFNeuronPoolSize;
+	persistent_data->magic_numbers_size = kMagicNumbersSize;
+	persistent_data->neuron_pool_size = kNeuronPoolSize;
+	persistent_data->f_neuron_pool_size = kFNeuronPoolSize;
 
 	test_consistency();
 	log("    ... DNA initialized\n");
@@ -771,27 +750,27 @@
 
 void ManagementData::test_consistency(bool itemized) {
 
-	assert(_persistent_data->neuron_weights.size() == _persistent_data->neuron_pool_size);
-	assert(_persistent_data->neuron_functs.size() == _persistent_data->neuron_pool_size);
-	assert(neuron_pool.size() == _persistent_data->neuron_pool_size);
+	assert(persistent_data->neuron_weights.size() == persistent_data->neuron_pool_size);
+	assert(persistent_data->neuron_functs.size() == persistent_data->neuron_pool_size);
+	assert(neuron_pool.size() == persistent_data->neuron_pool_size);
 	assert(neuron_pool.size() == kNeuronPoolSize);
 
-	assert(_persistent_data->magic_numbers_size == kMagicNumbersSize);
-	assert(_persistent_data->magic_numbers.size() == kMagicNumbersSize);
+	assert(persistent_data->magic_numbers_size == kMagicNumbersSize);
+	assert(persistent_data->magic_numbers.size() == kMagicNumbersSize);
 
-	assert(_persistent_data->f_neurons.size() == _persistent_data->f_neuron_pool_size);
-	assert(f_neuron_pool.size() == _persistent_data->f_neuron_pool_size);
+	assert(persistent_data->f_neurons.size() == persistent_data->f_neuron_pool_size);
+	assert(f_neuron_pool.size() == persistent_data->f_neuron_pool_size);
 	assert(f_neuron_pool.size() == kFNeuronPoolSize);
 
 	if (itemized) {
 		// comparing contents of neuron and fneuron pools
 		for (uint16_t i = 0; i < kNeuronPoolSize; i += 1) {
-			assert(_persistent_data->neuron_weights[i] == neuron_pool[i].get_weight());
-			assert(_persistent_data->neuron_functs[i] == neuron_pool[i].get_type());
+			assert(persistent_data->neuron_weights[i] == neuron_pool[i].get_weight());
+			assert(persistent_data->neuron_functs[i] == neuron_pool[i].get_type());
 			assert(neuron_pool[i].get_id() == i);
 		}
 		for (uint16_t i = 0; i < kFNeuronPoolSize; i += 1) {
-			assert(_persistent_data->f_neurons[i] == f_neuron_pool[i].get_int());
+			assert(persistent_data->f_neurons[i] == f_neuron_pool[i].get_int());
 			assert(f_neuron_pool[i].get_id() == i);
 		}
 	}
@@ -800,25 +779,25 @@
 }
 
 void ManagementData::dump_data(const PlayerNumber pn) {
-	ai_dna_handler.dump_output(_persistent_data, pn);
+	ai_dna_handler.dump_output(persistent_data, pn);
 }
 
 // Querying military number at a possition
 int16_t ManagementData::get_military_number_at(uint8_t pos) {
 	assert(pos < kMagicNumbersSize);
-	return _persistent_data->magic_numbers[pos];
+	return persistent_data->magic_numbers[pos];
 }
 
 // Setting military number (persistent numbers are used also for local use)
 void ManagementData::set_military_number_at(const uint8_t pos, int16_t value) {
 	assert(pos < kMagicNumbersSize);
 
-	while (pos >= _persistent_data->magic_numbers.size()) {
-		_persistent_data->magic_numbers.push_back(0);
+	while (pos >= persistent_data->magic_numbers.size()) {
+		persistent_data->magic_numbers.push_back(0);
 	}
 
 	value = Neuron::clip_weight_to_range(value);
-	_persistent_data->magic_numbers[pos] = value;
+	persistent_data->magic_numbers[pos] = value;
 }
 
 uint16_t MineTypesObserver::total_count() const {
@@ -1024,16 +1003,6 @@
 PlayersStrengths::PlayersStrengths() : update_time(0) {
 }
 
-// Default constructor
-PlayersStrengths::PlayerStat::PlayerStat()
-   : team_number(0),
-     is_enemy(false),
-     players_power(0),
-     old_players_power(0),
-     old60_players_power(0),
-     players_casualities(0) {
-}
-
 // Constructor to be used
 PlayersStrengths::PlayerStat::PlayerStat(Widelands::TeamNumber tc,
                                          bool e,
@@ -1349,8 +1318,4 @@
 	return update_time;
 }
 
-ProductionSiteObserver::ProductionSiteObserver()
-   : no_resources_since(kNever), upgrade_pending(false), dismantle_pending_since(kNever) {
-}
-
 }  // namespace Widelands

=== modified file 'src/ai/ai_help_structs.h'
--- src/ai/ai_help_structs.h	2017-08-12 06:51:08 +0000
+++ src/ai/ai_help_structs.h	2017-08-17 06:10:54 +0000
@@ -475,14 +475,13 @@
 };
 
 struct ProductionSiteObserver {
-	ProductionSiteObserver();
-	Widelands::ProductionSite* site;
-	uint32_t built_time;
-	uint32_t unoccupied_till;
-	uint32_t no_resources_since;
-	bool upgrade_pending;
-	uint32_t dismantle_pending_since;
-	BuildingObserver* bo;
+	Widelands::ProductionSite* site = nullptr;
+	uint32_t built_time = 0U;
+	uint32_t unoccupied_till = 0U;
+	uint32_t no_resources_since = kNever;
+	bool upgrade_pending = false;
+	uint32_t dismantle_pending_since = kNever;
+	BuildingObserver* bo = nullptr;
 };
 
 struct MilitarySiteObserver {
@@ -527,19 +526,17 @@
 // Also AI test more such targets when considering attack and calculated score is
 // is stored in the observer
 struct EnemySiteObserver {
-	EnemySiteObserver();
-
-	bool is_warehouse;
-	int32_t attack_soldiers_strength;
-	int32_t attack_soldiers_competency;
-	int32_t defenders_strength;
-	uint8_t stationed_soldiers;
-	uint32_t last_time_seen;
-	uint32_t last_tested;
-	int16_t score;
-	Widelands::ExtendedBool mines_nearby;
-	uint32_t last_time_attacked;
-	uint32_t attack_counter;
+	bool is_warehouse = false;
+	int32_t attack_soldiers_strength = 0;
+	int32_t attack_soldiers_competency = 0;
+	int32_t defenders_strength = 0;
+	uint8_t stationed_soldiers = 0U;
+	uint32_t last_time_seen = 0U;
+	uint32_t last_tested = 0U;
+	int16_t score = 0;
+	Widelands::ExtendedBool mines_nearby = Widelands::ExtendedBool::kUnset;
+	uint32_t last_time_attacked = 0U;
+	uint32_t attack_counter = 0U;
 };
 
 // as all mines have 3 levels, AI does not know total count of mines per mined material
@@ -630,12 +627,6 @@
 
 // This is to keep all data related to AI magic numbers
 struct ManagementData {
-	ManagementData();
-
-	std::vector<Neuron> neuron_pool;
-	std::vector<FNeuron> f_neuron_pool;
-	Widelands::Player::AiPersistentState* _persistent_data;
-
 	void mutate(PlayerNumber = 0);
 	void new_dna_for_persistent(uint8_t, Widelands::AiType);
 	void copy_persistent_to_local();
@@ -670,16 +661,21 @@
 	MutatingIntensity do_mutate(uint8_t, int16_t);
 	int8_t shift_weight_value(int8_t, bool = true);
 	void test_consistency(bool = false);
+
+	std::vector<Neuron> neuron_pool;
+	std::vector<FNeuron> f_neuron_pool;
+	Widelands::Player::AiPersistentState* persistent_data;
+
+private:
+	void dump_output(Widelands::Player::AiPersistentState, PlayerNumber);
+
+	int32_t score = 1;
+	uint8_t primary_parent = 255;
+	uint16_t next_neuron_id = 0U;
+	uint16_t next_bi_neuron_id = 0U;
+	uint16_t performance_change = 0U;
+	Widelands::AiType ai_type = Widelands::AiType::kNormal;
 	AiDnaHandler ai_dna_handler;
-
-private:
-	int32_t score;
-	uint8_t primary_parent;
-	uint16_t next_neuron_id;
-	uint16_t next_bi_neuron_id;
-	uint16_t performance_change;
-	Widelands::AiType ai_type;
-	void dump_output(Widelands::Player::AiPersistentState, PlayerNumber);
 };
 
 // this is used to count militarysites by their size
@@ -773,7 +769,7 @@
 struct PlayersStrengths {
 private:
 	struct PlayerStat {
-		PlayerStat();
+		PlayerStat() = default;
 		PlayerStat(Widelands::TeamNumber tc,
 		           bool en,
 		           uint32_t pp,
@@ -784,16 +780,16 @@
 		           uint32_t oland,
 		           uint32_t o60l);
 
-		Widelands::TeamNumber team_number;
-		bool is_enemy;
-		uint32_t players_power;
-		uint32_t old_players_power;
-		uint32_t old60_players_power;
-		uint32_t players_casualities;
-		uint32_t last_time_seen;
-		uint32_t players_land;
-		uint32_t old_players_land;
-		uint32_t old60_players_land;
+		Widelands::TeamNumber team_number = 0U;
+		bool is_enemy = false;
+		uint32_t players_power = 0U;
+		uint32_t old_players_power = 0U;
+		uint32_t old60_players_power = 0U;
+		uint32_t players_casualities = 0U;
+		uint32_t last_time_seen = 0U;
+		uint32_t players_land = 0U;
+		uint32_t old_players_land = 0U;
+		uint32_t old60_players_land = 0U;
 	};
 
 public:

=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc	2017-08-16 04:31:56 +0000
+++ src/ai/defaultai.cc	2017-08-17 06:10:54 +0000
@@ -501,7 +501,7 @@
 
 	// The data struct below is owned by Player object, the purpose is to have them saved therein
 	persistent_data = player_->get_mutable_ai_persistent_state();
-	management_data._persistent_data = player_->get_mutable_ai_persistent_state();
+	management_data.persistent_data = player_->get_mutable_ai_persistent_state();
 	const bool create_basic_buildings_list = (gametime < kRemainingBasicBuildingsResetTime);
 
 	if (persistent_data->initialized == kFalse) {

=== modified file 'src/economy/ware_instance.cc'
--- src/economy/ware_instance.cc	2017-06-24 08:47:46 +0000
+++ src/economy/ware_instance.cc	2017-08-17 06:10:54 +0000
@@ -518,9 +518,6 @@
 
 constexpr uint8_t kCurrentPacketVersion = 2;
 
-WareInstance::Loader::Loader() : location_(0), transfer_nextstep_(0) {
-}
-
 void WareInstance::Loader::load(FileRead& fr) {
 	MapObject::Loader::load(fr);
 

=== modified file 'src/economy/ware_instance.h'
--- src/economy/ware_instance.h	2017-04-23 12:11:19 +0000
+++ src/economy/ware_instance.h	2017-08-17 06:10:54 +0000
@@ -107,15 +107,15 @@
 	// loading and saving stuff
 protected:
 	struct Loader : MapObject::Loader {
-		Loader();
+		Loader() = default;
 
 		void load(FileRead&);
 		void load_pointers() override;
 		void load_finish() override;
 
 	private:
-		uint32_t location_;
-		uint32_t transfer_nextstep_;
+		uint32_t location_ = 0U;
+		uint32_t transfer_nextstep_ = 0U;
 		Transfer::ReadData transfer_;
 	};
 

=== modified file 'src/network/gamehost.cc'
--- src/network/gamehost.cc	2017-08-09 17:55:34 +0000
+++ src/network/gamehost.cc	2017-08-17 06:10:54 +0000
@@ -542,6 +542,7 @@
 	     lastpauseping(0),
 	     syncreport_pending(false),
 	     syncreport_time(0),
+		  syncreport(),
 	     syncreport_arrived(false) {
 	}
 };

=== modified file 'src/network/network_player_settings_backend.h'
--- src/network/network_player_settings_backend.h	2017-06-24 08:47:46 +0000
+++ src/network/network_player_settings_backend.h	2017-08-17 06:10:54 +0000
@@ -43,7 +43,7 @@
 
 	GameSettingsProvider* const s;
 	std::string shared_in_tribe[kMaxPlayers];
-	bool tribe_selection_blocked;
+	bool tribe_selection_blocked = false;
 
 private:
 	void toggle_shared_in(uint8_t id);

=== modified file 'src/ui_fsmenu/load_map_or_game.cc'
--- src/ui_fsmenu/load_map_or_game.cc	2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/load_map_or_game.cc	2017-08-17 06:10:54 +0000
@@ -33,13 +33,6 @@
 /// It also defines common buttons.
 FullscreenMenuLoadMapOrGame::FullscreenMenuLoadMapOrGame()
    : FullscreenMenuBase(),
-
-     // Values for alignment and size
-     padding_(4),
-     indent_(10),
-     label_height_(20),
-     right_column_margin_(15),
-
      // Main buttons
      back_(this, "back", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but0.png"), _("Back")),
      ok_(this, "ok", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but2.png"), _("OK")) {

=== modified file 'src/ui_fsmenu/load_map_or_game.h'
--- src/ui_fsmenu/load_map_or_game.h	2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/load_map_or_game.h	2017-08-17 06:10:54 +0000
@@ -70,14 +70,15 @@
 	int32_t get_right_column_w(int32_t x);
 
 	// UI coordinates and spacers
-	const int32_t padding_;  // Common padding between panels
-	const int32_t indent_;   // Indent for elements below labels
-	const int32_t label_height_;
-	const int32_t right_column_margin_;  // X margins of the right column
-	int32_t tablex_, tabley_, tablew_, tableh_;
-	int32_t right_column_x_;
-	int32_t buty_, butw_, buth_;  // Button dimensions
-	int32_t right_column_tab_;
+	const int32_t padding_ = 4;  // Common padding between panels
+	const int32_t indent_ = 10;   // Indent for elements below labels
+	const int32_t label_height_ = 20;
+	const int32_t right_column_margin_ = 15;  // X margins of the right column
+	// These are set by the layout() function.
+	int32_t tablex_, tabley_, tablew_, tableh_ = 0;
+	int32_t right_column_x_ = 0;
+	int32_t buty_, butw_, buth_ = 0;  // Button dimensions
+	int32_t right_column_tab_ = 0;
 
 	// Main buttons
 	UI::Button back_;

=== modified file 'src/wui/constructionsitewindow.cc'
--- src/wui/constructionsitewindow.cc	2017-06-06 05:37:57 +0000
+++ src/wui/constructionsitewindow.cc	2017-08-17 06:10:54 +0000
@@ -31,7 +31,7 @@
                                                UI::UniqueWindow::Registry& reg,
                                                Widelands::ConstructionSite& cs,
                                                bool avoid_fastclick)
-   : BuildingWindow(parent, reg, cs, avoid_fastclick) {
+   : BuildingWindow(parent, reg, cs, avoid_fastclick), progress_(nullptr) {
 	init(avoid_fastclick);
 }
 

=== modified file 'src/wui/dismantlesitewindow.cc'
--- src/wui/dismantlesitewindow.cc	2017-06-06 05:37:57 +0000
+++ src/wui/dismantlesitewindow.cc	2017-08-17 06:10:54 +0000
@@ -28,7 +28,7 @@
                                          UI::UniqueWindow::Registry& reg,
                                          Widelands::DismantleSite& ds,
                                          bool avoid_fastclick)
-   : BuildingWindow(parent, reg, ds, avoid_fastclick) {
+   : BuildingWindow(parent, reg, ds, avoid_fastclick), progress_(nullptr) {
 	init(avoid_fastclick);
 }
 

=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc	2017-06-06 05:37:57 +0000
+++ src/wui/productionsitewindow.cc	2017-08-17 06:10:54 +0000
@@ -42,7 +42,9 @@
                                            UI::UniqueWindow::Registry& reg,
                                            Widelands::ProductionSite& ps,
                                            bool avoid_fastclick)
-   : BuildingWindow(parent, reg, ps, avoid_fastclick) {
+   : BuildingWindow(parent, reg, ps, avoid_fastclick),
+	worker_table_(nullptr),
+	worker_caps_(nullptr) {
 	productionsitenotes_subscriber_ = Notifications::subscribe<Widelands::NoteBuilding>(
 	   [this](const Widelands::NoteBuilding& note) {
 		   if (note.serial == building().serial() && !is_dying_) {

=== modified file 'src/wui/suggested_teams_box.cc'
--- src/wui/suggested_teams_box.cc	2017-05-03 07:24:06 +0000
+++ src/wui/suggested_teams_box.cc	2017-08-17 06:10:54 +0000
@@ -45,12 +45,10 @@
      padding_(padding),
      indent_(indent),
      label_height_(g_gr->images().get("images/players/player_position_menu.png")->height() +
-                   padding) {
-	player_icons_.clear();
-	suggested_teams_.clear();
+                   padding),
+	  suggested_teams_box_label_(new UI::Textarea(this)),
+	  lineup_box_(nullptr) {
 	set_size(max_x, max_y);
-
-	suggested_teams_box_label_ = new UI::Textarea(this);
 	add(suggested_teams_box_label_);
 }
 SuggestedTeamsBox::~SuggestedTeamsBox() {


Follow ups