← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1293158 into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1293158 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1293158 in widelands: "Odd line in information tool in editor"
  https://bugs.launchpad.net/widelands/+bug/1293158

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1293158/+merge/221434

Got rid of a garbage string
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1293158/+merge/221434
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1293158 into lp:widelands.
=== modified file 'src/editor/tools/editor_info_tool.cc'
--- src/editor/tools/editor_info_tool.cc	2014-03-09 10:28:39 +0000
+++ src/editor/tools/editor_info_tool.cc	2014-05-29 17:11:57 +0000
@@ -49,16 +49,11 @@
 	Widelands::Field & f = map[center.node];
 
 	// *** Node info
-	char buf1[1024];
 	std::string buf = _("Node:");
 	buf += "\n";
 	buf += std::string("• ") + (boost::format(_("Coordinates: (%1$i, %2$i)"))
 					 % center.node.x % center.node.y).str() + "\n";
 
-	buf += std::string("• ");
-	buf += buf1;
-	buf += std::string("\n");
-
 	std::string temp = "";
 	Widelands::NodeCaps const caps = f.nodecaps();
 	switch (caps & Widelands::BUILDCAPS_SIZEMASK) {
@@ -83,9 +78,15 @@
 
 	buf += std::string("• ") + (boost::format(_("Caps:%s")) % temp).str() + "\n";
 
-	buf += std::string("• ");
-	snprintf(buf1, sizeof(buf1), _("Owned by %i"), f.get_owned_by());
-	buf += std::string(buf1) + "\n";
+	if(f.get_owned_by() > 0) {
+		buf += std::string("• ");
+		char buf1[1024];
+		snprintf(buf1, sizeof(buf1), _("Owned by: %u"), f.get_owned_by());
+		buf += std::string(buf1) + "\n";
+	}
+	else {
+		buf += std::string("• ") + _("Owned by: —") + "\n";
+	}
 
 	temp = f.get_immovable() ? _("Has base immovable") : _("No base immovable");
 	buf += std::string("• ") + temp + "\n";
@@ -116,8 +117,7 @@
 			).str() + "\n";
 		buf += std::string("• ") + (boost::format(_("Resource amount: %i")) % ramount).str() + "\n";
 	}
-	else
-	{
+	else {
 		buf += std::string("• ") + std::string(_("No resources")) + "\n";
 	}
 
@@ -127,10 +127,13 @@
 	buf += std::string("• ") + (boost::format(_("Size: %1$ix%2$i"))
 					 % map.get_width() % map.get_height()).str() + "\n";
 
-	buf += std::string("• ");
-	snprintf(buf1, sizeof(buf1), _("Players: %i"), map.get_nrplayers());
+	if (map.get_nrplayers() > 0) {
+		buf += std::string("• ") + (boost::format(_("Players: %u")) % map.get_nrplayers()).str() + "\n";
+	}
+	else {
+		buf += std::string("• ") + (boost::format(_("Players: %s")) % "—").str() + "\n";
+	}
 
-	buf += std::string(buf1) + "\n";
 	buf += std::string("• ") + (boost::format(_("Author: %s")) % map.get_author()).str() + "\n";
 	buf += std::string("• ") + (boost::format(_("Descr: %s")) % map.get_description()).str() + "\n";
 

=== modified file 'src/logic/cmd_queue.h'
--- src/logic/cmd_queue.h	2014-05-11 12:29:55 +0000
+++ src/logic/cmd_queue.h	2014-05-29 17:11:57 +0000
@@ -22,6 +22,7 @@
 
 #include <memory>
 #include <queue>
+#include <stdint.h>
 
 #include "logic/queue_cmd_ids.h"
 


Follow ups