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
1=== modified file 'src/base/scoped_timer.cc'
2--- src/base/scoped_timer.cc 2014-07-05 13:14:42 +0000
3+++ src/base/scoped_timer.cc 2014-10-27 10:39:23 +0000
4@@ -33,8 +33,8 @@
5
6 ScopedTimer::~ScopedTimer() {
7 uint32_t ms_in_existance = SDL_GetTicks() - startime_;
8-
9- log("%s\n", (boost::format(message_) % ms_in_existance).str().c_str());
10+ const std::string logmessage = (boost::format(message_) % ms_in_existance).str();
11+ log("%s\n", logmessage.c_str());
12 }
13
14 uint32_t ScopedTimer::ms_since_last_query() {
15
16=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc'
17--- src/editor/ui_menus/editor_main_menu_load_map.cc 2014-09-30 05:41:55 +0000
18+++ src/editor/ui_menus/editor_main_menu_load_map.cc 2014-10-27 10:39:23 +0000
19@@ -177,7 +177,7 @@
20
21 m_size ->set_text((boost::format(_("%1$ix%2$i"))
22 % map.get_width()
23- % map.get_height()).str().c_str());
24+ % map.get_height()).str());
25 } else {
26 m_name ->set_text("");
27 m_name ->set_tooltip("");
28@@ -207,13 +207,12 @@
29 #else
30 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));
31 #endif
32- std::string parent_string =
33+
34+ m_ls->add
35 /** TRANSLATORS: Parent directory */
36- (boost::format("\\<%s\\>") % _("parent")).str();
37- m_ls->add
38- (parent_string.c_str(),
39- m_parentdir.c_str(),
40- g_gr->images().get("pics/ls_dir.png"));
41+ ((boost::format("\\<%s\\>") % _("parent")).str(),
42+ m_parentdir.c_str(),
43+ g_gr->images().get("pics/ls_dir.png"));
44 }
45
46 const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end();
47@@ -248,7 +247,7 @@
48 try {
49 map_loader->preload_map(true);
50 m_ls->add
51- (FileSystem::filename_without_ext(name).c_str(),
52+ (FileSystem::filename_without_ext(name),
53 name,
54 g_gr->images().get
55 (dynamic_cast<WidelandsMapLoader*>(map_loader.get())
56
57=== modified file 'src/editor/ui_menus/editor_main_menu_map_options.cc'
58--- src/editor/ui_menus/editor_main_menu_map_options.cc 2014-09-30 05:41:55 +0000
59+++ src/editor/ui_menus/editor_main_menu_map_options.cc 2014-10-27 10:39:23 +0000
60@@ -118,7 +118,7 @@
61
62 m_size ->set_text((boost::format(_("%1$ix%2$i"))
63 % map.get_width()
64- % map.get_height()).str().c_str());
65+ % map.get_height()).str());
66 m_author->set_text(map.get_author());
67 m_name ->set_text(map.get_name());
68 m_nrplayers->set_text(std::to_string(static_cast<unsigned int>(map.get_nrplayers())));
69
70=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.cc'
71--- src/editor/ui_menus/editor_main_menu_new_map.cc 2014-09-30 05:41:55 +0000
72+++ src/editor/ui_menus/editor_main_menu_new_map.cc 2014-10-27 10:39:23 +0000
73@@ -62,7 +62,7 @@
74 }
75
76 m_width = new UI::Textarea(this, posx + spacing + 20, posy,
77- (boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str().c_str());
78+ (boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str());
79
80 UI::Button * widthupbtn = new UI::Button
81 (this, "width_up",
82@@ -82,7 +82,7 @@
83
84 m_height = new UI::Textarea(this, posx + spacing + 20, posy,
85 (boost::format(_("Height: %u"))
86- % Widelands::MAP_DIMENSIONS[m_h]).str().c_str());
87+ % Widelands::MAP_DIMENSIONS[m_h]).str());
88
89 UI::Button * heightupbtn = new UI::Button
90 (this, "height_up",
91
92=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
93--- src/editor/ui_menus/editor_main_menu_random_map.cc 2014-10-12 06:26:38 +0000
94+++ src/editor/ui_menus/editor_main_menu_random_map.cc 2014-10-27 10:39:23 +0000
95@@ -123,7 +123,7 @@
96
97 m_width = new UI::Textarea(this, posx + spacing + height, posy,
98 (boost::format(_("Width: %u"))
99- % Widelands::MAP_DIMENSIONS[m_w]).str().c_str());
100+ % Widelands::MAP_DIMENSIONS[m_w]).str());
101
102 posy += height + 2 * spacing;
103
104@@ -131,7 +131,7 @@
105
106 m_height = new UI::Textarea(this, posx + spacing + height, posy,
107 (boost::format(_("Height: %u"))
108- % Widelands::MAP_DIMENSIONS[m_h]).str().c_str());
109+ % Widelands::MAP_DIMENSIONS[m_h]).str());
110
111 UI::Button * heightupbtn = new UI::Button
112 (this, "height_up",
113@@ -171,7 +171,7 @@
114 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WATER_MINUS));
115
116 m_water = new UI::Textarea(this, posx + spacing + height, posy,
117- (boost::format(_("Water: %i %%")) % m_waterval).str().c_str());
118+ (boost::format(_("Water: %i %%")) % m_waterval).str());
119
120 posy += height + 2 * spacing;
121
122@@ -196,7 +196,7 @@
123 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::LAND_MINUS));
124
125 m_land = new UI::Textarea(this, posx + spacing + height, posy,
126- (boost::format(_("Land: %i %%")) % m_landval).str().c_str());
127+ (boost::format(_("Land: %i %%")) % m_landval).str());
128
129 posy += height + 2 * spacing;
130
131@@ -221,7 +221,7 @@
132 (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WASTE_MINUS));
133
134 m_wasteland = new UI::Textarea(this, posx + spacing + height, posy,
135- (boost::format(_("Wasteland: %i %%")) % m_wastelandval).str().c_str());
136+ (boost::format(_("Wasteland: %i %%")) % m_wastelandval).str());
137
138 posy += height + 2 * spacing;
139
140@@ -230,7 +230,7 @@
141 // ---------- Mountains -----------
142
143 m_mountains = new UI::Textarea(this, posx + spacing + height, posy,
144- (boost::format(_("Mountains: %i %%")) % m_mountainsval).str().c_str());
145+ (boost::format(_("Mountains: %i %%")) % m_mountainsval).str());
146
147 posy += height + 2 * spacing;
148
149@@ -317,7 +317,7 @@
150
151 m_players = new UI::Textarea(this, posx + spacing + height, posy,
152 (boost::format(_("Players: %u"))
153- % static_cast<unsigned int>(m_pn)).str().c_str());
154+ % static_cast<unsigned int>(m_pn)).str());
155
156 posy += height + 2 * spacing;
157
158@@ -424,14 +424,14 @@
159 if (m_h < 0) m_h = 0;
160 if (m_h >= NUMBER_OF_MAP_DIMENSIONS) m_h = NUMBER_OF_MAP_DIMENSIONS - 1;
161
162- m_width ->set_text((boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str().c_str());
163- m_height->set_text((boost::format(_("Height: %u")) % Widelands::MAP_DIMENSIONS[m_h]).str().c_str());
164- m_water->set_text((boost::format(_("Water: %i %%")) % m_waterval).str().c_str());
165- m_land->set_text((boost::format(_("Land: %i %%")) % m_landval).str().c_str());
166- m_wasteland->set_text((boost::format(_("Wasteland: %i %%")) % m_wastelandval).str().c_str());
167- m_mountains->set_text((boost::format(_("Mountains: %i %%")) % m_mountainsval).str().c_str());
168+ m_width ->set_text((boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str());
169+ m_height->set_text((boost::format(_("Height: %u")) % Widelands::MAP_DIMENSIONS[m_h]).str());
170+ m_water->set_text((boost::format(_("Water: %i %%")) % m_waterval).str());
171+ m_land->set_text((boost::format(_("Land: %i %%")) % m_landval).str());
172+ m_wasteland->set_text((boost::format(_("Wasteland: %i %%")) % m_wastelandval).str());
173+ m_mountains->set_text((boost::format(_("Mountains: %i %%")) % m_mountainsval).str());
174 m_players->set_text((boost::format(_("Players: %u"))
175- % static_cast<unsigned int>(m_pn)).str().c_str());
176+ % static_cast<unsigned int>(m_pn)).str());
177
178 nr_edit_box_changed(); // Update ID String
179 }
180
181=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
182--- src/editor/ui_menus/editor_main_menu_save_map.cc 2014-09-30 05:41:55 +0000
183+++ src/editor/ui_menus/editor_main_menu_save_map.cc 2014-10-27 10:39:23 +0000
184@@ -236,7 +236,7 @@
185 m_nrplayers->set_text(std::to_string(static_cast<unsigned int>(map.get_nrplayers())));
186
187 m_size->set_text((boost::format(_("%1$ix%2$i"))
188- % map.get_width() % map.get_height()).str().c_str());
189+ % map.get_width() % map.get_height()).str());
190 } else {
191 m_name ->set_text(FileSystem::fs_filename(name));
192 m_name ->set_tooltip("");
193@@ -286,13 +286,12 @@
194 #else
195 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));
196 #endif
197- std::string parent_string =
198+
199+ m_ls->add
200 /** TRANSLATORS: Parent directory */
201- (boost::format("\\<%s\\>") % _("parent")).str();
202- m_ls->add
203- (parent_string.c_str(),
204- m_parentdir.c_str(),
205- g_gr->images().get("pics/ls_dir.png"));
206+ ((boost::format("\\<%s\\>") % _("parent")).str(),
207+ m_parentdir.c_str(),
208+ g_gr->images().get("pics/ls_dir.png"));
209 }
210
211 const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end();
212@@ -329,7 +328,7 @@
213 try {
214 wml->preload_map(true);
215 m_ls->add
216- (FileSystem::filename_without_ext(name).c_str(),
217+ (FileSystem::filename_without_ext(name),
218 name,
219 g_gr->images().get("pics/ls_wlmap.png"));
220 } catch (const WException &) {} // we simply skip illegal entries
221
222=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
223--- src/editor/ui_menus/editor_player_menu.cc 2014-09-20 09:37:47 +0000
224+++ src/editor/ui_menus/editor_player_menu.cc 2014-10-27 10:39:23 +0000
225@@ -208,7 +208,7 @@
226 number += '0' + nr_players_10;
227 number += '0' + nr_players % 10;
228 /** TRANSLATORS: Default player name, e.g. Player 1 */
229- std::string name = (boost::format(_("Player %s")) % number).str();
230+ const std::string name = (boost::format(_("Player %s")) % number).str();
231 map.set_scenario_player_name(nr_players, name);
232 }
233 map.set_scenario_player_tribe(nr_players, m_tribes[0]);
234
235=== modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc'
236--- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2014-09-10 14:08:25 +0000
237+++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2014-10-27 10:39:23 +0000
238@@ -116,7 +116,7 @@
239 if (!building.is_enhanced() && !building.is_buildable())
240 continue;
241 (m_player.is_building_type_allowed(i) ? m_allowed : m_forbidden).add
242- (building.descname().c_str(), i, building.get_icon());
243+ (building.descname(), i, building.get_icon());
244 }
245 m_forbidden.sort();
246 m_allowed .sort();
247@@ -156,7 +156,7 @@
248 const Widelands::BuildingDescr & building =
249 *m_player.tribe().get_building_descr(building_index);
250 target.add
251- (building.descname().c_str(),
252+ (building.descname(),
253 building_index,
254 building.get_icon());
255 target.sort();
256
257=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc'
258--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2014-09-29 18:01:06 +0000
259+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2014-10-27 10:39:23 +0000
260@@ -126,7 +126,7 @@
261 /** TRANSLATORS: %1% = terrain name, %2% = list of terrain types */
262 const std::string tooltip = ((boost::format("%1%: %2%"))
263 % terrain_descr.descname()
264- % i18n::localize_item_list(tooltips, i18n::ConcatenateWith::AND)).str().c_str();
265+ % i18n::localize_item_list(tooltips, i18n::ConcatenateWith::AND)).str();
266
267 std::unique_ptr<const Image>& image = offscreen_images->back();
268 UI::Checkbox* cb = new UI::Checkbox(parent, Point(0, 0), image.get(), tooltip);
269
270=== modified file 'src/io/filesystem/zip_filesystem.cc'
271--- src/io/filesystem/zip_filesystem.cc 2014-09-30 05:41:55 +0000
272+++ src/io/filesystem/zip_filesystem.cc 2014-10-27 10:39:23 +0000
273@@ -329,11 +329,9 @@
274 break;
275 if (len < 0) {
276 unzCloseCurrentFile(m_unzipfile);
277+ const std::string errormessage = (boost::format("read error %i") % len).str();
278 throw ZipOperationError
279- ("ZipFilesystem::load",
280- fname,
281- m_zipfilename,
282- (boost::format("read error %i") % len).str().c_str());
283+ ("ZipFilesystem::load", fname, m_zipfilename, errormessage.c_str());
284 }
285
286 totallen += len;
287
288=== modified file 'src/logic/critter.cc'
289--- src/logic/critter.cc 2014-09-30 05:41:55 +0000
290+++ src/logic/critter.cc 2014-10-27 10:39:23 +0000
291@@ -154,7 +154,7 @@
292 add_attributes(attributes, std::set<uint32_t>());
293 }
294
295- const std::string defaultpics = (boost::format("%s_walk_!!_??.png") % _name).str().c_str();
296+ const std::string defaultpics = (boost::format("%s_walk_!!_??.png") % _name).str();
297 m_walk_anims.parse(*this, directory, prof, "walk", false, defaultpics);
298
299 while (Section::Value const * const v = global_s.get_next_val("program")) {
300
301=== modified file 'src/logic/production_program.cc'
302--- src/logic/production_program.cc 2014-09-30 20:31:43 +0000
303+++ src/logic/production_program.cc 2014-10-27 10:39:23 +0000
304@@ -54,8 +54,6 @@
305
306 namespace {
307
308-// For formation of better translateable texts
309-using boost::format;
310
311 /**
312 * Convert std::string to any sstream-compatible type
313@@ -268,15 +266,17 @@
314 // TODO(GunChleoc): We can make this more elegant if we add another definition to the conf files,
315 // so for "Log"; we will also have "logs" (numberless plural)
316 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy needs the ware ‘%s’*/
317- return (boost::format(_("the economy needs the ware ‘%s’"))
318+ std::string result = (boost::format(_("the economy needs the ware ‘%s’"))
319 % tribe.get_ware_descr(ware_type)->descname()).str();
320+ return result;
321 }
322 std::string ProductionProgram::ActReturn::EconomyNeedsWare::description_negation
323 (const TribeDescr & tribe) const
324 {
325 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy doesn’t need the ware ‘%s’*/
326- return (boost::format(_("the economy doesn’t need the ware ‘%s’"))
327+ std::string result = (boost::format(_("the economy doesn’t need the ware ‘%s’"))
328 % tribe.get_ware_descr(ware_type)->descname()).str();
329+ return result;
330 }
331
332 bool ProductionProgram::ActReturn::EconomyNeedsWorker::evaluate
333@@ -288,8 +288,9 @@
334 (const TribeDescr & tribe) const
335 {
336 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ... because the economy needs the worker ‘%s’*/
337- return (boost::format(_("the economy needs the worker ‘%s’"))
338+ std::string result = (boost::format(_("the economy needs the worker ‘%s’"))
339 % tribe.get_worker_descr(worker_type)->descname()).str();
340+ return result;
341 }
342
343 std::string ProductionProgram::ActReturn::EconomyNeedsWorker::description_negation
344@@ -297,8 +298,9 @@
345 {
346 /** TRANSLATORS: e.g. Completed/Skipped/Did not start ...*/
347 /** TRANSLATORS: ... because the economy doesn’t need the worker ‘%s’*/
348- return (boost::format(_("the economy doesn’t need the worker ‘%s’"))
349+ std::string result = (boost::format(_("the economy doesn’t need the worker ‘%s’"))
350 % tribe.get_worker_descr(worker_type)->descname()).str();
351+ return result;
352 }
353
354
355@@ -955,7 +957,7 @@
356 /** TRANSLATORS: e.g. 'Did not start working because fish, meat or pitta bread is missing' */
357 (boost::format(ngettext("%s is missing", "%s are missing", nr_missing_groups))
358 % i18n::localize_item_list(group_list, i18n::ConcatenateWith::AND))
359- .str().c_str();
360+ .str();
361
362 std::string result_string =
363 /** TRANSLATORS: e.g. 'Did not start working because 3x water and 3x wheat are missing' */
364@@ -1068,9 +1070,9 @@
365 }
366 std::string ware_list = i18n::localize_item_list(ware_descnames, i18n::ConcatenateWith::AND);
367
368- // Keep translateability in mind!
369 /** TRANSLATORS: %s is a list of wares */
370- ps.set_production_result(str(format(_("Produced %s")) % ware_list));
371+ const std::string result_string = (boost::format(_("Produced %s")) % ware_list).str();
372+ ps.set_production_result(result_string);
373 }
374
375 bool ProductionProgram::ActProduce::get_building_work
376@@ -1164,7 +1166,8 @@
377 std::string unit_string = i18n::localize_item_list(worker_descnames, i18n::ConcatenateWith::AND);
378
379 /** TRANSLATORS: %s is a list of workers */
380- ps.set_production_result((boost::format(_("Recruited %s")) % unit_string).str());
381+ const std::string result_string = (boost::format(_("Recruited %s")) % unit_string).str();
382+ ps.set_production_result(result_string);
383 }
384
385 bool ProductionProgram::ActRecruit::get_building_work
386
387=== modified file 'src/logic/productionsite.cc'
388--- src/logic/productionsite.cc 2014-09-24 21:06:00 +0000
389+++ src/logic/productionsite.cc 2014-10-27 10:39:23 +0000
390@@ -299,7 +299,7 @@
391 ++lastOk;
392 }
393 }
394- // Somehow boost::format doesn't handle correctly uint8_t in this case
395+ // boost::format would treat uint8_t as char
396 const unsigned int percOk = (ok * 100) / STATISTICS_VECTOR_LENGTH;
397 m_last_stat_percent = percOk;
398
399
400=== modified file 'src/logic/soldier.cc'
401--- src/logic/soldier.cc 2014-09-30 05:41:55 +0000
402+++ src/logic/soldier.cc 2014-10-27 10:39:23 +0000
403@@ -137,23 +137,23 @@
404 for (uint32_t i = 0; i <= m_max_hp_level; ++i) {
405 m_hp_pics_fn[i] = dir;
406 m_hp_pics_fn[i] += global_s.get_safe_string((boost::format("hp_level_%u_pic")
407- % i).str().c_str());
408+ % i).str());
409
410 }
411 for (uint32_t i = 0; i <= m_max_attack_level; ++i) {
412 m_attack_pics_fn[i] = dir;
413 m_attack_pics_fn[i] += global_s.get_safe_string((boost::format("attack_level_%u_pic")
414- % i).str().c_str());
415+ % i).str());
416 }
417 for (uint32_t i = 0; i <= m_max_defense_level; ++i) {
418 m_defense_pics_fn[i] = dir;
419 m_defense_pics_fn[i] += global_s.get_safe_string((boost::format("defense_level_%u_pic")
420- % i).str().c_str());
421+ % i).str());
422 }
423 for (uint32_t i = 0; i <= m_max_evade_level; ++i) {
424 m_evade_pics_fn[i] = dir;
425 m_evade_pics_fn[i] += global_s.get_safe_string((boost::format("evade_level_%u_pic")
426- % i).str().c_str());
427+ % i).str());
428 }
429
430 { /// Battle animations
431@@ -1550,7 +1550,7 @@
432 BaseImmovable const * const immovable_dest =
433 map[dest] .get_immovable();
434
435- std::string messagetext =
436+ const std::string messagetext =
437 (boost::format("The game engine has encountered a logic error. The %s "
438 "#%u of player %u could not find a way from (%i, %i) "
439 "(with %s immovable) to the opponent (%s #%u of player "
440
441=== modified file 'src/logic/trainingsite.cc'
442--- src/logic/trainingsite.cc 2014-09-30 05:41:55 +0000
443+++ src/logic/trainingsite.cc 2014-10-27 10:39:23 +0000
444@@ -659,7 +659,7 @@
445
446 return program_start(game, (boost::format("%s%i")
447 % upgrade.prefix.c_str()
448- % level).str().c_str());
449+ % level).str());
450 }
451
452 TrainingSite::Upgrade * TrainingSite::get_upgrade(TrainingAttribute const atr)
453
454=== modified file 'src/logic/tribe.cc'
455--- src/logic/tribe.cc 2014-09-30 05:41:55 +0000
456+++ src/logic/tribe.cc 2014-10-27 10:39:23 +0000
457@@ -433,7 +433,7 @@
458
459 return get_immovable_index((boost::format("resi_%s%i")
460 % res->name().c_str()
461- % bestmatch).str().c_str());
462+ % bestmatch).str());
463 }
464
465 /*
466
467=== modified file 'src/logic/worker.cc'
468--- src/logic/worker.cc 2014-10-18 13:39:27 +0000
469+++ src/logic/worker.cc 2014-10-27 10:39:23 +0000
470@@ -939,7 +939,7 @@
471 (boost::format("<rt image=world/resources/pics/%s4.png>"
472 "<p font-size=14 font-face=DejaVuSerif>%s</p></rt>")
473 % rdescr->name().c_str()
474- % _("A geologist found resources.")).str().c_str();
475+ % _("A geologist found resources.")).str();
476
477 // We should add a message to the player's message queue - but only,
478 // if there is not already a similar one in list.
479@@ -1841,7 +1841,7 @@
480 molog("[return]: Failed to return\n");
481 const std::string message =
482 (boost::format(_("Your %s can't find a way home and will likely die."))
483- % descr().descname().c_str()).str().c_str();
484+ % descr().descname().c_str()).str();
485
486 owner().add_message
487 (game,
488
489=== modified file 'src/map_io/coords_profile.cc'
490--- src/map_io/coords_profile.cc 2014-06-18 13:20:33 +0000
491+++ src/map_io/coords_profile.cc 2014-10-27 10:39:23 +0000
492@@ -71,7 +71,7 @@
493
494 Coords
495 get_safe_coords(const std::string& name, const Extent& extent, Section* section) {
496- return parse_coords(name, section->get_safe_string(name.c_str()), extent);
497+ return parse_coords(name, section->get_safe_string(name), extent);
498 }
499
500 } // namespace Widelands
501
502=== modified file 'src/map_io/map_allowed_building_types_packet.cc'
503--- src/map_io/map_allowed_building_types_packet.cc 2014-09-30 05:41:55 +0000
504+++ src/map_io/map_allowed_building_types_packet.cc 2014-10-27 10:39:23 +0000
505@@ -72,7 +72,7 @@
506 player->allow_building_type(--i, false);
507 try {
508 Section & s = prof.get_safe_section((boost::format("player_%u")
509- % static_cast<unsigned int>(p)).str().c_str());
510+ % static_cast<unsigned int>(p)).str());
511
512 bool allowed;
513 while (const char * const name = s.get_next_bool(nullptr, &allowed)) {
514@@ -108,8 +108,9 @@
515 PlayerNumber const nr_players = egbase.map().get_nrplayers();
516 iterate_players_existing_const(p, nr_players, egbase, player) {
517 const TribeDescr & tribe = player->tribe();
518- Section & section = prof.create_section((boost::format("player_%u")
519- % static_cast<unsigned int>(p)).str().c_str());
520+ const std::string section_key = (boost::format("player_%u")
521+ % static_cast<unsigned int>(p)).str();
522+ Section & section = prof.create_section(section_key.c_str());
523
524 // Write for all buildings if it is enabled.
525 BuildingIndex const nr_buildings = tribe.get_nrbuildings();
526
527=== modified file 'src/map_io/map_allowed_worker_types_packet.cc'
528--- src/map_io/map_allowed_worker_types_packet.cc 2014-09-30 05:41:55 +0000
529+++ src/map_io/map_allowed_worker_types_packet.cc 2014-10-27 10:39:23 +0000
530@@ -59,7 +59,7 @@
531 const TribeDescr & tribe = player->tribe();
532 try {
533 Section* s = prof.get_section((boost::format("player_%u")
534- % static_cast<unsigned int>(p)).str().c_str());
535+ % static_cast<unsigned int>(p)).str());
536 if (s == nullptr)
537 continue;
538
539@@ -93,8 +93,9 @@
540 bool forbidden_worker_seen = false;
541 iterate_players_existing_const(p, egbase.map().get_nrplayers(), egbase, player) {
542 const TribeDescr & tribe = player->tribe();
543- Section & section = prof.create_section((boost::format("player_%u")
544- % static_cast<unsigned int>(p)).str().c_str());
545+ const std::string section_key = (boost::format("player_%u")
546+ % static_cast<unsigned int>(p)).str();
547+ Section & section = prof.create_section(section_key.c_str());
548
549 // Only write the workers which are disabled.
550 for (WareIndex b = 0; b < tribe.get_nrworkers(); ++b) {
551
552=== modified file 'src/map_io/map_player_names_and_tribes_packet.cc'
553--- src/map_io/map_player_names_and_tribes_packet.cc 2014-09-30 05:41:55 +0000
554+++ src/map_io/map_player_names_and_tribes_packet.cc 2014-10-27 10:39:23 +0000
555@@ -68,7 +68,7 @@
556 PlayerNumber const nr_players = map->get_nrplayers();
557 iterate_player_numbers(p, nr_players) {
558 Section & s = prof.get_safe_section((boost::format("player_%u")
559- % static_cast<unsigned int>(p)).str().c_str());
560+ % static_cast<unsigned int>(p)).str());
561 map->set_scenario_player_name (p, s.get_string("name", ""));
562 map->set_scenario_player_tribe (p, s.get_string("tribe", ""));
563 map->set_scenario_player_ai (p, s.get_string("ai", ""));
564@@ -94,8 +94,9 @@
565 const Map & map = egbase.map();
566 PlayerNumber const nr_players = map.get_nrplayers();
567 iterate_player_numbers(p, nr_players) {
568- Section & s = prof.create_section((boost::format("player_%u")
569- % static_cast<unsigned int>(p)).str().c_str());
570+ const std::string section_key = (boost::format("player_%u")
571+ % static_cast<unsigned int>(p)).str();
572+ Section & s = prof.create_section(section_key.c_str());
573 s.set_string("name", map.get_scenario_player_name (p));
574 s.set_string("tribe", map.get_scenario_player_tribe (p));
575 s.set_string("ai", map.get_scenario_player_ai (p));
576
577=== modified file 'src/map_io/map_player_position_packet.cc'
578--- src/map_io/map_player_position_packet.cc 2014-09-30 05:41:55 +0000
579+++ src/map_io/map_player_position_packet.cc 2014-10-27 10:39:23 +0000
580@@ -52,7 +52,7 @@
581 try {
582 map.set_starting_pos(p,
583 get_safe_coords((boost::format("player_%u")
584- % static_cast<unsigned int>(p)).str().c_str(),
585+ % static_cast<unsigned int>(p)).str(),
586 extent, &s));
587 } catch (const WException & e) {
588 throw GameDataError("player %u: %s", p, e.what());
589@@ -79,7 +79,7 @@
590 const Map & map = egbase.map();
591 const PlayerNumber nr_players = map.get_nrplayers();
592 iterate_player_numbers(p, nr_players) {
593- set_coords((boost::format("player_%u") % static_cast<unsigned int>(p)).str().c_str(),
594+ set_coords((boost::format("player_%u") % static_cast<unsigned int>(p)).str(),
595 map.get_starting_pos(p), &s);
596 }
597
598
599=== modified file 'src/map_io/map_players_messages_packet.cc'
600--- src/map_io/map_players_messages_packet.cc 2014-09-30 05:41:55 +0000
601+++ src/map_io/map_players_messages_packet.cc 2014-10-27 10:39:23 +0000
602@@ -46,8 +46,9 @@
603 try {
604 Profile prof;
605 try {
606- prof.read((boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str().c_str(),
607- nullptr, fs);
608+ const std::string profile_filename =
609+ (boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str();
610+ prof.read(profile_filename.c_str(), nullptr, fs);
611 } catch (...) {continue;}
612 prof.get_safe_section("global").get_positive
613 ("packet_version", CURRENT_PACKET_VERSION);
614@@ -183,9 +184,11 @@
615 }
616 }
617 fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE)
618- % static_cast<unsigned int>(p)).str().c_str());
619- prof.write((boost::format(FILENAME_TEMPLATE)
620- % static_cast<unsigned int>(p)).str().c_str(), false, fs);
621+ % static_cast<unsigned int>(p)).str());
622+
623+ const std::string profile_filename =
624+ (boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str();
625+ prof.write(profile_filename.c_str(), false, fs);
626 }
627 }
628
629
630=== modified file 'src/map_io/map_players_view_packet.cc'
631--- src/map_io/map_players_view_packet.cc 2014-09-30 05:41:55 +0000
632+++ src/map_io/map_players_view_packet.cc 2014-10-27 10:39:23 +0000
633@@ -1179,9 +1179,9 @@
634 char filename[FILENAME_SIZE];
635
636 fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE)
637- % static_cast<unsigned int>(plnum)).str().c_str());
638+ % static_cast<unsigned int>(plnum)).str());
639 fs.ensure_directory_exists((boost::format(DIRNAME_TEMPLATE)
640- % static_cast<unsigned int>(plnum)).str().c_str());
641+ % static_cast<unsigned int>(plnum)).str());
642
643 WRITE
644 (unseen_times_file,
645
646=== modified file 'src/network/nethost.cc'
647--- src/network/nethost.cc 2014-10-26 12:17:01 +0000
648+++ src/network/nethost.cc 2014-10-27 10:39:23 +0000
649@@ -64,9 +64,6 @@
650 #include "wui/interactive_player.h"
651 #include "wui/interactive_spectator.h"
652
653-using boost::format;
654-
655-
656
657 struct HostGameSettingsProvider : public GameSettingsProvider {
658 HostGameSettingsProvider(NetHost * const _h) : h(_h), m_lua(nullptr), m_cur_wincondition(0) {}
659@@ -418,9 +415,9 @@
660 } else if (num == -1) {
661 if (!h->is_dedicated())
662 c.recipient = h->get_local_playername();
663- c.msg = (format(_("The client %s could not be found.")) % arg1).str();
664+ c.msg = (boost::format(_("The client %s could not be found.")) % arg1).str();
665 } else {
666- c.msg = (format("HOST WARNING FOR %s: ") % arg1).str();
667+ c.msg = (boost::format("HOST WARNING FOR %s: ") % arg1).str();
668 c.msg += arg2;
669 }
670 }
671@@ -444,12 +441,12 @@
672 } else
673 c.msg = _("You can not kick the dedicated server");
674 else if (num == -1)
675- c.msg = (format(_("The client %s could not be found.")) % arg1).str();
676+ c.msg = (boost::format(_("The client %s could not be found.")) % arg1).str();
677 else {
678 kickClient = num;
679- c.msg = (format(_("Are you sure you want to kick %s?")) % arg1).str() + "<br>";
680- c.msg += (format(_("The stated reason was: %s")) % kickReason).str() + "<br>";
681- c.msg += (format(_("If yes, type: /ack_kick %s")) % arg1).str();
682+ c.msg = (boost::format(_("Are you sure you want to kick %s?")) % arg1).str() + "<br>";
683+ c.msg += (boost::format(_("The stated reason was: %s")) % kickReason).str() + "<br>";
684+ c.msg += (boost::format(_("If yes, type: /ack_kick %s")) % arg1).str();
685 }
686 }
687 if (!h->is_dedicated())
688@@ -736,14 +733,13 @@
689 // May be the server is password protected?
690 Section & s = g_options.pull_section("global");
691 m_password = s.get_string("dedicated_password", "");
692+
693 // And we read the message of the day
694- m_dedicated_motd =
695- s.get_string
696- ("dedicated_motd",
697- (format
698- (_("This is a dedicated server. Send \"@%s help\" to get a full list of available commands."))
699- % d->localplayername)
700- .str().c_str());
701+ const std::string dedicated_motd_key =
702+ (boost::format
703+ (_("This is a dedicated server. Send \"@%s help\" to get a full list of available commands."))
704+ % d->localplayername).str();
705+ m_dedicated_motd = s.get_string("dedicated_motd", dedicated_motd_key.c_str());
706
707 // Maybe this is the first run, so we try to setup the DedicatedLog
708 // empty strings are treated as "do not write this type of log"
709@@ -1242,7 +1238,7 @@
710 return;
711 }
712 std::string temp = arg1 + " " + arg2;
713- c.msg = (format(_("%1$s told me to run the command: \"%2$s\"")) % sender % temp).str();
714+ c.msg = (boost::format(_("%1$s told me to run the command: \"%2$s\"")) % sender % temp).str();
715 c.recipient = "";
716 send(c);
717 d->chat.send(temp);
718@@ -1269,7 +1265,7 @@
719 c.msg = _("Game successfully saved!");
720 else
721 c.msg =
722- (format(_("Could not save the game to the file \"%1$s\"! (%2$s)"))
723+ (boost::format(_("Could not save the game to the file \"%1$s\"! (%2$s)"))
724 % savename % error)
725 .str();
726 send(c);
727@@ -1300,7 +1296,7 @@
728
729 // default
730 } else {
731- c.msg = (format(_("Unknown dedicated server command \"%s\"!")) % cmd).str();
732+ c.msg = (boost::format(_("Unknown dedicated server command \"%s\"!")) % cmd).str();
733 send(c);
734 }
735 }
736@@ -2163,7 +2159,7 @@
737 if (m_password.size() > 1) {
738 c.msg += "<br>";
739 c.msg +=
740- (format
741+ (boost::format
742 (_("This server is password protected. You can send the password with: \"@%s pwd PASSWORD\""))
743 % d->localplayername)
744 .str();
745@@ -2286,7 +2282,7 @@
746 if ((d->clients.at(i).hung_since < (time(nullptr) - 300)) && m_is_dedicated) {
747 disconnect_client(i, "CLIENT_TIMEOUTED");
748 // Try to save the game
749- std::string savename = (boost::format("save/client_hung_%i.wmf") % time(nullptr)).str();;
750+ std::string savename = (boost::format("save/client_hung_%i.wmf") % time(nullptr)).str();
751 std::string * error = new std::string();
752 SaveHandler & sh = d->game->save_handler();
753 if (sh.save_game(*d->game, savename, error))
754
755=== modified file 'src/scripting/lua_bases.cc'
756--- src/scripting/lua_bases.cc 2014-09-18 18:52:34 +0000
757+++ src/scripting/lua_bases.cc 2014-10-27 10:39:23 +0000
758@@ -317,8 +317,10 @@
759 }
760
761 int LuaPlayerBase::__tostring(lua_State * L) {
762- lua_pushstring(L, (boost::format("Player(%i)")
763- % static_cast<unsigned int>(get(L, get_egbase(L)).player_number())).str().c_str());
764+ const std::string pushme =
765+ (boost::format("Player(%i)")
766+ % static_cast<unsigned int>(get(L, get_egbase(L)).player_number())).str();
767+ lua_pushstring(L, pushme.c_str());
768 return 1;
769 }
770 /* RST
771
772=== modified file 'src/scripting/lua_map.cc'
773--- src/scripting/lua_map.cc 2014-10-11 11:14:25 +0000
774+++ src/scripting/lua_map.cc 2014-10-27 10:39:23 +0000
775@@ -3522,7 +3522,8 @@
776 */
777 // Hash is used to identify a class in a Set
778 int LuaField::get___hash(lua_State * L) {
779- lua_pushstring(L, (boost::format("%i_%i") % m_c.x % m_c.y).str().c_str());
780+ const std::string pushme = (boost::format("%i_%i") % m_c.x % m_c.y).str();
781+ lua_pushstring(L, pushme.c_str());
782 return 1;
783 }
784
785@@ -3851,7 +3852,8 @@
786 }
787
788 int LuaField::__tostring(lua_State * L) {
789- lua_pushstring(L, (boost::format("Field(%i,%i)") % m_c.x % m_c.y).str().c_str());
790+ const std::string pushme = (boost::format("Field(%i,%i)") % m_c.x % m_c.y).str();
791+ lua_pushstring(L, pushme);
792 return 1;
793 }
794
795
796=== modified file 'src/ui_basic/helpwindow.cc'
797--- src/ui_basic/helpwindow.cc 2014-09-30 05:41:55 +0000
798+++ src/ui_basic/helpwindow.cc 2014-10-27 10:39:23 +0000
799@@ -37,9 +37,6 @@
800 #include "ui_basic/window.h"
801 #include "wui/text_constants.h"
802
803-
804-using boost::format;
805-
806 namespace UI {
807
808 HelpWindow::HelpWindow
809@@ -48,7 +45,7 @@
810 uint32_t fontsize,
811 uint32_t width, uint32_t height)
812 :
813- Window(parent, "help_window", 0, 0, 20, 20, (boost::format(_("Help: %s")) % caption).str().c_str()),
814+ Window(parent, "help_window", 0, 0, 20, 20, (boost::format(_("Help: %s")) % caption).str()),
815 textarea(new MultilineTextarea(this, 5, 5, 30, 30, std::string(), Align_Left)),
816 m_h1(std::to_string(fontsize < 12 ? 18 : fontsize * 3 / 2)),
817 m_h2(std::to_string(fontsize < 12 ? 12 : fontsize)),
818@@ -191,7 +188,7 @@
819 uint32_t width, uint32_t height)
820 :
821 UI::UniqueWindow(parent, "help_window", &reg, width, height,
822- (boost::format(_("Help: %s")) % building_description.descname()).str().c_str()),
823+ (boost::format(_("Help: %s")) % building_description.descname()).str()),
824 textarea(new MultilineTextarea(this, 5, 5, width - 10, height -10, std::string(), Align_Left))
825 {
826 try {
827
828=== modified file 'src/ui_basic/listselect.cc'
829--- src/ui_basic/listselect.cc 2014-09-10 14:48:40 +0000
830+++ src/ui_basic/listselect.cc 2014-10-27 10:39:23 +0000
831@@ -119,7 +119,7 @@
832 * sel if true, directly select the new entry
833 */
834 void BaseListselect::add
835- (char const * const name,
836+ (const std::string& name,
837 uint32_t entry,
838 const Image* pic,
839 bool const sel,
840@@ -130,7 +130,7 @@
841 er->m_entry = entry;
842 er->pic = pic;
843 er->use_clr = false;
844- er->name = std::string(name);
845+ er->name = name;
846 er->tooltip = tooltip_text;
847 uint32_t entry_height = 0;
848 if (!pic) {
849@@ -158,7 +158,7 @@
850 }
851
852 void BaseListselect::add_front
853- (char const * const name,
854+ (const std::string& name,
855 const Image* pic,
856 bool const sel,
857 const std::string & tooltip_text)
858@@ -172,7 +172,7 @@
859
860 er->pic = pic;
861 er->use_clr = false;
862- er->name = std::string(name);
863+ er->name = name;
864 er->tooltip = tooltip_text;
865
866 uint32_t entry_height = 0;
867
868=== modified file 'src/ui_basic/listselect.h'
869--- src/ui_basic/listselect.h 2014-09-14 11:31:58 +0000
870+++ src/ui_basic/listselect.h 2014-10-27 10:39:23 +0000
871@@ -60,13 +60,13 @@
872 (const uint32_t Begin = 0,
873 uint32_t End = std::numeric_limits<uint32_t>::max());
874 void add
875- (const char * const name,
876+ (const std::string& name,
877 uint32_t value,
878 const Image* pic = nullptr,
879 const bool select_this = false,
880 const std::string & tooltip_text = std::string());
881 void add_front
882- (const char * const name,
883+ (const std::string& name,
884 const Image* pic = nullptr,
885 const bool select_this = false,
886 const std::string & tooltip_text = std::string());
887@@ -166,7 +166,7 @@
888 {}
889
890 void add
891- (const char * const name,
892+ (const std::string& name,
893 Entry value,
894 const Image* pic = nullptr,
895 const bool select_this = false,
896@@ -176,7 +176,7 @@
897 BaseListselect::add(name, m_entry_cache.size() - 1, pic, select_this, tooltip_text);
898 }
899 void add_front
900- (const char * const name,
901+ (const std::string& name,
902 Entry value,
903 const Image* pic = nullptr,
904 const bool select_this = false,
905@@ -221,7 +221,7 @@
906 {}
907
908 void add
909- (const char * const name,
910+ (const std::string& name,
911 Entry & value,
912 const Image* pic = nullptr,
913 const bool select_this = false,
914@@ -230,7 +230,7 @@
915 Base::add(name, &value, pic, select_this, tooltip_text);
916 }
917 void add_front
918- (const char * const name,
919+ (const std::string& name,
920 Entry & value,
921 const Image* pic = nullptr,
922 const bool select_this = false,
923
924=== modified file 'src/ui_fsmenu/editor_mapselect.cc'
925--- src/ui_fsmenu/editor_mapselect.cc 2014-09-30 05:41:55 +0000
926+++ src/ui_fsmenu/editor_mapselect.cc 2014-10-27 10:39:23 +0000
927@@ -209,12 +209,11 @@
928 #else
929 m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\'));
930 #endif
931- std::string parent_string =
932+
933+ m_list.add
934 /** TRANSLATORS: Parent directory */
935- (boost::format("\\<%s\\>") % _("parent")).str();
936- m_list.add
937- (parent_string.c_str(),
938- m_parentdir.c_str(),
939+ ((boost::format("\\<%s\\>") % _("parent")).str(),
940+ m_parentdir.c_str(),
941 g_gr->images().get("pics/ls_dir.png"));
942 }
943
944
945=== modified file 'src/ui_fsmenu/internet_lobby.cc'
946--- src/ui_fsmenu/internet_lobby.cc 2014-09-20 09:37:47 +0000
947+++ src/ui_fsmenu/internet_lobby.cc 2014-10-27 10:39:23 +0000
948@@ -249,7 +249,7 @@
949 // than one server with the same name.
950 if (games.at(i).name == localservername)
951 hostgame.set_enabled(false);
952- opengames.add(games.at(i).name.c_str(), games.at(i), pic, false, games.at(i).build_id);
953+ opengames.add(games.at(i).name, games.at(i), pic, false, games.at(i).build_id);
954 }
955 }
956
957
958=== modified file 'src/ui_fsmenu/launch_mpg.cc'
959--- src/ui_fsmenu/launch_mpg.cc 2014-10-26 12:17:01 +0000
960+++ src/ui_fsmenu/launch_mpg.cc 2014-10-27 10:39:23 +0000
961@@ -45,8 +45,6 @@
962 #include "wui/multiplayersetupgroup.h"
963 #include "wui/text_constants.h"
964
965-using boost::format;
966-
967 /// Simple user interaction window for selecting either map, save or cancel
968 struct MapOrSaveSelectionWindow : public UI::Window {
969 MapOrSaveSelectionWindow
970@@ -484,10 +482,10 @@
971 std::string temp =
972 (settings.playernum > -1) && (settings.playernum < MAX_PLAYERS)
973 ?
974- (format(_("Player %i")) % (settings.playernum + 1)).str()
975+ (boost::format(_("Player %i")) % (settings.playernum + 1)).str()
976 :
977 _("Spectator");
978- temp = (format(_("At the moment you are %s")) % temp.c_str()).str() + "\n\n";
979+ temp = (boost::format(_("At the moment you are %s")) % temp.c_str()).str() + "\n\n";
980 temp += _("Click on the ‘?’ in the top right corner to get help.");
981 m_client_info.set_text(temp);
982 }
983@@ -557,7 +555,7 @@
984 for (; i <= m_nr_players; ++i) {
985 infotext += "\n* ";
986 Section & s = prof.get_safe_section((boost::format("player_%u")
987- % static_cast<unsigned int>(i)).str().c_str());
988+ % static_cast<unsigned int>(i)).str());
989 player_save_name [i - 1] = s.get_string("name");
990 player_save_tribe[i - 1] = s.get_string("tribe");
991 player_save_ai [i - 1] = s.get_string("ai");
992@@ -639,12 +637,12 @@
993
994 std::string infotext;
995 infotext += std::string(_("Map details:")) + "\n";
996- infotext += std::string("• ") + (format(_("Size: %1$u x %2$u"))
997+ infotext += std::string("• ") + (boost::format(_("Size: %1$u x %2$u"))
998 % map.get_width() % map.get_height()).str() + "\n";
999- infotext += std::string("• ") + (format(ngettext("%u Player", "%u Players", m_nr_players))
1000+ infotext += std::string("• ") + (boost::format(ngettext("%u Player", "%u Players", m_nr_players))
1001 % m_nr_players).str() + "\n";
1002 if (m_settings->settings().scenario)
1003- infotext += std::string("• ") + (format(_("Scenario mode selected"))).str() + "\n";
1004+ infotext += std::string("• ") + (boost::format(_("Scenario mode selected"))).str() + "\n";
1005 infotext += "\n";
1006 infotext += map.get_description();
1007 infotext += "\n";
1008
1009=== modified file 'src/ui_fsmenu/loadgame.cc'
1010--- src/ui_fsmenu/loadgame.cc 2014-10-11 16:08:10 +0000
1011+++ src/ui_fsmenu/loadgame.cc 2014-10-27 10:39:23 +0000
1012@@ -294,7 +294,7 @@
1013 if (m_settings && !m_settings->settings().saved_games.empty()) {
1014 for (uint32_t i = 0; i < m_settings->settings().saved_games.size(); ++i) {
1015 const char * path = m_settings->settings().saved_games.at(i).path.c_str();
1016- m_list.add(FileSystem::filename_without_ext(path).c_str(), path);
1017+ m_list.add(FileSystem::filename_without_ext(path), path);
1018 }
1019 } else { // Normal case
1020 // Fill it with all files we find.
1021@@ -365,7 +365,7 @@
1022 }
1023 // End localization section
1024
1025- m_list.add(displaytitle.c_str(), name);
1026+ m_list.add(displaytitle, name);
1027 } catch (const WException &) {
1028 // we simply skip illegal entries
1029 }
1030
1031=== modified file 'src/ui_fsmenu/loadreplay.cc'
1032--- src/ui_fsmenu/loadreplay.cc 2014-10-11 16:08:10 +0000
1033+++ src/ui_fsmenu/loadreplay.cc 2014-10-27 10:39:23 +0000
1034@@ -291,7 +291,7 @@
1035 }
1036 // End localization section
1037
1038- m_list.add(displaytitle.c_str(), *pname);
1039+ m_list.add(displaytitle, *pname);
1040 } catch (const WException &) {} // we simply skip illegal entries
1041 }
1042
1043
1044=== modified file 'src/ui_fsmenu/options.cc'
1045--- src/ui_fsmenu/options.cc 2014-09-29 19:25:24 +0000
1046+++ src/ui_fsmenu/options.cc 2014-10-27 10:39:23 +0000
1047@@ -79,7 +79,7 @@
1048 std::sort(entries.begin(), entries.end());
1049
1050 for (const LanguageEntry& entry : entries) {
1051- list->add(entry.descname.c_str(), entry.abbreviation, nullptr, entry.abbreviation == language);
1052+ list->add(entry.descname, entry.abbreviation, nullptr, entry.abbreviation == language);
1053 }
1054 }
1055
1056@@ -367,13 +367,13 @@
1057 /** TRANSLATORS: Screen resolution, e.g. 800 x 600*/
1058 m_reslist.add((boost::format(_("%1% x %2%"))
1059 % m_resolutions[i].xres
1060- % m_resolutions[i].yres).str().c_str(),
1061+ % m_resolutions[i].yres).str(),
1062 nullptr, nullptr, selected);
1063 }
1064 if (!did_select_a_res) {
1065 m_reslist.add((boost::format(_("%1% x %2%"))
1066 % opt.xres
1067- % opt.yres).str().c_str(),
1068+ % opt.yres).str(),
1069 nullptr, nullptr, true);
1070 uint32_t entry = m_resolutions.size();
1071 m_resolutions.resize(entry + 1);
1072
1073=== modified file 'src/wlapplication.cc'
1074--- src/wlapplication.cc 2014-10-16 05:54:05 +0000
1075+++ src/wlapplication.cc 2014-10-27 10:39:23 +0000
1076@@ -532,7 +532,7 @@
1077 g_fs->ensure_directory_exists(SCREENSHOT_DIR);
1078 for (uint32_t nr = 0; nr < 10000; ++nr) {
1079 const std::string filename = (boost::format(SCREENSHOT_DIR "/shot%04u.png")
1080- % nr).str().c_str();
1081+ % nr).str();
1082 if (g_fs->file_exists(filename))
1083 continue;
1084 g_gr->screenshot(filename);
1085
1086=== modified file 'src/wui/actionconfirm.cc'
1087--- src/wui/actionconfirm.cc 2014-09-10 14:48:40 +0000
1088+++ src/wui/actionconfirm.cc 2014-10-27 10:39:23 +0000
1089@@ -31,7 +31,6 @@
1090 #include "ui_basic/window.h"
1091 #include "wui/interactive_player.h"
1092
1093-using boost::format;
1094
1095 struct ActionConfirm : public UI::Window {
1096 ActionConfirm
1097@@ -148,7 +147,7 @@
1098 new UI::MultilineTextarea
1099 (this,
1100 0, 0, 200, 74,
1101- (format(message) % building.descr().descname()).str(),
1102+ (boost::format(message) % building.descr().descname()).str(),
1103 UI::Align_Center);
1104
1105 UI::Button * okbtn =
1106
1107=== modified file 'src/wui/encyclopedia_window.cc'
1108--- src/wui/encyclopedia_window.cc 2014-09-30 05:41:55 +0000
1109+++ src/wui/encyclopedia_window.cc 2014-10-27 10:39:23 +0000
1110@@ -99,7 +99,7 @@
1111
1112 for (uint32_t i = 0; i < ware_vec.size(); i++) {
1113 Ware cur = ware_vec[i];
1114- wares.add(cur.m_descr->descname().c_str(), cur.m_i, cur.m_descr->icon());
1115+ wares.add(cur.m_descr->descname(), cur.m_i, cur.m_descr->icon());
1116 }
1117 }
1118
1119@@ -124,7 +124,7 @@
1120 &&
1121 de->output_ware_types().count(wares.get_selected()))
1122 {
1123- prodSites.add(de->descname().c_str(), i, de->get_icon());
1124+ prodSites.add(de->descname(), i, de->get_icon());
1125 found = true;
1126 }
1127 }
1128
1129=== modified file 'src/wui/game_debug_ui.cc'
1130--- src/wui/game_debug_ui.cc 2014-09-30 05:41:55 +0000
1131+++ src/wui/game_debug_ui.cc 2014-10-27 10:39:23 +0000
1132@@ -180,7 +180,7 @@
1133 }
1134 UI::Window::think();
1135 } else {
1136- set_title((boost::format("DEAD: %u") % m_serial).str().c_str());
1137+ set_title((boost::format("DEAD: %u") % m_serial).str());
1138 }
1139
1140 }
1141@@ -375,7 +375,7 @@
1142 {
1143 m_ui_immovable.set_title((boost::format("%s (%u)")
1144 % imm->descr().name().c_str()
1145- % imm->serial()).str().c_str());
1146+ % imm->serial()).str());
1147 m_ui_immovable.set_enabled(true);
1148 } else {
1149 m_ui_immovable.set_title("no immovable");
1150@@ -420,7 +420,7 @@
1151 m_ui_bobs.add(
1152 (boost::format("%s (%u)")
1153 % temp_bob->descr().name()
1154- % temp_bob->serial()).str().c_str(),
1155+ % temp_bob->serial()).str(),
1156 temp_bob->serial());
1157 }
1158 }
1159
1160=== modified file 'src/wui/game_main_menu_save_game.cc'
1161--- src/wui/game_main_menu_save_game.cc 2014-10-07 10:20:18 +0000
1162+++ src/wui/game_main_menu_save_game.cc 2014-10-27 10:39:23 +0000
1163@@ -34,8 +34,6 @@
1164 #include "profile/profile.h"
1165 #include "wui/interactive_gamebase.h"
1166
1167-using boost::format;
1168-
1169 InteractiveGameBase & GameMainMenuSaveGame::igbase() {
1170 return ref_cast<InteractiveGameBase, UI::Panel>(*get_parent());
1171 }
1172@@ -168,14 +166,10 @@
1173 m_gametime.set_text(gametimestring(gametime));
1174
1175 if (gpdp.get_number_of_players() > 0) {
1176- char buf[200];
1177- sprintf
1178- (buf, "%i %s", gpdp.get_number_of_players(),
1179- // TODO(GunChleoc): This should be ngettext(" %i player" etc.
1180- // with boost::format, but it refuses to work
1181- /** TRANSLATORS: This is preceded by a number */
1182- ngettext("player", "players", gpdp.get_number_of_players()));
1183- m_players_label.set_text(buf);
1184+ const std::string text =
1185+ (boost::format(ngettext("%u Player", "%u Players", gpdp.get_number_of_players()))
1186+ % static_cast<unsigned int>(gpdp.get_number_of_players())).str();
1187+ m_players_label.set_text(text);
1188 } else {
1189 // Keep label empty
1190 m_players_label.set_text("");
1191@@ -212,7 +206,7 @@
1192 try {
1193 Widelands::GameLoader gl(name, igbase().game());
1194 gl.preload_game(gpdp);
1195- m_ls.add(FileSystem::filename_without_ext(name).c_str(), name);
1196+ m_ls.add(FileSystem::filename_without_ext(name), name);
1197 } catch (const WException &) {} // we simply skip illegal entries
1198 }
1199 }
1200@@ -325,7 +319,7 @@
1201 (&parent,
1202 _("File deletion"),
1203 str
1204- (format(_("Do you really want to delete the file %s?")) %
1205+ (boost::format(_("Do you really want to delete the file %s?")) %
1206 FileSystem::fs_filename(filename.c_str())),
1207 YESNO),
1208 m_filename(filename)
1209
1210=== modified file 'src/wui/game_objectives_menu.cc'
1211--- src/wui/game_objectives_menu.cc 2014-09-14 11:31:58 +0000
1212+++ src/wui/game_objectives_menu.cc 2014-10-27 10:39:23 +0000
1213@@ -71,7 +71,7 @@
1214 for (uint32_t j = 0;; ++j)
1215 if (j == list_size) { // the objective is not in our list
1216 if (should_show)
1217- list.add(obj.descname().c_str(), obj);
1218+ list.add(obj.descname(), obj);
1219 break;
1220 } else if (&list[j] == &obj) { // the objective is in our list
1221 if (!should_show)
1222@@ -79,7 +79,7 @@
1223 else if (list[j].descname() != obj.descname() || list[j].descr() != obj.descr()) {
1224 // Update
1225 list.remove(j);
1226- list.add(obj.descname().c_str(), obj);
1227+ list.add(obj.descname(), obj);
1228 }
1229 break;
1230 }
1231
1232=== modified file 'src/wui/general_statistics_menu.cc'
1233--- src/wui/general_statistics_menu.cc 2014-09-18 18:52:34 +0000
1234+++ src/wui/general_statistics_menu.cc 2014-10-27 10:39:23 +0000
1235@@ -148,7 +148,7 @@
1236
1237 iterate_players_existing_const(p, nr_players, game, player) {
1238 const std::string pic = (boost::format("pics/genstats_enable_plr_%02u.png")
1239- % static_cast<unsigned int>(p)).str().c_str();
1240+ % static_cast<unsigned int>(p)).str();
1241 UI::Button & cb =
1242 *new UI::Button
1243 (hbox1, "playerbutton",
1244
1245=== modified file 'src/wui/interactive_base.cc'
1246--- src/wui/interactive_base.cc 2014-10-19 16:24:33 +0000
1247+++ src/wui/interactive_base.cc 2014-10-27 10:39:23 +0000
1248@@ -57,7 +57,6 @@
1249 #include "wui/text_layout.h"
1250 #include "wui/unique_window_handler.h"
1251
1252-using boost::format;
1253 using Widelands::Area;
1254 using Widelands::CoordPath;
1255 using Widelands::Coords;
1256@@ -329,12 +328,12 @@
1257 (real == 1000 ? std::string() : speed_string(real));
1258 else {
1259 m_label_speed.set_text(
1260- (format
1261+ (boost::format
1262 /** TRANSLATORS: actual_speed (desired_speed) */
1263 (_("%1$s (%2$s)"))
1264 % speed_string(real).c_str()
1265 % speed_string(desired).c_str()
1266- ).str().c_str()
1267+ ).str()
1268 );
1269 }
1270 } else
1271@@ -407,7 +406,7 @@
1272 const std::string gametime(gametimestring(egbase().get_gametime()));
1273 const std::string gametime_text = as_uifont(gametime, UI_FONT_SIZE_SMALL);
1274 dst.blit(Point(5, 5), UI::g_fh1->render(gametime_text), CM_Normal, UI::Align_TopLeft);
1275- static format node_format("(%i, %i)");
1276+ static boost::format node_format("(%i, %i)");
1277
1278 const std::string node_text = as_uifont
1279 ((node_format % m_sel.pos.node.x % m_sel.pos.node.y).str(), UI_FONT_SIZE_SMALL);
1280@@ -421,7 +420,7 @@
1281
1282 // Blit FPS when in debug mode.
1283 if (get_display_flag(dfDebug)) {
1284- static format fps_format("%5.1f fps (avg: %5.1f fps)");
1285+ static boost::format fps_format("%5.1f fps (avg: %5.1f fps)");
1286 const std::string fps_text = as_uifont
1287 ((fps_format %
1288 (1000.0 / m_frametime) % (1000.0 / (m_avg_usframetime / 1000)))
1289@@ -993,7 +992,7 @@
1290
1291 if (!obj) {
1292 DebugConsole::write
1293- (str(format("No MapObject with serial number %1%") % serial));
1294+ (str(boost::format("No MapObject with serial number %1%") % serial));
1295 return;
1296 }
1297
1298
1299=== modified file 'src/wui/interactive_player.cc'
1300--- src/wui/interactive_player.cc 2014-09-19 12:54:54 +0000
1301+++ src/wui/interactive_player.cc 2014-10-27 10:39:23 +0000
1302@@ -60,8 +60,6 @@
1303
1304 using Widelands::Building;
1305 using Widelands::Map;
1306-using boost::format;
1307-
1308
1309 namespace {
1310
1311@@ -456,13 +454,13 @@
1312
1313 int const n = atoi(args[1].c_str());
1314 if (n < 1 || n > MAX_PLAYERS || !game().get_player(n)) {
1315- DebugConsole::write(str(format("Player #%1% does not exist.") % n));
1316+ DebugConsole::write(str(boost::format("Player #%1% does not exist.") % n));
1317 return;
1318 }
1319
1320 DebugConsole::write
1321 (str
1322- (format("Switching from #%1% to #%2%.")
1323+ (boost::format("Switching from #%1% to #%2%.")
1324 % static_cast<int>(m_player_number) % n));
1325 m_player_number = n;
1326 Map & map = egbase().map();
1327
1328=== modified file 'src/wui/multiplayersetupgroup.cc'
1329--- src/wui/multiplayersetupgroup.cc 2014-10-26 12:17:01 +0000
1330+++ src/wui/multiplayersetupgroup.cc 2014-10-27 10:39:23 +0000
1331@@ -121,7 +121,7 @@
1332 pic = (boost::format("pics/genstats_enable_plr_0%u.png")
1333 % static_cast<unsigned int>(us.position + 1)).str();
1334 temp_tooltip = (boost::format(_("Player %u"))
1335- % static_cast<unsigned int>(us.position + 1)).str().c_str();
1336+ % static_cast<unsigned int>(us.position + 1)).str();
1337 } else {
1338 pic = "pics/menu_tab_watch.png";
1339 temp_tooltip = _("Spectator");
1340@@ -174,7 +174,7 @@
1341 set_size(w, h);
1342
1343 const std::string pic = (boost::format("pics/fsel_editor_set_player_0%i_pos.png")
1344- % static_cast<unsigned int>(id + 1)).str().c_str();
1345+ % static_cast<unsigned int>(id + 1)).str();
1346 player =
1347 new UI::Icon(this, 0, 0, h, h, g_gr->images().get(pic));
1348 add(player, UI::Box::AlignCenter);
1349@@ -288,11 +288,11 @@
1350 type ->set_pic(g_gr->images().get("pics/shared_in.png"));
1351
1352 const std::string pic = (boost::format("pics/fsel_editor_set_player_0%u_pos.png")
1353- % static_cast<unsigned int>(player_setting.shared_in)).str().c_str();
1354+ % static_cast<unsigned int>(player_setting.shared_in)).str();
1355
1356 tribe->set_pic(g_gr->images().get(pic));
1357 tribe->set_tooltip((boost::format(_("Player %u"))
1358- % static_cast<unsigned int>(player_setting.shared_in)).str().c_str());
1359+ % static_cast<unsigned int>(player_setting.shared_in)).str());
1360
1361 team ->set_visible(false);
1362 team ->set_enabled(false);
1363
1364=== modified file 'src/wui/plot_area.cc'
1365--- src/wui/plot_area.cc 2014-09-18 18:52:34 +0000
1366+++ src/wui/plot_area.cc 2014-10-27 10:39:23 +0000
1367@@ -35,7 +35,6 @@
1368 #include "wui/text_layout.h"
1369
1370 using namespace std;
1371-using boost::format;
1372
1373 namespace {
1374
1375@@ -71,7 +70,8 @@
1376 };
1377
1378 string ytick_text_style(const string& text, const RGBColor& clr) {
1379- static format f("<rt><p><font face=DejaVuSansCondensed size=13 color=%02x%02x%02x>%s</font></p></rt>");
1380+ static boost::format
1381+ f("<rt><p><font face=DejaVuSansCondensed size=13 color=%02x%02x%02x>%s</font></p></rt>");
1382 f % int(clr.r) % int(clr.g) % int(clr.b);
1383 f % text;
1384 return f.str();

Subscribers

People subscribed via source and target branches

to status/vote changes: