[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src game.cpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src game.cpp |
Date: |
Sat, 23 Apr 2005 06:05:52 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 05/04/23 10:05:52
Modified files:
src : game.cpp
Log message:
Beautify filesize displaying for non-MSVC compiler. I didn't change the
MSVC part, since I understand only part of the comment; and the part I
understand ("Other platforms make it set the number of significant figures") is
plain wrong for fixed output. So I will leave it to MSVC-competent people if
they want the same display.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.234&tr2=1.235&r1=text&r2=text
Patches:
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.234 wesnoth/src/game.cpp:1.235
--- wesnoth/src/game.cpp:1.234 Wed Apr 20 22:51:25 2005
+++ wesnoth/src/game.cpp Sat Apr 23 10:05:52 2005
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.234 2005/04/20 22:51:25 Sirp Exp $ */
+/* $Id: game.cpp,v 1.235 2005/04/23 10:05:52 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -974,14 +974,16 @@
}
std::ostringstream stream;
+#ifdef _MSC_VER
//Visual C++ makes 'precision' set the number of decimal
places. Other platforms
//make it set the number of significant figures
-#ifdef _MSC_VER
stream.precision(1);
+ stream << std::fixed << size << size_postfix;
#else
- stream.precision(3);
+ if (size < 100) stream.precision(3);
+ else size = (int)size;
+ stream << size << size_postfix;
#endif
- stream << std::fixed << size << size_postfix;
return stream.str();
} else {
return "";