widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #01795
[Merge] lp:~gunchleoc/widelands/fix-codechecks into lp:widelands
GunChleoc has proposed merging lp:~gunchleoc/widelands/fix-codechecks into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~gunchleoc/widelands/fix-codechecks/+merge/210082
Just some code feng shui, no changes in functionality.
--
https://code.launchpad.net/~gunchleoc/widelands/fix-codechecks/+merge/210082
Your team Widelands Developers is requested to review the proposed merge of lp:~gunchleoc/widelands/fix-codechecks into lp:widelands.
=== modified file 'src/editor/tools/editor_info_tool.cc'
--- src/editor/tools/editor_info_tool.cc 2014-03-05 11:59:09 +0000
+++ src/editor/tools/editor_info_tool.cc 2014-03-09 10:30:28 +0000
@@ -19,8 +19,9 @@
#include "editor/tools/editor_info_tool.h"
+#include <cstdio>
+
#include <boost/format.hpp>
-#include <cstdio>
#include "editor/editorinteractive.h"
#include "i18n.h"
@@ -51,10 +52,10 @@
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("• ") + (boost::format(_("Coordinates: (%1$i, %2$i)"))
+ % center.node.x % center.node.y).str() + "\n";
buf += std::string("• ");
- snprintf(buf1, sizeof(buf1), _("Height: %u"),f.get_height());
buf += buf1;
buf += std::string("\n");
@@ -83,7 +84,7 @@
buf += std::string("• ") + (boost::format(_("Caps:%s")) % temp).str() + "\n";
buf += std::string("• ");
- snprintf(buf1, sizeof(buf1), _("Owned by %i"),f.get_owned_by());
+ snprintf(buf1, sizeof(buf1), _("Owned by %i"), f.get_owned_by());
buf += std::string(buf1) + "\n";
temp = f.get_immovable() ? _("Has base immovable") : _("No base immovable");
@@ -123,7 +124,8 @@
// *** Map info
buf += std::string("\n") + _("Map:") + "\n";
buf += std::string("• ") + (boost::format(_("Name: %s")) % map.get_name()).str() + "\n";
- buf += std::string("• ") + (boost::format(_("Size: %1$ix%2$i")) % map.get_width() % map.get_height()).str() + "\n";
+ 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());
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
--- src/editor/ui_menus/editor_main_menu_save_map.cc 2014-03-05 11:59:09 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map.cc 2014-03-09 10:30:28 +0000
@@ -383,8 +383,8 @@
// Check if file exists. If so, show a warning.
if (g_fs->FileExists(complete_filename)) {
std::string s =
- (boost::format(_("A File with the name ‘%s’ already exists. Overwrite?")) %
- FileSystem::FS_Filename(filename.c_str())).str();
+ (boost::format(_("A File with the name ‘%s’ already exists. Overwrite?"))
+ % FileSystem::FS_Filename(filename.c_str())).str();
UI::WLMessageBox mbox
(&eia(), _("Error Saving Map!!"), s, UI::WLMessageBox::YESNO);
if (not mbox.run())
=== modified file 'src/logic/ship.cc'
--- src/logic/ship.cc 2014-03-04 13:24:58 +0000
+++ src/logic/ship.cc 2014-03-09 10:30:28 +0000
@@ -565,8 +565,10 @@
// Check whether the island was completely surrounded
if (get_position() == m_expedition->exploration_start) {
std::string msg_head = _("Island Circumnavigated");
- std::string msg_body = _("An expedition ship sailed around its island without any events.");
- send_message(game, "exp_island", msg_head, msg_body, "ship_explore_island_cw.png");
+ std::string msg_body = _("An expedition ship sailed around its"
+ " island without any events.");
+ send_message(game, "exp_island", msg_head, msg_body,
+ "ship_explore_island_cw.png");
m_ship_state = EXP_WAITING;
return start_task_idle(game, descr().main_animation(), 1500);
}
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc 2014-03-04 21:19:45 +0000
+++ src/logic/worker.cc 2014-03-09 10:30:28 +0000
@@ -603,9 +603,9 @@
// NOTE mirroring the above ugly hack.
// Avoiding placeholders for the resouce names to avert grammar trouble in translations.
- std::string out_of_message =_("Out of Resources");
- if (res_type == "fish") out_of_message =_("Out of Fish");
- else if (res_type == "stone") out_of_message =_("Out of Stone");
+ std::string out_of_message = _("Out of Resources");
+ if (res_type == "fish") out_of_message = _("Out of Fish");
+ else if (res_type == "stone") out_of_message = _("Out of Stone");
building.send_message
(game,
=== modified file 'src/network/network_gaming_messages.cc'
--- src/network/network_gaming_messages.cc 2014-02-25 15:04:27 +0000
+++ src/network/network_gaming_messages.cc 2014-03-09 10:30:28 +0000
@@ -138,7 +138,8 @@
ngmessages["PLAYER_UPDATE_FOR_N_E_P"] = _("Server sent a player update for a player that does not exist.");
ngmessages["USER_UPDATE_FOR_N_E_U"] = _("Server sent a user update for a user that does not exist.");
ngmessages["DIFFERENT_PROTOCOL_VERS"] = _("Server uses a different protocol version");
- ngmessages["PROTOCOL_EXCEPTION"] = _("Received command number %s, which is not allowed in this state.");
+ ngmessages["PROTOCOL_EXCEPTION"] = _("Received command number %s,"
+ " which is not allowed in this state.");
ngmessages["BACKWARTS_RUNNING_TIME"] = _("Client reports time to host that is running backwards.");
ngmessages["SIMULATING_BEYOND_TIME"] = _("Client simulates beyond the game time allowed by the host.");
ngmessages["CLIENT_SYNC_REP_TIMEOUT"] = _("Client did not submit sync report in time.");
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2014-03-05 12:49:38 +0000
+++ src/ui_basic/editbox.cc 2014-03-09 10:30:28 +0000
@@ -226,12 +226,12 @@
switch (code.sym) {
case SDLK_ESCAPE:
cancel();
- return true;
-
- case SDLK_TAB:
- //let the panel handle the tab key
+ return true;
+
+ case SDLK_TAB:
+ //let the panel handle the tab key
return false;
-
+
case SDLK_KP_ENTER:
case SDLK_RETURN:
// Save history if active and text is not empty
=== modified file 'src/ui_basic/helpwindow.cc'
--- src/ui_basic/helpwindow.cc 2014-03-05 11:59:09 +0000
+++ src/ui_basic/helpwindow.cc 2014-03-09 10:30:28 +0000
@@ -188,7 +188,9 @@
std::string path_to_script,
uint32_t width, uint32_t height)
:
- UI::UniqueWindow(parent, "help_window", ®, width, height, (boost::format(_("Help: %s")) % caption).str().c_str()),
+ UI::UniqueWindow(parent, "help_window", ®, width, height,
+ (boost::format(_("Help: %s")) % caption).str().c_str()
+ ),
textarea(new Multiline_Textarea(this, 5, 5, width - 10, height -10, std::string(), Align_Left))
{
LuaInterface lua;
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2014-03-05 09:25:02 +0000
+++ src/ui_basic/panel.cc 2014-03-09 10:30:28 +0000
@@ -682,31 +682,31 @@
bool Panel::handle_key(bool down, SDL_keysym code)
{
if (down) {
- if (_focus) {
- Panel * p = _focus->_next;
+ if (_focus) {
+ Panel * p = _focus->_next;
switch (code.sym) {
-
- case SDLK_TAB:
- while (p != _focus) {
- if (p->get_can_focus()) {
- p->focus();
- p->update();
- break;
- }
- if (p == _lchild) {
- p = _fchild;
- }
- else {
- p = p->_next;
- }
- }
- return true;
-
- default:
- return false;
- }
- }
- }
+
+ case SDLK_TAB:
+ while (p != _focus) {
+ if (p->get_can_focus()) {
+ p->focus();
+ p->update();
+ break;
+ }
+ if (p == _lchild) {
+ p = _fchild;
+ }
+ else {
+ p = p->_next;
+ }
+ }
+ return true;
+
+ default:
+ return false;
+ }
+ }
+ }
return false;
}
=== modified file 'src/ui_fsmenu/launchMPG.cc'
--- src/ui_fsmenu/launchMPG.cc 2014-03-05 11:59:09 +0000
+++ src/ui_fsmenu/launchMPG.cc 2014-03-09 10:30:28 +0000
@@ -395,10 +395,11 @@
(this, _("Saved game is directory"),
_
("WARNING:\n"
- "The saved game you selected is a directory. This happens if you set the option ‘nozip’ to "
+ "The saved game you selected is a directory."
+ " This happens if you set the option ‘nozip’ to "
"true or manually unzipped the saved game.\n"
- "Widelands is not able to transfer directory structures to the clients, please select another "
- "saved game or zip the directories’ content."),
+ "Widelands is not able to transfer directory structures to the clients,"
+ " please select another saved game or zip the directories’ content."),
UI::WLMessageBox::OK);
warning.run();
}
@@ -647,8 +648,10 @@
std::string infotext;
infotext += std::string(_("Map details:")) + "\n";
- infotext += std::string("• ") + (format(_("Size: %1$u x %2$u")) % map.get_width() % map.get_height()).str() + "\n";
- infotext += std::string("• ") + (format(ngettext("%u Player", "%u Players", m_nr_players)) % m_nr_players).str() + "\n";
+ infotext += std::string("• ") + (format(_("Size: %1$u x %2$u"))
+ % map.get_width() % map.get_height()).str() + "\n";
+ infotext += std::string("• ") + (format(ngettext("%u Player", "%u Players", m_nr_players))
+ % m_nr_players).str() + "\n";
infotext += std::string("• ") + (format(_("World: %s")) % world).str() + "\n";
if (m_settings->settings().scenario)
infotext += std::string("• ") + (format(_("Scenario mode selected"))).str() + "\n";
=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc 2014-03-05 11:59:09 +0000
+++ src/ui_fsmenu/mapselect.cc 2014-03-09 10:30:28 +0000
@@ -502,8 +502,8 @@
mapdata.filename = name;
mapdata.name = dmap.path.substr(5, dmap.path.size() - 1);
mapdata.author = _("unknown");
- mapdata.description =
- _("This map file is not present in your filesystem. The data shown here was sent by the server.");
+ mapdata.description = _("This map file is not present in your filesystem."
+ " The data shown here was sent by the server.");
mapdata.hint = "";
mapdata.world = _("unknown");
mapdata.nrplayers = dmap.players;
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2014-03-05 11:59:09 +0000
+++ src/ui_fsmenu/options.cc 2014-03-09 10:30:28 +0000
@@ -21,12 +21,12 @@
#include <cstdio>
#include <iostream>
-#include <libintl.h>
#include "constants.h"
#include "graphic/graphic.h"
#include "i18n.h"
#include "io/filesystem/layered_filesystem.h"
+#include "libintl.h"
#include "profile/profile.h"
#include "save_handler.h"
#include "sound/sound_handler.h"
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2014-03-06 12:52:12 +0000
+++ src/wlapplication.cc 2014-03-09 10:30:28 +0000
@@ -19,7 +19,6 @@
#include "wlapplication.h"
-#include <boost/format.hpp>
#include <cerrno>
#ifndef _WIN32
#include <csignal>
@@ -31,6 +30,7 @@
#include <stdexcept>
#include <string>
+#include <boost/format.hpp>
#include <config.h>
#ifdef __APPLE__
#include <mach-o/dyld.h>
@@ -1341,83 +1341,87 @@
wout << _("Usage: widelands <option0>=<value0> ... <optionN>=<valueN>") << "\n\n";
wout << _("Options:") << "\n\n";
wout
- << _(" --<config-entry-name>=value overwrites any config file setting") << "\n\n"
- << _(" --logfile=FILENAME Log output to file FILENAME instead of \n"
+ << _(" --<config-entry-name>=value overwrites any config file setting") << "\n\n"
+ << _(" --logfile=FILENAME Log output to file FILENAME instead of \n"
" terminal output") << "\n"
- << _(" --datadir=DIRNAME Use specified directory for the widelands\n"
+ << _(" --datadir=DIRNAME Use specified directory for the widelands\n"
" data files") << "\n"
- << _(" --homedir=DIRNAME Use specified directory for widelands config\n"
+ << _(" --homedir=DIRNAME Use specified directory for widelands config\n"
" files, savegames and replays") << "\n"
#ifdef __linux__
- << _(" Default is ~/.widelands") << "\n"
+ << _(" Default is ~/.widelands") << "\n"
#endif
- << _(" --record=FILENAME Record all events to the given filename for\n"
+ << _(" --record=FILENAME Record all events to the given filename for\n"
" later playback") << "\n"
- << _(" --playback=FILENAME Playback given filename (see --record)") << "\n\n"
- << _(" --coredump=[yes|no] Generates a core dump on segfaults instead\n"
+ << _(" --playback=FILENAME Playback given filename (see --record)") << "\n\n"
+ << _(" --coredump=[yes|no] Generates a core dump on segfaults instead\n"
" of using the SDL") << "\n"
- << _(" --language=[de_DE|sv_SE|...]\n"
+ << _(" --language=[de_DE|sv_SE|...]\n"
" The locale to use.") << "\n"
- << _(" --localedir=DIRNAME Use DIRNAME as location for the locale") << "\n"
- << _(" --remove_syncstreams=[true|false]\n"
+ << _(" --localedir=DIRNAME Use DIRNAME as location for the locale") << "\n"
+ << _(" --remove_syncstreams=[true|false]\n"
" Remove syncstream files on startup") << "\n"
- << _(" --remove_replays=[...]\n"
- " Remove replays after this number of days.\n"
- " If this is 0, replays are not deleted.") << "\n\n"
+ << _(" --remove_replays=[...]\n"
+ " Remove replays after this number of days.\n"
+ " If this is 0, replays are not deleted.") << "\n\n"
- << _("Sound options:") << "\n"
- << _(" --nosound Starts the game with sound disabled.") << "\n"
- << _(" --disable_fx Disable sound effects.") << "\n"
- << _(" --disable_music Disable music.") << "\n\n"
- << _(" --nozip Do not save files as binary zip archives.") << "\n\n"
- << _(" --editor Directly starts the Widelands editor.\n"
- " You can add a =FILENAME to directly load\n"
- " the map FILENAME in editor.") << "\n"
- << _(" --scenario=FILENAME Directly starts the map FILENAME as scenario\n"
+ << _("Sound options:") << "\n"
+ << _(" --nosound Starts the game with sound disabled.") << "\n"
+ << _(" --disable_fx Disable sound effects.") << "\n"
+ << _(" --disable_music Disable music.") << "\n\n"
+ << _(" --nozip Do not save files as binary zip archives.") << "\n\n"
+ << _(" --editor Directly starts the Widelands editor.\n"
+ " You can add a =FILENAME to directly load\n"
+ " the map FILENAME in editor.") << "\n"
+ << _(" --scenario=FILENAME Directly starts the map FILENAME as scenario\n"
" map.") << "\n"
- << _(" --loadgame=FILENAME Directly loads the savegame FILENAME.") << "\n"
- << _(" --script=FILENAME Run the given Lua script after initialization.\n"
- " Only valid with --scenario, --loadgame, or --editor.") << "\n"
- << _(" --dedicated=FILENAME Starts a dedicated server with FILENAME as map") << "\n"
- << _(" --auto_roadbuild_mode=[yes|no]\n"
- " Whether to enter roadbuilding mode\n"
- " automatically after placing a flag that is\n"
- " not connected to a road.") << "\n\n"
- << _("Graphic options:") << "\n"
- << _(" --fullscreen=[yes|no]\n"
- " Whether to use the whole display for the\n"
- " game screen.") << "\n"
- << _(" --xres=[...] Width of the window in pixel.") << "\n"
- << _(" --yres=[...] Height of the window in pixel.") << "\n"
- << _(" --opengl=[0|1] Enables OpenGL rendering") << "\n\n"
- << _("Options for the internal window manager:") << "\n"
- << _(" --border_snap_distance=[0 ...]\n"
- " Move a window to the edge of the screen\n"
- " when the edge of the window comes within\n"
- " this distance from the edge of the screen.") << "\n"
- << _(" --dock_windows_to_edges=[yes|no]\n"
- " Eliminate a window's border towards the\n"
- " edge of the screen when the edge of the\n"
- " window is next to the edge of the screen.") << "\n"
- << _(" --panel_snap_distance=[0 ...]\n"
- " Move a window to the edge of the panel when\n"
- " the edge of the window comes within this\n"
- " distance from the edge of the panel.") << "\n"
- << _(" --snap_windows_only_when_overlapping=[yes|no]\n"
- " Only move a window to the edge of a panel\n"
- " if the window is overlapping with the\n"
- " panel.") << "\n\n";
+ << _(" --loadgame=FILENAME Directly loads the savegame FILENAME.") << "\n"
+ << _(" --script=FILENAME Run the given Lua script after initialization.\n"
+ " Only valid with --scenario, --loadgame, or --editor.") << "\n"
+ << _(" --dedicated=FILENAME Starts a dedicated server with FILENAME as map") << "\n"
+ << _(" --auto_roadbuild_mode=[yes|no]\n"
+ " Whether to enter roadbuilding mode\n"
+ " automatically after placing a flag that is\n"
+ " not connected to a road.") << "\n\n"
+ << _("Graphic options:") << "\n"
+ << _(" --fullscreen=[yes|no]\n"
+ " Whether to use the whole display for the\n"
+ " game screen.") << "\n"
+ << _(" --xres=[...] Width of the window in pixel.") << "\n"
+ << _(" --yres=[...] Height of the window in pixel.") << "\n"
+ << _(" --opengl=[0|1] Enables OpenGL rendering") << "\n\n"
+ << _("Options for the internal window manager:") << "\n"
+ << _(" --border_snap_distance=[0 ...]\n"
+ " Move a window to the edge of the screen\n"
+ " when the edge of the window comes within\n"
+ " this distance from the edge of the screen.") << "\n"
+ << _(" --dock_windows_to_edges=[yes|no]\n"
+ " Eliminate a window's border towards the\n"
+ " edge of the screen when the edge of the\n"
+ " window is next to the edge of the screen.") << "\n"
+ << _(" --panel_snap_distance=[0 ...]\n"
+ " Move a window to the edge of the panel when\n"
+ " the edge of the window comes within this\n"
+ " distance from the edge of the panel.") << "\n"
+ << _(" --snap_windows_only_when_overlapping=[yes|no]\n"
+ " Only move a window to the edge of a panel\n"
+ " if the window is overlapping with the\n"
+ " panel.") << "\n\n";
#ifndef NDEBUG
#ifndef _WIN32
- wout << _(" --double Start the game twice (for localhost network\n"
- " testing)") << "\n\n";
-#endif
-#endif
- wout << _(" --verbose Enable verbose debug messages") << "\n" << endl;
- wout << _(" --help Show this help") << "\n" << endl;
- wout << _("Bug reports? Suggestions? Check out the project website:\n"
- " https://launchpad.net/widelands\n\n"
- "Hope you enjoy this game!") << "\n\n";
+ wout
+ << _(" --double Start the game twice (for localhost network\n"
+ " testing)") << "\n\n";
+#endif
+#endif
+ wout
+ << _(" --verbose Enable verbose debug messages") << "\n" << endl;
+ wout
+ << _(" --help Show this help") << "\n" << endl;
+ wout
+ << _("Bug reports? Suggestions? Check out the project website:\n"
+ " https://launchpad.net/widelands\n\n"
+ "Hope you enjoy this game!") << "\n\n";
}
#ifndef NDEBUG
@@ -1878,7 +1882,7 @@
s.players[number].state = PlayerSettings::stateComputer;
}
- virtual void setPlayerTribe
+ virtual void setPlayerTribe
(uint8_t const number, const std::string & tribe, bool const random_tribe) override
{
if (number >= s.players.size())
@@ -1959,10 +1963,10 @@
virtual std::string getWinCondition() override {return s.win_condition;}
virtual void setWinCondition(std::string wc) override {s.win_condition = wc;}
- virtual void nextWinCondition() override // not implemented - feel free to do so, if you need it
- {
- assert(false);
- }
+ virtual void nextWinCondition() override // not implemented - feel free to do so, if you need it
+ {
+ assert(false);
+ }
private:
GameSettings s;
=== modified file 'src/wui/game_main_menu_save_game.cc'
--- src/wui/game_main_menu_save_game.cc 2014-03-05 11:59:09 +0000
+++ src/wui/game_main_menu_save_game.cc 2014-03-09 10:30:28 +0000
@@ -262,8 +262,8 @@
UI::WLMessageBox
(&parent,
_("Save Game Error!!"),
- (boost::format(_("A File with the name ‘%s’ already exists. Overwrite?")) %
- FileSystem::FS_Filename(filename.c_str())).str(),
+ (boost::format(_("A File with the name ‘%s’ already exists. Overwrite?"))
+ % FileSystem::FS_Filename(filename.c_str())).str(),
YESNO),
m_filename(filename)
{}
=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc 2014-03-03 20:50:30 +0000
+++ src/wui/productionsitewindow.cc 2014-03-09 10:30:28 +0000
@@ -78,7 +78,9 @@
m_worker_table = new UI::Table<uintptr_t>(worker_box, 0, 0, 0, 100);
m_worker_caps = new UI::Box(worker_box, 0, 0, UI::Box::Horizontal);
- m_worker_table->add_column(150, (ngettext("Worker", "Workers", productionsite().descr().nr_working_positions())));
+ m_worker_table->add_column(150, (ngettext
+ ("Worker", "Workers", productionsite().descr().nr_working_positions())
+ ));
m_worker_table->add_column(60, _("Exp"));
m_worker_table->add_column(150, _("Next Level"));
Follow ups