Merge lp:~widelands-dev/widelands/bug-1385859 into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7226
Proposed branch: lp:~widelands-dev/widelands/bug-1385859
Merge into: lp:widelands
Diff against target: 1384 lines (+171/-182)
47 files modified
src/base/scoped_timer.cc (+2/-2)
src/editor/ui_menus/editor_main_menu_load_map.cc (+7/-8)
src/editor/ui_menus/editor_main_menu_map_options.cc (+1/-1)
src/editor/ui_menus/editor_main_menu_new_map.cc (+2/-2)
src/editor/ui_menus/editor_main_menu_random_map.cc (+14/-14)
src/editor/ui_menus/editor_main_menu_save_map.cc (+7/-8)
src/editor/ui_menus/editor_player_menu.cc (+1/-1)
src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc (+2/-2)
src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc (+1/-1)
src/io/filesystem/zip_filesystem.cc (+2/-4)
src/logic/critter.cc (+1/-1)
src/logic/production_program.cc (+13/-10)
src/logic/productionsite.cc (+1/-1)
src/logic/soldier.cc (+5/-5)
src/logic/trainingsite.cc (+1/-1)
src/logic/tribe.cc (+1/-1)
src/logic/worker.cc (+2/-2)
src/map_io/coords_profile.cc (+1/-1)
src/map_io/map_allowed_building_types_packet.cc (+4/-3)
src/map_io/map_allowed_worker_types_packet.cc (+4/-3)
src/map_io/map_player_names_and_tribes_packet.cc (+4/-3)
src/map_io/map_player_position_packet.cc (+2/-2)
src/map_io/map_players_messages_packet.cc (+8/-5)
src/map_io/map_players_view_packet.cc (+2/-2)
src/network/nethost.cc (+17/-21)
src/scripting/lua_bases.cc (+4/-2)
src/scripting/lua_map.cc (+4/-2)
src/ui_basic/helpwindow.cc (+2/-5)
src/ui_basic/listselect.cc (+4/-4)
src/ui_basic/listselect.h (+6/-6)
src/ui_fsmenu/editor_mapselect.cc (+4/-5)
src/ui_fsmenu/internet_lobby.cc (+1/-1)
src/ui_fsmenu/launch_mpg.cc (+6/-8)
src/ui_fsmenu/loadgame.cc (+2/-2)
src/ui_fsmenu/loadreplay.cc (+1/-1)
src/ui_fsmenu/options.cc (+3/-3)
src/wlapplication.cc (+1/-1)
src/wui/actionconfirm.cc (+1/-2)
src/wui/encyclopedia_window.cc (+2/-2)
src/wui/game_debug_ui.cc (+3/-3)
src/wui/game_main_menu_save_game.cc (+6/-12)
src/wui/game_objectives_menu.cc (+2/-2)
src/wui/general_statistics_menu.cc (+1/-1)
src/wui/interactive_base.cc (+5/-6)
src/wui/interactive_player.cc (+2/-4)
src/wui/multiplayersetupgroup.cc (+4/-4)
src/wui/plot_area.cc (+2/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1385859
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+239705@code.launchpad.net

Description of the change

To avoid occasional crashes, c_str() is no longer used directly with boost::format

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

Solid change! Lots of small but impactful improvements here.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/base/scoped_timer.cc'
--- src/base/scoped_timer.cc 2014-07-05 13:14:42 +0000
+++ src/base/scoped_timer.cc 2014-10-27 10:39:23 +0000
@@ -33,8 +33,8 @@
3333
34ScopedTimer::~ScopedTimer() {34ScopedTimer::~ScopedTimer() {
35 uint32_t ms_in_existance = SDL_GetTicks() - startime_;35 uint32_t ms_in_existance = SDL_GetTicks() - startime_;
3636 const std::string logmessage = (boost::format(message_) % ms_in_existance).str();
37 log("%s\n", (boost::format(message_) % ms_in_existance).str().c_str());37 log("%s\n", logmessage.c_str());
38}38}
3939
40uint32_t ScopedTimer::ms_since_last_query() {40uint32_t ScopedTimer::ms_since_last_query() {
4141
=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc'
--- src/editor/ui_menus/editor_main_menu_load_map.cc 2014-09-30 05:41:55 +0000
+++ src/editor/ui_menus/editor_main_menu_load_map.cc 2014-10-27 10:39:23 +0000
@@ -177,7 +177,7 @@
177177
178 m_size ->set_text((boost::format(_("%1$ix%2$i"))178 m_size ->set_text((boost::format(_("%1$ix%2$i"))
179 % map.get_width()179 % map.get_width()
180 % map.get_height()).str().c_str());180 % map.get_height()).str());
181 } else {181 } else {
182 m_name ->set_text("");182 m_name ->set_text("");
183 m_name ->set_tooltip("");183 m_name ->set_tooltip("");
@@ -207,13 +207,12 @@
207#else207#else
208 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));208 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));
209#endif209#endif
210 std::string parent_string =210
211 m_ls->add
211 /** TRANSLATORS: Parent directory */212 /** TRANSLATORS: Parent directory */
212 (boost::format("\\<%s\\>") % _("parent")).str();213 ((boost::format("\\<%s\\>") % _("parent")).str(),
213 m_ls->add214 m_parentdir.c_str(),
214 (parent_string.c_str(),215 g_gr->images().get("pics/ls_dir.png"));
215 m_parentdir.c_str(),
216 g_gr->images().get("pics/ls_dir.png"));
217 }216 }
218217
219 const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end();218 const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end();
@@ -248,7 +247,7 @@
248 try {247 try {
249 map_loader->preload_map(true);248 map_loader->preload_map(true);
250 m_ls->add249 m_ls->add
251 (FileSystem::filename_without_ext(name).c_str(),250 (FileSystem::filename_without_ext(name),
252 name,251 name,
253 g_gr->images().get252 g_gr->images().get
254 (dynamic_cast<WidelandsMapLoader*>(map_loader.get())253 (dynamic_cast<WidelandsMapLoader*>(map_loader.get())
255254
=== modified file 'src/editor/ui_menus/editor_main_menu_map_options.cc'
--- src/editor/ui_menus/editor_main_menu_map_options.cc 2014-09-30 05:41:55 +0000
+++ src/editor/ui_menus/editor_main_menu_map_options.cc 2014-10-27 10:39:23 +0000
@@ -118,7 +118,7 @@
118118
119 m_size ->set_text((boost::format(_("%1$ix%2$i"))119 m_size ->set_text((boost::format(_("%1$ix%2$i"))
120 % map.get_width()120 % map.get_width()
121 % map.get_height()).str().c_str());121 % map.get_height()).str());
122 m_author->set_text(map.get_author());122 m_author->set_text(map.get_author());
123 m_name ->set_text(map.get_name());123 m_name ->set_text(map.get_name());
124 m_nrplayers->set_text(std::to_string(static_cast<unsigned int>(map.get_nrplayers())));124 m_nrplayers->set_text(std::to_string(static_cast<unsigned int>(map.get_nrplayers())));
125125
=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.cc'
--- src/editor/ui_menus/editor_main_menu_new_map.cc 2014-09-30 05:41:55 +0000
+++ src/editor/ui_menus/editor_main_menu_new_map.cc 2014-10-27 10:39:23 +0000
@@ -62,7 +62,7 @@
62 }62 }
6363
64 m_width = new UI::Textarea(this, posx + spacing + 20, posy,64 m_width = new UI::Textarea(this, posx + spacing + 20, posy,
65 (boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str().c_str());65 (boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str());
6666
67 UI::Button * widthupbtn = new UI::Button67 UI::Button * widthupbtn = new UI::Button
68 (this, "width_up",68 (this, "width_up",
@@ -82,7 +82,7 @@
8282
83 m_height = new UI::Textarea(this, posx + spacing + 20, posy,83 m_height = new UI::Textarea(this, posx + spacing + 20, posy,
84 (boost::format(_("Height: %u"))84 (boost::format(_("Height: %u"))
85 % Widelands::MAP_DIMENSIONS[m_h]).str().c_str());85 % Widelands::MAP_DIMENSIONS[m_h]).str());
8686
87 UI::Button * heightupbtn = new UI::Button87 UI::Button * heightupbtn = new UI::Button
88 (this, "height_up",88 (this, "height_up",
8989
=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
--- src/editor/ui_menus/editor_main_menu_random_map.cc 2014-10-12 06:26:38 +0000
+++ src/editor/ui_menus/editor_main_menu_random_map.cc 2014-10-27 10:39:23 +0000
@@ -123,7 +123,7 @@
123123
124 m_width = new UI::Textarea(this, posx + spacing + height, posy,124 m_width = new UI::Textarea(this, posx + spacing + height, posy,
125 (boost::format(_("Width: %u"))125 (boost::format(_("Width: %u"))
126 % Widelands::MAP_DIMENSIONS[m_w]).str().c_str());126 % Widelands::MAP_DIMENSIONS[m_w]).str());
127127
128 posy += height + 2 * spacing;128 posy += height + 2 * spacing;
129129
@@ -131,7 +131,7 @@
131131
132 m_height = new UI::Textarea(this, posx + spacing + height, posy,132 m_height = new UI::Textarea(this, posx + spacing + height, posy,
133 (boost::format(_("Height: %u"))133 (boost::format(_("Height: %u"))
134 % Widelands::MAP_DIMENSIONS[m_h]).str().c_str());134 % Widelands::MAP_DIMENSIONS[m_h]).str());
135135
136 UI::Button * heightupbtn = new UI::Button136 UI::Button * heightupbtn = new UI::Button
137 (this, "height_up",137 (this, "height_up",
@@ -171,7 +171,7 @@
171 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WATER_MINUS));171 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WATER_MINUS));
172172
173 m_water = new UI::Textarea(this, posx + spacing + height, posy,173 m_water = new UI::Textarea(this, posx + spacing + height, posy,
174 (boost::format(_("Water: %i %%")) % m_waterval).str().c_str());174 (boost::format(_("Water: %i %%")) % m_waterval).str());
175175
176 posy += height + 2 * spacing;176 posy += height + 2 * spacing;
177177
@@ -196,7 +196,7 @@
196 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::LAND_MINUS));196 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::LAND_MINUS));
197197
198 m_land = new UI::Textarea(this, posx + spacing + height, posy,198 m_land = new UI::Textarea(this, posx + spacing + height, posy,
199 (boost::format(_("Land: %i %%")) % m_landval).str().c_str());199 (boost::format(_("Land: %i %%")) % m_landval).str());
200200
201 posy += height + 2 * spacing;201 posy += height + 2 * spacing;
202202
@@ -221,7 +221,7 @@
221 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WASTE_MINUS));221 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WASTE_MINUS));
222222
223 m_wasteland = new UI::Textarea(this, posx + spacing + height, posy,223 m_wasteland = new UI::Textarea(this, posx + spacing + height, posy,
224 (boost::format(_("Wasteland: %i %%")) % m_wastelandval).str().c_str());224 (boost::format(_("Wasteland: %i %%")) % m_wastelandval).str());
225225
226 posy += height + 2 * spacing;226 posy += height + 2 * spacing;
227227
@@ -230,7 +230,7 @@
230 // ---------- Mountains -----------230 // ---------- Mountains -----------
231231
232 m_mountains = new UI::Textarea(this, posx + spacing + height, posy,232 m_mountains = new UI::Textarea(this, posx + spacing + height, posy,
233 (boost::format(_("Mountains: %i %%")) % m_mountainsval).str().c_str());233 (boost::format(_("Mountains: %i %%")) % m_mountainsval).str());
234234
235 posy += height + 2 * spacing;235 posy += height + 2 * spacing;
236236
@@ -317,7 +317,7 @@
317317
318 m_players = new UI::Textarea(this, posx + spacing + height, posy,318 m_players = new UI::Textarea(this, posx + spacing + height, posy,
319 (boost::format(_("Players: %u"))319 (boost::format(_("Players: %u"))
320 % static_cast<unsigned int>(m_pn)).str().c_str());320 % static_cast<unsigned int>(m_pn)).str());
321321
322 posy += height + 2 * spacing;322 posy += height + 2 * spacing;
323323
@@ -424,14 +424,14 @@
424 if (m_h < 0) m_h = 0;424 if (m_h < 0) m_h = 0;
425 if (m_h >= NUMBER_OF_MAP_DIMENSIONS) m_h = NUMBER_OF_MAP_DIMENSIONS - 1;425 if (m_h >= NUMBER_OF_MAP_DIMENSIONS) m_h = NUMBER_OF_MAP_DIMENSIONS - 1;
426426
427 m_width ->set_text((boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str().c_str());427 m_width ->set_text((boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str());
428 m_height->set_text((boost::format(_("Height: %u")) % Widelands::MAP_DIMENSIONS[m_h]).str().c_str());428 m_height->set_text((boost::format(_("Height: %u")) % Widelands::MAP_DIMENSIONS[m_h]).str());
429 m_water->set_text((boost::format(_("Water: %i %%")) % m_waterval).str().c_str());429 m_water->set_text((boost::format(_("Water: %i %%")) % m_waterval).str());
430 m_land->set_text((boost::format(_("Land: %i %%")) % m_landval).str().c_str());430 m_land->set_text((boost::format(_("Land: %i %%")) % m_landval).str());
431 m_wasteland->set_text((boost::format(_("Wasteland: %i %%")) % m_wastelandval).str().c_str());431 m_wasteland->set_text((boost::format(_("Wasteland: %i %%")) % m_wastelandval).str());
432 m_mountains->set_text((boost::format(_("Mountains: %i %%")) % m_mountainsval).str().c_str());432 m_mountains->set_text((boost::format(_("Mountains: %i %%")) % m_mountainsval).str());
433 m_players->set_text((boost::format(_("Players: %u"))433 m_players->set_text((boost::format(_("Players: %u"))
434 % static_cast<unsigned int>(m_pn)).str().c_str());434 % static_cast<unsigned int>(m_pn)).str());
435435
436 nr_edit_box_changed(); // Update ID String436 nr_edit_box_changed(); // Update ID String
437}437}
438438
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
--- src/editor/ui_menus/editor_main_menu_save_map.cc 2014-09-30 05:41:55 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map.cc 2014-10-27 10:39:23 +0000
@@ -236,7 +236,7 @@
236 m_nrplayers->set_text(std::to_string(static_cast<unsigned int>(map.get_nrplayers())));236 m_nrplayers->set_text(std::to_string(static_cast<unsigned int>(map.get_nrplayers())));
237237
238 m_size->set_text((boost::format(_("%1$ix%2$i"))238 m_size->set_text((boost::format(_("%1$ix%2$i"))
239 % map.get_width() % map.get_height()).str().c_str());239 % map.get_width() % map.get_height()).str());
240 } else {240 } else {
241 m_name ->set_text(FileSystem::fs_filename(name));241 m_name ->set_text(FileSystem::fs_filename(name));
242 m_name ->set_tooltip("");242 m_name ->set_tooltip("");
@@ -286,13 +286,12 @@
286#else286#else
287 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));287 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));
288#endif288#endif
289 std::string parent_string =289
290 m_ls->add
290 /** TRANSLATORS: Parent directory */291 /** TRANSLATORS: Parent directory */
291 (boost::format("\\<%s\\>") % _("parent")).str();292 ((boost::format("\\<%s\\>") % _("parent")).str(),
292 m_ls->add293 m_parentdir.c_str(),
293 (parent_string.c_str(),294 g_gr->images().get("pics/ls_dir.png"));
294 m_parentdir.c_str(),
295 g_gr->images().get("pics/ls_dir.png"));
296 }295 }
297296
298 const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end();297 const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end();
@@ -329,7 +328,7 @@
329 try {328 try {
330 wml->preload_map(true);329 wml->preload_map(true);
331 m_ls->add330 m_ls->add
332 (FileSystem::filename_without_ext(name).c_str(),331 (FileSystem::filename_without_ext(name),
333 name,332 name,
334 g_gr->images().get("pics/ls_wlmap.png"));333 g_gr->images().get("pics/ls_wlmap.png"));
335 } catch (const WException &) {} // we simply skip illegal entries334 } catch (const WException &) {} // we simply skip illegal entries
336335
=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
--- src/editor/ui_menus/editor_player_menu.cc 2014-09-20 09:37:47 +0000
+++ src/editor/ui_menus/editor_player_menu.cc 2014-10-27 10:39:23 +0000
@@ -208,7 +208,7 @@
208 number += '0' + nr_players_10;208 number += '0' + nr_players_10;
209 number += '0' + nr_players % 10;209 number += '0' + nr_players % 10;
210 /** TRANSLATORS: Default player name, e.g. Player 1 */210 /** TRANSLATORS: Default player name, e.g. Player 1 */
211 std::string name = (boost::format(_("Player %s")) % number).str();211 const std::string name = (boost::format(_("Player %s")) % number).str();
212 map.set_scenario_player_name(nr_players, name);212 map.set_scenario_player_name(nr_players, name);
213 }213 }
214 map.set_scenario_player_tribe(nr_players, m_tribes[0]);214 map.set_scenario_player_tribe(nr_players, m_tribes[0]);
215215
=== modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc'
--- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2014-09-10 14:08:25 +0000
+++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2014-10-27 10:39:23 +0000
@@ -116,7 +116,7 @@
116 if (!building.is_enhanced() && !building.is_buildable())116 if (!building.is_enhanced() && !building.is_buildable())
117 continue;117 continue;
118 (m_player.is_building_type_allowed(i) ? m_allowed : m_forbidden).add118 (m_player.is_building_type_allowed(i) ? m_allowed : m_forbidden).add
119 (building.descname().c_str(), i, building.get_icon());119 (building.descname(), i, building.get_icon());
120 }120 }
121 m_forbidden.sort();121 m_forbidden.sort();
122 m_allowed .sort();122 m_allowed .sort();
@@ -156,7 +156,7 @@
156 const Widelands::BuildingDescr & building =156 const Widelands::BuildingDescr & building =
157 *m_player.tribe().get_building_descr(building_index);157 *m_player.tribe().get_building_descr(building_index);
158 target.add158 target.add
159 (building.descname().c_str(),159 (building.descname(),
160 building_index,160 building_index,
161 building.get_icon());161 building.get_icon());
162 target.sort();162 target.sort();
163163
=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc'
--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2014-09-29 18:01:06 +0000
+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2014-10-27 10:39:23 +0000
@@ -126,7 +126,7 @@
126 /** TRANSLATORS: %1% = terrain name, %2% = list of terrain types */126 /** TRANSLATORS: %1% = terrain name, %2% = list of terrain types */
127 const std::string tooltip = ((boost::format("%1%: %2%"))127 const std::string tooltip = ((boost::format("%1%: %2%"))
128 % terrain_descr.descname()128 % terrain_descr.descname()
129 % i18n::localize_item_list(tooltips, i18n::ConcatenateWith::AND)).str().c_str();129 % i18n::localize_item_list(tooltips, i18n::ConcatenateWith::AND)).str();
130130
131 std::unique_ptr<const Image>& image = offscreen_images->back();131 std::unique_ptr<const Image>& image = offscreen_images->back();
132 UI::Checkbox* cb = new UI::Checkbox(parent, Point(0, 0), image.get(), tooltip);132 UI::Checkbox* cb = new UI::Checkbox(parent, Point(0, 0), image.get(), tooltip);
133133
=== modified file 'src/io/filesystem/zip_filesystem.cc'
--- src/io/filesystem/zip_filesystem.cc 2014-09-30 05:41:55 +0000
+++ src/io/filesystem/zip_filesystem.cc 2014-10-27 10:39:23 +0000
@@ -329,11 +329,9 @@
329 break;329 break;
330 if (len < 0) {330 if (len < 0) {
331 unzCloseCurrentFile(m_unzipfile);331 unzCloseCurrentFile(m_unzipfile);
332 const std::string errormessage = (boost::format("read error %i") % len).str();
332 throw ZipOperationError333 throw ZipOperationError
333 ("ZipFilesystem::load",334 ("ZipFilesystem::load", fname, m_zipfilename, errormessage.c_str());
334 fname,
335 m_zipfilename,
336 (boost::format("read error %i") % len).str().c_str());
337 }335 }
338336
339 totallen += len;337 totallen += len;
340338
=== modified file 'src/logic/critter.cc'
--- src/logic/critter.cc 2014-09-30 05:41:55 +0000
+++ src/logic/critter.cc 2014-10-27 10:39:23 +0000
@@ -154,7 +154,7 @@
154 add_attributes(attributes, std::set<uint32_t>());154 add_attributes(attributes, std::set<uint32_t>());
155 }155 }
156156
157 const std::string defaultpics = (boost::format("%s_walk_!!_??.png") % _name).str().c_str();157 const std::string defaultpics = (boost::format("%s_walk_!!_??.png") % _name).str();
158 m_walk_anims.parse(*this, directory, prof, "walk", false, defaultpics);158 m_walk_anims.parse(*this, directory, prof, "walk", false, defaultpics);
159159
160 while (Section::Value const * const v = global_s.get_next_val("program")) {160 while (Section::Value const * const v = global_s.get_next_val("program")) {
161161
=== modified file 'src/logic/production_program.cc'
--- src/logic/production_program.cc 2014-09-30 20:31:43 +0000
+++ src/logic/production_program.cc 2014-10-27 10:39:23 +0000
@@ -54,8 +54,6 @@
5454
55namespace {55namespace {
5656
57// For formation of better translateable texts
58using boost::format;
5957
60/**58/**
61 * Convert std::string to any sstream-compatible type59 * Convert std::string to any sstream-compatible type
@@ -268,15 +266,17 @@
268 // TODO(GunChleoc): We can make this more elegant if we add another definition to the conf files,266 // TODO(GunChleoc): We can make this more elegant if we add another definition to the conf files,
269 // so for "Log"; we will also have "logs" (numberless plural)267 // so for "Log"; we will also have "logs" (numberless plural)
270 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy needs the ware ‘%s’*/268 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy needs the ware ‘%s’*/
271 return (boost::format(_("the economy needs the ware ‘%s’"))269 std::string result = (boost::format(_("the economy needs the ware ‘%s’"))
272 % tribe.get_ware_descr(ware_type)->descname()).str();270 % tribe.get_ware_descr(ware_type)->descname()).str();
271 return result;
273}272}
274std::string ProductionProgram::ActReturn::EconomyNeedsWare::description_negation273std::string ProductionProgram::ActReturn::EconomyNeedsWare::description_negation
275 (const TribeDescr & tribe) const274 (const TribeDescr & tribe) const
276{275{
277 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy doesn’t need the ware ‘%s’*/276 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy doesn’t need the ware ‘%s’*/
278 return (boost::format(_("the economy doesn’t need the ware ‘%s’"))277 std::string result = (boost::format(_("the economy doesn’t need the ware ‘%s’"))
279 % tribe.get_ware_descr(ware_type)->descname()).str();278 % tribe.get_ware_descr(ware_type)->descname()).str();
279 return result;
280}280}
281281
282bool ProductionProgram::ActReturn::EconomyNeedsWorker::evaluate282bool ProductionProgram::ActReturn::EconomyNeedsWorker::evaluate
@@ -288,8 +288,9 @@
288 (const TribeDescr & tribe) const288 (const TribeDescr & tribe) const
289{289{
290 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy needs the worker ‘%s’*/290 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy needs the worker ‘%s’*/
291 return (boost::format(_("the economy needs the worker ‘%s’"))291 std::string result = (boost::format(_("the economy needs the worker ‘%s’"))
292 % tribe.get_worker_descr(worker_type)->descname()).str();292 % tribe.get_worker_descr(worker_type)->descname()).str();
293 return result;
293}294}
294295
295std::string ProductionProgram::ActReturn::EconomyNeedsWorker::description_negation296std::string ProductionProgram::ActReturn::EconomyNeedsWorker::description_negation
@@ -297,8 +298,9 @@
297{298{
298 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ...*/299 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ...*/
299 /** TRANSLATORS: ... because the economy doesn’t need the worker ‘%s’*/300 /** TRANSLATORS: ... because the economy doesn’t need the worker ‘%s’*/
300 return (boost::format(_("the economy doesn’t need the worker ‘%s’"))301 std::string result = (boost::format(_("the economy doesn’t need the worker ‘%s’"))
301 % tribe.get_worker_descr(worker_type)->descname()).str();302 % tribe.get_worker_descr(worker_type)->descname()).str();
303 return result;
302}304}
303305
304306
@@ -955,7 +957,7 @@
955 /** TRANSLATORS: e.g. 'Did not start working because fish, meat or pitta bread is missing' */957 /** TRANSLATORS: e.g. 'Did not start working because fish, meat or pitta bread is missing' */
956 (boost::format(ngettext("%s is missing", "%s are missing", nr_missing_groups))958 (boost::format(ngettext("%s is missing", "%s are missing", nr_missing_groups))
957 % i18n::localize_item_list(group_list, i18n::ConcatenateWith::AND))959 % i18n::localize_item_list(group_list, i18n::ConcatenateWith::AND))
958 .str().c_str();960 .str();
959961
960 std::string result_string =962 std::string result_string =
961 /** TRANSLATORS: e.g. 'Did not start working because 3x water and 3x wheat are missing' */963 /** TRANSLATORS: e.g. 'Did not start working because 3x water and 3x wheat are missing' */
@@ -1068,9 +1070,9 @@
1068 }1070 }
1069 std::string ware_list = i18n::localize_item_list(ware_descnames, i18n::ConcatenateWith::AND);1071 std::string ware_list = i18n::localize_item_list(ware_descnames, i18n::ConcatenateWith::AND);
10701072
1071 // Keep translateability in mind!
1072 /** TRANSLATORS: %s is a list of wares */1073 /** TRANSLATORS: %s is a list of wares */
1073 ps.set_production_result(str(format(_("Produced %s")) % ware_list));1074 const std::string result_string = (boost::format(_("Produced %s")) % ware_list).str();
1075 ps.set_production_result(result_string);
1074}1076}
10751077
1076bool ProductionProgram::ActProduce::get_building_work1078bool ProductionProgram::ActProduce::get_building_work
@@ -1164,7 +1166,8 @@
1164 std::string unit_string = i18n::localize_item_list(worker_descnames, i18n::ConcatenateWith::AND);1166 std::string unit_string = i18n::localize_item_list(worker_descnames, i18n::ConcatenateWith::AND);
11651167
1166 /** TRANSLATORS: %s is a list of workers */1168 /** TRANSLATORS: %s is a list of workers */
1167 ps.set_production_result((boost::format(_("Recruited %s")) % unit_string).str());1169 const std::string result_string = (boost::format(_("Recruited %s")) % unit_string).str();
1170 ps.set_production_result(result_string);
1168}1171}
11691172
1170bool ProductionProgram::ActRecruit::get_building_work1173bool ProductionProgram::ActRecruit::get_building_work
11711174
=== modified file 'src/logic/productionsite.cc'
--- src/logic/productionsite.cc 2014-09-24 21:06:00 +0000
+++ src/logic/productionsite.cc 2014-10-27 10:39:23 +0000
@@ -299,7 +299,7 @@
299 ++lastOk;299 ++lastOk;
300 }300 }
301 }301 }
302 // Somehow boost::format doesn't handle correctly uint8_t in this case302 // boost::format would treat uint8_t as char
303 const unsigned int percOk = (ok * 100) / STATISTICS_VECTOR_LENGTH;303 const unsigned int percOk = (ok * 100) / STATISTICS_VECTOR_LENGTH;
304 m_last_stat_percent = percOk;304 m_last_stat_percent = percOk;
305305
306306
=== modified file 'src/logic/soldier.cc'
--- src/logic/soldier.cc 2014-09-30 05:41:55 +0000
+++ src/logic/soldier.cc 2014-10-27 10:39:23 +0000
@@ -137,23 +137,23 @@
137 for (uint32_t i = 0; i <= m_max_hp_level; ++i) {137 for (uint32_t i = 0; i <= m_max_hp_level; ++i) {
138 m_hp_pics_fn[i] = dir;138 m_hp_pics_fn[i] = dir;
139 m_hp_pics_fn[i] += global_s.get_safe_string((boost::format("hp_level_%u_pic")139 m_hp_pics_fn[i] += global_s.get_safe_string((boost::format("hp_level_%u_pic")
140 % i).str().c_str());140 % i).str());
141141
142 }142 }
143 for (uint32_t i = 0; i <= m_max_attack_level; ++i) {143 for (uint32_t i = 0; i <= m_max_attack_level; ++i) {
144 m_attack_pics_fn[i] = dir;144 m_attack_pics_fn[i] = dir;
145 m_attack_pics_fn[i] += global_s.get_safe_string((boost::format("attack_level_%u_pic")145 m_attack_pics_fn[i] += global_s.get_safe_string((boost::format("attack_level_%u_pic")
146 % i).str().c_str());146 % i).str());
147 }147 }
148 for (uint32_t i = 0; i <= m_max_defense_level; ++i) {148 for (uint32_t i = 0; i <= m_max_defense_level; ++i) {
149 m_defense_pics_fn[i] = dir;149 m_defense_pics_fn[i] = dir;
150 m_defense_pics_fn[i] += global_s.get_safe_string((boost::format("defense_level_%u_pic")150 m_defense_pics_fn[i] += global_s.get_safe_string((boost::format("defense_level_%u_pic")
151 % i).str().c_str());151 % i).str());
152 }152 }
153 for (uint32_t i = 0; i <= m_max_evade_level; ++i) {153 for (uint32_t i = 0; i <= m_max_evade_level; ++i) {
154 m_evade_pics_fn[i] = dir;154 m_evade_pics_fn[i] = dir;
155 m_evade_pics_fn[i] += global_s.get_safe_string((boost::format("evade_level_%u_pic")155 m_evade_pics_fn[i] += global_s.get_safe_string((boost::format("evade_level_%u_pic")
156 % i).str().c_str());156 % i).str());
157 }157 }
158158
159 { /// Battle animations159 { /// Battle animations
@@ -1550,7 +1550,7 @@
1550 BaseImmovable const * const immovable_dest =1550 BaseImmovable const * const immovable_dest =
1551 map[dest] .get_immovable();1551 map[dest] .get_immovable();
15521552
1553 std::string messagetext =1553 const std::string messagetext =
1554 (boost::format("The game engine has encountered a logic error. The %s "1554 (boost::format("The game engine has encountered a logic error. The %s "
1555 "#%u of player %u could not find a way from (%i, %i) "1555 "#%u of player %u could not find a way from (%i, %i) "
1556 "(with %s immovable) to the opponent (%s #%u of player "1556 "(with %s immovable) to the opponent (%s #%u of player "
15571557
=== modified file 'src/logic/trainingsite.cc'
--- src/logic/trainingsite.cc 2014-09-30 05:41:55 +0000
+++ src/logic/trainingsite.cc 2014-10-27 10:39:23 +0000
@@ -659,7 +659,7 @@
659659
660 return program_start(game, (boost::format("%s%i")660 return program_start(game, (boost::format("%s%i")
661 % upgrade.prefix.c_str()661 % upgrade.prefix.c_str()
662 % level).str().c_str());662 % level).str());
663}663}
664664
665TrainingSite::Upgrade * TrainingSite::get_upgrade(TrainingAttribute const atr)665TrainingSite::Upgrade * TrainingSite::get_upgrade(TrainingAttribute const atr)
666666
=== modified file 'src/logic/tribe.cc'
--- src/logic/tribe.cc 2014-09-30 05:41:55 +0000
+++ src/logic/tribe.cc 2014-10-27 10:39:23 +0000
@@ -433,7 +433,7 @@
433433
434 return get_immovable_index((boost::format("resi_%s%i")434 return get_immovable_index((boost::format("resi_%s%i")
435 % res->name().c_str()435 % res->name().c_str()
436 % bestmatch).str().c_str());436 % bestmatch).str());
437}437}
438438
439/*439/*
440440
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc 2014-10-18 13:39:27 +0000
+++ src/logic/worker.cc 2014-10-27 10:39:23 +0000
@@ -939,7 +939,7 @@
939 (boost::format("<rt image=world/resources/pics/%s4.png>"939 (boost::format("<rt image=world/resources/pics/%s4.png>"
940 "<p font-size=14 font-face=DejaVuSerif>%s</p></rt>")940 "<p font-size=14 font-face=DejaVuSerif>%s</p></rt>")
941 % rdescr->name().c_str()941 % rdescr->name().c_str()
942 % _("A geologist found resources.")).str().c_str();942 % _("A geologist found resources.")).str();
943943
944 // We should add a message to the player's message queue - but only,944 // We should add a message to the player's message queue - but only,
945 // if there is not already a similar one in list.945 // if there is not already a similar one in list.
@@ -1841,7 +1841,7 @@
1841 molog("[return]: Failed to return\n");1841 molog("[return]: Failed to return\n");
1842 const std::string message =1842 const std::string message =
1843 (boost::format(_("Your %s can't find a way home and will likely die."))1843 (boost::format(_("Your %s can't find a way home and will likely die."))
1844 % descr().descname().c_str()).str().c_str();1844 % descr().descname().c_str()).str();
18451845
1846 owner().add_message1846 owner().add_message
1847 (game,1847 (game,
18481848
=== modified file 'src/map_io/coords_profile.cc'
--- src/map_io/coords_profile.cc 2014-06-18 13:20:33 +0000
+++ src/map_io/coords_profile.cc 2014-10-27 10:39:23 +0000
@@ -71,7 +71,7 @@
7171
72Coords72Coords
73get_safe_coords(const std::string& name, const Extent& extent, Section* section) {73get_safe_coords(const std::string& name, const Extent& extent, Section* section) {
74 return parse_coords(name, section->get_safe_string(name.c_str()), extent);74 return parse_coords(name, section->get_safe_string(name), extent);
75}75}
7676
77} // namespace Widelands77} // namespace Widelands
7878
=== modified file 'src/map_io/map_allowed_building_types_packet.cc'
--- src/map_io/map_allowed_building_types_packet.cc 2014-09-30 05:41:55 +0000
+++ src/map_io/map_allowed_building_types_packet.cc 2014-10-27 10:39:23 +0000
@@ -72,7 +72,7 @@
72 player->allow_building_type(--i, false);72 player->allow_building_type(--i, false);
73 try {73 try {
74 Section & s = prof.get_safe_section((boost::format("player_%u")74 Section & s = prof.get_safe_section((boost::format("player_%u")
75 % static_cast<unsigned int>(p)).str().c_str());75 % static_cast<unsigned int>(p)).str());
7676
77 bool allowed;77 bool allowed;
78 while (const char * const name = s.get_next_bool(nullptr, &allowed)) {78 while (const char * const name = s.get_next_bool(nullptr, &allowed)) {
@@ -108,8 +108,9 @@
108 PlayerNumber const nr_players = egbase.map().get_nrplayers();108 PlayerNumber const nr_players = egbase.map().get_nrplayers();
109 iterate_players_existing_const(p, nr_players, egbase, player) {109 iterate_players_existing_const(p, nr_players, egbase, player) {
110 const TribeDescr & tribe = player->tribe();110 const TribeDescr & tribe = player->tribe();
111 Section & section = prof.create_section((boost::format("player_%u")111 const std::string section_key = (boost::format("player_%u")
112 % static_cast<unsigned int>(p)).str().c_str());112 % static_cast<unsigned int>(p)).str();
113 Section & section = prof.create_section(section_key.c_str());
113114
114 // Write for all buildings if it is enabled.115 // Write for all buildings if it is enabled.
115 BuildingIndex const nr_buildings = tribe.get_nrbuildings();116 BuildingIndex const nr_buildings = tribe.get_nrbuildings();
116117
=== modified file 'src/map_io/map_allowed_worker_types_packet.cc'
--- src/map_io/map_allowed_worker_types_packet.cc 2014-09-30 05:41:55 +0000
+++ src/map_io/map_allowed_worker_types_packet.cc 2014-10-27 10:39:23 +0000
@@ -59,7 +59,7 @@
59 const TribeDescr & tribe = player->tribe();59 const TribeDescr & tribe = player->tribe();
60 try {60 try {
61 Section* s = prof.get_section((boost::format("player_%u")61 Section* s = prof.get_section((boost::format("player_%u")
62 % static_cast<unsigned int>(p)).str().c_str());62 % static_cast<unsigned int>(p)).str());
63 if (s == nullptr)63 if (s == nullptr)
64 continue;64 continue;
6565
@@ -93,8 +93,9 @@
93 bool forbidden_worker_seen = false;93 bool forbidden_worker_seen = false;
94 iterate_players_existing_const(p, egbase.map().get_nrplayers(), egbase, player) {94 iterate_players_existing_const(p, egbase.map().get_nrplayers(), egbase, player) {
95 const TribeDescr & tribe = player->tribe();95 const TribeDescr & tribe = player->tribe();
96 Section & section = prof.create_section((boost::format("player_%u")96 const std::string section_key = (boost::format("player_%u")
97 % static_cast<unsigned int>(p)).str().c_str());97 % static_cast<unsigned int>(p)).str();
98 Section & section = prof.create_section(section_key.c_str());
9899
99 // Only write the workers which are disabled.100 // Only write the workers which are disabled.
100 for (WareIndex b = 0; b < tribe.get_nrworkers(); ++b) {101 for (WareIndex b = 0; b < tribe.get_nrworkers(); ++b) {
101102
=== modified file 'src/map_io/map_player_names_and_tribes_packet.cc'
--- src/map_io/map_player_names_and_tribes_packet.cc 2014-09-30 05:41:55 +0000
+++ src/map_io/map_player_names_and_tribes_packet.cc 2014-10-27 10:39:23 +0000
@@ -68,7 +68,7 @@
68 PlayerNumber const nr_players = map->get_nrplayers();68 PlayerNumber const nr_players = map->get_nrplayers();
69 iterate_player_numbers(p, nr_players) {69 iterate_player_numbers(p, nr_players) {
70 Section & s = prof.get_safe_section((boost::format("player_%u")70 Section & s = prof.get_safe_section((boost::format("player_%u")
71 % static_cast<unsigned int>(p)).str().c_str());71 % static_cast<unsigned int>(p)).str());
72 map->set_scenario_player_name (p, s.get_string("name", ""));72 map->set_scenario_player_name (p, s.get_string("name", ""));
73 map->set_scenario_player_tribe (p, s.get_string("tribe", ""));73 map->set_scenario_player_tribe (p, s.get_string("tribe", ""));
74 map->set_scenario_player_ai (p, s.get_string("ai", ""));74 map->set_scenario_player_ai (p, s.get_string("ai", ""));
@@ -94,8 +94,9 @@
94 const Map & map = egbase.map();94 const Map & map = egbase.map();
95 PlayerNumber const nr_players = map.get_nrplayers();95 PlayerNumber const nr_players = map.get_nrplayers();
96 iterate_player_numbers(p, nr_players) {96 iterate_player_numbers(p, nr_players) {
97 Section & s = prof.create_section((boost::format("player_%u")97 const std::string section_key = (boost::format("player_%u")
98 % static_cast<unsigned int>(p)).str().c_str());98 % static_cast<unsigned int>(p)).str();
99 Section & s = prof.create_section(section_key.c_str());
99 s.set_string("name", map.get_scenario_player_name (p));100 s.set_string("name", map.get_scenario_player_name (p));
100 s.set_string("tribe", map.get_scenario_player_tribe (p));101 s.set_string("tribe", map.get_scenario_player_tribe (p));
101 s.set_string("ai", map.get_scenario_player_ai (p));102 s.set_string("ai", map.get_scenario_player_ai (p));
102103
=== modified file 'src/map_io/map_player_position_packet.cc'
--- src/map_io/map_player_position_packet.cc 2014-09-30 05:41:55 +0000
+++ src/map_io/map_player_position_packet.cc 2014-10-27 10:39:23 +0000
@@ -52,7 +52,7 @@
52 try {52 try {
53 map.set_starting_pos(p,53 map.set_starting_pos(p,
54 get_safe_coords((boost::format("player_%u")54 get_safe_coords((boost::format("player_%u")
55 % static_cast<unsigned int>(p)).str().c_str(),55 % static_cast<unsigned int>(p)).str(),
56 extent, &s));56 extent, &s));
57 } catch (const WException & e) {57 } catch (const WException & e) {
58 throw GameDataError("player %u: %s", p, e.what());58 throw GameDataError("player %u: %s", p, e.what());
@@ -79,7 +79,7 @@
79 const Map & map = egbase.map();79 const Map & map = egbase.map();
80 const PlayerNumber nr_players = map.get_nrplayers();80 const PlayerNumber nr_players = map.get_nrplayers();
81 iterate_player_numbers(p, nr_players) {81 iterate_player_numbers(p, nr_players) {
82 set_coords((boost::format("player_%u") % static_cast<unsigned int>(p)).str().c_str(),82 set_coords((boost::format("player_%u") % static_cast<unsigned int>(p)).str(),
83 map.get_starting_pos(p), &s);83 map.get_starting_pos(p), &s);
84 }84 }
8585
8686
=== modified file 'src/map_io/map_players_messages_packet.cc'
--- src/map_io/map_players_messages_packet.cc 2014-09-30 05:41:55 +0000
+++ src/map_io/map_players_messages_packet.cc 2014-10-27 10:39:23 +0000
@@ -46,8 +46,9 @@
46 try {46 try {
47 Profile prof;47 Profile prof;
48 try {48 try {
49 prof.read((boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str().c_str(),49 const std::string profile_filename =
50 nullptr, fs);50 (boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str();
51 prof.read(profile_filename.c_str(), nullptr, fs);
51 } catch (...) {continue;}52 } catch (...) {continue;}
52 prof.get_safe_section("global").get_positive53 prof.get_safe_section("global").get_positive
53 ("packet_version", CURRENT_PACKET_VERSION);54 ("packet_version", CURRENT_PACKET_VERSION);
@@ -183,9 +184,11 @@
183 }184 }
184 }185 }
185 fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE)186 fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE)
186 % static_cast<unsigned int>(p)).str().c_str());187 % static_cast<unsigned int>(p)).str());
187 prof.write((boost::format(FILENAME_TEMPLATE)188
188 % static_cast<unsigned int>(p)).str().c_str(), false, fs);189 const std::string profile_filename =
190 (boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str();
191 prof.write(profile_filename.c_str(), false, fs);
189 }192 }
190}193}
191194
192195
=== modified file 'src/map_io/map_players_view_packet.cc'
--- src/map_io/map_players_view_packet.cc 2014-09-30 05:41:55 +0000
+++ src/map_io/map_players_view_packet.cc 2014-10-27 10:39:23 +0000
@@ -1179,9 +1179,9 @@
1179 char filename[FILENAME_SIZE];1179 char filename[FILENAME_SIZE];
11801180
1181 fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE)1181 fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE)
1182 % static_cast<unsigned int>(plnum)).str().c_str());1182 % static_cast<unsigned int>(plnum)).str());
1183 fs.ensure_directory_exists((boost::format(DIRNAME_TEMPLATE)1183 fs.ensure_directory_exists((boost::format(DIRNAME_TEMPLATE)
1184 % static_cast<unsigned int>(plnum)).str().c_str());1184 % static_cast<unsigned int>(plnum)).str());
11851185
1186 WRITE1186 WRITE
1187 (unseen_times_file,1187 (unseen_times_file,
11881188
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2014-10-26 12:17:01 +0000
+++ src/network/nethost.cc 2014-10-27 10:39:23 +0000
@@ -64,9 +64,6 @@
64#include "wui/interactive_player.h"64#include "wui/interactive_player.h"
65#include "wui/interactive_spectator.h"65#include "wui/interactive_spectator.h"
6666
67using boost::format;
68
69
7067
71struct HostGameSettingsProvider : public GameSettingsProvider {68struct HostGameSettingsProvider : public GameSettingsProvider {
72 HostGameSettingsProvider(NetHost * const _h) : h(_h), m_lua(nullptr), m_cur_wincondition(0) {}69 HostGameSettingsProvider(NetHost * const _h) : h(_h), m_lua(nullptr), m_cur_wincondition(0) {}
@@ -418,9 +415,9 @@
418 } else if (num == -1) {415 } else if (num == -1) {
419 if (!h->is_dedicated())416 if (!h->is_dedicated())
420 c.recipient = h->get_local_playername();417 c.recipient = h->get_local_playername();
421 c.msg = (format(_("The client %s could not be found.")) % arg1).str();418 c.msg = (boost::format(_("The client %s could not be found.")) % arg1).str();
422 } else {419 } else {
423 c.msg = (format("HOST WARNING FOR %s: ") % arg1).str();420 c.msg = (boost::format("HOST WARNING FOR %s: ") % arg1).str();
424 c.msg += arg2;421 c.msg += arg2;
425 }422 }
426 }423 }
@@ -444,12 +441,12 @@
444 } else441 } else
445 c.msg = _("You can not kick the dedicated server");442 c.msg = _("You can not kick the dedicated server");
446 else if (num == -1)443 else if (num == -1)
447 c.msg = (format(_("The client %s could not be found.")) % arg1).str();444 c.msg = (boost::format(_("The client %s could not be found.")) % arg1).str();
448 else {445 else {
449 kickClient = num;446 kickClient = num;
450 c.msg = (format(_("Are you sure you want to kick %s?")) % arg1).str() + "<br>";447 c.msg = (boost::format(_("Are you sure you want to kick %s?")) % arg1).str() + "<br>";
451 c.msg += (format(_("The stated reason was: %s")) % kickReason).str() + "<br>";448 c.msg += (boost::format(_("The stated reason was: %s")) % kickReason).str() + "<br>";
452 c.msg += (format(_("If yes, type: /ack_kick %s")) % arg1).str();449 c.msg += (boost::format(_("If yes, type: /ack_kick %s")) % arg1).str();
453 }450 }
454 }451 }
455 if (!h->is_dedicated())452 if (!h->is_dedicated())
@@ -736,14 +733,13 @@
736 // May be the server is password protected?733 // May be the server is password protected?
737 Section & s = g_options.pull_section("global");734 Section & s = g_options.pull_section("global");
738 m_password = s.get_string("dedicated_password", "");735 m_password = s.get_string("dedicated_password", "");
736
739 // And we read the message of the day737 // And we read the message of the day
740 m_dedicated_motd =738 const std::string dedicated_motd_key =
741 s.get_string739 (boost::format
742 ("dedicated_motd",740 (_("This is a dedicated server. Send \"@%s help\" to get a full list of available commands."))
743 (format741 % d->localplayername).str();
744 (_("This is a dedicated server. Send \"@%s help\" to get a full list of available commands."))742 m_dedicated_motd = s.get_string("dedicated_motd", dedicated_motd_key.c_str());
745 % d->localplayername)
746 .str().c_str());
747743
748 // Maybe this is the first run, so we try to setup the DedicatedLog744 // Maybe this is the first run, so we try to setup the DedicatedLog
749 // empty strings are treated as "do not write this type of log"745 // empty strings are treated as "do not write this type of log"
@@ -1242,7 +1238,7 @@
1242 return;1238 return;
1243 }1239 }
1244 std::string temp = arg1 + " " + arg2;1240 std::string temp = arg1 + " " + arg2;
1245 c.msg = (format(_("%1$s told me to run the command: \"%2$s\"")) % sender % temp).str();1241 c.msg = (boost::format(_("%1$s told me to run the command: \"%2$s\"")) % sender % temp).str();
1246 c.recipient = "";1242 c.recipient = "";
1247 send(c);1243 send(c);
1248 d->chat.send(temp);1244 d->chat.send(temp);
@@ -1269,7 +1265,7 @@
1269 c.msg = _("Game successfully saved!");1265 c.msg = _("Game successfully saved!");
1270 else1266 else
1271 c.msg =1267 c.msg =
1272 (format(_("Could not save the game to the file \"%1$s\"! (%2$s)"))1268 (boost::format(_("Could not save the game to the file \"%1$s\"! (%2$s)"))
1273 % savename % error)1269 % savename % error)
1274 .str();1270 .str();
1275 send(c);1271 send(c);
@@ -1300,7 +1296,7 @@
13001296
1301 // default1297 // default
1302 } else {1298 } else {
1303 c.msg = (format(_("Unknown dedicated server command \"%s\"!")) % cmd).str();1299 c.msg = (boost::format(_("Unknown dedicated server command \"%s\"!")) % cmd).str();
1304 send(c);1300 send(c);
1305 }1301 }
1306}1302}
@@ -2163,7 +2159,7 @@
2163 if (m_password.size() > 1) {2159 if (m_password.size() > 1) {
2164 c.msg += "<br>";2160 c.msg += "<br>";
2165 c.msg +=2161 c.msg +=
2166 (format2162 (boost::format
2167 (_("This server is password protected. You can send the password with: \"@%s pwd PASSWORD\""))2163 (_("This server is password protected. You can send the password with: \"@%s pwd PASSWORD\""))
2168 % d->localplayername)2164 % d->localplayername)
2169 .str();2165 .str();
@@ -2286,7 +2282,7 @@
2286 if ((d->clients.at(i).hung_since < (time(nullptr) - 300)) && m_is_dedicated) {2282 if ((d->clients.at(i).hung_since < (time(nullptr) - 300)) && m_is_dedicated) {
2287 disconnect_client(i, "CLIENT_TIMEOUTED");2283 disconnect_client(i, "CLIENT_TIMEOUTED");
2288 // Try to save the game2284 // Try to save the game
2289 std::string savename = (boost::format("save/client_hung_%i.wmf") % time(nullptr)).str();;2285 std::string savename = (boost::format("save/client_hung_%i.wmf") % time(nullptr)).str();
2290 std::string * error = new std::string();2286 std::string * error = new std::string();
2291 SaveHandler & sh = d->game->save_handler();2287 SaveHandler & sh = d->game->save_handler();
2292 if (sh.save_game(*d->game, savename, error))2288 if (sh.save_game(*d->game, savename, error))
22932289
=== modified file 'src/scripting/lua_bases.cc'
--- src/scripting/lua_bases.cc 2014-09-18 18:52:34 +0000
+++ src/scripting/lua_bases.cc 2014-10-27 10:39:23 +0000
@@ -317,8 +317,10 @@
317}317}
318318
319int LuaPlayerBase::__tostring(lua_State * L) {319int LuaPlayerBase::__tostring(lua_State * L) {
320 lua_pushstring(L, (boost::format("Player(%i)")320 const std::string pushme =
321 % static_cast<unsigned int>(get(L, get_egbase(L)).player_number())).str().c_str());321 (boost::format("Player(%i)")
322 % static_cast<unsigned int>(get(L, get_egbase(L)).player_number())).str();
323 lua_pushstring(L, pushme.c_str());
322 return 1;324 return 1;
323}325}
324/* RST326/* RST
325327
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2014-10-11 11:14:25 +0000
+++ src/scripting/lua_map.cc 2014-10-27 10:39:23 +0000
@@ -3522,7 +3522,8 @@
3522 */3522 */
3523// Hash is used to identify a class in a Set3523// Hash is used to identify a class in a Set
3524int LuaField::get___hash(lua_State * L) {3524int LuaField::get___hash(lua_State * L) {
3525 lua_pushstring(L, (boost::format("%i_%i") % m_c.x % m_c.y).str().c_str());3525 const std::string pushme = (boost::format("%i_%i") % m_c.x % m_c.y).str();
3526 lua_pushstring(L, pushme.c_str());
3526 return 1;3527 return 1;
3527}3528}
35283529
@@ -3851,7 +3852,8 @@
3851}3852}
38523853
3853int LuaField::__tostring(lua_State * L) {3854int LuaField::__tostring(lua_State * L) {
3854 lua_pushstring(L, (boost::format("Field(%i,%i)") % m_c.x % m_c.y).str().c_str());3855 const std::string pushme = (boost::format("Field(%i,%i)") % m_c.x % m_c.y).str();
3856 lua_pushstring(L, pushme);
3855 return 1;3857 return 1;
3856}3858}
38573859
38583860
=== modified file 'src/ui_basic/helpwindow.cc'
--- src/ui_basic/helpwindow.cc 2014-09-30 05:41:55 +0000
+++ src/ui_basic/helpwindow.cc 2014-10-27 10:39:23 +0000
@@ -37,9 +37,6 @@
37#include "ui_basic/window.h"37#include "ui_basic/window.h"
38#include "wui/text_constants.h"38#include "wui/text_constants.h"
3939
40
41using boost::format;
42
43namespace UI {40namespace UI {
4441
45HelpWindow::HelpWindow42HelpWindow::HelpWindow
@@ -48,7 +45,7 @@
48 uint32_t fontsize,45 uint32_t fontsize,
49 uint32_t width, uint32_t height)46 uint32_t width, uint32_t height)
50 :47 :
51 Window(parent, "help_window", 0, 0, 20, 20, (boost::format(_("Help: %s")) % caption).str().c_str()),48 Window(parent, "help_window", 0, 0, 20, 20, (boost::format(_("Help: %s")) % caption).str()),
52 textarea(new MultilineTextarea(this, 5, 5, 30, 30, std::string(), Align_Left)),49 textarea(new MultilineTextarea(this, 5, 5, 30, 30, std::string(), Align_Left)),
53 m_h1(std::to_string(fontsize < 12 ? 18 : fontsize * 3 / 2)),50 m_h1(std::to_string(fontsize < 12 ? 18 : fontsize * 3 / 2)),
54 m_h2(std::to_string(fontsize < 12 ? 12 : fontsize)),51 m_h2(std::to_string(fontsize < 12 ? 12 : fontsize)),
@@ -191,7 +188,7 @@
191 uint32_t width, uint32_t height)188 uint32_t width, uint32_t height)
192 :189 :
193 UI::UniqueWindow(parent, "help_window", &reg, width, height,190 UI::UniqueWindow(parent, "help_window", &reg, width, height,
194 (boost::format(_("Help: %s")) % building_description.descname()).str().c_str()),191 (boost::format(_("Help: %s")) % building_description.descname()).str()),
195 textarea(new MultilineTextarea(this, 5, 5, width - 10, height -10, std::string(), Align_Left))192 textarea(new MultilineTextarea(this, 5, 5, width - 10, height -10, std::string(), Align_Left))
196{193{
197 try {194 try {
198195
=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc 2014-09-10 14:48:40 +0000
+++ src/ui_basic/listselect.cc 2014-10-27 10:39:23 +0000
@@ -119,7 +119,7 @@
119 * sel if true, directly select the new entry119 * sel if true, directly select the new entry
120*/120*/
121void BaseListselect::add121void BaseListselect::add
122 (char const * const name,122 (const std::string& name,
123 uint32_t entry,123 uint32_t entry,
124 const Image* pic,124 const Image* pic,
125 bool const sel,125 bool const sel,
@@ -130,7 +130,7 @@
130 er->m_entry = entry;130 er->m_entry = entry;
131 er->pic = pic;131 er->pic = pic;
132 er->use_clr = false;132 er->use_clr = false;
133 er->name = std::string(name);133 er->name = name;
134 er->tooltip = tooltip_text;134 er->tooltip = tooltip_text;
135 uint32_t entry_height = 0;135 uint32_t entry_height = 0;
136 if (!pic) {136 if (!pic) {
@@ -158,7 +158,7 @@
158}158}
159159
160void BaseListselect::add_front160void BaseListselect::add_front
161 (char const * const name,161 (const std::string& name,
162 const Image* pic,162 const Image* pic,
163 bool const sel,163 bool const sel,
164 const std::string & tooltip_text)164 const std::string & tooltip_text)
@@ -172,7 +172,7 @@
172172
173 er->pic = pic;173 er->pic = pic;
174 er->use_clr = false;174 er->use_clr = false;
175 er->name = std::string(name);175 er->name = name;
176 er->tooltip = tooltip_text;176 er->tooltip = tooltip_text;
177177
178 uint32_t entry_height = 0;178 uint32_t entry_height = 0;
179179
=== modified file 'src/ui_basic/listselect.h'
--- src/ui_basic/listselect.h 2014-09-14 11:31:58 +0000
+++ src/ui_basic/listselect.h 2014-10-27 10:39:23 +0000
@@ -60,13 +60,13 @@
60 (const uint32_t Begin = 0,60 (const uint32_t Begin = 0,
61 uint32_t End = std::numeric_limits<uint32_t>::max());61 uint32_t End = std::numeric_limits<uint32_t>::max());
62 void add62 void add
63 (const char * const name,63 (const std::string& name,
64 uint32_t value,64 uint32_t value,
65 const Image* pic = nullptr,65 const Image* pic = nullptr,
66 const bool select_this = false,66 const bool select_this = false,
67 const std::string & tooltip_text = std::string());67 const std::string & tooltip_text = std::string());
68 void add_front68 void add_front
69 (const char * const name,69 (const std::string& name,
70 const Image* pic = nullptr,70 const Image* pic = nullptr,
71 const bool select_this = false,71 const bool select_this = false,
72 const std::string & tooltip_text = std::string());72 const std::string & tooltip_text = std::string());
@@ -166,7 +166,7 @@
166 {}166 {}
167167
168 void add168 void add
169 (const char * const name,169 (const std::string& name,
170 Entry value,170 Entry value,
171 const Image* pic = nullptr,171 const Image* pic = nullptr,
172 const bool select_this = false,172 const bool select_this = false,
@@ -176,7 +176,7 @@
176 BaseListselect::add(name, m_entry_cache.size() - 1, pic, select_this, tooltip_text);176 BaseListselect::add(name, m_entry_cache.size() - 1, pic, select_this, tooltip_text);
177 }177 }
178 void add_front178 void add_front
179 (const char * const name,179 (const std::string& name,
180 Entry value,180 Entry value,
181 const Image* pic = nullptr,181 const Image* pic = nullptr,
182 const bool select_this = false,182 const bool select_this = false,
@@ -221,7 +221,7 @@
221 {}221 {}
222222
223 void add223 void add
224 (const char * const name,224 (const std::string& name,
225 Entry & value,225 Entry & value,
226 const Image* pic = nullptr,226 const Image* pic = nullptr,
227 const bool select_this = false,227 const bool select_this = false,
@@ -230,7 +230,7 @@
230 Base::add(name, &value, pic, select_this, tooltip_text);230 Base::add(name, &value, pic, select_this, tooltip_text);
231 }231 }
232 void add_front232 void add_front
233 (const char * const name,233 (const std::string& name,
234 Entry & value,234 Entry & value,
235 const Image* pic = nullptr,235 const Image* pic = nullptr,
236 const bool select_this = false,236 const bool select_this = false,
237237
=== modified file 'src/ui_fsmenu/editor_mapselect.cc'
--- src/ui_fsmenu/editor_mapselect.cc 2014-09-30 05:41:55 +0000
+++ src/ui_fsmenu/editor_mapselect.cc 2014-10-27 10:39:23 +0000
@@ -209,12 +209,11 @@
209#else209#else
210 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));210 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));
211#endif211#endif
212 std::string parent_string =212
213 m_list.add
213 /** TRANSLATORS: Parent directory */214 /** TRANSLATORS: Parent directory */
214 (boost::format("\\<%s\\>") % _("parent")).str();215 ((boost::format("\\<%s\\>") % _("parent")).str(),
215 m_list.add216 m_parentdir.c_str(),
216 (parent_string.c_str(),
217 m_parentdir.c_str(),
218 g_gr->images().get("pics/ls_dir.png"));217 g_gr->images().get("pics/ls_dir.png"));
219 }218 }
220219
221220
=== modified file 'src/ui_fsmenu/internet_lobby.cc'
--- src/ui_fsmenu/internet_lobby.cc 2014-09-20 09:37:47 +0000
+++ src/ui_fsmenu/internet_lobby.cc 2014-10-27 10:39:23 +0000
@@ -249,7 +249,7 @@
249 // than one server with the same name.249 // than one server with the same name.
250 if (games.at(i).name == localservername)250 if (games.at(i).name == localservername)
251 hostgame.set_enabled(false);251 hostgame.set_enabled(false);
252 opengames.add(games.at(i).name.c_str(), games.at(i), pic, false, games.at(i).build_id);252 opengames.add(games.at(i).name, games.at(i), pic, false, games.at(i).build_id);
253 }253 }
254}254}
255255
256256
=== modified file 'src/ui_fsmenu/launch_mpg.cc'
--- src/ui_fsmenu/launch_mpg.cc 2014-10-26 12:17:01 +0000
+++ src/ui_fsmenu/launch_mpg.cc 2014-10-27 10:39:23 +0000
@@ -45,8 +45,6 @@
45#include "wui/multiplayersetupgroup.h"45#include "wui/multiplayersetupgroup.h"
46#include "wui/text_constants.h"46#include "wui/text_constants.h"
4747
48using boost::format;
49
50/// Simple user interaction window for selecting either map, save or cancel48/// Simple user interaction window for selecting either map, save or cancel
51struct MapOrSaveSelectionWindow : public UI::Window {49struct MapOrSaveSelectionWindow : public UI::Window {
52 MapOrSaveSelectionWindow50 MapOrSaveSelectionWindow
@@ -484,10 +482,10 @@
484 std::string temp =482 std::string temp =
485 (settings.playernum > -1) && (settings.playernum < MAX_PLAYERS)483 (settings.playernum > -1) && (settings.playernum < MAX_PLAYERS)
486 ?484 ?
487 (format(_("Player %i")) % (settings.playernum + 1)).str()485 (boost::format(_("Player %i")) % (settings.playernum + 1)).str()
488 :486 :
489 _("Spectator");487 _("Spectator");
490 temp = (format(_("At the moment you are %s")) % temp.c_str()).str() + "\n\n";488 temp = (boost::format(_("At the moment you are %s")) % temp.c_str()).str() + "\n\n";
491 temp += _("Click on the ‘?’ in the top right corner to get help.");489 temp += _("Click on the ‘?’ in the top right corner to get help.");
492 m_client_info.set_text(temp);490 m_client_info.set_text(temp);
493 }491 }
@@ -557,7 +555,7 @@
557 for (; i <= m_nr_players; ++i) {555 for (; i <= m_nr_players; ++i) {
558 infotext += "\n* ";556 infotext += "\n* ";
559 Section & s = prof.get_safe_section((boost::format("player_%u")557 Section & s = prof.get_safe_section((boost::format("player_%u")
560 % static_cast<unsigned int>(i)).str().c_str());558 % static_cast<unsigned int>(i)).str());
561 player_save_name [i - 1] = s.get_string("name");559 player_save_name [i - 1] = s.get_string("name");
562 player_save_tribe[i - 1] = s.get_string("tribe");560 player_save_tribe[i - 1] = s.get_string("tribe");
563 player_save_ai [i - 1] = s.get_string("ai");561 player_save_ai [i - 1] = s.get_string("ai");
@@ -639,12 +637,12 @@
639637
640 std::string infotext;638 std::string infotext;
641 infotext += std::string(_("Map details:")) + "\n";639 infotext += std::string(_("Map details:")) + "\n";
642 infotext += std::string("• ") + (format(_("Size: %1$u x %2$u"))640 infotext += std::string("• ") + (boost::format(_("Size: %1$u x %2$u"))
643 % map.get_width() % map.get_height()).str() + "\n";641 % map.get_width() % map.get_height()).str() + "\n";
644 infotext += std::string("• ") + (format(ngettext("%u Player", "%u Players", m_nr_players))642 infotext += std::string("• ") + (boost::format(ngettext("%u Player", "%u Players", m_nr_players))
645 % m_nr_players).str() + "\n";643 % m_nr_players).str() + "\n";
646 if (m_settings->settings().scenario)644 if (m_settings->settings().scenario)
647 infotext += std::string("• ") + (format(_("Scenario mode selected"))).str() + "\n";645 infotext += std::string("• ") + (boost::format(_("Scenario mode selected"))).str() + "\n";
648 infotext += "\n";646 infotext += "\n";
649 infotext += map.get_description();647 infotext += map.get_description();
650 infotext += "\n";648 infotext += "\n";
651649
=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc 2014-10-11 16:08:10 +0000
+++ src/ui_fsmenu/loadgame.cc 2014-10-27 10:39:23 +0000
@@ -294,7 +294,7 @@
294 if (m_settings && !m_settings->settings().saved_games.empty()) {294 if (m_settings && !m_settings->settings().saved_games.empty()) {
295 for (uint32_t i = 0; i < m_settings->settings().saved_games.size(); ++i) {295 for (uint32_t i = 0; i < m_settings->settings().saved_games.size(); ++i) {
296 const char * path = m_settings->settings().saved_games.at(i).path.c_str();296 const char * path = m_settings->settings().saved_games.at(i).path.c_str();
297 m_list.add(FileSystem::filename_without_ext(path).c_str(), path);297 m_list.add(FileSystem::filename_without_ext(path), path);
298 }298 }
299 } else { // Normal case299 } else { // Normal case
300 // Fill it with all files we find.300 // Fill it with all files we find.
@@ -365,7 +365,7 @@
365 }365 }
366 // End localization section366 // End localization section
367367
368 m_list.add(displaytitle.c_str(), name);368 m_list.add(displaytitle, name);
369 } catch (const WException &) {369 } catch (const WException &) {
370 // we simply skip illegal entries370 // we simply skip illegal entries
371 }371 }
372372
=== modified file 'src/ui_fsmenu/loadreplay.cc'
--- src/ui_fsmenu/loadreplay.cc 2014-10-11 16:08:10 +0000
+++ src/ui_fsmenu/loadreplay.cc 2014-10-27 10:39:23 +0000
@@ -291,7 +291,7 @@
291 }291 }
292 // End localization section292 // End localization section
293293
294 m_list.add(displaytitle.c_str(), *pname);294 m_list.add(displaytitle, *pname);
295 } catch (const WException &) {} // we simply skip illegal entries295 } catch (const WException &) {} // we simply skip illegal entries
296 }296 }
297297
298298
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2014-09-29 19:25:24 +0000
+++ src/ui_fsmenu/options.cc 2014-10-27 10:39:23 +0000
@@ -79,7 +79,7 @@
79 std::sort(entries.begin(), entries.end());79 std::sort(entries.begin(), entries.end());
8080
81 for (const LanguageEntry& entry : entries) {81 for (const LanguageEntry& entry : entries) {
82 list->add(entry.descname.c_str(), entry.abbreviation, nullptr, entry.abbreviation == language);82 list->add(entry.descname, entry.abbreviation, nullptr, entry.abbreviation == language);
83 }83 }
84}84}
8585
@@ -367,13 +367,13 @@
367 /** TRANSLATORS: Screen resolution, e.g. 800 x 600*/367 /** TRANSLATORS: Screen resolution, e.g. 800 x 600*/
368 m_reslist.add((boost::format(_("%1% x %2%"))368 m_reslist.add((boost::format(_("%1% x %2%"))
369 % m_resolutions[i].xres369 % m_resolutions[i].xres
370 % m_resolutions[i].yres).str().c_str(),370 % m_resolutions[i].yres).str(),
371 nullptr, nullptr, selected);371 nullptr, nullptr, selected);
372 }372 }
373 if (!did_select_a_res) {373 if (!did_select_a_res) {
374 m_reslist.add((boost::format(_("%1% x %2%"))374 m_reslist.add((boost::format(_("%1% x %2%"))
375 % opt.xres375 % opt.xres
376 % opt.yres).str().c_str(),376 % opt.yres).str(),
377 nullptr, nullptr, true);377 nullptr, nullptr, true);
378 uint32_t entry = m_resolutions.size();378 uint32_t entry = m_resolutions.size();
379 m_resolutions.resize(entry + 1);379 m_resolutions.resize(entry + 1);
380380
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2014-10-16 05:54:05 +0000
+++ src/wlapplication.cc 2014-10-27 10:39:23 +0000
@@ -532,7 +532,7 @@
532 g_fs->ensure_directory_exists(SCREENSHOT_DIR);532 g_fs->ensure_directory_exists(SCREENSHOT_DIR);
533 for (uint32_t nr = 0; nr < 10000; ++nr) {533 for (uint32_t nr = 0; nr < 10000; ++nr) {
534 const std::string filename = (boost::format(SCREENSHOT_DIR "/shot%04u.png")534 const std::string filename = (boost::format(SCREENSHOT_DIR "/shot%04u.png")
535 % nr).str().c_str();535 % nr).str();
536 if (g_fs->file_exists(filename))536 if (g_fs->file_exists(filename))
537 continue;537 continue;
538 g_gr->screenshot(filename);538 g_gr->screenshot(filename);
539539
=== modified file 'src/wui/actionconfirm.cc'
--- src/wui/actionconfirm.cc 2014-09-10 14:48:40 +0000
+++ src/wui/actionconfirm.cc 2014-10-27 10:39:23 +0000
@@ -31,7 +31,6 @@
31#include "ui_basic/window.h"31#include "ui_basic/window.h"
32#include "wui/interactive_player.h"32#include "wui/interactive_player.h"
3333
34using boost::format;
3534
36struct ActionConfirm : public UI::Window {35struct ActionConfirm : public UI::Window {
37 ActionConfirm36 ActionConfirm
@@ -148,7 +147,7 @@
148 new UI::MultilineTextarea147 new UI::MultilineTextarea
149 (this,148 (this,
150 0, 0, 200, 74,149 0, 0, 200, 74,
151 (format(message) % building.descr().descname()).str(),150 (boost::format(message) % building.descr().descname()).str(),
152 UI::Align_Center);151 UI::Align_Center);
153152
154 UI::Button * okbtn =153 UI::Button * okbtn =
155154
=== modified file 'src/wui/encyclopedia_window.cc'
--- src/wui/encyclopedia_window.cc 2014-09-30 05:41:55 +0000
+++ src/wui/encyclopedia_window.cc 2014-10-27 10:39:23 +0000
@@ -99,7 +99,7 @@
9999
100 for (uint32_t i = 0; i < ware_vec.size(); i++) {100 for (uint32_t i = 0; i < ware_vec.size(); i++) {
101 Ware cur = ware_vec[i];101 Ware cur = ware_vec[i];
102 wares.add(cur.m_descr->descname().c_str(), cur.m_i, cur.m_descr->icon());102 wares.add(cur.m_descr->descname(), cur.m_i, cur.m_descr->icon());
103 }103 }
104}104}
105105
@@ -124,7 +124,7 @@
124 &&124 &&
125 de->output_ware_types().count(wares.get_selected()))125 de->output_ware_types().count(wares.get_selected()))
126 {126 {
127 prodSites.add(de->descname().c_str(), i, de->get_icon());127 prodSites.add(de->descname(), i, de->get_icon());
128 found = true;128 found = true;
129 }129 }
130 }130 }
131131
=== modified file 'src/wui/game_debug_ui.cc'
--- src/wui/game_debug_ui.cc 2014-09-30 05:41:55 +0000
+++ src/wui/game_debug_ui.cc 2014-10-27 10:39:23 +0000
@@ -180,7 +180,7 @@
180 }180 }
181 UI::Window::think();181 UI::Window::think();
182 } else {182 } else {
183 set_title((boost::format("DEAD: %u") % m_serial).str().c_str());183 set_title((boost::format("DEAD: %u") % m_serial).str());
184 }184 }
185185
186}186}
@@ -375,7 +375,7 @@
375 {375 {
376 m_ui_immovable.set_title((boost::format("%s (%u)")376 m_ui_immovable.set_title((boost::format("%s (%u)")
377 % imm->descr().name().c_str()377 % imm->descr().name().c_str()
378 % imm->serial()).str().c_str());378 % imm->serial()).str());
379 m_ui_immovable.set_enabled(true);379 m_ui_immovable.set_enabled(true);
380 } else {380 } else {
381 m_ui_immovable.set_title("no immovable");381 m_ui_immovable.set_title("no immovable");
@@ -420,7 +420,7 @@
420 m_ui_bobs.add(420 m_ui_bobs.add(
421 (boost::format("%s (%u)")421 (boost::format("%s (%u)")
422 % temp_bob->descr().name()422 % temp_bob->descr().name()
423 % temp_bob->serial()).str().c_str(),423 % temp_bob->serial()).str(),
424 temp_bob->serial());424 temp_bob->serial());
425 }425 }
426}426}
427427
=== modified file 'src/wui/game_main_menu_save_game.cc'
--- src/wui/game_main_menu_save_game.cc 2014-10-07 10:20:18 +0000
+++ src/wui/game_main_menu_save_game.cc 2014-10-27 10:39:23 +0000
@@ -34,8 +34,6 @@
34#include "profile/profile.h"34#include "profile/profile.h"
35#include "wui/interactive_gamebase.h"35#include "wui/interactive_gamebase.h"
3636
37using boost::format;
38
39InteractiveGameBase & GameMainMenuSaveGame::igbase() {37InteractiveGameBase & GameMainMenuSaveGame::igbase() {
40 return ref_cast<InteractiveGameBase, UI::Panel>(*get_parent());38 return ref_cast<InteractiveGameBase, UI::Panel>(*get_parent());
41}39}
@@ -168,14 +166,10 @@
168 m_gametime.set_text(gametimestring(gametime));166 m_gametime.set_text(gametimestring(gametime));
169167
170 if (gpdp.get_number_of_players() > 0) {168 if (gpdp.get_number_of_players() > 0) {
171 char buf[200];169 const std::string text =
172 sprintf170 (boost::format(ngettext("%u Player", "%u Players", gpdp.get_number_of_players()))
173 (buf, "%i %s", gpdp.get_number_of_players(),171 % static_cast<unsigned int>(gpdp.get_number_of_players())).str();
174 // TODO(GunChleoc): This should be ngettext(" %i player" etc.172 m_players_label.set_text(text);
175 // with boost::format, but it refuses to work
176 /** TRANSLATORS: This is preceded by a number */
177 ngettext("player", "players", gpdp.get_number_of_players()));
178 m_players_label.set_text(buf);
179 } else {173 } else {
180 // Keep label empty174 // Keep label empty
181 m_players_label.set_text("");175 m_players_label.set_text("");
@@ -212,7 +206,7 @@
212 try {206 try {
213 Widelands::GameLoader gl(name, igbase().game());207 Widelands::GameLoader gl(name, igbase().game());
214 gl.preload_game(gpdp);208 gl.preload_game(gpdp);
215 m_ls.add(FileSystem::filename_without_ext(name).c_str(), name);209 m_ls.add(FileSystem::filename_without_ext(name), name);
216 } catch (const WException &) {} // we simply skip illegal entries210 } catch (const WException &) {} // we simply skip illegal entries
217 }211 }
218}212}
@@ -325,7 +319,7 @@
325 (&parent,319 (&parent,
326 _("File deletion"),320 _("File deletion"),
327 str321 str
328 (format(_("Do you really want to delete the file %s?")) %322 (boost::format(_("Do you really want to delete the file %s?")) %
329 FileSystem::fs_filename(filename.c_str())),323 FileSystem::fs_filename(filename.c_str())),
330 YESNO),324 YESNO),
331 m_filename(filename)325 m_filename(filename)
332326
=== modified file 'src/wui/game_objectives_menu.cc'
--- src/wui/game_objectives_menu.cc 2014-09-14 11:31:58 +0000
+++ src/wui/game_objectives_menu.cc 2014-10-27 10:39:23 +0000
@@ -71,7 +71,7 @@
71 for (uint32_t j = 0;; ++j)71 for (uint32_t j = 0;; ++j)
72 if (j == list_size) { // the objective is not in our list72 if (j == list_size) { // the objective is not in our list
73 if (should_show)73 if (should_show)
74 list.add(obj.descname().c_str(), obj);74 list.add(obj.descname(), obj);
75 break;75 break;
76 } else if (&list[j] == &obj) { // the objective is in our list76 } else if (&list[j] == &obj) { // the objective is in our list
77 if (!should_show)77 if (!should_show)
@@ -79,7 +79,7 @@
79 else if (list[j].descname() != obj.descname() || list[j].descr() != obj.descr()) {79 else if (list[j].descname() != obj.descname() || list[j].descr() != obj.descr()) {
80 // Update80 // Update
81 list.remove(j);81 list.remove(j);
82 list.add(obj.descname().c_str(), obj);82 list.add(obj.descname(), obj);
83 }83 }
84 break;84 break;
85 }85 }
8686
=== modified file 'src/wui/general_statistics_menu.cc'
--- src/wui/general_statistics_menu.cc 2014-09-18 18:52:34 +0000
+++ src/wui/general_statistics_menu.cc 2014-10-27 10:39:23 +0000
@@ -148,7 +148,7 @@
148148
149 iterate_players_existing_const(p, nr_players, game, player) {149 iterate_players_existing_const(p, nr_players, game, player) {
150 const std::string pic = (boost::format("pics/genstats_enable_plr_%02u.png")150 const std::string pic = (boost::format("pics/genstats_enable_plr_%02u.png")
151 % static_cast<unsigned int>(p)).str().c_str();151 % static_cast<unsigned int>(p)).str();
152 UI::Button & cb =152 UI::Button & cb =
153 *new UI::Button153 *new UI::Button
154 (hbox1, "playerbutton",154 (hbox1, "playerbutton",
155155
=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc 2014-10-19 16:24:33 +0000
+++ src/wui/interactive_base.cc 2014-10-27 10:39:23 +0000
@@ -57,7 +57,6 @@
57#include "wui/text_layout.h"57#include "wui/text_layout.h"
58#include "wui/unique_window_handler.h"58#include "wui/unique_window_handler.h"
5959
60using boost::format;
61using Widelands::Area;60using Widelands::Area;
62using Widelands::CoordPath;61using Widelands::CoordPath;
63using Widelands::Coords;62using Widelands::Coords;
@@ -329,12 +328,12 @@
329 (real == 1000 ? std::string() : speed_string(real));328 (real == 1000 ? std::string() : speed_string(real));
330 else {329 else {
331 m_label_speed.set_text(330 m_label_speed.set_text(
332 (format331 (boost::format
333 /** TRANSLATORS: actual_speed (desired_speed) */332 /** TRANSLATORS: actual_speed (desired_speed) */
334 (_("%1$s (%2$s)"))333 (_("%1$s (%2$s)"))
335 % speed_string(real).c_str()334 % speed_string(real).c_str()
336 % speed_string(desired).c_str()335 % speed_string(desired).c_str()
337 ).str().c_str()336 ).str()
338 );337 );
339 }338 }
340 } else339 } else
@@ -407,7 +406,7 @@
407 const std::string gametime(gametimestring(egbase().get_gametime()));406 const std::string gametime(gametimestring(egbase().get_gametime()));
408 const std::string gametime_text = as_uifont(gametime, UI_FONT_SIZE_SMALL);407 const std::string gametime_text = as_uifont(gametime, UI_FONT_SIZE_SMALL);
409 dst.blit(Point(5, 5), UI::g_fh1->render(gametime_text), CM_Normal, UI::Align_TopLeft);408 dst.blit(Point(5, 5), UI::g_fh1->render(gametime_text), CM_Normal, UI::Align_TopLeft);
410 static format node_format("(%i, %i)");409 static boost::format node_format("(%i, %i)");
411410
412 const std::string node_text = as_uifont411 const std::string node_text = as_uifont
413 ((node_format % m_sel.pos.node.x % m_sel.pos.node.y).str(), UI_FONT_SIZE_SMALL);412 ((node_format % m_sel.pos.node.x % m_sel.pos.node.y).str(), UI_FONT_SIZE_SMALL);
@@ -421,7 +420,7 @@
421420
422 // Blit FPS when in debug mode.421 // Blit FPS when in debug mode.
423 if (get_display_flag(dfDebug)) {422 if (get_display_flag(dfDebug)) {
424 static format fps_format("%5.1f fps (avg: %5.1f fps)");423 static boost::format fps_format("%5.1f fps (avg: %5.1f fps)");
425 const std::string fps_text = as_uifont424 const std::string fps_text = as_uifont
426 ((fps_format %425 ((fps_format %
427 (1000.0 / m_frametime) % (1000.0 / (m_avg_usframetime / 1000)))426 (1000.0 / m_frametime) % (1000.0 / (m_avg_usframetime / 1000)))
@@ -993,7 +992,7 @@
993992
994 if (!obj) {993 if (!obj) {
995 DebugConsole::write994 DebugConsole::write
996 (str(format("No MapObject with serial number %1%") % serial));995 (str(boost::format("No MapObject with serial number %1%") % serial));
997 return;996 return;
998 }997 }
999998
1000999
=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc 2014-09-19 12:54:54 +0000
+++ src/wui/interactive_player.cc 2014-10-27 10:39:23 +0000
@@ -60,8 +60,6 @@
6060
61using Widelands::Building;61using Widelands::Building;
62using Widelands::Map;62using Widelands::Map;
63using boost::format;
64
6563
66namespace {64namespace {
6765
@@ -456,13 +454,13 @@
456454
457 int const n = atoi(args[1].c_str());455 int const n = atoi(args[1].c_str());
458 if (n < 1 || n > MAX_PLAYERS || !game().get_player(n)) {456 if (n < 1 || n > MAX_PLAYERS || !game().get_player(n)) {
459 DebugConsole::write(str(format("Player #%1% does not exist.") % n));457 DebugConsole::write(str(boost::format("Player #%1% does not exist.") % n));
460 return;458 return;
461 }459 }
462460
463 DebugConsole::write461 DebugConsole::write
464 (str462 (str
465 (format("Switching from #%1% to #%2%.")463 (boost::format("Switching from #%1% to #%2%.")
466 % static_cast<int>(m_player_number) % n));464 % static_cast<int>(m_player_number) % n));
467 m_player_number = n;465 m_player_number = n;
468 Map & map = egbase().map();466 Map & map = egbase().map();
469467
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2014-10-26 12:17:01 +0000
+++ src/wui/multiplayersetupgroup.cc 2014-10-27 10:39:23 +0000
@@ -121,7 +121,7 @@
121 pic = (boost::format("pics/genstats_enable_plr_0%u.png")121 pic = (boost::format("pics/genstats_enable_plr_0%u.png")
122 % static_cast<unsigned int>(us.position + 1)).str();122 % static_cast<unsigned int>(us.position + 1)).str();
123 temp_tooltip = (boost::format(_("Player %u"))123 temp_tooltip = (boost::format(_("Player %u"))
124 % static_cast<unsigned int>(us.position + 1)).str().c_str();124 % static_cast<unsigned int>(us.position + 1)).str();
125 } else {125 } else {
126 pic = "pics/menu_tab_watch.png";126 pic = "pics/menu_tab_watch.png";
127 temp_tooltip = _("Spectator");127 temp_tooltip = _("Spectator");
@@ -174,7 +174,7 @@
174 set_size(w, h);174 set_size(w, h);
175175
176 const std::string pic = (boost::format("pics/fsel_editor_set_player_0%i_pos.png")176 const std::string pic = (boost::format("pics/fsel_editor_set_player_0%i_pos.png")
177 % static_cast<unsigned int>(id + 1)).str().c_str();177 % static_cast<unsigned int>(id + 1)).str();
178 player =178 player =
179 new UI::Icon(this, 0, 0, h, h, g_gr->images().get(pic));179 new UI::Icon(this, 0, 0, h, h, g_gr->images().get(pic));
180 add(player, UI::Box::AlignCenter);180 add(player, UI::Box::AlignCenter);
@@ -288,11 +288,11 @@
288 type ->set_pic(g_gr->images().get("pics/shared_in.png"));288 type ->set_pic(g_gr->images().get("pics/shared_in.png"));
289289
290 const std::string pic = (boost::format("pics/fsel_editor_set_player_0%u_pos.png")290 const std::string pic = (boost::format("pics/fsel_editor_set_player_0%u_pos.png")
291 % static_cast<unsigned int>(player_setting.shared_in)).str().c_str();291 % static_cast<unsigned int>(player_setting.shared_in)).str();
292292
293 tribe->set_pic(g_gr->images().get(pic));293 tribe->set_pic(g_gr->images().get(pic));
294 tribe->set_tooltip((boost::format(_("Player %u"))294 tribe->set_tooltip((boost::format(_("Player %u"))
295 % static_cast<unsigned int>(player_setting.shared_in)).str().c_str());295 % static_cast<unsigned int>(player_setting.shared_in)).str());
296296
297 team ->set_visible(false);297 team ->set_visible(false);
298 team ->set_enabled(false);298 team ->set_enabled(false);
299299
=== modified file 'src/wui/plot_area.cc'
--- src/wui/plot_area.cc 2014-09-18 18:52:34 +0000
+++ src/wui/plot_area.cc 2014-10-27 10:39:23 +0000
@@ -35,7 +35,6 @@
35#include "wui/text_layout.h"35#include "wui/text_layout.h"
3636
37using namespace std;37using namespace std;
38using boost::format;
3938
40namespace {39namespace {
4140
@@ -71,7 +70,8 @@
71};70};
7271
73string ytick_text_style(const string& text, const RGBColor& clr) {72string ytick_text_style(const string& text, const RGBColor& clr) {
74 static format f("<rt><p><font face=DejaVuSansCondensed size=13 color=%02x%02x%02x>%s</font></p></rt>");73 static boost::format
74 f("<rt><p><font face=DejaVuSansCondensed size=13 color=%02x%02x%02x>%s</font></p></rt>");
75 f % int(clr.r) % int(clr.g) % int(clr.b);75 f % int(clr.r) % int(clr.g) % int(clr.b);
76 f % text;76 f % text;
77 return f.str();77 return f.str();

Subscribers

People subscribed via source and target branches

to status/vote changes: