← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1581647-compiler-warnings into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1581647-compiler-warnings into lp:widelands.

Commit message:
Fixed some compiler warnings.

Requested reviews:
  kaputtnik (franku)
Related bugs:
  Bug #1581647 in widelands: "Compiler warning: Unreachable code was reached"
  https://bugs.launchpad.net/widelands/+bug/1581647

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1581647-compiler-warnings/+merge/294698
-- 
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1581647-compiler-warnings.
=== modified file 'src/logic/map_objects/immovable.cc'
--- src/logic/map_objects/immovable.cc	2016-03-21 05:45:29 +0000
+++ src/logic/map_objects/immovable.cc	2016-05-14 06:37:19 +0000
@@ -326,7 +326,7 @@
 Immovable & ImmovableDescr::create
 	(EditorGameBase & egbase, Coords const coords) const
 {
-	assert(this);
+	assert(this != nullptr);
 	Immovable & result = *new Immovable(*this);
 	result.position_ = coords;
 	result.init(egbase);

=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc	2016-05-01 10:05:17 +0000
+++ src/network/nethost.cc	2016-05-14 06:37:19 +0000
@@ -1212,13 +1212,13 @@
 
 	SendPacket s;
 
-	if (player.state == PlayerSettings::stateHuman)
+	if (player.state == PlayerSettings::stateHuman) {
 		//  0 is host and has no client
 		if (d->settings.users.at(0).position == number) {
 			d->settings.users.at(0).position = UserSettings::none();
 			d->settings.playernum = UserSettings::none();
 		}
-		for (uint8_t i = 1; i < d->settings.users.size(); ++i)
+		for (uint8_t i = 1; i < d->settings.users.size(); ++i) {
 			if (d->settings.users.at(i).position == number) {
 				d->settings.users.at(i).position = UserSettings::none();
 				if (host) //  Did host send the user to lobby?
@@ -1241,6 +1241,8 @@
 
 				break;
 			}
+		}
+	}
 
 	player.state = state;
 


Follow ups