Merge lp:~widelands-dev/widelands/bug-1385859 into lp:widelands
- bug-1385859
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | Approve | ||
Review via email: mp+239705@code.launchpad.net |
Commit message
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.
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 | 33 | 33 | ||
6 | 34 | ScopedTimer::~ScopedTimer() { | 34 | ScopedTimer::~ScopedTimer() { |
7 | 35 | uint32_t ms_in_existance = SDL_GetTicks() - startime_; | 35 | uint32_t ms_in_existance = SDL_GetTicks() - startime_; |
10 | 36 | 36 | const std::string logmessage = (boost::format(message_) % ms_in_existance).str(); | |
11 | 37 | log("%s\n", (boost::format(message_) % ms_in_existance).str().c_str()); | 37 | log("%s\n", logmessage.c_str()); |
12 | 38 | } | 38 | } |
13 | 39 | 39 | ||
14 | 40 | uint32_t ScopedTimer::ms_since_last_query() { | 40 | uint32_t ScopedTimer::ms_since_last_query() { |
15 | 41 | 41 | ||
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 | 177 | 177 | ||
21 | 178 | m_size ->set_text((boost::format(_("%1$ix%2$i")) | 178 | m_size ->set_text((boost::format(_("%1$ix%2$i")) |
22 | 179 | % map.get_width() | 179 | % map.get_width() |
24 | 180 | % map.get_height()).str().c_str()); | 180 | % map.get_height()).str()); |
25 | 181 | } else { | 181 | } else { |
26 | 182 | m_name ->set_text(""); | 182 | m_name ->set_text(""); |
27 | 183 | m_name ->set_tooltip(""); | 183 | m_name ->set_tooltip(""); |
28 | @@ -207,13 +207,12 @@ | |||
29 | 207 | #else | 207 | #else |
30 | 208 | m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\')); | 208 | m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\')); |
31 | 209 | #endif | 209 | #endif |
33 | 210 | std::string parent_string = | 210 | |
34 | 211 | m_ls->add | ||
35 | 211 | /** TRANSLATORS: Parent directory */ | 212 | /** TRANSLATORS: Parent directory */ |
41 | 212 | (boost::format("\\<%s\\>") % _("parent")).str(); | 213 | ((boost::format("\\<%s\\>") % _("parent")).str(), |
42 | 213 | m_ls->add | 214 | m_parentdir.c_str(), |
43 | 214 | (parent_string.c_str(), | 215 | g_gr->images().get("pics/ls_dir.png")); |
39 | 215 | m_parentdir.c_str(), | ||
40 | 216 | g_gr->images().get("pics/ls_dir.png")); | ||
44 | 217 | } | 216 | } |
45 | 218 | 217 | ||
46 | 219 | const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end(); | 218 | const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end(); |
47 | @@ -248,7 +247,7 @@ | |||
48 | 248 | try { | 247 | try { |
49 | 249 | map_loader->preload_map(true); | 248 | map_loader->preload_map(true); |
50 | 250 | m_ls->add | 249 | m_ls->add |
52 | 251 | (FileSystem::filename_without_ext(name).c_str(), | 250 | (FileSystem::filename_without_ext(name), |
53 | 252 | name, | 251 | name, |
54 | 253 | g_gr->images().get | 252 | g_gr->images().get |
55 | 254 | (dynamic_cast<WidelandsMapLoader*>(map_loader.get()) | 253 | (dynamic_cast<WidelandsMapLoader*>(map_loader.get()) |
56 | 255 | 254 | ||
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 | 118 | 118 | ||
62 | 119 | m_size ->set_text((boost::format(_("%1$ix%2$i")) | 119 | m_size ->set_text((boost::format(_("%1$ix%2$i")) |
63 | 120 | % map.get_width() | 120 | % map.get_width() |
65 | 121 | % map.get_height()).str().c_str()); | 121 | % map.get_height()).str()); |
66 | 122 | m_author->set_text(map.get_author()); | 122 | m_author->set_text(map.get_author()); |
67 | 123 | m_name ->set_text(map.get_name()); | 123 | m_name ->set_text(map.get_name()); |
68 | 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()))); |
69 | 125 | 125 | ||
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 | 62 | } | 62 | } |
75 | 63 | 63 | ||
76 | 64 | m_width = new UI::Textarea(this, posx + spacing + 20, posy, | 64 | m_width = new UI::Textarea(this, posx + spacing + 20, posy, |
78 | 65 | (boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str().c_str()); | 65 | (boost::format(_("Width: %u")) % Widelands::MAP_DIMENSIONS[m_w]).str()); |
79 | 66 | 66 | ||
80 | 67 | UI::Button * widthupbtn = new UI::Button | 67 | UI::Button * widthupbtn = new UI::Button |
81 | 68 | (this, "width_up", | 68 | (this, "width_up", |
82 | @@ -82,7 +82,7 @@ | |||
83 | 82 | 82 | ||
84 | 83 | m_height = new UI::Textarea(this, posx + spacing + 20, posy, | 83 | m_height = new UI::Textarea(this, posx + spacing + 20, posy, |
85 | 84 | (boost::format(_("Height: %u")) | 84 | (boost::format(_("Height: %u")) |
87 | 85 | % Widelands::MAP_DIMENSIONS[m_h]).str().c_str()); | 85 | % Widelands::MAP_DIMENSIONS[m_h]).str()); |
88 | 86 | 86 | ||
89 | 87 | UI::Button * heightupbtn = new UI::Button | 87 | UI::Button * heightupbtn = new UI::Button |
90 | 88 | (this, "height_up", | 88 | (this, "height_up", |
91 | 89 | 89 | ||
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 | 123 | 123 | ||
97 | 124 | m_width = new UI::Textarea(this, posx + spacing + height, posy, | 124 | m_width = new UI::Textarea(this, posx + spacing + height, posy, |
98 | 125 | (boost::format(_("Width: %u")) | 125 | (boost::format(_("Width: %u")) |
100 | 126 | % Widelands::MAP_DIMENSIONS[m_w]).str().c_str()); | 126 | % Widelands::MAP_DIMENSIONS[m_w]).str()); |
101 | 127 | 127 | ||
102 | 128 | posy += height + 2 * spacing; | 128 | posy += height + 2 * spacing; |
103 | 129 | 129 | ||
104 | @@ -131,7 +131,7 @@ | |||
105 | 131 | 131 | ||
106 | 132 | m_height = new UI::Textarea(this, posx + spacing + height, posy, | 132 | m_height = new UI::Textarea(this, posx + spacing + height, posy, |
107 | 133 | (boost::format(_("Height: %u")) | 133 | (boost::format(_("Height: %u")) |
109 | 134 | % Widelands::MAP_DIMENSIONS[m_h]).str().c_str()); | 134 | % Widelands::MAP_DIMENSIONS[m_h]).str()); |
110 | 135 | 135 | ||
111 | 136 | UI::Button * heightupbtn = new UI::Button | 136 | UI::Button * heightupbtn = new UI::Button |
112 | 137 | (this, "height_up", | 137 | (this, "height_up", |
113 | @@ -171,7 +171,7 @@ | |||
114 | 171 | (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WATER_MINUS)); | 171 | (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WATER_MINUS)); |
115 | 172 | 172 | ||
116 | 173 | m_water = new UI::Textarea(this, posx + spacing + height, posy, | 173 | m_water = new UI::Textarea(this, posx + spacing + height, posy, |
118 | 174 | (boost::format(_("Water: %i %%")) % m_waterval).str().c_str()); | 174 | (boost::format(_("Water: %i %%")) % m_waterval).str()); |
119 | 175 | 175 | ||
120 | 176 | posy += height + 2 * spacing; | 176 | posy += height + 2 * spacing; |
121 | 177 | 177 | ||
122 | @@ -196,7 +196,7 @@ | |||
123 | 196 | (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::LAND_MINUS)); | 196 | (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::LAND_MINUS)); |
124 | 197 | 197 | ||
125 | 198 | m_land = new UI::Textarea(this, posx + spacing + height, posy, | 198 | m_land = new UI::Textarea(this, posx + spacing + height, posy, |
127 | 199 | (boost::format(_("Land: %i %%")) % m_landval).str().c_str()); | 199 | (boost::format(_("Land: %i %%")) % m_landval).str()); |
128 | 200 | 200 | ||
129 | 201 | posy += height + 2 * spacing; | 201 | posy += height + 2 * spacing; |
130 | 202 | 202 | ||
131 | @@ -221,7 +221,7 @@ | |||
132 | 221 | (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WASTE_MINUS)); | 221 | (boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::WASTE_MINUS)); |
133 | 222 | 222 | ||
134 | 223 | m_wasteland = new UI::Textarea(this, posx + spacing + height, posy, | 223 | m_wasteland = new UI::Textarea(this, posx + spacing + height, posy, |
136 | 224 | (boost::format(_("Wasteland: %i %%")) % m_wastelandval).str().c_str()); | 224 | (boost::format(_("Wasteland: %i %%")) % m_wastelandval).str()); |
137 | 225 | 225 | ||
138 | 226 | posy += height + 2 * spacing; | 226 | posy += height + 2 * spacing; |
139 | 227 | 227 | ||
140 | @@ -230,7 +230,7 @@ | |||
141 | 230 | // ---------- Mountains ----------- | 230 | // ---------- Mountains ----------- |
142 | 231 | 231 | ||
143 | 232 | m_mountains = new UI::Textarea(this, posx + spacing + height, posy, | 232 | m_mountains = new UI::Textarea(this, posx + spacing + height, posy, |
145 | 233 | (boost::format(_("Mountains: %i %%")) % m_mountainsval).str().c_str()); | 233 | (boost::format(_("Mountains: %i %%")) % m_mountainsval).str()); |
146 | 234 | 234 | ||
147 | 235 | posy += height + 2 * spacing; | 235 | posy += height + 2 * spacing; |
148 | 236 | 236 | ||
149 | @@ -317,7 +317,7 @@ | |||
150 | 317 | 317 | ||
151 | 318 | m_players = new UI::Textarea(this, posx + spacing + height, posy, | 318 | m_players = new UI::Textarea(this, posx + spacing + height, posy, |
152 | 319 | (boost::format(_("Players: %u")) | 319 | (boost::format(_("Players: %u")) |
154 | 320 | % static_cast<unsigned int>(m_pn)).str().c_str()); | 320 | % static_cast<unsigned int>(m_pn)).str()); |
155 | 321 | 321 | ||
156 | 322 | posy += height + 2 * spacing; | 322 | posy += height + 2 * spacing; |
157 | 323 | 323 | ||
158 | @@ -424,14 +424,14 @@ | |||
159 | 424 | if (m_h < 0) m_h = 0; | 424 | if (m_h < 0) m_h = 0; |
160 | 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; |
161 | 426 | 426 | ||
168 | 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()); |
169 | 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()); |
170 | 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()); |
171 | 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()); |
172 | 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()); |
173 | 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()); |
174 | 433 | m_players->set_text((boost::format(_("Players: %u")) | 433 | m_players->set_text((boost::format(_("Players: %u")) |
176 | 434 | % static_cast<unsigned int>(m_pn)).str().c_str()); | 434 | % static_cast<unsigned int>(m_pn)).str()); |
177 | 435 | 435 | ||
178 | 436 | nr_edit_box_changed(); // Update ID String | 436 | nr_edit_box_changed(); // Update ID String |
179 | 437 | } | 437 | } |
180 | 438 | 438 | ||
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 | 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()))); |
186 | 237 | 237 | ||
187 | 238 | m_size->set_text((boost::format(_("%1$ix%2$i")) | 238 | m_size->set_text((boost::format(_("%1$ix%2$i")) |
189 | 239 | % map.get_width() % map.get_height()).str().c_str()); | 239 | % map.get_width() % map.get_height()).str()); |
190 | 240 | } else { | 240 | } else { |
191 | 241 | m_name ->set_text(FileSystem::fs_filename(name)); | 241 | m_name ->set_text(FileSystem::fs_filename(name)); |
192 | 242 | m_name ->set_tooltip(""); | 242 | m_name ->set_tooltip(""); |
193 | @@ -286,13 +286,12 @@ | |||
194 | 286 | #else | 286 | #else |
195 | 287 | m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\')); | 287 | m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\')); |
196 | 288 | #endif | 288 | #endif |
198 | 289 | std::string parent_string = | 289 | |
199 | 290 | m_ls->add | ||
200 | 290 | /** TRANSLATORS: Parent directory */ | 291 | /** TRANSLATORS: Parent directory */ |
206 | 291 | (boost::format("\\<%s\\>") % _("parent")).str(); | 292 | ((boost::format("\\<%s\\>") % _("parent")).str(), |
207 | 292 | m_ls->add | 293 | m_parentdir.c_str(), |
208 | 293 | (parent_string.c_str(), | 294 | g_gr->images().get("pics/ls_dir.png")); |
204 | 294 | m_parentdir.c_str(), | ||
205 | 295 | g_gr->images().get("pics/ls_dir.png")); | ||
209 | 296 | } | 295 | } |
210 | 297 | 296 | ||
211 | 298 | const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end(); | 297 | const FilenameSet::const_iterator mapfiles_end = m_mapfiles.end(); |
212 | @@ -329,7 +328,7 @@ | |||
213 | 329 | try { | 328 | try { |
214 | 330 | wml->preload_map(true); | 329 | wml->preload_map(true); |
215 | 331 | m_ls->add | 330 | m_ls->add |
217 | 332 | (FileSystem::filename_without_ext(name).c_str(), | 331 | (FileSystem::filename_without_ext(name), |
218 | 333 | name, | 332 | name, |
219 | 334 | g_gr->images().get("pics/ls_wlmap.png")); | 333 | g_gr->images().get("pics/ls_wlmap.png")); |
220 | 335 | } catch (const WException &) {} // we simply skip illegal entries | 334 | } catch (const WException &) {} // we simply skip illegal entries |
221 | 336 | 335 | ||
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 | 208 | number += '0' + nr_players_10; | 208 | number += '0' + nr_players_10; |
227 | 209 | number += '0' + nr_players % 10; | 209 | number += '0' + nr_players % 10; |
228 | 210 | /** TRANSLATORS: Default player name, e.g. Player 1 */ | 210 | /** TRANSLATORS: Default player name, e.g. Player 1 */ |
230 | 211 | std::string name = (boost::format(_("Player %s")) % number).str(); | 211 | const std::string name = (boost::format(_("Player %s")) % number).str(); |
231 | 212 | map.set_scenario_player_name(nr_players, name); | 212 | map.set_scenario_player_name(nr_players, name); |
232 | 213 | } | 213 | } |
233 | 214 | map.set_scenario_player_tribe(nr_players, m_tribes[0]); | 214 | map.set_scenario_player_tribe(nr_players, m_tribes[0]); |
234 | 215 | 215 | ||
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 | 116 | if (!building.is_enhanced() && !building.is_buildable()) | 116 | if (!building.is_enhanced() && !building.is_buildable()) |
240 | 117 | continue; | 117 | continue; |
241 | 118 | (m_player.is_building_type_allowed(i) ? m_allowed : m_forbidden).add | 118 | (m_player.is_building_type_allowed(i) ? m_allowed : m_forbidden).add |
243 | 119 | (building.descname().c_str(), i, building.get_icon()); | 119 | (building.descname(), i, building.get_icon()); |
244 | 120 | } | 120 | } |
245 | 121 | m_forbidden.sort(); | 121 | m_forbidden.sort(); |
246 | 122 | m_allowed .sort(); | 122 | m_allowed .sort(); |
247 | @@ -156,7 +156,7 @@ | |||
248 | 156 | const Widelands::BuildingDescr & building = | 156 | const Widelands::BuildingDescr & building = |
249 | 157 | *m_player.tribe().get_building_descr(building_index); | 157 | *m_player.tribe().get_building_descr(building_index); |
250 | 158 | target.add | 158 | target.add |
252 | 159 | (building.descname().c_str(), | 159 | (building.descname(), |
253 | 160 | building_index, | 160 | building_index, |
254 | 161 | building.get_icon()); | 161 | building.get_icon()); |
255 | 162 | target.sort(); | 162 | target.sort(); |
256 | 163 | 163 | ||
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 | 126 | /** TRANSLATORS: %1% = terrain name, %2% = list of terrain types */ | 126 | /** TRANSLATORS: %1% = terrain name, %2% = list of terrain types */ |
262 | 127 | const std::string tooltip = ((boost::format("%1%: %2%")) | 127 | const std::string tooltip = ((boost::format("%1%: %2%")) |
263 | 128 | % terrain_descr.descname() | 128 | % terrain_descr.descname() |
265 | 129 | % i18n::localize_item_list(tooltips, i18n::ConcatenateWith::AND)).str().c_str(); | 129 | % i18n::localize_item_list(tooltips, i18n::ConcatenateWith::AND)).str(); |
266 | 130 | 130 | ||
267 | 131 | std::unique_ptr<const Image>& image = offscreen_images->back(); | 131 | std::unique_ptr<const Image>& image = offscreen_images->back(); |
268 | 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); |
269 | 133 | 133 | ||
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 | 329 | break; | 329 | break; |
275 | 330 | if (len < 0) { | 330 | if (len < 0) { |
276 | 331 | unzCloseCurrentFile(m_unzipfile); | 331 | unzCloseCurrentFile(m_unzipfile); |
277 | 332 | const std::string errormessage = (boost::format("read error %i") % len).str(); | ||
278 | 332 | throw ZipOperationError | 333 | throw ZipOperationError |
283 | 333 | ("ZipFilesystem::load", | 334 | ("ZipFilesystem::load", fname, m_zipfilename, errormessage.c_str()); |
280 | 334 | fname, | ||
281 | 335 | m_zipfilename, | ||
282 | 336 | (boost::format("read error %i") % len).str().c_str()); | ||
284 | 337 | } | 335 | } |
285 | 338 | 336 | ||
286 | 339 | totallen += len; | 337 | totallen += len; |
287 | 340 | 338 | ||
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 | 154 | add_attributes(attributes, std::set<uint32_t>()); | 154 | add_attributes(attributes, std::set<uint32_t>()); |
293 | 155 | } | 155 | } |
294 | 156 | 156 | ||
296 | 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(); |
297 | 158 | m_walk_anims.parse(*this, directory, prof, "walk", false, defaultpics); | 158 | m_walk_anims.parse(*this, directory, prof, "walk", false, defaultpics); |
298 | 159 | 159 | ||
299 | 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")) { |
300 | 161 | 161 | ||
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 | 54 | 54 | ||
306 | 55 | namespace { | 55 | namespace { |
307 | 56 | 56 | ||
308 | 57 | // For formation of better translateable texts | ||
309 | 58 | using boost::format; | ||
310 | 59 | 57 | ||
311 | 60 | /** | 58 | /** |
312 | 61 | * Convert std::string to any sstream-compatible type | 59 | * Convert std::string to any sstream-compatible type |
313 | @@ -268,15 +266,17 @@ | |||
314 | 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, |
315 | 269 | // so for "Log"; we will also have "logs" (numberless plural) | 267 | // so for "Log"; we will also have "logs" (numberless plural) |
316 | 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’*/ |
318 | 271 | return (boost::format(_("the economy needs the ware ‘%s’")) | 269 | std::string result = (boost::format(_("the economy needs the ware ‘%s’")) |
319 | 272 | % tribe.get_ware_descr(ware_type)->descname()).str(); | 270 | % tribe.get_ware_descr(ware_type)->descname()).str(); |
320 | 271 | return result; | ||
321 | 273 | } | 272 | } |
322 | 274 | std::string ProductionProgram::ActReturn::EconomyNeedsWare::description_negation | 273 | std::string ProductionProgram::ActReturn::EconomyNeedsWare::description_negation |
323 | 275 | (const TribeDescr & tribe) const | 274 | (const TribeDescr & tribe) const |
324 | 276 | { | 275 | { |
325 | 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’*/ |
327 | 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’")) |
328 | 279 | % tribe.get_ware_descr(ware_type)->descname()).str(); | 278 | % tribe.get_ware_descr(ware_type)->descname()).str(); |
329 | 279 | return result; | ||
330 | 280 | } | 280 | } |
331 | 281 | 281 | ||
332 | 282 | bool ProductionProgram::ActReturn::EconomyNeedsWorker::evaluate | 282 | bool ProductionProgram::ActReturn::EconomyNeedsWorker::evaluate |
333 | @@ -288,8 +288,9 @@ | |||
334 | 288 | (const TribeDescr & tribe) const | 288 | (const TribeDescr & tribe) const |
335 | 289 | { | 289 | { |
336 | 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’*/ |
338 | 291 | return (boost::format(_("the economy needs the worker ‘%s’")) | 291 | std::string result = (boost::format(_("the economy needs the worker ‘%s’")) |
339 | 292 | % tribe.get_worker_descr(worker_type)->descname()).str(); | 292 | % tribe.get_worker_descr(worker_type)->descname()).str(); |
340 | 293 | return result; | ||
341 | 293 | } | 294 | } |
342 | 294 | 295 | ||
343 | 295 | std::string ProductionProgram::ActReturn::EconomyNeedsWorker::description_negation | 296 | std::string ProductionProgram::ActReturn::EconomyNeedsWorker::description_negation |
344 | @@ -297,8 +298,9 @@ | |||
345 | 297 | { | 298 | { |
346 | 298 | /** TRANSLATORS: e.g. Completed/Skipped/Did not start ...*/ | 299 | /** TRANSLATORS: e.g. Completed/Skipped/Did not start ...*/ |
347 | 299 | /** TRANSLATORS: ... because the economy doesn’t need the worker ‘%s’*/ | 300 | /** TRANSLATORS: ... because the economy doesn’t need the worker ‘%s’*/ |
349 | 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’")) |
350 | 301 | % tribe.get_worker_descr(worker_type)->descname()).str(); | 302 | % tribe.get_worker_descr(worker_type)->descname()).str(); |
351 | 303 | return result; | ||
352 | 302 | } | 304 | } |
353 | 303 | 305 | ||
354 | 304 | 306 | ||
355 | @@ -955,7 +957,7 @@ | |||
356 | 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' */ |
357 | 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)) |
358 | 957 | % i18n::localize_item_list(group_list, i18n::ConcatenateWith::AND)) | 959 | % i18n::localize_item_list(group_list, i18n::ConcatenateWith::AND)) |
360 | 958 | .str().c_str(); | 960 | .str(); |
361 | 959 | 961 | ||
362 | 960 | std::string result_string = | 962 | std::string result_string = |
363 | 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' */ |
364 | @@ -1068,9 +1070,9 @@ | |||
365 | 1068 | } | 1070 | } |
366 | 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); |
367 | 1070 | 1072 | ||
368 | 1071 | // Keep translateability in mind! | ||
369 | 1072 | /** TRANSLATORS: %s is a list of wares */ | 1073 | /** TRANSLATORS: %s is a list of wares */ |
371 | 1073 | ps.set_production_result(str(format(_("Produced %s")) % ware_list)); | 1074 | const std::string result_string = (boost::format(_("Produced %s")) % ware_list).str(); |
372 | 1075 | ps.set_production_result(result_string); | ||
373 | 1074 | } | 1076 | } |
374 | 1075 | 1077 | ||
375 | 1076 | bool ProductionProgram::ActProduce::get_building_work | 1078 | bool ProductionProgram::ActProduce::get_building_work |
376 | @@ -1164,7 +1166,8 @@ | |||
377 | 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); |
378 | 1165 | 1167 | ||
379 | 1166 | /** TRANSLATORS: %s is a list of workers */ | 1168 | /** TRANSLATORS: %s is a list of workers */ |
381 | 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(); |
382 | 1170 | ps.set_production_result(result_string); | ||
383 | 1168 | } | 1171 | } |
384 | 1169 | 1172 | ||
385 | 1170 | bool ProductionProgram::ActRecruit::get_building_work | 1173 | bool ProductionProgram::ActRecruit::get_building_work |
386 | 1171 | 1174 | ||
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 | 299 | ++lastOk; | 299 | ++lastOk; |
392 | 300 | } | 300 | } |
393 | 301 | } | 301 | } |
395 | 302 | // Somehow boost::format doesn't handle correctly uint8_t in this case | 302 | // boost::format would treat uint8_t as char |
396 | 303 | const unsigned int percOk = (ok * 100) / STATISTICS_VECTOR_LENGTH; | 303 | const unsigned int percOk = (ok * 100) / STATISTICS_VECTOR_LENGTH; |
397 | 304 | m_last_stat_percent = percOk; | 304 | m_last_stat_percent = percOk; |
398 | 305 | 305 | ||
399 | 306 | 306 | ||
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 | 137 | for (uint32_t i = 0; i <= m_max_hp_level; ++i) { | 137 | for (uint32_t i = 0; i <= m_max_hp_level; ++i) { |
405 | 138 | m_hp_pics_fn[i] = dir; | 138 | m_hp_pics_fn[i] = dir; |
406 | 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") |
408 | 140 | % i).str().c_str()); | 140 | % i).str()); |
409 | 141 | 141 | ||
410 | 142 | } | 142 | } |
411 | 143 | for (uint32_t i = 0; i <= m_max_attack_level; ++i) { | 143 | for (uint32_t i = 0; i <= m_max_attack_level; ++i) { |
412 | 144 | m_attack_pics_fn[i] = dir; | 144 | m_attack_pics_fn[i] = dir; |
413 | 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") |
415 | 146 | % i).str().c_str()); | 146 | % i).str()); |
416 | 147 | } | 147 | } |
417 | 148 | for (uint32_t i = 0; i <= m_max_defense_level; ++i) { | 148 | for (uint32_t i = 0; i <= m_max_defense_level; ++i) { |
418 | 149 | m_defense_pics_fn[i] = dir; | 149 | m_defense_pics_fn[i] = dir; |
419 | 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") |
421 | 151 | % i).str().c_str()); | 151 | % i).str()); |
422 | 152 | } | 152 | } |
423 | 153 | for (uint32_t i = 0; i <= m_max_evade_level; ++i) { | 153 | for (uint32_t i = 0; i <= m_max_evade_level; ++i) { |
424 | 154 | m_evade_pics_fn[i] = dir; | 154 | m_evade_pics_fn[i] = dir; |
425 | 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") |
427 | 156 | % i).str().c_str()); | 156 | % i).str()); |
428 | 157 | } | 157 | } |
429 | 158 | 158 | ||
430 | 159 | { /// Battle animations | 159 | { /// Battle animations |
431 | @@ -1550,7 +1550,7 @@ | |||
432 | 1550 | BaseImmovable const * const immovable_dest = | 1550 | BaseImmovable const * const immovable_dest = |
433 | 1551 | map[dest] .get_immovable(); | 1551 | map[dest] .get_immovable(); |
434 | 1552 | 1552 | ||
436 | 1553 | std::string messagetext = | 1553 | const std::string messagetext = |
437 | 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 " |
438 | 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) " |
439 | 1556 | "(with %s immovable) to the opponent (%s #%u of player " | 1556 | "(with %s immovable) to the opponent (%s #%u of player " |
440 | 1557 | 1557 | ||
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 | 659 | 659 | ||
446 | 660 | return program_start(game, (boost::format("%s%i") | 660 | return program_start(game, (boost::format("%s%i") |
447 | 661 | % upgrade.prefix.c_str() | 661 | % upgrade.prefix.c_str() |
449 | 662 | % level).str().c_str()); | 662 | % level).str()); |
450 | 663 | } | 663 | } |
451 | 664 | 664 | ||
452 | 665 | TrainingSite::Upgrade * TrainingSite::get_upgrade(TrainingAttribute const atr) | 665 | TrainingSite::Upgrade * TrainingSite::get_upgrade(TrainingAttribute const atr) |
453 | 666 | 666 | ||
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 | 433 | 433 | ||
459 | 434 | return get_immovable_index((boost::format("resi_%s%i") | 434 | return get_immovable_index((boost::format("resi_%s%i") |
460 | 435 | % res->name().c_str() | 435 | % res->name().c_str() |
462 | 436 | % bestmatch).str().c_str()); | 436 | % bestmatch).str()); |
463 | 437 | } | 437 | } |
464 | 438 | 438 | ||
465 | 439 | /* | 439 | /* |
466 | 440 | 440 | ||
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 | 939 | (boost::format("<rt image=world/resources/pics/%s4.png>" | 939 | (boost::format("<rt image=world/resources/pics/%s4.png>" |
472 | 940 | "<p font-size=14 font-face=DejaVuSerif>%s</p></rt>") | 940 | "<p font-size=14 font-face=DejaVuSerif>%s</p></rt>") |
473 | 941 | % rdescr->name().c_str() | 941 | % rdescr->name().c_str() |
475 | 942 | % _("A geologist found resources.")).str().c_str(); | 942 | % _("A geologist found resources.")).str(); |
476 | 943 | 943 | ||
477 | 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, |
478 | 945 | // if there is not already a similar one in list. | 945 | // if there is not already a similar one in list. |
479 | @@ -1841,7 +1841,7 @@ | |||
480 | 1841 | molog("[return]: Failed to return\n"); | 1841 | molog("[return]: Failed to return\n"); |
481 | 1842 | const std::string message = | 1842 | const std::string message = |
482 | 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.")) |
484 | 1844 | % descr().descname().c_str()).str().c_str(); | 1844 | % descr().descname().c_str()).str(); |
485 | 1845 | 1845 | ||
486 | 1846 | owner().add_message | 1846 | owner().add_message |
487 | 1847 | (game, | 1847 | (game, |
488 | 1848 | 1848 | ||
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 | 71 | 71 | ||
494 | 72 | Coords | 72 | Coords |
495 | 73 | get_safe_coords(const std::string& name, const Extent& extent, Section* section) { | 73 | get_safe_coords(const std::string& name, const Extent& extent, Section* section) { |
497 | 74 | return parse_coords(name, section->get_safe_string(name.c_str()), extent); | 74 | return parse_coords(name, section->get_safe_string(name), extent); |
498 | 75 | } | 75 | } |
499 | 76 | 76 | ||
500 | 77 | } // namespace Widelands | 77 | } // namespace Widelands |
501 | 78 | 78 | ||
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 | 72 | player->allow_building_type(--i, false); | 72 | player->allow_building_type(--i, false); |
507 | 73 | try { | 73 | try { |
508 | 74 | Section & s = prof.get_safe_section((boost::format("player_%u") | 74 | Section & s = prof.get_safe_section((boost::format("player_%u") |
510 | 75 | % static_cast<unsigned int>(p)).str().c_str()); | 75 | % static_cast<unsigned int>(p)).str()); |
511 | 76 | 76 | ||
512 | 77 | bool allowed; | 77 | bool allowed; |
513 | 78 | while (const char * const name = s.get_next_bool(nullptr, &allowed)) { | 78 | while (const char * const name = s.get_next_bool(nullptr, &allowed)) { |
514 | @@ -108,8 +108,9 @@ | |||
515 | 108 | PlayerNumber const nr_players = egbase.map().get_nrplayers(); | 108 | PlayerNumber const nr_players = egbase.map().get_nrplayers(); |
516 | 109 | iterate_players_existing_const(p, nr_players, egbase, player) { | 109 | iterate_players_existing_const(p, nr_players, egbase, player) { |
517 | 110 | const TribeDescr & tribe = player->tribe(); | 110 | const TribeDescr & tribe = player->tribe(); |
520 | 111 | Section & section = prof.create_section((boost::format("player_%u") | 111 | const std::string section_key = (boost::format("player_%u") |
521 | 112 | % static_cast<unsigned int>(p)).str().c_str()); | 112 | % static_cast<unsigned int>(p)).str(); |
522 | 113 | Section & section = prof.create_section(section_key.c_str()); | ||
523 | 113 | 114 | ||
524 | 114 | // Write for all buildings if it is enabled. | 115 | // Write for all buildings if it is enabled. |
525 | 115 | BuildingIndex const nr_buildings = tribe.get_nrbuildings(); | 116 | BuildingIndex const nr_buildings = tribe.get_nrbuildings(); |
526 | 116 | 117 | ||
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 | 59 | const TribeDescr & tribe = player->tribe(); | 59 | const TribeDescr & tribe = player->tribe(); |
532 | 60 | try { | 60 | try { |
533 | 61 | Section* s = prof.get_section((boost::format("player_%u") | 61 | Section* s = prof.get_section((boost::format("player_%u") |
535 | 62 | % static_cast<unsigned int>(p)).str().c_str()); | 62 | % static_cast<unsigned int>(p)).str()); |
536 | 63 | if (s == nullptr) | 63 | if (s == nullptr) |
537 | 64 | continue; | 64 | continue; |
538 | 65 | 65 | ||
539 | @@ -93,8 +93,9 @@ | |||
540 | 93 | bool forbidden_worker_seen = false; | 93 | bool forbidden_worker_seen = false; |
541 | 94 | iterate_players_existing_const(p, egbase.map().get_nrplayers(), egbase, player) { | 94 | iterate_players_existing_const(p, egbase.map().get_nrplayers(), egbase, player) { |
542 | 95 | const TribeDescr & tribe = player->tribe(); | 95 | const TribeDescr & tribe = player->tribe(); |
545 | 96 | Section & section = prof.create_section((boost::format("player_%u") | 96 | const std::string section_key = (boost::format("player_%u") |
546 | 97 | % static_cast<unsigned int>(p)).str().c_str()); | 97 | % static_cast<unsigned int>(p)).str(); |
547 | 98 | Section & section = prof.create_section(section_key.c_str()); | ||
548 | 98 | 99 | ||
549 | 99 | // Only write the workers which are disabled. | 100 | // Only write the workers which are disabled. |
550 | 100 | for (WareIndex b = 0; b < tribe.get_nrworkers(); ++b) { | 101 | for (WareIndex b = 0; b < tribe.get_nrworkers(); ++b) { |
551 | 101 | 102 | ||
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 | 68 | PlayerNumber const nr_players = map->get_nrplayers(); | 68 | PlayerNumber const nr_players = map->get_nrplayers(); |
557 | 69 | iterate_player_numbers(p, nr_players) { | 69 | iterate_player_numbers(p, nr_players) { |
558 | 70 | Section & s = prof.get_safe_section((boost::format("player_%u") | 70 | Section & s = prof.get_safe_section((boost::format("player_%u") |
560 | 71 | % static_cast<unsigned int>(p)).str().c_str()); | 71 | % static_cast<unsigned int>(p)).str()); |
561 | 72 | map->set_scenario_player_name (p, s.get_string("name", "")); | 72 | map->set_scenario_player_name (p, s.get_string("name", "")); |
562 | 73 | map->set_scenario_player_tribe (p, s.get_string("tribe", "")); | 73 | map->set_scenario_player_tribe (p, s.get_string("tribe", "")); |
563 | 74 | map->set_scenario_player_ai (p, s.get_string("ai", "")); | 74 | map->set_scenario_player_ai (p, s.get_string("ai", "")); |
564 | @@ -94,8 +94,9 @@ | |||
565 | 94 | const Map & map = egbase.map(); | 94 | const Map & map = egbase.map(); |
566 | 95 | PlayerNumber const nr_players = map.get_nrplayers(); | 95 | PlayerNumber const nr_players = map.get_nrplayers(); |
567 | 96 | iterate_player_numbers(p, nr_players) { | 96 | iterate_player_numbers(p, nr_players) { |
570 | 97 | Section & s = prof.create_section((boost::format("player_%u") | 97 | const std::string section_key = (boost::format("player_%u") |
571 | 98 | % static_cast<unsigned int>(p)).str().c_str()); | 98 | % static_cast<unsigned int>(p)).str(); |
572 | 99 | Section & s = prof.create_section(section_key.c_str()); | ||
573 | 99 | s.set_string("name", map.get_scenario_player_name (p)); | 100 | s.set_string("name", map.get_scenario_player_name (p)); |
574 | 100 | s.set_string("tribe", map.get_scenario_player_tribe (p)); | 101 | s.set_string("tribe", map.get_scenario_player_tribe (p)); |
575 | 101 | s.set_string("ai", map.get_scenario_player_ai (p)); | 102 | s.set_string("ai", map.get_scenario_player_ai (p)); |
576 | 102 | 103 | ||
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 | 52 | try { | 52 | try { |
582 | 53 | map.set_starting_pos(p, | 53 | map.set_starting_pos(p, |
583 | 54 | get_safe_coords((boost::format("player_%u") | 54 | get_safe_coords((boost::format("player_%u") |
585 | 55 | % static_cast<unsigned int>(p)).str().c_str(), | 55 | % static_cast<unsigned int>(p)).str(), |
586 | 56 | extent, &s)); | 56 | extent, &s)); |
587 | 57 | } catch (const WException & e) { | 57 | } catch (const WException & e) { |
588 | 58 | throw GameDataError("player %u: %s", p, e.what()); | 58 | throw GameDataError("player %u: %s", p, e.what()); |
589 | @@ -79,7 +79,7 @@ | |||
590 | 79 | const Map & map = egbase.map(); | 79 | const Map & map = egbase.map(); |
591 | 80 | const PlayerNumber nr_players = map.get_nrplayers(); | 80 | const PlayerNumber nr_players = map.get_nrplayers(); |
592 | 81 | iterate_player_numbers(p, nr_players) { | 81 | iterate_player_numbers(p, nr_players) { |
594 | 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(), |
595 | 83 | map.get_starting_pos(p), &s); | 83 | map.get_starting_pos(p), &s); |
596 | 84 | } | 84 | } |
597 | 85 | 85 | ||
598 | 86 | 86 | ||
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 | 46 | try { | 46 | try { |
604 | 47 | Profile prof; | 47 | Profile prof; |
605 | 48 | try { | 48 | try { |
608 | 49 | prof.read((boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str().c_str(), | 49 | const std::string profile_filename = |
609 | 50 | nullptr, fs); | 50 | (boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str(); |
610 | 51 | prof.read(profile_filename.c_str(), nullptr, fs); | ||
611 | 51 | } catch (...) {continue;} | 52 | } catch (...) {continue;} |
612 | 52 | prof.get_safe_section("global").get_positive | 53 | prof.get_safe_section("global").get_positive |
613 | 53 | ("packet_version", CURRENT_PACKET_VERSION); | 54 | ("packet_version", CURRENT_PACKET_VERSION); |
614 | @@ -183,9 +184,11 @@ | |||
615 | 183 | } | 184 | } |
616 | 184 | } | 185 | } |
617 | 185 | fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE) | 186 | fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE) |
621 | 186 | % static_cast<unsigned int>(p)).str().c_str()); | 187 | % static_cast<unsigned int>(p)).str()); |
622 | 187 | prof.write((boost::format(FILENAME_TEMPLATE) | 188 | |
623 | 188 | % static_cast<unsigned int>(p)).str().c_str(), false, fs); | 189 | const std::string profile_filename = |
624 | 190 | (boost::format(FILENAME_TEMPLATE) % static_cast<unsigned int>(p)).str(); | ||
625 | 191 | prof.write(profile_filename.c_str(), false, fs); | ||
626 | 189 | } | 192 | } |
627 | 190 | } | 193 | } |
628 | 191 | 194 | ||
629 | 192 | 195 | ||
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 | 1179 | char filename[FILENAME_SIZE]; | 1179 | char filename[FILENAME_SIZE]; |
635 | 1180 | 1180 | ||
636 | 1181 | fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE) | 1181 | fs.ensure_directory_exists((boost::format(PLAYERDIRNAME_TEMPLATE) |
638 | 1182 | % static_cast<unsigned int>(plnum)).str().c_str()); | 1182 | % static_cast<unsigned int>(plnum)).str()); |
639 | 1183 | fs.ensure_directory_exists((boost::format(DIRNAME_TEMPLATE) | 1183 | fs.ensure_directory_exists((boost::format(DIRNAME_TEMPLATE) |
641 | 1184 | % static_cast<unsigned int>(plnum)).str().c_str()); | 1184 | % static_cast<unsigned int>(plnum)).str()); |
642 | 1185 | 1185 | ||
643 | 1186 | WRITE | 1186 | WRITE |
644 | 1187 | (unseen_times_file, | 1187 | (unseen_times_file, |
645 | 1188 | 1188 | ||
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 | 64 | #include "wui/interactive_player.h" | 64 | #include "wui/interactive_player.h" |
651 | 65 | #include "wui/interactive_spectator.h" | 65 | #include "wui/interactive_spectator.h" |
652 | 66 | 66 | ||
653 | 67 | using boost::format; | ||
654 | 68 | |||
655 | 69 | |||
656 | 70 | 67 | ||
657 | 71 | struct HostGameSettingsProvider : public GameSettingsProvider { | 68 | struct HostGameSettingsProvider : public GameSettingsProvider { |
658 | 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) {} |
659 | @@ -418,9 +415,9 @@ | |||
660 | 418 | } else if (num == -1) { | 415 | } else if (num == -1) { |
661 | 419 | if (!h->is_dedicated()) | 416 | if (!h->is_dedicated()) |
662 | 420 | c.recipient = h->get_local_playername(); | 417 | c.recipient = h->get_local_playername(); |
664 | 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(); |
665 | 422 | } else { | 419 | } else { |
667 | 423 | c.msg = (format("HOST WARNING FOR %s: ") % arg1).str(); | 420 | c.msg = (boost::format("HOST WARNING FOR %s: ") % arg1).str(); |
668 | 424 | c.msg += arg2; | 421 | c.msg += arg2; |
669 | 425 | } | 422 | } |
670 | 426 | } | 423 | } |
671 | @@ -444,12 +441,12 @@ | |||
672 | 444 | } else | 441 | } else |
673 | 445 | c.msg = _("You can not kick the dedicated server"); | 442 | c.msg = _("You can not kick the dedicated server"); |
674 | 446 | else if (num == -1) | 443 | else if (num == -1) |
676 | 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(); |
677 | 448 | else { | 445 | else { |
678 | 449 | kickClient = num; | 446 | kickClient = num; |
682 | 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>"; |
683 | 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>"; |
684 | 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(); |
685 | 453 | } | 450 | } |
686 | 454 | } | 451 | } |
687 | 455 | if (!h->is_dedicated()) | 452 | if (!h->is_dedicated()) |
688 | @@ -736,14 +733,13 @@ | |||
689 | 736 | // May be the server is password protected? | 733 | // May be the server is password protected? |
690 | 737 | Section & s = g_options.pull_section("global"); | 734 | Section & s = g_options.pull_section("global"); |
691 | 738 | m_password = s.get_string("dedicated_password", ""); | 735 | m_password = s.get_string("dedicated_password", ""); |
692 | 736 | |||
693 | 739 | // And we read the message of the day | 737 | // And we read the message of the day |
701 | 740 | m_dedicated_motd = | 738 | const std::string dedicated_motd_key = |
702 | 741 | s.get_string | 739 | (boost::format |
703 | 742 | ("dedicated_motd", | 740 | (_("This is a dedicated server. Send \"@%s help\" to get a full list of available commands.")) |
704 | 743 | (format | 741 | % d->localplayername).str(); |
705 | 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()); |
699 | 745 | % d->localplayername) | ||
700 | 746 | .str().c_str()); | ||
706 | 747 | 743 | ||
707 | 748 | // Maybe this is the first run, so we try to setup the DedicatedLog | 744 | // Maybe this is the first run, so we try to setup the DedicatedLog |
708 | 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" |
709 | @@ -1242,7 +1238,7 @@ | |||
710 | 1242 | return; | 1238 | return; |
711 | 1243 | } | 1239 | } |
712 | 1244 | std::string temp = arg1 + " " + arg2; | 1240 | std::string temp = arg1 + " " + arg2; |
714 | 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(); |
715 | 1246 | c.recipient = ""; | 1242 | c.recipient = ""; |
716 | 1247 | send(c); | 1243 | send(c); |
717 | 1248 | d->chat.send(temp); | 1244 | d->chat.send(temp); |
718 | @@ -1269,7 +1265,7 @@ | |||
719 | 1269 | c.msg = _("Game successfully saved!"); | 1265 | c.msg = _("Game successfully saved!"); |
720 | 1270 | else | 1266 | else |
721 | 1271 | c.msg = | 1267 | c.msg = |
723 | 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)")) |
724 | 1273 | % savename % error) | 1269 | % savename % error) |
725 | 1274 | .str(); | 1270 | .str(); |
726 | 1275 | send(c); | 1271 | send(c); |
727 | @@ -1300,7 +1296,7 @@ | |||
728 | 1300 | 1296 | ||
729 | 1301 | // default | 1297 | // default |
730 | 1302 | } else { | 1298 | } else { |
732 | 1303 | c.msg = (format(_("Unknown dedicated server command \"%s\"!")) % cmd).str(); | 1299 | c.msg = (boost::format(_("Unknown dedicated server command \"%s\"!")) % cmd).str(); |
733 | 1304 | send(c); | 1300 | send(c); |
734 | 1305 | } | 1301 | } |
735 | 1306 | } | 1302 | } |
736 | @@ -2163,7 +2159,7 @@ | |||
737 | 2163 | if (m_password.size() > 1) { | 2159 | if (m_password.size() > 1) { |
738 | 2164 | c.msg += "<br>"; | 2160 | c.msg += "<br>"; |
739 | 2165 | c.msg += | 2161 | c.msg += |
741 | 2166 | (format | 2162 | (boost::format |
742 | 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\"")) |
743 | 2168 | % d->localplayername) | 2164 | % d->localplayername) |
744 | 2169 | .str(); | 2165 | .str(); |
745 | @@ -2286,7 +2282,7 @@ | |||
746 | 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) { |
747 | 2287 | disconnect_client(i, "CLIENT_TIMEOUTED"); | 2283 | disconnect_client(i, "CLIENT_TIMEOUTED"); |
748 | 2288 | // Try to save the game | 2284 | // Try to save the game |
750 | 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(); |
751 | 2290 | std::string * error = new std::string(); | 2286 | std::string * error = new std::string(); |
752 | 2291 | SaveHandler & sh = d->game->save_handler(); | 2287 | SaveHandler & sh = d->game->save_handler(); |
753 | 2292 | if (sh.save_game(*d->game, savename, error)) | 2288 | if (sh.save_game(*d->game, savename, error)) |
754 | 2293 | 2289 | ||
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 | 317 | } | 317 | } |
760 | 318 | 318 | ||
761 | 319 | int LuaPlayerBase::__tostring(lua_State * L) { | 319 | int LuaPlayerBase::__tostring(lua_State * L) { |
764 | 320 | lua_pushstring(L, (boost::format("Player(%i)") | 320 | const std::string pushme = |
765 | 321 | % static_cast<unsigned int>(get(L, get_egbase(L)).player_number())).str().c_str()); | 321 | (boost::format("Player(%i)") |
766 | 322 | % static_cast<unsigned int>(get(L, get_egbase(L)).player_number())).str(); | ||
767 | 323 | lua_pushstring(L, pushme.c_str()); | ||
768 | 322 | return 1; | 324 | return 1; |
769 | 323 | } | 325 | } |
770 | 324 | /* RST | 326 | /* RST |
771 | 325 | 327 | ||
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 | 3522 | */ | 3522 | */ |
777 | 3523 | // Hash is used to identify a class in a Set | 3523 | // Hash is used to identify a class in a Set |
778 | 3524 | int LuaField::get___hash(lua_State * L) { | 3524 | int LuaField::get___hash(lua_State * L) { |
780 | 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(); |
781 | 3526 | lua_pushstring(L, pushme.c_str()); | ||
782 | 3526 | return 1; | 3527 | return 1; |
783 | 3527 | } | 3528 | } |
784 | 3528 | 3529 | ||
785 | @@ -3851,7 +3852,8 @@ | |||
786 | 3851 | } | 3852 | } |
787 | 3852 | 3853 | ||
788 | 3853 | int LuaField::__tostring(lua_State * L) { | 3854 | int LuaField::__tostring(lua_State * L) { |
790 | 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(); |
791 | 3856 | lua_pushstring(L, pushme); | ||
792 | 3855 | return 1; | 3857 | return 1; |
793 | 3856 | } | 3858 | } |
794 | 3857 | 3859 | ||
795 | 3858 | 3860 | ||
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 | 37 | #include "ui_basic/window.h" | 37 | #include "ui_basic/window.h" |
801 | 38 | #include "wui/text_constants.h" | 38 | #include "wui/text_constants.h" |
802 | 39 | 39 | ||
803 | 40 | |||
804 | 41 | using boost::format; | ||
805 | 42 | |||
806 | 43 | namespace UI { | 40 | namespace UI { |
807 | 44 | 41 | ||
808 | 45 | HelpWindow::HelpWindow | 42 | HelpWindow::HelpWindow |
809 | @@ -48,7 +45,7 @@ | |||
810 | 48 | uint32_t fontsize, | 45 | uint32_t fontsize, |
811 | 49 | uint32_t width, uint32_t height) | 46 | uint32_t width, uint32_t height) |
812 | 50 | : | 47 | : |
814 | 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()), |
815 | 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)), |
816 | 53 | m_h1(std::to_string(fontsize < 12 ? 18 : fontsize * 3 / 2)), | 50 | m_h1(std::to_string(fontsize < 12 ? 18 : fontsize * 3 / 2)), |
817 | 54 | m_h2(std::to_string(fontsize < 12 ? 12 : fontsize)), | 51 | m_h2(std::to_string(fontsize < 12 ? 12 : fontsize)), |
818 | @@ -191,7 +188,7 @@ | |||
819 | 191 | uint32_t width, uint32_t height) | 188 | uint32_t width, uint32_t height) |
820 | 192 | : | 189 | : |
821 | 193 | UI::UniqueWindow(parent, "help_window", ®, width, height, | 190 | UI::UniqueWindow(parent, "help_window", ®, width, height, |
823 | 194 | (boost::format(_("Help: %s")) % building_description.descname()).str().c_str()), | 191 | (boost::format(_("Help: %s")) % building_description.descname()).str()), |
824 | 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)) |
825 | 196 | { | 193 | { |
826 | 197 | try { | 194 | try { |
827 | 198 | 195 | ||
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 | 119 | * sel if true, directly select the new entry | 119 | * sel if true, directly select the new entry |
833 | 120 | */ | 120 | */ |
834 | 121 | void BaseListselect::add | 121 | void BaseListselect::add |
836 | 122 | (char const * const name, | 122 | (const std::string& name, |
837 | 123 | uint32_t entry, | 123 | uint32_t entry, |
838 | 124 | const Image* pic, | 124 | const Image* pic, |
839 | 125 | bool const sel, | 125 | bool const sel, |
840 | @@ -130,7 +130,7 @@ | |||
841 | 130 | er->m_entry = entry; | 130 | er->m_entry = entry; |
842 | 131 | er->pic = pic; | 131 | er->pic = pic; |
843 | 132 | er->use_clr = false; | 132 | er->use_clr = false; |
845 | 133 | er->name = std::string(name); | 133 | er->name = name; |
846 | 134 | er->tooltip = tooltip_text; | 134 | er->tooltip = tooltip_text; |
847 | 135 | uint32_t entry_height = 0; | 135 | uint32_t entry_height = 0; |
848 | 136 | if (!pic) { | 136 | if (!pic) { |
849 | @@ -158,7 +158,7 @@ | |||
850 | 158 | } | 158 | } |
851 | 159 | 159 | ||
852 | 160 | void BaseListselect::add_front | 160 | void BaseListselect::add_front |
854 | 161 | (char const * const name, | 161 | (const std::string& name, |
855 | 162 | const Image* pic, | 162 | const Image* pic, |
856 | 163 | bool const sel, | 163 | bool const sel, |
857 | 164 | const std::string & tooltip_text) | 164 | const std::string & tooltip_text) |
858 | @@ -172,7 +172,7 @@ | |||
859 | 172 | 172 | ||
860 | 173 | er->pic = pic; | 173 | er->pic = pic; |
861 | 174 | er->use_clr = false; | 174 | er->use_clr = false; |
863 | 175 | er->name = std::string(name); | 175 | er->name = name; |
864 | 176 | er->tooltip = tooltip_text; | 176 | er->tooltip = tooltip_text; |
865 | 177 | 177 | ||
866 | 178 | uint32_t entry_height = 0; | 178 | uint32_t entry_height = 0; |
867 | 179 | 179 | ||
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 | 60 | (const uint32_t Begin = 0, | 60 | (const uint32_t Begin = 0, |
873 | 61 | uint32_t End = std::numeric_limits<uint32_t>::max()); | 61 | uint32_t End = std::numeric_limits<uint32_t>::max()); |
874 | 62 | void add | 62 | void add |
876 | 63 | (const char * const name, | 63 | (const std::string& name, |
877 | 64 | uint32_t value, | 64 | uint32_t value, |
878 | 65 | const Image* pic = nullptr, | 65 | const Image* pic = nullptr, |
879 | 66 | const bool select_this = false, | 66 | const bool select_this = false, |
880 | 67 | const std::string & tooltip_text = std::string()); | 67 | const std::string & tooltip_text = std::string()); |
881 | 68 | void add_front | 68 | void add_front |
883 | 69 | (const char * const name, | 69 | (const std::string& name, |
884 | 70 | const Image* pic = nullptr, | 70 | const Image* pic = nullptr, |
885 | 71 | const bool select_this = false, | 71 | const bool select_this = false, |
886 | 72 | const std::string & tooltip_text = std::string()); | 72 | const std::string & tooltip_text = std::string()); |
887 | @@ -166,7 +166,7 @@ | |||
888 | 166 | {} | 166 | {} |
889 | 167 | 167 | ||
890 | 168 | void add | 168 | void add |
892 | 169 | (const char * const name, | 169 | (const std::string& name, |
893 | 170 | Entry value, | 170 | Entry value, |
894 | 171 | const Image* pic = nullptr, | 171 | const Image* pic = nullptr, |
895 | 172 | const bool select_this = false, | 172 | const bool select_this = false, |
896 | @@ -176,7 +176,7 @@ | |||
897 | 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); |
898 | 177 | } | 177 | } |
899 | 178 | void add_front | 178 | void add_front |
901 | 179 | (const char * const name, | 179 | (const std::string& name, |
902 | 180 | Entry value, | 180 | Entry value, |
903 | 181 | const Image* pic = nullptr, | 181 | const Image* pic = nullptr, |
904 | 182 | const bool select_this = false, | 182 | const bool select_this = false, |
905 | @@ -221,7 +221,7 @@ | |||
906 | 221 | {} | 221 | {} |
907 | 222 | 222 | ||
908 | 223 | void add | 223 | void add |
910 | 224 | (const char * const name, | 224 | (const std::string& name, |
911 | 225 | Entry & value, | 225 | Entry & value, |
912 | 226 | const Image* pic = nullptr, | 226 | const Image* pic = nullptr, |
913 | 227 | const bool select_this = false, | 227 | const bool select_this = false, |
914 | @@ -230,7 +230,7 @@ | |||
915 | 230 | Base::add(name, &value, pic, select_this, tooltip_text); | 230 | Base::add(name, &value, pic, select_this, tooltip_text); |
916 | 231 | } | 231 | } |
917 | 232 | void add_front | 232 | void add_front |
919 | 233 | (const char * const name, | 233 | (const std::string& name, |
920 | 234 | Entry & value, | 234 | Entry & value, |
921 | 235 | const Image* pic = nullptr, | 235 | const Image* pic = nullptr, |
922 | 236 | const bool select_this = false, | 236 | const bool select_this = false, |
923 | 237 | 237 | ||
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 | 209 | #else | 209 | #else |
929 | 210 | m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\')); | 210 | m_parentdir = m_curdir.substr(0, m_curdir.rfind('\\')); |
930 | 211 | #endif | 211 | #endif |
932 | 212 | std::string parent_string = | 212 | |
933 | 213 | m_list.add | ||
934 | 213 | /** TRANSLATORS: Parent directory */ | 214 | /** TRANSLATORS: Parent directory */ |
939 | 214 | (boost::format("\\<%s\\>") % _("parent")).str(); | 215 | ((boost::format("\\<%s\\>") % _("parent")).str(), |
940 | 215 | m_list.add | 216 | m_parentdir.c_str(), |
937 | 216 | (parent_string.c_str(), | ||
938 | 217 | m_parentdir.c_str(), | ||
941 | 218 | g_gr->images().get("pics/ls_dir.png")); | 217 | g_gr->images().get("pics/ls_dir.png")); |
942 | 219 | } | 218 | } |
943 | 220 | 219 | ||
944 | 221 | 220 | ||
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 | 249 | // than one server with the same name. | 249 | // than one server with the same name. |
950 | 250 | if (games.at(i).name == localservername) | 250 | if (games.at(i).name == localservername) |
951 | 251 | hostgame.set_enabled(false); | 251 | hostgame.set_enabled(false); |
953 | 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); |
954 | 253 | } | 253 | } |
955 | 254 | } | 254 | } |
956 | 255 | 255 | ||
957 | 256 | 256 | ||
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 | 45 | #include "wui/multiplayersetupgroup.h" | 45 | #include "wui/multiplayersetupgroup.h" |
963 | 46 | #include "wui/text_constants.h" | 46 | #include "wui/text_constants.h" |
964 | 47 | 47 | ||
965 | 48 | using boost::format; | ||
966 | 49 | |||
967 | 50 | /// Simple user interaction window for selecting either map, save or cancel | 48 | /// Simple user interaction window for selecting either map, save or cancel |
968 | 51 | struct MapOrSaveSelectionWindow : public UI::Window { | 49 | struct MapOrSaveSelectionWindow : public UI::Window { |
969 | 52 | MapOrSaveSelectionWindow | 50 | MapOrSaveSelectionWindow |
970 | @@ -484,10 +482,10 @@ | |||
971 | 484 | std::string temp = | 482 | std::string temp = |
972 | 485 | (settings.playernum > -1) && (settings.playernum < MAX_PLAYERS) | 483 | (settings.playernum > -1) && (settings.playernum < MAX_PLAYERS) |
973 | 486 | ? | 484 | ? |
975 | 487 | (format(_("Player %i")) % (settings.playernum + 1)).str() | 485 | (boost::format(_("Player %i")) % (settings.playernum + 1)).str() |
976 | 488 | : | 486 | : |
977 | 489 | _("Spectator"); | 487 | _("Spectator"); |
979 | 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"; |
980 | 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."); |
981 | 492 | m_client_info.set_text(temp); | 490 | m_client_info.set_text(temp); |
982 | 493 | } | 491 | } |
983 | @@ -557,7 +555,7 @@ | |||
984 | 557 | for (; i <= m_nr_players; ++i) { | 555 | for (; i <= m_nr_players; ++i) { |
985 | 558 | infotext += "\n* "; | 556 | infotext += "\n* "; |
986 | 559 | Section & s = prof.get_safe_section((boost::format("player_%u") | 557 | Section & s = prof.get_safe_section((boost::format("player_%u") |
988 | 560 | % static_cast<unsigned int>(i)).str().c_str()); | 558 | % static_cast<unsigned int>(i)).str()); |
989 | 561 | player_save_name [i - 1] = s.get_string("name"); | 559 | player_save_name [i - 1] = s.get_string("name"); |
990 | 562 | player_save_tribe[i - 1] = s.get_string("tribe"); | 560 | player_save_tribe[i - 1] = s.get_string("tribe"); |
991 | 563 | player_save_ai [i - 1] = s.get_string("ai"); | 561 | player_save_ai [i - 1] = s.get_string("ai"); |
992 | @@ -639,12 +637,12 @@ | |||
993 | 639 | 637 | ||
994 | 640 | std::string infotext; | 638 | std::string infotext; |
995 | 641 | infotext += std::string(_("Map details:")) + "\n"; | 639 | infotext += std::string(_("Map details:")) + "\n"; |
997 | 642 | infotext += std::string("• ") + (format(_("Size: %1$u x %2$u")) | 640 | infotext += std::string("• ") + (boost::format(_("Size: %1$u x %2$u")) |
998 | 643 | % map.get_width() % map.get_height()).str() + "\n"; | 641 | % map.get_width() % map.get_height()).str() + "\n"; |
1000 | 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)) |
1001 | 645 | % m_nr_players).str() + "\n"; | 643 | % m_nr_players).str() + "\n"; |
1002 | 646 | if (m_settings->settings().scenario) | 644 | if (m_settings->settings().scenario) |
1004 | 647 | infotext += std::string("• ") + (format(_("Scenario mode selected"))).str() + "\n"; | 645 | infotext += std::string("• ") + (boost::format(_("Scenario mode selected"))).str() + "\n"; |
1005 | 648 | infotext += "\n"; | 646 | infotext += "\n"; |
1006 | 649 | infotext += map.get_description(); | 647 | infotext += map.get_description(); |
1007 | 650 | infotext += "\n"; | 648 | infotext += "\n"; |
1008 | 651 | 649 | ||
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 | 294 | if (m_settings && !m_settings->settings().saved_games.empty()) { | 294 | if (m_settings && !m_settings->settings().saved_games.empty()) { |
1014 | 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) { |
1015 | 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(); |
1017 | 297 | m_list.add(FileSystem::filename_without_ext(path).c_str(), path); | 297 | m_list.add(FileSystem::filename_without_ext(path), path); |
1018 | 298 | } | 298 | } |
1019 | 299 | } else { // Normal case | 299 | } else { // Normal case |
1020 | 300 | // Fill it with all files we find. | 300 | // Fill it with all files we find. |
1021 | @@ -365,7 +365,7 @@ | |||
1022 | 365 | } | 365 | } |
1023 | 366 | // End localization section | 366 | // End localization section |
1024 | 367 | 367 | ||
1026 | 368 | m_list.add(displaytitle.c_str(), name); | 368 | m_list.add(displaytitle, name); |
1027 | 369 | } catch (const WException &) { | 369 | } catch (const WException &) { |
1028 | 370 | // we simply skip illegal entries | 370 | // we simply skip illegal entries |
1029 | 371 | } | 371 | } |
1030 | 372 | 372 | ||
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 | 291 | } | 291 | } |
1036 | 292 | // End localization section | 292 | // End localization section |
1037 | 293 | 293 | ||
1039 | 294 | m_list.add(displaytitle.c_str(), *pname); | 294 | m_list.add(displaytitle, *pname); |
1040 | 295 | } catch (const WException &) {} // we simply skip illegal entries | 295 | } catch (const WException &) {} // we simply skip illegal entries |
1041 | 296 | } | 296 | } |
1042 | 297 | 297 | ||
1043 | 298 | 298 | ||
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 | 79 | std::sort(entries.begin(), entries.end()); | 79 | std::sort(entries.begin(), entries.end()); |
1049 | 80 | 80 | ||
1050 | 81 | for (const LanguageEntry& entry : entries) { | 81 | for (const LanguageEntry& entry : entries) { |
1052 | 82 | list->add(entry.descname.c_str(), entry.abbreviation, nullptr, entry.abbreviation == language); | 82 | list->add(entry.descname, entry.abbreviation, nullptr, entry.abbreviation == language); |
1053 | 83 | } | 83 | } |
1054 | 84 | } | 84 | } |
1055 | 85 | 85 | ||
1056 | @@ -367,13 +367,13 @@ | |||
1057 | 367 | /** TRANSLATORS: Screen resolution, e.g. 800 x 600*/ | 367 | /** TRANSLATORS: Screen resolution, e.g. 800 x 600*/ |
1058 | 368 | m_reslist.add((boost::format(_("%1% x %2%")) | 368 | m_reslist.add((boost::format(_("%1% x %2%")) |
1059 | 369 | % m_resolutions[i].xres | 369 | % m_resolutions[i].xres |
1061 | 370 | % m_resolutions[i].yres).str().c_str(), | 370 | % m_resolutions[i].yres).str(), |
1062 | 371 | nullptr, nullptr, selected); | 371 | nullptr, nullptr, selected); |
1063 | 372 | } | 372 | } |
1064 | 373 | if (!did_select_a_res) { | 373 | if (!did_select_a_res) { |
1065 | 374 | m_reslist.add((boost::format(_("%1% x %2%")) | 374 | m_reslist.add((boost::format(_("%1% x %2%")) |
1066 | 375 | % opt.xres | 375 | % opt.xres |
1068 | 376 | % opt.yres).str().c_str(), | 376 | % opt.yres).str(), |
1069 | 377 | nullptr, nullptr, true); | 377 | nullptr, nullptr, true); |
1070 | 378 | uint32_t entry = m_resolutions.size(); | 378 | uint32_t entry = m_resolutions.size(); |
1071 | 379 | m_resolutions.resize(entry + 1); | 379 | m_resolutions.resize(entry + 1); |
1072 | 380 | 380 | ||
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 | 532 | g_fs->ensure_directory_exists(SCREENSHOT_DIR); | 532 | g_fs->ensure_directory_exists(SCREENSHOT_DIR); |
1078 | 533 | for (uint32_t nr = 0; nr < 10000; ++nr) { | 533 | for (uint32_t nr = 0; nr < 10000; ++nr) { |
1079 | 534 | const std::string filename = (boost::format(SCREENSHOT_DIR "/shot%04u.png") | 534 | const std::string filename = (boost::format(SCREENSHOT_DIR "/shot%04u.png") |
1081 | 535 | % nr).str().c_str(); | 535 | % nr).str(); |
1082 | 536 | if (g_fs->file_exists(filename)) | 536 | if (g_fs->file_exists(filename)) |
1083 | 537 | continue; | 537 | continue; |
1084 | 538 | g_gr->screenshot(filename); | 538 | g_gr->screenshot(filename); |
1085 | 539 | 539 | ||
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 | 31 | #include "ui_basic/window.h" | 31 | #include "ui_basic/window.h" |
1091 | 32 | #include "wui/interactive_player.h" | 32 | #include "wui/interactive_player.h" |
1092 | 33 | 33 | ||
1093 | 34 | using boost::format; | ||
1094 | 35 | 34 | ||
1095 | 36 | struct ActionConfirm : public UI::Window { | 35 | struct ActionConfirm : public UI::Window { |
1096 | 37 | ActionConfirm | 36 | ActionConfirm |
1097 | @@ -148,7 +147,7 @@ | |||
1098 | 148 | new UI::MultilineTextarea | 147 | new UI::MultilineTextarea |
1099 | 149 | (this, | 148 | (this, |
1100 | 150 | 0, 0, 200, 74, | 149 | 0, 0, 200, 74, |
1102 | 151 | (format(message) % building.descr().descname()).str(), | 150 | (boost::format(message) % building.descr().descname()).str(), |
1103 | 152 | UI::Align_Center); | 151 | UI::Align_Center); |
1104 | 153 | 152 | ||
1105 | 154 | UI::Button * okbtn = | 153 | UI::Button * okbtn = |
1106 | 155 | 154 | ||
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 | 99 | 99 | ||
1112 | 100 | for (uint32_t i = 0; i < ware_vec.size(); i++) { | 100 | for (uint32_t i = 0; i < ware_vec.size(); i++) { |
1113 | 101 | Ware cur = ware_vec[i]; | 101 | Ware cur = ware_vec[i]; |
1115 | 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()); |
1116 | 103 | } | 103 | } |
1117 | 104 | } | 104 | } |
1118 | 105 | 105 | ||
1119 | @@ -124,7 +124,7 @@ | |||
1120 | 124 | && | 124 | && |
1121 | 125 | de->output_ware_types().count(wares.get_selected())) | 125 | de->output_ware_types().count(wares.get_selected())) |
1122 | 126 | { | 126 | { |
1124 | 127 | prodSites.add(de->descname().c_str(), i, de->get_icon()); | 127 | prodSites.add(de->descname(), i, de->get_icon()); |
1125 | 128 | found = true; | 128 | found = true; |
1126 | 129 | } | 129 | } |
1127 | 130 | } | 130 | } |
1128 | 131 | 131 | ||
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 | 180 | } | 180 | } |
1134 | 181 | UI::Window::think(); | 181 | UI::Window::think(); |
1135 | 182 | } else { | 182 | } else { |
1137 | 183 | set_title((boost::format("DEAD: %u") % m_serial).str().c_str()); | 183 | set_title((boost::format("DEAD: %u") % m_serial).str()); |
1138 | 184 | } | 184 | } |
1139 | 185 | 185 | ||
1140 | 186 | } | 186 | } |
1141 | @@ -375,7 +375,7 @@ | |||
1142 | 375 | { | 375 | { |
1143 | 376 | m_ui_immovable.set_title((boost::format("%s (%u)") | 376 | m_ui_immovable.set_title((boost::format("%s (%u)") |
1144 | 377 | % imm->descr().name().c_str() | 377 | % imm->descr().name().c_str() |
1146 | 378 | % imm->serial()).str().c_str()); | 378 | % imm->serial()).str()); |
1147 | 379 | m_ui_immovable.set_enabled(true); | 379 | m_ui_immovable.set_enabled(true); |
1148 | 380 | } else { | 380 | } else { |
1149 | 381 | m_ui_immovable.set_title("no immovable"); | 381 | m_ui_immovable.set_title("no immovable"); |
1150 | @@ -420,7 +420,7 @@ | |||
1151 | 420 | m_ui_bobs.add( | 420 | m_ui_bobs.add( |
1152 | 421 | (boost::format("%s (%u)") | 421 | (boost::format("%s (%u)") |
1153 | 422 | % temp_bob->descr().name() | 422 | % temp_bob->descr().name() |
1155 | 423 | % temp_bob->serial()).str().c_str(), | 423 | % temp_bob->serial()).str(), |
1156 | 424 | temp_bob->serial()); | 424 | temp_bob->serial()); |
1157 | 425 | } | 425 | } |
1158 | 426 | } | 426 | } |
1159 | 427 | 427 | ||
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 | 34 | #include "profile/profile.h" | 34 | #include "profile/profile.h" |
1165 | 35 | #include "wui/interactive_gamebase.h" | 35 | #include "wui/interactive_gamebase.h" |
1166 | 36 | 36 | ||
1167 | 37 | using boost::format; | ||
1168 | 38 | |||
1169 | 39 | InteractiveGameBase & GameMainMenuSaveGame::igbase() { | 37 | InteractiveGameBase & GameMainMenuSaveGame::igbase() { |
1170 | 40 | return ref_cast<InteractiveGameBase, UI::Panel>(*get_parent()); | 38 | return ref_cast<InteractiveGameBase, UI::Panel>(*get_parent()); |
1171 | 41 | } | 39 | } |
1172 | @@ -168,14 +166,10 @@ | |||
1173 | 168 | m_gametime.set_text(gametimestring(gametime)); | 166 | m_gametime.set_text(gametimestring(gametime)); |
1174 | 169 | 167 | ||
1175 | 170 | if (gpdp.get_number_of_players() > 0) { | 168 | if (gpdp.get_number_of_players() > 0) { |
1184 | 171 | char buf[200]; | 169 | const std::string text = |
1185 | 172 | sprintf | 170 | (boost::format(ngettext("%u Player", "%u Players", gpdp.get_number_of_players())) |
1186 | 173 | (buf, "%i %s", gpdp.get_number_of_players(), | 171 | % static_cast<unsigned int>(gpdp.get_number_of_players())).str(); |
1187 | 174 | // TODO(GunChleoc): This should be ngettext(" %i player" etc. | 172 | m_players_label.set_text(text); |
1180 | 175 | // with boost::format, but it refuses to work | ||
1181 | 176 | /** TRANSLATORS: This is preceded by a number */ | ||
1182 | 177 | ngettext("player", "players", gpdp.get_number_of_players())); | ||
1183 | 178 | m_players_label.set_text(buf); | ||
1188 | 179 | } else { | 173 | } else { |
1189 | 180 | // Keep label empty | 174 | // Keep label empty |
1190 | 181 | m_players_label.set_text(""); | 175 | m_players_label.set_text(""); |
1191 | @@ -212,7 +206,7 @@ | |||
1192 | 212 | try { | 206 | try { |
1193 | 213 | Widelands::GameLoader gl(name, igbase().game()); | 207 | Widelands::GameLoader gl(name, igbase().game()); |
1194 | 214 | gl.preload_game(gpdp); | 208 | gl.preload_game(gpdp); |
1196 | 215 | m_ls.add(FileSystem::filename_without_ext(name).c_str(), name); | 209 | m_ls.add(FileSystem::filename_without_ext(name), name); |
1197 | 216 | } catch (const WException &) {} // we simply skip illegal entries | 210 | } catch (const WException &) {} // we simply skip illegal entries |
1198 | 217 | } | 211 | } |
1199 | 218 | } | 212 | } |
1200 | @@ -325,7 +319,7 @@ | |||
1201 | 325 | (&parent, | 319 | (&parent, |
1202 | 326 | _("File deletion"), | 320 | _("File deletion"), |
1203 | 327 | str | 321 | str |
1205 | 328 | (format(_("Do you really want to delete the file %s?")) % | 322 | (boost::format(_("Do you really want to delete the file %s?")) % |
1206 | 329 | FileSystem::fs_filename(filename.c_str())), | 323 | FileSystem::fs_filename(filename.c_str())), |
1207 | 330 | YESNO), | 324 | YESNO), |
1208 | 331 | m_filename(filename) | 325 | m_filename(filename) |
1209 | 332 | 326 | ||
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 | 71 | for (uint32_t j = 0;; ++j) | 71 | for (uint32_t j = 0;; ++j) |
1215 | 72 | if (j == list_size) { // the objective is not in our list | 72 | if (j == list_size) { // the objective is not in our list |
1216 | 73 | if (should_show) | 73 | if (should_show) |
1218 | 74 | list.add(obj.descname().c_str(), obj); | 74 | list.add(obj.descname(), obj); |
1219 | 75 | break; | 75 | break; |
1220 | 76 | } else if (&list[j] == &obj) { // the objective is in our list | 76 | } else if (&list[j] == &obj) { // the objective is in our list |
1221 | 77 | if (!should_show) | 77 | if (!should_show) |
1222 | @@ -79,7 +79,7 @@ | |||
1223 | 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()) { |
1224 | 80 | // Update | 80 | // Update |
1225 | 81 | list.remove(j); | 81 | list.remove(j); |
1227 | 82 | list.add(obj.descname().c_str(), obj); | 82 | list.add(obj.descname(), obj); |
1228 | 83 | } | 83 | } |
1229 | 84 | break; | 84 | break; |
1230 | 85 | } | 85 | } |
1231 | 86 | 86 | ||
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 | 148 | 148 | ||
1237 | 149 | iterate_players_existing_const(p, nr_players, game, player) { | 149 | iterate_players_existing_const(p, nr_players, game, player) { |
1238 | 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") |
1240 | 151 | % static_cast<unsigned int>(p)).str().c_str(); | 151 | % static_cast<unsigned int>(p)).str(); |
1241 | 152 | UI::Button & cb = | 152 | UI::Button & cb = |
1242 | 153 | *new UI::Button | 153 | *new UI::Button |
1243 | 154 | (hbox1, "playerbutton", | 154 | (hbox1, "playerbutton", |
1244 | 155 | 155 | ||
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 | 57 | #include "wui/text_layout.h" | 57 | #include "wui/text_layout.h" |
1250 | 58 | #include "wui/unique_window_handler.h" | 58 | #include "wui/unique_window_handler.h" |
1251 | 59 | 59 | ||
1252 | 60 | using boost::format; | ||
1253 | 61 | using Widelands::Area; | 60 | using Widelands::Area; |
1254 | 62 | using Widelands::CoordPath; | 61 | using Widelands::CoordPath; |
1255 | 63 | using Widelands::Coords; | 62 | using Widelands::Coords; |
1256 | @@ -329,12 +328,12 @@ | |||
1257 | 329 | (real == 1000 ? std::string() : speed_string(real)); | 328 | (real == 1000 ? std::string() : speed_string(real)); |
1258 | 330 | else { | 329 | else { |
1259 | 331 | m_label_speed.set_text( | 330 | m_label_speed.set_text( |
1261 | 332 | (format | 331 | (boost::format |
1262 | 333 | /** TRANSLATORS: actual_speed (desired_speed) */ | 332 | /** TRANSLATORS: actual_speed (desired_speed) */ |
1263 | 334 | (_("%1$s (%2$s)")) | 333 | (_("%1$s (%2$s)")) |
1264 | 335 | % speed_string(real).c_str() | 334 | % speed_string(real).c_str() |
1265 | 336 | % speed_string(desired).c_str() | 335 | % speed_string(desired).c_str() |
1267 | 337 | ).str().c_str() | 336 | ).str() |
1268 | 338 | ); | 337 | ); |
1269 | 339 | } | 338 | } |
1270 | 340 | } else | 339 | } else |
1271 | @@ -407,7 +406,7 @@ | |||
1272 | 407 | const std::string gametime(gametimestring(egbase().get_gametime())); | 406 | const std::string gametime(gametimestring(egbase().get_gametime())); |
1273 | 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); |
1274 | 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); |
1276 | 410 | static format node_format("(%i, %i)"); | 409 | static boost::format node_format("(%i, %i)"); |
1277 | 411 | 410 | ||
1278 | 412 | const std::string node_text = as_uifont | 411 | const std::string node_text = as_uifont |
1279 | 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); |
1280 | @@ -421,7 +420,7 @@ | |||
1281 | 421 | 420 | ||
1282 | 422 | // Blit FPS when in debug mode. | 421 | // Blit FPS when in debug mode. |
1283 | 423 | if (get_display_flag(dfDebug)) { | 422 | if (get_display_flag(dfDebug)) { |
1285 | 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)"); |
1286 | 425 | const std::string fps_text = as_uifont | 424 | const std::string fps_text = as_uifont |
1287 | 426 | ((fps_format % | 425 | ((fps_format % |
1288 | 427 | (1000.0 / m_frametime) % (1000.0 / (m_avg_usframetime / 1000))) | 426 | (1000.0 / m_frametime) % (1000.0 / (m_avg_usframetime / 1000))) |
1289 | @@ -993,7 +992,7 @@ | |||
1290 | 993 | 992 | ||
1291 | 994 | if (!obj) { | 993 | if (!obj) { |
1292 | 995 | DebugConsole::write | 994 | DebugConsole::write |
1294 | 996 | (str(format("No MapObject with serial number %1%") % serial)); | 995 | (str(boost::format("No MapObject with serial number %1%") % serial)); |
1295 | 997 | return; | 996 | return; |
1296 | 998 | } | 997 | } |
1297 | 999 | 998 | ||
1298 | 1000 | 999 | ||
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 | 60 | 60 | ||
1304 | 61 | using Widelands::Building; | 61 | using Widelands::Building; |
1305 | 62 | using Widelands::Map; | 62 | using Widelands::Map; |
1306 | 63 | using boost::format; | ||
1307 | 64 | |||
1308 | 65 | 63 | ||
1309 | 66 | namespace { | 64 | namespace { |
1310 | 67 | 65 | ||
1311 | @@ -456,13 +454,13 @@ | |||
1312 | 456 | 454 | ||
1313 | 457 | int const n = atoi(args[1].c_str()); | 455 | int const n = atoi(args[1].c_str()); |
1314 | 458 | if (n < 1 || n > MAX_PLAYERS || !game().get_player(n)) { | 456 | if (n < 1 || n > MAX_PLAYERS || !game().get_player(n)) { |
1316 | 459 | DebugConsole::write(str(format("Player #%1% does not exist.") % n)); | 457 | DebugConsole::write(str(boost::format("Player #%1% does not exist.") % n)); |
1317 | 460 | return; | 458 | return; |
1318 | 461 | } | 459 | } |
1319 | 462 | 460 | ||
1320 | 463 | DebugConsole::write | 461 | DebugConsole::write |
1321 | 464 | (str | 462 | (str |
1323 | 465 | (format("Switching from #%1% to #%2%.") | 463 | (boost::format("Switching from #%1% to #%2%.") |
1324 | 466 | % static_cast<int>(m_player_number) % n)); | 464 | % static_cast<int>(m_player_number) % n)); |
1325 | 467 | m_player_number = n; | 465 | m_player_number = n; |
1326 | 468 | Map & map = egbase().map(); | 466 | Map & map = egbase().map(); |
1327 | 469 | 467 | ||
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 | 121 | pic = (boost::format("pics/genstats_enable_plr_0%u.png") | 121 | pic = (boost::format("pics/genstats_enable_plr_0%u.png") |
1333 | 122 | % static_cast<unsigned int>(us.position + 1)).str(); | 122 | % static_cast<unsigned int>(us.position + 1)).str(); |
1334 | 123 | temp_tooltip = (boost::format(_("Player %u")) | 123 | temp_tooltip = (boost::format(_("Player %u")) |
1336 | 124 | % static_cast<unsigned int>(us.position + 1)).str().c_str(); | 124 | % static_cast<unsigned int>(us.position + 1)).str(); |
1337 | 125 | } else { | 125 | } else { |
1338 | 126 | pic = "pics/menu_tab_watch.png"; | 126 | pic = "pics/menu_tab_watch.png"; |
1339 | 127 | temp_tooltip = _("Spectator"); | 127 | temp_tooltip = _("Spectator"); |
1340 | @@ -174,7 +174,7 @@ | |||
1341 | 174 | set_size(w, h); | 174 | set_size(w, h); |
1342 | 175 | 175 | ||
1343 | 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") |
1345 | 177 | % static_cast<unsigned int>(id + 1)).str().c_str(); | 177 | % static_cast<unsigned int>(id + 1)).str(); |
1346 | 178 | player = | 178 | player = |
1347 | 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)); |
1348 | 180 | add(player, UI::Box::AlignCenter); | 180 | add(player, UI::Box::AlignCenter); |
1349 | @@ -288,11 +288,11 @@ | |||
1350 | 288 | type ->set_pic(g_gr->images().get("pics/shared_in.png")); | 288 | type ->set_pic(g_gr->images().get("pics/shared_in.png")); |
1351 | 289 | 289 | ||
1352 | 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") |
1354 | 291 | % static_cast<unsigned int>(player_setting.shared_in)).str().c_str(); | 291 | % static_cast<unsigned int>(player_setting.shared_in)).str(); |
1355 | 292 | 292 | ||
1356 | 293 | tribe->set_pic(g_gr->images().get(pic)); | 293 | tribe->set_pic(g_gr->images().get(pic)); |
1357 | 294 | tribe->set_tooltip((boost::format(_("Player %u")) | 294 | tribe->set_tooltip((boost::format(_("Player %u")) |
1359 | 295 | % static_cast<unsigned int>(player_setting.shared_in)).str().c_str()); | 295 | % static_cast<unsigned int>(player_setting.shared_in)).str()); |
1360 | 296 | 296 | ||
1361 | 297 | team ->set_visible(false); | 297 | team ->set_visible(false); |
1362 | 298 | team ->set_enabled(false); | 298 | team ->set_enabled(false); |
1363 | 299 | 299 | ||
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 | 35 | #include "wui/text_layout.h" | 35 | #include "wui/text_layout.h" |
1369 | 36 | 36 | ||
1370 | 37 | using namespace std; | 37 | using namespace std; |
1371 | 38 | using boost::format; | ||
1372 | 39 | 38 | ||
1373 | 40 | namespace { | 39 | namespace { |
1374 | 41 | 40 | ||
1375 | @@ -71,7 +70,8 @@ | |||
1376 | 71 | }; | 70 | }; |
1377 | 72 | 71 | ||
1378 | 73 | string ytick_text_style(const string& text, const RGBColor& clr) { | 72 | string ytick_text_style(const string& text, const RGBColor& clr) { |
1380 | 74 | static format f("<rt><p><font face=DejaVuSansCondensed size=13 color=%02x%02x%02x>%s</font></p></rt>"); | 73 | static boost::format |
1381 | 74 | f("<rt><p><font face=DejaVuSansCondensed size=13 color=%02x%02x%02x>%s</font></p></rt>"); | ||
1382 | 75 | f % int(clr.r) % int(clr.g) % int(clr.b); | 75 | f % int(clr.r) % int(clr.g) % int(clr.b); |
1383 | 76 | f % text; | 76 | f % text; |
1384 | 77 | return f.str(); | 77 | return f.str(); |
Solid change! Lots of small but impactful improvements here.