Merge lp:~widelands-dev/widelands/delete_deprecated into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7292
Proposed branch: lp:~widelands-dev/widelands/delete_deprecated
Merge into: lp:widelands
Diff against target: 2761 lines (+296/-461)
108 files modified
src/ai/defaultai.cc (+12/-12)
src/base/CMakeLists.txt (+0/-7)
src/base/deprecated.cc (+0/-20)
src/base/deprecated.h (+0/-35)
src/economy/CMakeLists.txt (+0/-1)
src/economy/economy.cc (+3/-2)
src/economy/flag.cc (+8/-6)
src/economy/fleet.cc (+0/-1)
src/economy/portdock.cc (+1/-1)
src/economy/road.cc (+2/-2)
src/economy/routeastar.h (+0/-1)
src/economy/supply_list.cc (+0/-1)
src/economy/test/CMakeLists.txt (+0/-1)
src/economy/test/test_routing.cc (+0/-1)
src/economy/ware_instance.cc (+1/-1)
src/economy/wares_queue.cc (+1/-1)
src/editor/editorinteractive.cc (+6/-4)
src/editor/ui_menus/editor_main_menu.cc (+1/-1)
src/editor/ui_menus/editor_main_menu_load_map.cc (+1/-1)
src/editor/ui_menus/editor_main_menu_map_options.cc (+1/-1)
src/editor/ui_menus/editor_main_menu_new_map.cc (+1/-1)
src/editor/ui_menus/editor_main_menu_random_map.cc (+1/-1)
src/editor/ui_menus/editor_main_menu_save_map.cc (+1/-1)
src/editor/ui_menus/editor_player_menu.cc (+13/-18)
src/editor/ui_menus/editor_player_menu.h (+1/-0)
src/editor/ui_menus/editor_tool_change_resources_options_menu.cc (+7/-3)
src/editor/ui_menus/editor_tool_change_resources_options_menu.h (+1/-0)
src/editor/ui_menus/editor_tool_menu.cc (+1/-1)
src/editor/ui_menus/editor_tool_options_menu.cc (+1/-1)
src/editor/ui_menus/editor_toolsize_menu.cc (+1/-1)
src/graphic/CMakeLists.txt (+0/-1)
src/graphic/animation.cc (+0/-1)
src/graphic/graphic.cc (+0/-1)
src/graphic/terrain_texture.cc (+0/-1)
src/graphic/text_parser.cc (+0/-1)
src/io/CMakeLists.txt (+0/-1)
src/io/filesystem/layered_filesystem.cc (+0/-1)
src/logic/CMakeLists.txt (+0/-1)
src/logic/battle.cc (+12/-8)
src/logic/bob.cc (+3/-2)
src/logic/building.cc (+2/-3)
src/logic/carrier.cc (+19/-19)
src/logic/constructionsite.cc (+2/-2)
src/logic/critter.cc (+1/-2)
src/logic/findnode.cc (+0/-1)
src/logic/immovable.cc (+1/-2)
src/logic/instances.cc (+0/-1)
src/logic/instances.h (+4/-5)
src/logic/militarysite.cc (+9/-9)
src/logic/partially_finished_building.cc (+1/-1)
src/logic/pathfield.cc (+0/-1)
src/logic/player.cc (+5/-4)
src/logic/production_program.h (+0/-1)
src/logic/productionsite.cc (+2/-2)
src/logic/requirements.cc (+0/-1)
src/logic/ship.cc (+2/-2)
src/logic/soldier.cc (+12/-14)
src/logic/trainingsite.cc (+3/-3)
src/logic/warehouse.cc (+12/-20)
src/logic/worker.cc (+13/-24)
src/logic/worker_descr.cc (+1/-2)
src/map_io/CMakeLists.txt (+0/-1)
src/map_io/map_buildingdata_packet.cc (+29/-72)
src/map_io/map_elemental_packet.cc (+0/-1)
src/map_io/map_flag_packet.cc (+1/-1)
src/map_io/map_flagdata_packet.cc (+2/-2)
src/map_io/map_object_saver.cc (+0/-1)
src/map_io/map_port_spaces_packet.cc (+0/-1)
src/map_io/map_roaddata_packet.cc (+6/-12)
src/network/CMakeLists.txt (+0/-1)
src/network/network_lan_promotion.cc (+0/-1)
src/scripting/CMakeLists.txt (+0/-1)
src/scripting/lua_map.cc (+8/-7)
src/sound/CMakeLists.txt (+0/-1)
src/sound/sound_handler.cc (+0/-1)
src/ui_basic/CMakeLists.txt (+0/-1)
src/ui_basic/listselect.cc (+0/-1)
src/ui_basic/progresswindow.cc (+0/-1)
src/ui_basic/spinbox.cc (+0/-1)
src/ui_basic/table.cc (+0/-1)
src/wui/CMakeLists.txt (+0/-1)
src/wui/actionconfirm.cc (+1/-1)
src/wui/building_statistics_menu.cc (+2/-2)
src/wui/buildingwindow.cc (+3/-3)
src/wui/buildingwindow.h (+1/-1)
src/wui/constructionsitewindow.cc (+1/-1)
src/wui/dismantlesitewindow.cc (+1/-1)
src/wui/encyclopedia_window.cc (+3/-5)
src/wui/fieldaction.cc (+36/-35)
src/wui/game_debug_ui.cc (+3/-3)
src/wui/game_main_menu_save_game.cc (+3/-3)
src/wui/game_main_menu_save_game.h (+0/-1)
src/wui/game_message_menu.cc (+1/-2)
src/wui/game_message_menu.h (+0/-1)
src/wui/game_objectives_menu.cc (+1/-1)
src/wui/general_statistics_menu.cc (+2/-2)
src/wui/interactive_gamebase.cc (+1/-1)
src/wui/interactive_player.cc (+2/-2)
src/wui/interactive_spectator.cc (+1/-2)
src/wui/militarysitewindow.cc (+1/-1)
src/wui/minimap.cc (+1/-1)
src/wui/productionsitewindow.h (+1/-1)
src/wui/shipwindow.cc (+2/-2)
src/wui/soldierlist.cc (+0/-1)
src/wui/trainingsitewindow.cc (+1/-1)
src/wui/transport_ui.cc (+11/-12)
src/wui/warehousewindow.cc (+1/-1)
src/wui/watchwindow.cc (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/delete_deprecated
Reviewer Review Type Date Requested Status
SirVer Approve
GunChleoc Needs Resubmitting
Review via email: mp+243174@code.launchpad.net

Description of the change

Got rid of base/deprecated.h.

There are 2 NOCOM comments in the code with questions.

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

Couple of nits. I suggest to prefer dynamic_cast<> wherever possible (i.e. when you know the type of the object you have) instead of upcast() which is made for if(upcast()) { situations. dynamic_cast<> can also cast references which will make for easier to read code.

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Next round - replaced upcast with dynamic_cast, but only for the statements that I introduced. typeid(building) is also gone.

review: Needs Resubmitting
Revision history for this message
SirVer (sirver) wrote :

Looks good. Gonna merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ai/defaultai.cc'
2--- src/ai/defaultai.cc 2014-11-30 11:14:34 +0000
3+++ src/ai/defaultai.cc 2014-11-30 18:54:51 +0000
4@@ -329,9 +329,9 @@
5 }
6
7 // Read all interesting data from ware producing buildings
8- if (typeid(bld) == typeid(ProductionSiteDescr)) {
9+ if (bld.type() == MapObjectType::PRODUCTIONSITE) {
10 const ProductionSiteDescr& prod =
11- ref_cast<ProductionSiteDescr const, BuildingDescr const>(bld);
12+ dynamic_cast<const ProductionSiteDescr&>(bld);
13 bo.type = bld.get_ismine() ? BuildingObserver::MINE : BuildingObserver::PRODUCTIONSITE;
14 for (const WareAmount& temp_input : prod.inputs()) {
15 bo.inputs_.push_back(temp_input.first);
16@@ -368,10 +368,10 @@
17 // now for every military building, we fill critical_built_mat_ vector
18 // with critical construction wares
19 // non critical are excluded (see below)
20- if (typeid(bld) == typeid(MilitarySiteDescr)) {
21+ if (bld.type() == MapObjectType::MILITARYSITE) {
22 bo.type = BuildingObserver::MILITARYSITE;
23 const MilitarySiteDescr& milit =
24- ref_cast<MilitarySiteDescr const, BuildingDescr const>(bld);
25+ dynamic_cast<const MilitarySiteDescr&>(bld);
26 for (const std::pair<unsigned char, unsigned char>& temp_buildcosts : milit.buildcost()) {
27 // bellow are non-critical wares
28 if (tribe_->ware_index("log") == temp_buildcosts.first ||
29@@ -387,17 +387,17 @@
30 continue;
31 }
32
33- if (typeid(bld) == typeid(WarehouseDescr)) {
34+ if (bld.type() == MapObjectType::WAREHOUSE) {
35 bo.type = BuildingObserver::WAREHOUSE;
36 continue;
37 }
38
39- if (typeid(bld) == typeid(TrainingSiteDescr)) {
40+ if (bld.type() == MapObjectType::TRAININGSITE) {
41 bo.type = BuildingObserver::TRAININGSITE;
42 continue;
43 }
44
45- if (typeid(bld) == typeid(ConstructionSiteDescr)) {
46+ if (bld.type() == MapObjectType::CONSTRUCTIONSITE) {
47 bo.type = BuildingObserver::CONSTRUCTIONSITE;
48 continue;
49 }
50@@ -3008,7 +3008,7 @@
51
52 if (bo.type == BuildingObserver::CONSTRUCTIONSITE) {
53 BuildingObserver& target_bo =
54- get_building_observer(ref_cast<ConstructionSite, Building>(b).building().name().c_str());
55+ get_building_observer(dynamic_cast<ConstructionSite&>(b).building().name().c_str());
56 ++target_bo.cnt_under_construction_;
57 ++num_constructionsites_;
58 if (target_bo.type == BuildingObserver::PRODUCTIONSITE) {
59@@ -3025,7 +3025,7 @@
60
61 if (bo.type == BuildingObserver::PRODUCTIONSITE) {
62 productionsites.push_back(ProductionSiteObserver());
63- productionsites.back().site = &ref_cast<ProductionSite, Building>(b);
64+ productionsites.back().site = &dynamic_cast<ProductionSite&>(b);
65 productionsites.back().bo = &bo;
66 productionsites.back().built_time_ = game().get_gametime();
67 productionsites.back().unoccupied_till_ = game().get_gametime();
68@@ -3039,7 +3039,7 @@
69 ++wares.at(bo.inputs_.at(i)).consumers_;
70 } else if (bo.type == BuildingObserver::MINE) {
71 mines_.push_back(ProductionSiteObserver());
72- mines_.back().site = &ref_cast<ProductionSite, Building>(b);
73+ mines_.back().site = &dynamic_cast<ProductionSite&>(b);
74 mines_.back().bo = &bo;
75 mines_.back().built_time_ = game().get_gametime();
76
77@@ -3050,7 +3050,7 @@
78 ++wares.at(bo.inputs_.at(i)).consumers_;
79 } else if (bo.type == BuildingObserver::MILITARYSITE) {
80 militarysites.push_back(MilitarySiteObserver());
81- militarysites.back().site = &ref_cast<MilitarySite, Building>(b);
82+ militarysites.back().site = &dynamic_cast<MilitarySite&>(b);
83 militarysites.back().bo = &bo;
84 militarysites.back().checks = bo.desc->get_size();
85 militarysites.back().enemies_nearby_ = true;
86@@ -3067,7 +3067,7 @@
87
88 if (bo.type == BuildingObserver::CONSTRUCTIONSITE) {
89 BuildingObserver& target_bo = get_building_observer(
90- ref_cast<ConstructionSite const, Building const>(b).building().name().c_str());
91+ dynamic_cast<const ConstructionSite&>(b).building().name().c_str());
92 --target_bo.cnt_under_construction_;
93 --num_constructionsites_;
94 if (target_bo.type == BuildingObserver::PRODUCTIONSITE) {
95
96=== modified file 'src/base/CMakeLists.txt'
97--- src/base/CMakeLists.txt 2014-11-26 09:36:46 +0000
98+++ src/base/CMakeLists.txt 2014-11-30 18:54:51 +0000
99@@ -45,13 +45,6 @@
100 base_macros
101 )
102
103-# TODO(sirver): this library should be deleted.
104-wl_library(base_deprecated
105- SRCS
106- deprecated.h
107- deprecated.cc
108- DEPENDS
109-)
110
111 wl_library(base_scoped_timer
112 SRCS
113
114=== removed file 'src/base/deprecated.cc'
115--- src/base/deprecated.cc 2014-07-05 12:17:03 +0000
116+++ src/base/deprecated.cc 1970-01-01 00:00:00 +0000
117@@ -1,20 +0,0 @@
118-/*
119- * Copyright (C) 2006-2014 by the Widelands Development Team
120- *
121- * This program is free software; you can redistribute it and/or
122- * modify it under the terms of the GNU General Public License
123- * as published by the Free Software Foundation; either version 2
124- * of the License, or (at your option) any later version.
125- *
126- * This program is distributed in the hope that it will be useful,
127- * but WITHOUT ANY WARRANTY; without even the implied warranty of
128- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129- * GNU General Public License for more details.
130- *
131- * You should have received a copy of the GNU General Public License
132- * along with this program; if not, write to the Free Software
133- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
134- *
135- */
136-
137-// Dummy file as cmake cannot handle header only libraries :(.
138
139=== removed file 'src/base/deprecated.h'
140--- src/base/deprecated.h 2014-07-25 19:15:23 +0000
141+++ src/base/deprecated.h 1970-01-01 00:00:00 +0000
142@@ -1,35 +0,0 @@
143-/*
144- * Copyright (C) 2006-2014 by the Widelands Development Team
145- *
146- * This program is free software; you can redistribute it and/or
147- * modify it under the terms of the GNU General Public License
148- * as published by the Free Software Foundation; either version 2
149- * of the License, or (at your option) any later version.
150- *
151- * This program is distributed in the hope that it will be useful,
152- * but WITHOUT ANY WARRANTY; without even the implied warranty of
153- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
154- * GNU General Public License for more details.
155- *
156- * You should have received a copy of the GNU General Public License
157- * along with this program; if not, write to the Free Software
158- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
159- *
160- */
161-
162-#ifndef WL_BASE_DEPRECATED_H
163-#define WL_BASE_DEPRECATED_H
164-
165-// Code that is still used all over the place, but should not be used anymore.
166-
167-#include <cassert>
168-
169-// DEPRECATED: leads to unsafe code. Instead use upcast() or is_a() to check at
170-// runtime for the type you are expecting.
171-template<typename Derived, typename Base> Derived & ref_cast(Base & base) {
172- assert(dynamic_cast<Derived *>(&base) == static_cast<Derived *>(&base));
173- return static_cast<Derived &>(base);
174-}
175-
176-
177-#endif // end of include guard: WL_BASE_DEPRECATED_H
178
179=== modified file 'src/economy/CMakeLists.txt'
180--- src/economy/CMakeLists.txt 2014-07-05 12:17:03 +0000
181+++ src/economy/CMakeLists.txt 2014-11-30 18:54:51 +0000
182@@ -41,7 +41,6 @@
183 wares_queue.cc
184 wares_queue.h
185 DEPENDS
186- base_deprecated
187 base_exceptions
188 base_log
189 base_macros
190
191=== modified file 'src/economy/economy.cc'
192--- src/economy/economy.cc 2014-09-20 09:37:47 +0000
193+++ src/economy/economy.cc 2014-11-30 18:54:51 +0000
194@@ -1034,11 +1034,12 @@
195 */
196 void Economy::balance(uint32_t const timerid)
197 {
198- if (m_request_timerid != timerid)
199+ if (m_request_timerid != timerid) {
200 return;
201+ }
202 ++m_request_timerid;
203
204- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
205+ Game & game = dynamic_cast<Game&>(owner().egbase());
206
207 _check_splits();
208
209
210=== modified file 'src/economy/flag.cc'
211--- src/economy/flag.cc 2014-09-10 10:18:46 +0000
212+++ src/economy/flag.cc 2014-11-30 18:54:51 +0000
213@@ -19,7 +19,6 @@
214
215 #include "economy/flag.h"
216
217-#include "base/deprecated.h"
218 #include "base/macros.h"
219 #include "base/wexception.h"
220 #include "economy/economy.h"
221@@ -640,15 +639,16 @@
222 }
223
224 // Deal with the normal (flag) case
225- ref_cast<Flag const, PlayerImmovable const>(*nextstep);
226+ const Flag& nextflag = dynamic_cast<const Flag&>(*nextstep);
227
228 for (int32_t dir = 1; dir <= 6; ++dir) {
229 Road * const road = get_road(dir);
230 Flag * other;
231 Road::FlagId flagid;
232
233- if (!road)
234+ if (!road) {
235 continue;
236+ }
237
238 if (&road->get_flag(Road::FlagStart) == this) {
239 flagid = Road::FlagStart;
240@@ -658,12 +658,14 @@
241 other = &road->get_flag(Road::FlagStart);
242 }
243
244- if (other != nextstep)
245+ if (other != &nextflag) {
246 continue;
247+ }
248
249 // Yes, this is the road we want; inform it
250- if (road->notify_ware(game, flagid))
251+ if (road->notify_ware(game, flagid)) {
252 return;
253+ }
254
255 // If the road doesn't react to the ware immediately, we try other roads:
256 // They might lead to the same flag!
257@@ -791,7 +793,7 @@
258 Worker * const w,
259 PlayerImmovable & target)
260 {
261- Flag & flag = ref_cast<Flag, PlayerImmovable>(target);
262+ Flag & flag = dynamic_cast<Flag&>(target);
263
264 assert(w);
265
266
267=== modified file 'src/economy/fleet.cc'
268--- src/economy/fleet.cc 2014-09-20 09:37:47 +0000
269+++ src/economy/fleet.cc 2014-11-30 18:54:51 +0000
270@@ -21,7 +21,6 @@
271
272 #include <memory>
273
274-#include "base/deprecated.h"
275 #include "base/macros.h"
276 #include "economy/economy.h"
277 #include "economy/flag.h"
278
279=== modified file 'src/economy/portdock.cc'
280--- src/economy/portdock.cc 2014-09-20 09:37:47 +0000
281+++ src/economy/portdock.cc 2014-11-30 18:54:51 +0000
282@@ -21,8 +21,8 @@
283
284 #include <memory>
285
286-#include "base/deprecated.h"
287 #include "base/log.h"
288+#include "base/macros.h"
289 #include "economy/fleet.h"
290 #include "economy/ware_instance.h"
291 #include "economy/wares_queue.h"
292
293=== modified file 'src/economy/road.cc'
294--- src/economy/road.cc 2014-09-19 12:54:54 +0000
295+++ src/economy/road.cc 2014-11-30 18:54:51 +0000
296@@ -382,11 +382,11 @@
297 {
298 assert(w);
299
300- Road & road = ref_cast<Road, PlayerImmovable>(target);
301+ Road& road = dynamic_cast<Road&>(target);
302
303 for (CarrierSlot& slot : road.m_carrier_slots) {
304 if (slot.carrier_request == &rq) {
305- Carrier & carrier = ref_cast<Carrier, Worker> (*w);
306+ Carrier & carrier = dynamic_cast<Carrier&> (*w);
307 slot.carrier_request = nullptr;
308 slot.carrier = &carrier;
309
310
311=== modified file 'src/economy/routeastar.h'
312--- src/economy/routeastar.h 2014-09-14 11:31:58 +0000
313+++ src/economy/routeastar.h 2014-11-30 18:54:51 +0000
314@@ -20,7 +20,6 @@
315 #ifndef WL_ECONOMY_ROUTEASTAR_H
316 #define WL_ECONOMY_ROUTEASTAR_H
317
318-#include "base/deprecated.h"
319 #include "economy/itransport_cost_calculator.h"
320 #include "economy/routing_node.h"
321
322
323=== modified file 'src/economy/supply_list.cc'
324--- src/economy/supply_list.cc 2014-07-25 16:37:06 +0000
325+++ src/economy/supply_list.cc 2014-11-30 18:54:51 +0000
326@@ -19,7 +19,6 @@
327
328 #include "economy/supply_list.h"
329
330-#include "base/deprecated.h"
331 #include "base/wexception.h"
332 #include "economy/request.h"
333 #include "economy/supply.h"
334
335=== modified file 'src/economy/test/CMakeLists.txt'
336--- src/economy/test/CMakeLists.txt 2014-10-28 21:14:24 +0000
337+++ src/economy/test/CMakeLists.txt 2014-11-30 18:54:51 +0000
338@@ -4,7 +4,6 @@
339 test_road.cc
340 test_routing.cc
341 DEPENDS
342- base_deprecated
343 economy
344 io_filesystem
345 logic
346
347=== modified file 'src/economy/test/test_routing.cc'
348--- src/economy/test/test_routing.cc 2014-10-28 21:14:24 +0000
349+++ src/economy/test/test_routing.cc 2014-11-30 18:54:51 +0000
350@@ -22,7 +22,6 @@
351 #include <boost/bind.hpp>
352 #include <boost/test/unit_test.hpp>
353
354-#include "base/deprecated.h"
355 #include "economy/flag.h"
356 #include "economy/iroute.h"
357 #include "economy/itransport_cost_calculator.h"
358
359=== modified file 'src/economy/ware_instance.cc'
360--- src/economy/ware_instance.cc 2014-09-20 09:37:47 +0000
361+++ src/economy/ware_instance.cc 2014-11-30 18:54:51 +0000
362@@ -561,7 +561,7 @@
363 m_transfer_nextstep = fr.unsigned_32();
364 if (fr.unsigned_8()) {
365 ware.m_transfer =
366- new Transfer(ref_cast<Game, EditorGameBase>(egbase()), ware);
367+ new Transfer(dynamic_cast<Game&>(egbase()), ware);
368 ware.m_transfer->read(fr, m_transfer);
369 }
370 }
371
372=== modified file 'src/economy/wares_queue.cc'
373--- src/economy/wares_queue.cc 2014-09-20 09:37:47 +0000
374+++ src/economy/wares_queue.cc 2014-11-30 18:54:51 +0000
375@@ -131,7 +131,7 @@
376 PlayerImmovable & target)
377 {
378 WaresQueue & wq =
379- ref_cast<Building, PlayerImmovable>(target).waresqueue(ware);
380+ dynamic_cast<Building&>(target).waresqueue(ware);
381
382 assert(!w); // WaresQueue can't hold workers
383 assert(wq.m_filled < wq.m_max_size);
384
385=== modified file 'src/editor/editorinteractive.cc'
386--- src/editor/editorinteractive.cc 2014-11-23 14:34:38 +0000
387+++ src/editor/editorinteractive.cc 2014-11-30 18:54:51 +0000
388@@ -336,12 +336,14 @@
389 }
390
391 void EditorInteractive::set_sel_radius_and_update_menu(uint32_t const val) {
392- if (tools.current().has_size_one())
393+ if (tools.current().has_size_one()) {
394 return;
395- if (UI::UniqueWindow * const w = m_toolsizemenu.window)
396- ref_cast<EditorToolsizeMenu, UI::UniqueWindow>(*w).update(val);
397- else
398+ }
399+ if (UI::UniqueWindow * const w = m_toolsizemenu.window) {
400+ dynamic_cast<EditorToolsizeMenu&>(*w).update(val);
401+ } else {
402 set_sel_radius(val);
403+ }
404 }
405
406
407
408=== modified file 'src/editor/ui_menus/editor_main_menu.cc'
409--- src/editor/ui_menus/editor_main_menu.cc 2014-09-10 14:08:25 +0000
410+++ src/editor/ui_menus/editor_main_menu.cc 2014-11-30 18:54:51 +0000
411@@ -37,7 +37,7 @@
412 #define vspacing 15
413
414 inline EditorInteractive & EditorMainMenu::eia() {
415- return ref_cast<EditorInteractive, UI::Panel>(*get_parent());
416+ return dynamic_cast<EditorInteractive&>(*get_parent());
417 }
418
419 /**
420
421=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc'
422--- src/editor/ui_menus/editor_main_menu_load_map.cc 2014-10-28 14:57:52 +0000
423+++ src/editor/ui_menus/editor_main_menu_load_map.cc 2014-11-30 18:54:51 +0000
424@@ -146,7 +146,7 @@
425 m_mapfiles.clear();
426 fill_list();
427 } else {
428- ref_cast<EditorInteractive, UI::Panel>(*get_parent()).load(filename);
429+ dynamic_cast<EditorInteractive&>(*get_parent()).load(filename);
430 die();
431 }
432 }
433
434=== modified file 'src/editor/ui_menus/editor_main_menu_map_options.cc'
435--- src/editor/ui_menus/editor_main_menu_map_options.cc 2014-10-28 08:16:53 +0000
436+++ src/editor/ui_menus/editor_main_menu_map_options.cc 2014-11-30 18:54:51 +0000
437@@ -36,7 +36,7 @@
438
439
440 inline EditorInteractive & MainMenuMapOptions::eia() {
441- return ref_cast<EditorInteractive, UI::Panel>(*get_parent());
442+ return dynamic_cast<EditorInteractive&>(*get_parent());
443 }
444
445
446
447=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.cc'
448--- src/editor/ui_menus/editor_main_menu_new_map.cc 2014-11-13 08:25:45 +0000
449+++ src/editor/ui_menus/editor_main_menu_new_map.cc 2014-11-30 18:54:51 +0000
450@@ -134,7 +134,7 @@
451
452 void MainMenuNewMap::clicked_create_map() {
453 EditorInteractive & eia =
454- ref_cast<EditorInteractive, UI::Panel>(*get_parent());
455+ dynamic_cast<EditorInteractive&>(*get_parent());
456 Widelands::EditorGameBase & egbase = eia.egbase();
457 Widelands::Map & map = egbase.map();
458 UI::ProgressWindow loader;
459
460=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
461--- src/editor/ui_menus/editor_main_menu_random_map.cc 2014-11-13 08:25:45 +0000
462+++ src/editor/ui_menus/editor_main_menu_random_map.cc 2014-11-30 18:54:51 +0000
463@@ -484,7 +484,7 @@
464
465 void MainMenuNewRandomMap::clicked_create_map() {
466 EditorInteractive & eia =
467- ref_cast<EditorInteractive, UI::Panel>(*get_parent());
468+ dynamic_cast<EditorInteractive&>(*get_parent());
469 Widelands::EditorGameBase & egbase = eia.egbase();
470 Widelands::Map & map = egbase.map();
471 UI::ProgressWindow loader;
472
473=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
474--- src/editor/ui_menus/editor_main_menu_save_map.cc 2014-10-28 14:57:52 +0000
475+++ src/editor/ui_menus/editor_main_menu_save_map.cc 2014-11-30 18:54:51 +0000
476@@ -46,7 +46,7 @@
477 #include "ui_basic/textarea.h"
478
479 inline EditorInteractive & MainMenuSaveMap::eia() {
480- return ref_cast<EditorInteractive, UI::Panel>(*get_parent());
481+ return dynamic_cast<EditorInteractive&>(*get_parent());
482 }
483
484
485
486=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
487--- src/editor/ui_menus/editor_player_menu.cc 2014-11-22 10:18:20 +0000
488+++ src/editor/ui_menus/editor_player_menu.cc 2014-11-30 18:54:51 +0000
489@@ -38,6 +38,10 @@
490
491 #define UNDEFINED_TRIBE_NAME "<undefined>"
492
493+inline EditorInteractive & EditorPlayerMenu::eia() {
494+ return dynamic_cast<EditorInteractive&>(*get_parent());
495+}
496+
497 EditorPlayerMenu::EditorPlayerMenu
498 (EditorInteractive & parent, UI::UniqueWindow::Registry & registry)
499 :
500@@ -108,9 +112,7 @@
501 if (is_minimal())
502 return;
503
504- Widelands::Map & map =
505- ref_cast<EditorInteractive const, UI::Panel const>(*get_parent())
506- .egbase().map();
507+ Widelands::Map & map = eia().egbase().map();
508 Widelands::PlayerNumber const nr_players = map.get_nrplayers();
509 {
510 assert(nr_players <= 99); // 2 decimal digits
511@@ -194,9 +196,7 @@
512 }
513
514 void EditorPlayerMenu::clicked_add_player() {
515- EditorInteractive & menu =
516- ref_cast<EditorInteractive, UI::Panel>(*get_parent());
517- Widelands::Map & map = menu.egbase().map();
518+ Widelands::Map & map = eia().egbase().map();
519 Widelands::PlayerNumber const nr_players = map.get_nrplayers() + 1;
520 assert(nr_players <= MAX_PLAYERS);
521 map.set_nrplayers(nr_players);
522@@ -211,7 +211,7 @@
523 map.set_scenario_player_name(nr_players, name);
524 }
525 map.set_scenario_player_tribe(nr_players, m_tribes[0]);
526- menu.set_need_save(true);
527+ eia().set_need_save(true);
528 m_add_player .set_enabled(nr_players < MAX_PLAYERS);
529 m_remove_last_player.set_enabled(true);
530 update();
531@@ -219,14 +219,12 @@
532
533
534 void EditorPlayerMenu::clicked_remove_last_player() {
535- EditorInteractive & menu =
536- ref_cast<EditorInteractive, UI::Panel>(*get_parent());
537- Widelands::Map & map = menu.egbase().map();
538+ Widelands::Map & map = eia().egbase().map();
539 Widelands::PlayerNumber const old_nr_players = map.get_nrplayers();
540 Widelands::PlayerNumber const nr_players = old_nr_players - 1;
541 assert(1 <= nr_players);
542
543- if (!menu.is_player_tribe_referenced(old_nr_players)) {
544+ if (!eia().is_player_tribe_referenced(old_nr_players)) {
545 if (const Widelands::Coords sp = map.get_starting_pos(old_nr_players)) {
546 // Remove starting position marker.
547 char picsname[] = "pics/editor_player_00_starting_pos.png";
548@@ -306,9 +304,8 @@
549 * Player Tribe Button clicked
550 */
551 void EditorPlayerMenu::player_tribe_clicked(uint8_t n) {
552- EditorInteractive & menu =
553- ref_cast<EditorInteractive, UI::Panel>(*get_parent());
554- if (!menu.is_player_tribe_referenced(n + 1)) {
555+ EditorInteractive& menu = eia();
556+ if (!menu.is_player_tribe_referenced(n + 1)) {
557 std::string t = m_plr_set_tribes_buts[n]->get_title();
558 if (!Widelands::TribeDescr::exists_tribe(t))
559 throw wexception
560@@ -338,8 +335,7 @@
561 * Set Current Start Position button selected
562 */
563 void EditorPlayerMenu::set_starting_pos_clicked(uint8_t n) {
564- EditorInteractive & menu =
565- ref_cast<EditorInteractive, UI::Panel>(*get_parent());
566+ EditorInteractive& menu = eia();
567 // jump to the current node
568 Widelands::Map & map = menu.egbase().map();
569 if (Widelands::Coords const sp = map.get_starting_pos(n))
570@@ -366,8 +362,7 @@
571 void EditorPlayerMenu::name_changed(int32_t m) {
572 // Player name has been changed.
573 std::string text = m_plr_names[m]->text();
574- EditorInteractive & menu =
575- ref_cast<EditorInteractive, UI::Panel>(*get_parent());
576+ EditorInteractive& menu = eia();
577 Widelands::Map & map = menu.egbase().map();
578 if (text == "") {
579 text = map.get_scenario_player_name(m + 1);
580
581=== modified file 'src/editor/ui_menus/editor_player_menu.h'
582--- src/editor/ui_menus/editor_player_menu.h 2014-09-10 14:08:25 +0000
583+++ src/editor/ui_menus/editor_player_menu.h 2014-11-30 18:54:51 +0000
584@@ -44,6 +44,7 @@
585 virtual ~EditorPlayerMenu() {}
586
587 private:
588+ EditorInteractive & eia();
589 UI::UniqueWindow::Registry m_allow_buildings_menu;
590 UI::Textarea * m_nr_of_players_ta;
591 UI::EditBox * m_plr_names[MAX_PLAYERS];
592
593=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.cc'
594--- src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2014-09-30 05:41:55 +0000
595+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2014-11-30 18:54:51 +0000
596@@ -37,6 +37,11 @@
597 const static int BUTTON_WIDTH = 20;
598 const static int BUTTON_HEIGHT = 20;
599
600+inline EditorInteractive & EditorToolChangeResourcesOptionsMenu::eia() {
601+ return dynamic_cast<EditorInteractive&>(*get_parent());
602+}
603+
604+
605 EditorToolChangeResourcesOptionsMenu::
606 EditorToolChangeResourcesOptionsMenu
607 (EditorInteractive & parent,
608@@ -213,7 +218,7 @@
609 m_increase_tool.set_cur_res(n);
610 m_increase_tool.decrease_tool().set_cur_res(n);
611
612- Widelands::EditorGameBase& egbase = ref_cast<EditorInteractive, UI::Panel>(*get_parent()).egbase();
613+ Widelands::EditorGameBase& egbase = eia().egbase();
614 Widelands::Map & map = egbase.map();
615 map.overlay_manager().register_overlay_callback_function(
616 boost::bind(&editor_change_resource_tool_callback, _1, boost::ref(map), boost::ref(egbase.world()), n));
617@@ -234,8 +239,7 @@
618 static_cast<unsigned int>(m_increase_tool.set_tool().get_set_to())));
619
620 m_cur_selection.set_text
621- (ref_cast<EditorInteractive, UI::Panel>(*get_parent()).egbase()
622- .world().get_resource(m_increase_tool.set_tool().get_cur_res())->descname());
623+ (eia().egbase().world().get_resource(m_increase_tool.set_tool().get_cur_res())->descname());
624 m_cur_selection.set_pos
625 (Point
626 ((get_inner_w() - m_cur_selection.get_w()) / 2, get_inner_h() - 20));
627
628=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.h'
629--- src/editor/ui_menus/editor_tool_change_resources_options_menu.h 2014-09-10 14:08:25 +0000
630+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.h 2014-11-30 18:54:51 +0000
631@@ -37,6 +37,7 @@
632 UI::UniqueWindow::Registry &);
633
634 private:
635+ EditorInteractive & eia();
636 void selected();
637 enum Button {
638 Change_By_Increase, Change_By_Decrease,
639
640=== modified file 'src/editor/ui_menus/editor_tool_menu.cc'
641--- src/editor/ui_menus/editor_tool_menu.cc 2014-09-20 09:37:47 +0000
642+++ src/editor/ui_menus/editor_tool_menu.cc 2014-11-30 18:54:51 +0000
643@@ -99,7 +99,7 @@
644 const int32_t n = m_radioselect.get_state();
645
646 EditorInteractive & parent =
647- ref_cast<EditorInteractive, UI::Panel>(*get_parent());
648+ dynamic_cast<EditorInteractive&>(*get_parent());
649
650 EditorTool * current_tool_pointer = nullptr;
651 UI::UniqueWindow::Registry * current_registry_pointer = nullptr;
652
653=== modified file 'src/editor/ui_menus/editor_tool_options_menu.cc'
654--- src/editor/ui_menus/editor_tool_options_menu.cc 2014-09-10 14:08:25 +0000
655+++ src/editor/ui_menus/editor_tool_options_menu.cc 2014-11-30 18:54:51 +0000
656@@ -35,6 +35,6 @@
657
658
659 void EditorToolOptionsMenu::select_correct_tool() {
660- ref_cast<EditorInteractive, UI::Panel>(*get_parent())
661+ dynamic_cast<EditorInteractive&>(*get_parent())
662 .select_tool(*m_current_pointer, EditorTool::First);
663 }
664
665=== modified file 'src/editor/ui_menus/editor_toolsize_menu.cc'
666--- src/editor/ui_menus/editor_toolsize_menu.cc 2014-09-18 18:52:34 +0000
667+++ src/editor/ui_menus/editor_toolsize_menu.cc 2014-11-30 18:54:51 +0000
668@@ -29,7 +29,7 @@
669 #include "graphic/graphic.h"
670
671 inline EditorInteractive & EditorToolsizeMenu::eia() {
672- return ref_cast<EditorInteractive, UI::Panel>(*get_parent());
673+ return dynamic_cast<EditorInteractive&>(*get_parent());
674 }
675
676
677
678=== modified file 'src/graphic/CMakeLists.txt'
679--- src/graphic/CMakeLists.txt 2014-11-24 07:25:21 +0000
680+++ src/graphic/CMakeLists.txt 2014-11-30 18:54:51 +0000
681@@ -128,7 +128,6 @@
682 USES_SDL2_IMAGE
683 USES_SDL2_TTF
684 DEPENDS
685- base_deprecated
686 base_exceptions
687 base_geometry
688 base_i18n
689
690=== modified file 'src/graphic/animation.cc'
691--- src/graphic/animation.cc 2014-11-24 07:10:03 +0000
692+++ src/graphic/animation.cc 2014-11-30 18:54:51 +0000
693@@ -30,7 +30,6 @@
694 #include <boost/format.hpp>
695 #include <boost/lexical_cast.hpp>
696
697-#include "base/deprecated.h"
698 #include "base/i18n.h"
699 #include "base/log.h"
700 #include "base/macros.h"
701
702=== modified file 'src/graphic/graphic.cc'
703--- src/graphic/graphic.cc 2014-11-30 09:17:50 +0000
704+++ src/graphic/graphic.cc 2014-11-30 18:54:51 +0000
705@@ -25,7 +25,6 @@
706
707 #include <SDL_image.h>
708
709-#include "base/deprecated.h"
710 #include "base/i18n.h"
711 #include "base/log.h"
712 #include "base/macros.h"
713
714=== modified file 'src/graphic/terrain_texture.cc'
715--- src/graphic/terrain_texture.cc 2014-11-24 07:10:03 +0000
716+++ src/graphic/terrain_texture.cc 2014-11-30 18:54:51 +0000
717@@ -21,7 +21,6 @@
718
719 #include <SDL_image.h>
720
721-#include "base/deprecated.h"
722 #include "base/log.h"
723 #include "base/wexception.h"
724 #include "graphic/image_io.h"
725
726=== modified file 'src/graphic/text_parser.cc'
727--- src/graphic/text_parser.cc 2014-09-10 14:48:40 +0000
728+++ src/graphic/text_parser.cc 2014-11-30 18:54:51 +0000
729@@ -24,7 +24,6 @@
730 #include <string>
731 #include <vector>
732
733-#include "base/deprecated.h"
734 #include "base/log.h"
735 #include "helper.h"
736
737
738=== modified file 'src/io/CMakeLists.txt'
739--- src/io/CMakeLists.txt 2014-10-13 15:04:50 +0000
740+++ src/io/CMakeLists.txt 2014-11-30 18:54:51 +0000
741@@ -37,7 +37,6 @@
742 filesystem/zip_filesystem.cc
743 filesystem/zip_filesystem.h
744 DEPENDS
745- base_deprecated
746 base_exceptions
747 base_log
748 base_macros
749
750=== modified file 'src/io/filesystem/layered_filesystem.cc'
751--- src/io/filesystem/layered_filesystem.cc 2014-09-29 13:30:46 +0000
752+++ src/io/filesystem/layered_filesystem.cc 2014-11-30 18:54:51 +0000
753@@ -22,7 +22,6 @@
754 #include <cstdio>
755 #include <memory>
756
757-#include "base/deprecated.h"
758 #include "base/log.h"
759 #include "base/wexception.h"
760 #include "io/fileread.h"
761
762=== modified file 'src/logic/CMakeLists.txt'
763--- src/logic/CMakeLists.txt 2014-10-13 15:04:50 +0000
764+++ src/logic/CMakeLists.txt 2014-11-30 18:54:51 +0000
765@@ -215,7 +215,6 @@
766 USES_SDL2
767 DEPENDS
768 ai
769- base_deprecated
770 base_exceptions
771 base_geometry
772 base_i18n
773
774=== modified file 'src/logic/battle.cc'
775--- src/logic/battle.cc 2014-09-20 09:37:47 +0000
776+++ src/logic/battle.cc 2014-11-30 18:54:51 +0000
777@@ -83,23 +83,27 @@
778
779 m_creationtime = egbase.get_gametime();
780
781- if (Battle* battle = m_first ->get_battle())
782- battle->cancel(ref_cast<Game, EditorGameBase>(egbase), *m_first);
783- m_first->set_battle(ref_cast<Game, EditorGameBase>(egbase), this);
784- if (Battle* battle = m_second->get_battle())
785- battle->cancel(ref_cast<Game, EditorGameBase>(egbase), *m_second);
786- m_second->set_battle(ref_cast<Game, EditorGameBase>(egbase), this);
787+ Game& game = dynamic_cast<Game&>(egbase);
788+
789+ if (Battle* battle = m_first ->get_battle()) {
790+ battle->cancel(game, *m_first);
791+ }
792+ m_first->set_battle(game, this);
793+ if (Battle* battle = m_second->get_battle()) {
794+ battle->cancel(game, *m_second);
795+ }
796+ m_second->set_battle(game, this);
797 }
798
799
800 void Battle::cleanup (EditorGameBase & egbase)
801 {
802 if (m_first) {
803- m_first ->set_battle(ref_cast<Game, EditorGameBase>(egbase), nullptr);
804+ m_first ->set_battle(dynamic_cast<Game&>(egbase), nullptr);
805 m_first = nullptr;
806 }
807 if (m_second) {
808- m_second->set_battle(ref_cast<Game, EditorGameBase>(egbase), nullptr);
809+ m_second->set_battle(dynamic_cast<Game&>(egbase), nullptr);
810 m_second = nullptr;
811 }
812
813
814=== modified file 'src/logic/bob.cc'
815--- src/logic/bob.cc 2014-09-20 09:37:47 +0000
816+++ src/logic/bob.cc 2014-11-30 18:54:51 +0000
817@@ -149,8 +149,9 @@
818 */
819 void Bob::cleanup(EditorGameBase & egbase)
820 {
821- while (!m_stack.empty()) // bobs in the editor do not have tasks
822- do_pop_task(ref_cast<Game, EditorGameBase>(egbase));
823+ while (!m_stack.empty()) { // bobs in the editor do not have tasks
824+ do_pop_task(dynamic_cast<Game&>(egbase));
825+ }
826
827 set_owner(nullptr); // implicitly remove ourselves from owner's map
828
829
830=== modified file 'src/logic/building.cc'
831--- src/logic/building.cc 2014-11-24 07:25:21 +0000
832+++ src/logic/building.cc 2014-11-30 18:54:51 +0000
833@@ -245,7 +245,7 @@
834 m_tribe.get_building_descr
835 (m_tribe.safe_building_index("constructionsite"));
836 ConstructionSite & csite =
837- ref_cast<ConstructionSite, MapObject>(descr->create_object());
838+ dynamic_cast<ConstructionSite&>(descr->create_object());
839 csite.set_building(*this);
840
841 return csite;
842@@ -725,8 +725,7 @@
843 (const EditorGameBase& game, RenderTarget& dst, const FCoords&, const Point& pos)
844 {
845 const InteractiveGameBase & igbase =
846- ref_cast<InteractiveGameBase const, InteractiveBase const>
847- (*game.get_ibase());
848+ dynamic_cast<const InteractiveGameBase&>(*game.get_ibase());
849 uint32_t const dpyflags = igbase.get_display_flags();
850
851 if (dpyflags & InteractiveBase::dfShowCensus) {
852
853=== modified file 'src/logic/carrier.cc'
854--- src/logic/carrier.cc 2014-09-20 09:37:47 +0000
855+++ src/logic/carrier.cc 2014-11-30 18:54:51 +0000
856@@ -84,8 +84,6 @@
857 return pop_task(game);
858 }
859
860- Road & road = ref_cast<Road, PlayerImmovable>(*get_location(game));
861-
862 // Check for pending wares
863 if (m_promised_pickup_to == NOONE)
864 find_pending_ware(game);
865@@ -103,6 +101,8 @@
866 }
867 }
868
869+ Road & road = dynamic_cast<Road&>(*get_location(game));
870+
871 // Move into idle position if necessary
872 if
873 (start_task_movepath
874@@ -127,7 +127,7 @@
875 void Carrier::road_pop(Game & game, State & /* state */)
876 {
877 if (m_promised_pickup_to != NOONE && get_location(game)) {
878- Road & road = ref_cast<Road, PlayerImmovable>(*get_location(game));
879+ Road & road = dynamic_cast<Road&>(*get_location(game));
880 Flag & flag = road.get_flag(static_cast<Road::FlagId>(m_promised_pickup_to));
881 Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(m_promised_pickup_to ^ 1));
882
883@@ -176,8 +176,6 @@
884 return pop_task(game);
885 }
886
887- Road & road = ref_cast<Road, PlayerImmovable>(*get_location(game));
888-
889 if (state.ivar1 == -1)
890 // If we're "in" the target building, special code applies
891 deliver_to_building(game, state);
892@@ -187,6 +185,7 @@
893 pickup_from_flag(game, state);
894
895 else {
896+ Road & road = dynamic_cast<Road&>(*get_location(game));
897 // If the ware should go to the building attached to our flag, walk
898 // directly into said building
899 Flag & flag = road.get_flag(static_cast<Road::FlagId>(state.ivar1 ^ 1));
900@@ -243,7 +242,7 @@
901 state.ivar1 =
902 &building->base_flag()
903 ==
904- &ref_cast<Road, PlayerImmovable>(*get_location(game)).get_flag
905+ &dynamic_cast<Road&>(*get_location(game)).get_flag
906 (static_cast<Road::FlagId>(0));
907 break;
908 }
909@@ -277,7 +276,7 @@
910
911 m_promised_pickup_to = NOONE;
912
913- Road & road = ref_cast<Road, PlayerImmovable>(*get_location(game));
914+ Road & road = dynamic_cast<Road&>(*get_location(game));
915 Flag & flag = road.get_flag(static_cast<Road::FlagId>(ivar1));
916 Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(ivar1 ^ 1));
917
918@@ -305,7 +304,7 @@
919 void Carrier::drop_ware(Game & game, State & state)
920 {
921 WareInstance * other = nullptr;
922- Road & road = ref_cast<Road, PlayerImmovable>(*get_location(game));
923+ Road & road = dynamic_cast<Road&>(*get_location(game));
924 Flag & flag = road.get_flag(static_cast<Road::FlagId>(state.ivar1 ^ 1));
925
926 if (m_promised_pickup_to == (state.ivar1 ^ 1)) {
927@@ -376,7 +375,7 @@
928 bool Carrier::swap_or_wait(Game & game, State & state)
929 {
930 // Road that employs us
931- Road & road = ref_cast<Road, PlayerImmovable>(*get_location(game));
932+ Road & road = dynamic_cast<Road&>(*get_location(game));
933 // Flag we are delivering to
934 Flag & flag = road.get_flag(static_cast<Road::FlagId>(state.ivar1 ^ 1));
935 // The other flag of our road
936@@ -456,24 +455,25 @@
937 */
938 void Carrier::find_pending_ware(Game & game)
939 {
940- Road & road = ref_cast<Road, PlayerImmovable>(*get_location(game));
941+ Road & road = dynamic_cast<Road&>(*get_location(game));
942 uint32_t havewarebits = 0;
943
944 assert(m_promised_pickup_to == NOONE);
945
946- if
947- (road.get_flag(Road::FlagStart).has_pending_ware
948- (game, road.get_flag(Road::FlagEnd)))
949+ if (road.get_flag(Road::FlagStart).has_pending_ware
950+ (game, road.get_flag(Road::FlagEnd))) {
951 havewarebits |= 1;
952+ }
953
954- if
955- (road.get_flag(Road::FlagEnd).has_pending_ware
956- (game, road.get_flag(Road::FlagStart)))
957+ if (road.get_flag(Road::FlagEnd).has_pending_ware
958+ (game, road.get_flag(Road::FlagStart))) {
959 havewarebits |= 2;
960+ }
961
962 // If both flags have an ware, we pick the one closer to us.
963- if (havewarebits == 3)
964+ if (havewarebits == 3) {
965 havewarebits = 1 << find_closest_flag(game);
966+ }
967
968 // Ack our decision
969 if (havewarebits == 1) {
970@@ -503,7 +503,7 @@
971 {
972 Map & map = game.map();
973 CoordPath startpath
974- (map, ref_cast<Road, PlayerImmovable>(*get_location(game)).get_path());
975+ (map, dynamic_cast<Road&>(*get_location(game)).get_path());
976
977 CoordPath endpath;
978 int32_t startcost, endcost;
979@@ -551,7 +551,7 @@
980 (Game & game, int32_t const flag, bool const offset)
981 {
982 const Path & path =
983- ref_cast<Road, PlayerImmovable>(*get_location(game)).get_path();
984+ dynamic_cast<Road&>(*get_location(game)).get_path();
985 int32_t idx;
986
987 if (!flag) {
988
989=== modified file 'src/logic/constructionsite.cc'
990--- src/logic/constructionsite.cc 2014-09-10 17:52:49 +0000
991+++ src/logic/constructionsite.cc 2014-11-30 18:54:51 +0000
992@@ -172,7 +172,7 @@
993 Building & b =
994 m_building->create(egbase, owner(), m_position, false, false, m_old_buildings);
995 if (Worker * const builder = m_builder.get(egbase)) {
996- builder->reset_tasks(ref_cast<Game, EditorGameBase>(egbase));
997+ builder->reset_tasks(dynamic_cast<Game&>(egbase));
998 builder->set_location(&b);
999 }
1000 // Open the new building window if needed
1001@@ -180,7 +180,7 @@
1002 Point window_position = m_optionswindow->get_pos();
1003 hide_options();
1004 InteractiveGameBase & igbase =
1005- ref_cast<InteractiveGameBase, InteractiveBase>(*egbase.get_ibase());
1006+ dynamic_cast<InteractiveGameBase&>(*egbase.get_ibase());
1007 b.show_options(igbase, false, window_position);
1008 }
1009 }
1010
1011=== modified file 'src/logic/critter.cc'
1012--- src/logic/critter.cc 2014-10-27 10:14:10 +0000
1013+++ src/logic/critter.cc 2014-11-30 18:54:51 +0000
1014@@ -302,8 +302,7 @@
1015
1016 for (;;) {
1017 const CritterProgram & program =
1018- ref_cast<CritterProgram const, BobProgramBase const>
1019- (*state.program);
1020+ dynamic_cast<const CritterProgram&>(*state.program);
1021
1022 if (state.ivar1 >= program.get_size())
1023 return pop_task(game);
1024
1025=== modified file 'src/logic/findnode.cc'
1026--- src/logic/findnode.cc 2014-07-24 16:26:55 +0000
1027+++ src/logic/findnode.cc 2014-11-30 18:54:51 +0000
1028@@ -19,7 +19,6 @@
1029
1030 #include "logic/findnode.h"
1031
1032-#include "base/deprecated.h"
1033 #include "base/wexception.h"
1034 #include "logic/field.h"
1035 #include "logic/immovable.h"
1036
1037=== modified file 'src/logic/immovable.cc'
1038--- src/logic/immovable.cc 2014-11-24 07:25:21 +0000
1039+++ src/logic/immovable.cc 2014-11-30 18:54:51 +0000
1040@@ -25,7 +25,6 @@
1041 #include <boost/algorithm/string.hpp>
1042 #include <boost/format.hpp>
1043
1044-#include "base/deprecated.h"
1045 #include "base/macros.h"
1046 #include "base/wexception.h"
1047 #include "config.h"
1048@@ -619,7 +618,7 @@
1049 {
1050 BaseImmovable::Loader::load(fr);
1051
1052- Immovable & imm = ref_cast<Immovable, MapObject>(*get_object());
1053+ Immovable & imm = dynamic_cast<Immovable&>(*get_object());
1054
1055 if (version >= 5) {
1056 PlayerNumber pn = fr.unsigned_8();
1057
1058=== modified file 'src/logic/instances.cc'
1059--- src/logic/instances.cc 2014-09-20 09:37:47 +0000
1060+++ src/logic/instances.cc 2014-11-30 18:54:51 +0000
1061@@ -24,7 +24,6 @@
1062 #include <cstring>
1063 #include <string>
1064
1065-#include "base/deprecated.h"
1066 #include "base/log.h"
1067 #include "base/wexception.h"
1068 #include "io/fileread.h"
1069
1070=== modified file 'src/logic/instances.h'
1071--- src/logic/instances.h 2014-09-19 12:54:54 +0000
1072+++ src/logic/instances.h 2014-11-30 18:54:51 +0000
1073@@ -30,7 +30,6 @@
1074 #include <boost/unordered_map.hpp>
1075 #include <boost/signals2.hpp>
1076
1077-#include "base/deprecated.h"
1078 #include "base/log.h"
1079 #include "base/macros.h"
1080 #include "logic/cmd_queue.h"
1081@@ -181,9 +180,9 @@
1082
1083 /// If you find a better way to do this that doesn't cost a virtual function
1084 /// or additional member variable, go ahead
1085-#define MO_DESCR(type) \
1086-public: const type & descr() const { \
1087- return ref_cast<type const, MapObjectDescr const>(*m_descr); \
1088+#define MO_DESCR(type) \
1089+public: const type & descr() const { \
1090+ return dynamic_cast<const type&>(*m_descr); \
1091 } \
1092
1093 class MapObject {
1094@@ -311,7 +310,7 @@
1095 MapObjectLoader & mol () {return *m_mol;}
1096 MapObject * get_object() {return m_object;}
1097 template<typename T> T & get() {
1098- return ref_cast<T, MapObject>(*m_object);
1099+ return dynamic_cast<T&>(*m_object);
1100 }
1101
1102 protected:
1103
1104=== modified file 'src/logic/militarysite.cc'
1105--- src/logic/militarysite.cc 2014-09-30 05:41:55 +0000
1106+++ src/logic/militarysite.cc 2014-11-30 18:54:51 +0000
1107@@ -335,7 +335,7 @@
1108 // Now I know that the new guy is worthy.
1109 if (nullptr != kickoutCandidate)
1110 {
1111- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
1112+ Game & game = dynamic_cast<Game&>(owner().egbase());
1113 kickoutCandidate->reset_tasks(game);
1114 kickoutCandidate->start_task_leavebuilding(game, true);
1115 return true;
1116@@ -355,7 +355,7 @@
1117 // Call to drop_least routine has side effects: it tries to drop a soldier. Order is important!
1118 if (stationed_soldiers().size() < m_capacity || drop_least_suited_soldier(true, &s))
1119 {
1120- Game & game = ref_cast<Game, EditorGameBase>(egbase);
1121+ Game & game = dynamic_cast<Game&>(egbase);
1122 s.set_location(this);
1123 s.reset_tasks(game);
1124 s.start_task_buildingwork(game);
1125@@ -376,8 +376,8 @@
1126 Worker * const w,
1127 PlayerImmovable & target)
1128 {
1129- MilitarySite & msite = ref_cast<MilitarySite, PlayerImmovable>(target);
1130- Soldier & s = ref_cast<Soldier, Worker> (*w);
1131+ MilitarySite& msite = dynamic_cast<MilitarySite&>(target);
1132+ Soldier& s = dynamic_cast<Soldier&>(*w);
1133
1134 msite.incorporate_soldier(game, s);
1135 }
1136@@ -409,7 +409,7 @@
1137 }
1138
1139 if (m_capacity < present.size()) {
1140- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
1141+ Game & game = dynamic_cast<Game&>(owner().egbase());
1142 for (uint32_t i = 0; i < present.size() - m_capacity; ++i) {
1143 Soldier & soldier = *present[i];
1144 soldier.reset_tasks(game);
1145@@ -716,7 +716,7 @@
1146
1147 void MilitarySite::drop_soldier(Soldier & soldier)
1148 {
1149- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
1150+ Game & game = dynamic_cast<Game&>(owner().egbase());
1151
1152 if (!is_present(soldier)) {
1153 // This can happen when the "drop soldier" player command is delayed
1154@@ -754,7 +754,7 @@
1155
1156 void MilitarySite::aggressor(Soldier & enemy)
1157 {
1158- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
1159+ Game & game = dynamic_cast<Game&>(owner().egbase());
1160 Map & map = game.map();
1161 if
1162 (enemy.get_owner() == &owner() ||
1163@@ -797,7 +797,7 @@
1164
1165 bool MilitarySite::attack(Soldier & enemy)
1166 {
1167- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
1168+ Game & game = dynamic_cast<Game&>(owner().egbase());
1169
1170 std::vector<Soldier *> present = present_soldiers();
1171 Soldier * defender = nullptr;
1172@@ -992,7 +992,7 @@
1173 m_soldierjobs.push_back(sj);
1174
1175 soldier.update_task_buildingwork
1176- (ref_cast<Game, EditorGameBase>(owner().egbase()));
1177+ (dynamic_cast<Game&>(owner().egbase()));
1178 }
1179
1180
1181
1182=== modified file 'src/logic/partially_finished_building.cc'
1183--- src/logic/partially_finished_building.cc 2014-09-10 10:18:46 +0000
1184+++ src/logic/partially_finished_building.cc 2014-11-30 18:54:51 +0000
1185@@ -201,7 +201,7 @@
1186 {
1187 assert(w);
1188
1189- PartiallyFinishedBuilding & b = ref_cast<PartiallyFinishedBuilding, PlayerImmovable>(target);
1190+ PartiallyFinishedBuilding & b = dynamic_cast<PartiallyFinishedBuilding&>(target);
1191
1192 b.m_builder = w;
1193
1194
1195=== modified file 'src/logic/pathfield.cc'
1196--- src/logic/pathfield.cc 2014-09-19 12:54:54 +0000
1197+++ src/logic/pathfield.cc 2014-11-30 18:54:51 +0000
1198@@ -19,7 +19,6 @@
1199
1200 #include "logic/pathfield.h"
1201
1202-#include "base/deprecated.h"
1203 #include "base/wexception.h"
1204
1205 namespace Widelands {
1206
1207=== modified file 'src/logic/player.cc'
1208--- src/logic/player.cc 2014-09-20 09:37:47 +0000
1209+++ src/logic/player.cc 2014-11-30 18:54:51 +0000
1210@@ -201,7 +201,7 @@
1211 const TribeDescr::Initialization & initialization =
1212 tribe().initialization(m_initialization_index);
1213
1214- Game & game = ref_cast<Game, EditorGameBase>(egbase());
1215+ Game & game = dynamic_cast<Game&>(egbase());
1216
1217 // Run the corresponding script
1218 std::unique_ptr<LuaTable> table(game.lua().run_script(initialization.script));
1219@@ -485,7 +485,7 @@
1220 log("Clearing for road at (%i, %i)\n", c.x, c.y);
1221
1222 // Make sure that the player owns the area around.
1223- ref_cast<Game, EditorGameBase>(egbase()).conquer_area_no_building
1224+ dynamic_cast<Game&>(egbase()).conquer_area_no_building
1225 (PlayerArea<Area<FCoords> >(player_number(), Area<FCoords>(c, 1)));
1226
1227 if (BaseImmovable * const immovable = c.field->get_immovable()) {
1228@@ -774,11 +774,12 @@
1229 */
1230 void Player::flagaction(Flag & flag)
1231 {
1232- if (&flag.owner() == this) // Additional security check.
1233+ if (&flag.owner() == this) { // Additional security check.
1234 flag.add_flag_job
1235- (ref_cast<Game, EditorGameBase>(egbase()),
1236+ (dynamic_cast<Game&>(egbase()),
1237 tribe().worker_index("geologist"),
1238 "expedition");
1239+ }
1240 }
1241
1242
1243
1244=== modified file 'src/logic/production_program.h'
1245--- src/logic/production_program.h 2014-09-14 11:31:58 +0000
1246+++ src/logic/production_program.h 2014-11-30 18:54:51 +0000
1247@@ -28,7 +28,6 @@
1248
1249 #include <stdint.h>
1250
1251-#include "base/deprecated.h"
1252 #include "base/log.h"
1253 #include "base/macros.h"
1254 #include "logic/bill_of_materials.h"
1255
1256=== modified file 'src/logic/productionsite.cc'
1257--- src/logic/productionsite.cc 2014-10-27 10:14:10 +0000
1258+++ src/logic/productionsite.cc 2014-11-30 18:54:51 +0000
1259@@ -517,7 +517,7 @@
1260 Worker * const w,
1261 PlayerImmovable & target)
1262 {
1263- ProductionSite & psite = ref_cast<ProductionSite, PlayerImmovable>(target);
1264+ ProductionSite & psite = dynamic_cast<ProductionSite&>(target);
1265
1266 assert(w);
1267 assert(w->get_location(game) == &psite);
1268@@ -766,7 +766,7 @@
1269 *descr().tribe().get_worker_descr(worker_type_with_count.first);
1270 {
1271 Worker & recruit =
1272- ref_cast<Worker, Bob>(worker_descr.create_object());
1273+ dynamic_cast<Worker&>(worker_descr.create_object());
1274 recruit.set_owner(&worker.owner());
1275 recruit.set_position(game, worker.get_position());
1276 recruit.init(game);
1277
1278=== modified file 'src/logic/requirements.cc'
1279--- src/logic/requirements.cc 2014-09-20 09:37:47 +0000
1280+++ src/logic/requirements.cc 2014-11-30 18:54:51 +0000
1281@@ -19,7 +19,6 @@
1282
1283 #include "logic/requirements.h"
1284
1285-#include "base/deprecated.h"
1286 #include "base/i18n.h"
1287 #include "io/fileread.h"
1288 #include "io/filewrite.h"
1289
1290=== modified file 'src/logic/ship.cc'
1291--- src/logic/ship.cc 2014-09-20 09:37:47 +0000
1292+++ src/logic/ship.cc 2014-11-30 18:54:51 +0000
1293@@ -21,7 +21,7 @@
1294
1295 #include <memory>
1296
1297-#include "base/deprecated.h"
1298+#include "base/macros.h"
1299 #include "economy/economy.h"
1300 #include "economy/flag.h"
1301 #include "economy/fleet.h"
1302@@ -1031,7 +1031,7 @@
1303 // economy of all workers we're transporting so that they are in the correct
1304 // economy. Also, we might are on an expedition which means that we just now
1305 // created the economy of this ship and must inform all wares.
1306- ship.set_economy(ref_cast<Game>(egbase()), ship.m_economy);
1307+ ship.set_economy(dynamic_cast<Game&>(egbase()), ship.m_economy);
1308 }
1309
1310
1311
1312=== modified file 'src/logic/soldier.cc'
1313--- src/logic/soldier.cc 2014-10-27 10:14:10 +0000
1314+++ src/logic/soldier.cc 2014-11-30 18:54:51 +0000
1315@@ -700,12 +700,8 @@
1316 uint32_t const time)
1317 {
1318 molog("[soldier] starting animation %s", animname);
1319- return
1320- start_task_idle
1321- (ref_cast<Game, EditorGameBase>(egbase),
1322- descr().get_rand_anim
1323- (ref_cast<Game, EditorGameBase>(egbase), animname),
1324- time);
1325+ Game& game = dynamic_cast<Game&>(egbase);
1326+ return start_task_idle(game, descr().get_rand_anim(game, animname), time);
1327 }
1328
1329
1330@@ -748,14 +744,16 @@
1331 */
1332 bool Soldier::can_be_challenged()
1333 {
1334- if (m_hp_current < 1) //< Soldier is dead!
1335- return false;
1336- if (!is_on_battlefield())
1337- return false;
1338- if (!m_battle)
1339+ if (m_hp_current < 1) { //< Soldier is dead!
1340+ return false;
1341+ }
1342+ if (!is_on_battlefield()) {
1343+ return false;
1344+ }
1345+ if (!m_battle) {
1346 return true;
1347- return
1348- !m_battle->locked(ref_cast<Game, EditorGameBase>(owner().egbase()));
1349+ }
1350+ return !m_battle->locked(dynamic_cast<Game&>(owner().egbase()));
1351 }
1352
1353 /**
1354@@ -1806,7 +1804,7 @@
1355
1356 for (BaseImmovable * temp_attackable : attackables) {
1357 if
1358- (ref_cast<PlayerImmovable const, BaseImmovable const>(*temp_attackable)
1359+ (dynamic_cast<const PlayerImmovable&>(*temp_attackable)
1360 .get_owner()->player_number()
1361 ==
1362 land_owner) {
1363
1364=== modified file 'src/logic/trainingsite.cc'
1365--- src/logic/trainingsite.cc 2014-10-27 10:14:10 +0000
1366+++ src/logic/trainingsite.cc 2014-11-30 18:54:51 +0000
1367@@ -341,8 +341,8 @@
1368 Worker * const w,
1369 PlayerImmovable & target)
1370 {
1371- TrainingSite & tsite = ref_cast<TrainingSite, PlayerImmovable>(target);
1372- Soldier & s = ref_cast<Soldier, Worker> (*w);
1373+ TrainingSite& tsite = dynamic_cast<TrainingSite&>(target);
1374+ Soldier& s = dynamic_cast<Soldier&>(*w);
1375
1376 assert(s.get_location(game) == &tsite);
1377 assert(tsite.m_soldier_request == &rq);
1378@@ -416,7 +416,7 @@
1379 */
1380 void TrainingSite::drop_soldier(Soldier & soldier)
1381 {
1382- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
1383+ Game & game = dynamic_cast<Game&>(owner().egbase());
1384
1385 std::vector<Soldier *>::iterator it =
1386 std::find(m_soldiers.begin(), m_soldiers.end(), &soldier);
1387
1388=== modified file 'src/logic/warehouse.cc'
1389--- src/logic/warehouse.cc 2014-09-30 05:41:55 +0000
1390+++ src/logic/warehouse.cc 2014-11-30 18:54:51 +0000
1391@@ -23,7 +23,6 @@
1392
1393 #include <boost/format.hpp>
1394
1395-#include "base/deprecated.h"
1396 #include "base/log.h"
1397 #include "base/macros.h"
1398 #include "base/wexception.h"
1399@@ -377,11 +376,10 @@
1400 (owner().is_worker_type_allowed(worker_index) &&
1401 m_next_worker_without_cost_spawn[i] == static_cast<uint32_t>(never()))
1402 {
1403- if (next_spawn == static_cast<uint32_t>(never()))
1404- next_spawn =
1405- schedule_act
1406- (ref_cast<Game, EditorGameBase>(egbase),
1407- WORKER_WITHOUT_COST_SPAWN_INTERVAL);
1408+ upcast(Game, game, &egbase);
1409+ if (next_spawn == static_cast<uint32_t>(never())) {
1410+ next_spawn = schedule_act(dynamic_cast<Game&>(egbase), WORKER_WITHOUT_COST_SPAWN_INTERVAL);
1411+ }
1412 m_next_worker_without_cost_spawn[i] = next_spawn;
1413 log
1414 ("WARNING: player %u is allowed to create worker type %s but his "
1415@@ -444,17 +442,13 @@
1416 // m_next_military_act is not touched in the loading code. Is only needed
1417 // if there warehous is created in the game? I assume it's for the
1418 // conquer_radius thing
1419- m_next_military_act =
1420- schedule_act
1421- (ref_cast<Game, EditorGameBase>(egbase), 1000);
1422+ m_next_military_act = schedule_act(*game, 1000);
1423
1424- m_next_stock_remove_act =
1425- schedule_act
1426- (ref_cast<Game, EditorGameBase>(egbase), 4000);
1427+ m_next_stock_remove_act = schedule_act(*game, 4000);
1428
1429 log("Message: adding (wh) (%s) %i \n", to_string(descr().type()).c_str(), player.player_number());
1430 send_message
1431- (ref_cast<Game, EditorGameBase>(egbase),
1432+ (*game,
1433 "warehouse",
1434 descr().descname(),
1435 (boost::format(_("A new %s was added to your economy."))
1436@@ -911,7 +905,7 @@
1437 Worker * const w,
1438 PlayerImmovable & target)
1439 {
1440- Warehouse & wh = ref_cast<Warehouse, PlayerImmovable>(target);
1441+ Warehouse & wh = dynamic_cast<Warehouse&>(target);
1442
1443 if (w) {
1444 w->schedule_incorporate(game);
1445@@ -1198,7 +1192,7 @@
1446 if (!descr().get_conquers())
1447 return;
1448
1449- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
1450+ Game & game = dynamic_cast<Game&>(owner().egbase());
1451 Map & map = game.map();
1452 if
1453 (enemy.get_owner() == &owner() ||
1454@@ -1221,20 +1215,18 @@
1455 if (!count_workers(game, soldier_index, noreq))
1456 return;
1457
1458- Soldier & defender =
1459- ref_cast<Soldier, Worker>(launch_worker(game, soldier_index, noreq));
1460+ Soldier & defender = dynamic_cast<Soldier&>(launch_worker(game, soldier_index, noreq));
1461 defender.start_task_defense(game, false);
1462 }
1463
1464 bool Warehouse::attack(Soldier & enemy)
1465 {
1466- Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
1467+ Game & game = dynamic_cast<Game&>(owner().egbase());
1468 WareIndex const soldier_index = descr().tribe().worker_index("soldier");
1469 Requirements noreq;
1470
1471 if (count_workers(game, soldier_index, noreq)) {
1472- Soldier & defender =
1473- ref_cast<Soldier, Worker>(launch_worker(game, soldier_index, noreq));
1474+ Soldier & defender = dynamic_cast<Soldier&>(launch_worker(game, soldier_index, noreq));
1475 defender.start_task_defense(game, true);
1476 enemy.send_signal(game, "sleep");
1477 return true;
1478
1479=== modified file 'src/logic/worker.cc'
1480--- src/logic/worker.cc 2014-10-27 10:14:10 +0000
1481+++ src/logic/worker.cc 2014-11-30 18:54:51 +0000
1482@@ -618,7 +618,7 @@
1483 int32_t max_steps = -1;
1484
1485 // First of all, make sure we're outside
1486- if (imm == &ref_cast<Building, PlayerImmovable>(*get_location(game))) {
1487+ if (imm == &dynamic_cast<Building&>(*get_location(game))) {
1488 start_task_leavebuilding(game, false);
1489 return true;
1490 }
1491@@ -901,9 +901,6 @@
1492 */
1493 bool Worker::run_geologist(Game & game, State & state, const Action & action)
1494 {
1495- // assert that location is of the right type.
1496- ref_cast<Flag const, PlayerImmovable const>(*get_location(game));
1497-
1498 molog
1499 (" Start Geologist (%i attempts, %i radius -> %s)\n",
1500 action.iparam1, action.iparam2, action.sparam1.c_str());
1501@@ -1902,8 +1899,7 @@
1502 }
1503
1504 for (;;) {
1505- const WorkerProgram & program =
1506- ref_cast<WorkerProgram const, BobProgramBase const>(*state.program);
1507+ const WorkerProgram & program = dynamic_cast<const WorkerProgram&>(*state.program);
1508
1509 if (static_cast<uint32_t>(state.ivar1) >= program.get_size())
1510 return pop_task(game);
1511@@ -2083,7 +2079,7 @@
1512 WareInstance * ware = get_carried_ware(game);
1513 BaseImmovable * const location = game.map()[get_position()].get_immovable();
1514 #ifndef NDEBUG
1515- Building & ploc = ref_cast<Building, PlayerImmovable>(*get_location(game));
1516+ Building & ploc = dynamic_cast<Building&>(*get_location(game));
1517 assert(&ploc == location || &ploc.base_flag() == location);
1518 #endif
1519
1520@@ -2205,11 +2201,9 @@
1521
1522 // The ware has decided that it doesn't want to go to us after all
1523 // In order to return to the warehouse, we're switching to State_DropOff
1524- if
1525- (WareInstance * const ware =
1526- ref_cast<Flag, PlayerImmovable>(*location).fetch_pending_ware
1527- (game, employer))
1528+ if (WareInstance * const ware = dynamic_cast<Flag&>(*location).fetch_pending_ware(game, employer)) {
1529 set_carried_ware(game, ware);
1530+ }
1531
1532 set_animation(game, descr().get_animation("idle"));
1533 return schedule_act(game, 20);
1534@@ -2367,14 +2361,11 @@
1535 */
1536 void Worker::start_task_leavebuilding(Game & game, bool const changelocation)
1537 {
1538- Building & building =
1539- ref_cast<Building, PlayerImmovable>(*get_location(game));
1540-
1541 // Set the wait task
1542 push_task(game, taskLeavebuilding);
1543 State & state = top_state();
1544 state.ivar1 = changelocation;
1545- state.objvar1 = &building;
1546+ state.objvar1 = &dynamic_cast<Building&>(*get_location(game));
1547 }
1548
1549
1550@@ -2437,8 +2428,9 @@
1551 // The if-statement is needed because this is (unfortunately) also called
1552 // when the Worker is deallocated when shutting down the simulation. Then
1553 // the building might not exist any more.
1554- if (MapObject * const building = state.objvar1.get(game))
1555- ref_cast<Building, MapObject>(*building).leave_skip(game, *this);
1556+ if (MapObject * const building = state.objvar1.get(game)) {
1557+ dynamic_cast<Building&>(*building).leave_skip(game, *this);
1558+ }
1559 }
1560
1561
1562@@ -2544,7 +2536,7 @@
1563 molog("[fugitive]: found a flag connected to warehouse(s)\n");
1564 for (const ImmovableFound& tmp_flag : flags) {
1565
1566- Flag & flag = ref_cast<Flag, BaseImmovable>(*tmp_flag.object);
1567+ Flag & flag = dynamic_cast<Flag&>(*tmp_flag.object);
1568
1569 if (game.logic_rand() % 2 == 0)
1570 continue;
1571@@ -2651,7 +2643,7 @@
1572 const World & world = game.world();
1573 Area<FCoords> owner_area
1574 (map.get_fcoords
1575- (ref_cast<Flag, PlayerImmovable>(*get_location(game)).get_position()),
1576+ (dynamic_cast<Flag&>(*get_location(game)).get_position()),
1577 state.ivar2);
1578
1579 // Check if it's not time to go home
1580@@ -2798,12 +2790,10 @@
1581 state.ivar2 = game.get_gametime() + time;
1582
1583 // first get out
1584- Building & building =
1585- ref_cast<Building, PlayerImmovable>(*get_location(game));
1586 push_task(game, taskLeavebuilding);
1587 State & stateLeave = top_state();
1588 stateLeave.ivar1 = false;
1589- stateLeave.objvar1 = &building;
1590+ stateLeave.objvar1 = &dynamic_cast<Building&>(*get_location(game));
1591 }
1592
1593
1594@@ -2958,8 +2948,7 @@
1595
1596 if (version >= 2) {
1597 if (fr.unsigned_8()) {
1598- worker.m_transfer =
1599- new Transfer(ref_cast<Game, EditorGameBase>(egbase()), worker);
1600+ worker.m_transfer = new Transfer(dynamic_cast<Game&>(egbase()), worker);
1601 worker.m_transfer->read(fr, m_transfer);
1602 }
1603 }
1604
1605=== modified file 'src/logic/worker_descr.cc'
1606--- src/logic/worker_descr.cc 2014-09-20 09:37:47 +0000
1607+++ src/logic/worker_descr.cc 2014-11-30 18:54:51 +0000
1608@@ -19,7 +19,6 @@
1609
1610 #include "logic/worker_descr.h"
1611
1612-#include "base/deprecated.h"
1613 #include "base/i18n.h"
1614 #include "base/wexception.h"
1615 #include "graphic/graphic.h"
1616@@ -177,7 +176,7 @@
1617 Coords const coords)
1618 const
1619 {
1620- Worker & worker = ref_cast<Worker, MapObject>(create_object());
1621+ Worker & worker = dynamic_cast<Worker&>(create_object());
1622 worker.set_owner(&owner);
1623 worker.set_location(location);
1624 worker.set_position(egbase, coords);
1625
1626=== modified file 'src/map_io/CMakeLists.txt'
1627--- src/map_io/CMakeLists.txt 2014-11-22 15:27:45 +0000
1628+++ src/map_io/CMakeLists.txt 2014-11-30 18:54:51 +0000
1629@@ -86,7 +86,6 @@
1630 map_version_packet.h
1631 USES_SDL2_IMAGE
1632 DEPENDS
1633- base_deprecated
1634 base_exceptions
1635 base_log
1636 base_macros
1637
1638=== modified file 'src/map_io/map_buildingdata_packet.cc'
1639--- src/map_io/map_buildingdata_packet.cc 2014-09-20 09:37:47 +0000
1640+++ src/map_io/map_buildingdata_packet.cc 2014-11-30 18:54:51 +0000
1641@@ -194,43 +194,21 @@
1642 // Set economy now, some stuff below will count on this.
1643 building.set_economy(building.m_flag->get_economy());
1644
1645+ Game& game = dynamic_cast<Game&>(egbase);
1646+
1647 if (upcast(ConstructionSite, constructionsite, &building)) {
1648- read_constructionsite
1649- (*constructionsite,
1650- fr,
1651- ref_cast<Game, EditorGameBase>(egbase),
1652- mol);
1653+ read_constructionsite(*constructionsite, fr, game, mol);
1654 } else if (upcast(DismantleSite, dms, &building)) {
1655- read_dismantlesite
1656- (*dms,
1657- fr,
1658- ref_cast<Game, EditorGameBase>(egbase),
1659- mol);
1660+ read_dismantlesite(*dms, fr, game, mol);
1661 } else if (upcast(Warehouse, warehouse, &building)) {
1662- read_warehouse
1663- (*warehouse,
1664- fr,
1665- ref_cast<Game, EditorGameBase>(egbase),
1666- mol);
1667+ read_warehouse(*warehouse, fr, game, mol);
1668 } else if (upcast(ProductionSite, productionsite, &building)) {
1669 if (upcast(MilitarySite, militarysite, productionsite)) {
1670- read_militarysite
1671- (*militarysite,
1672- fr,
1673- ref_cast<Game, EditorGameBase>(egbase),
1674- mol);
1675+ read_militarysite(*militarysite, fr, game, mol);
1676 } else if (upcast(TrainingSite, trainingsite, productionsite)) {
1677- read_trainingsite
1678- (*trainingsite,
1679- fr,
1680- ref_cast<Game, EditorGameBase>(egbase),
1681- mol);
1682+ read_trainingsite(*trainingsite, fr, game, mol);
1683 } else {
1684- read_productionsite
1685- (*productionsite,
1686- fr,
1687- ref_cast<Game, EditorGameBase>(egbase),
1688- mol);
1689+ read_productionsite(*productionsite, fr, game, mol);
1690 }
1691 } else {
1692 // type of building is not one of (or derived from)
1693@@ -238,8 +216,7 @@
1694 assert(false);
1695 }
1696 if (packet_version < 3) {
1697- read_formerbuildings_v2
1698- (building, fr, ref_cast<Game, EditorGameBase>(egbase), mol);
1699+ read_formerbuildings_v2(building, fr, game, mol);
1700 }
1701
1702 mol.mark_object_as_loaded(building);
1703@@ -1137,7 +1114,7 @@
1704 Map & map = egbase.map();
1705 const uint32_t mapwidth = map.get_width();
1706 MapIndex const max_index = map.max_index();
1707- for (MapIndex i = 0; i < max_index; ++i)
1708+ for (MapIndex i = 0; i < max_index; ++i) {
1709 if (upcast(Building const, building, map[i].get_immovable())) {
1710 assert(mos.is_object_known(*building));
1711
1712@@ -1190,52 +1167,32 @@
1713 fw.unsigned_8(is_stopped);
1714 }
1715
1716- if (upcast(ConstructionSite const, constructionsite, building))
1717- write_constructionsite
1718- (*constructionsite,
1719- fw,
1720- ref_cast<Game, EditorGameBase>(egbase),
1721- mos);
1722- else if (upcast(DismantleSite const, dms, building))
1723- write_dismantlesite
1724- (*dms,
1725- fw,
1726- ref_cast<Game, EditorGameBase>(egbase),
1727- mos);
1728- else if (upcast(Warehouse const, warehouse, building))
1729- write_warehouse
1730- (*warehouse,
1731- fw,
1732- ref_cast<Game, EditorGameBase>(egbase),
1733- mos);
1734- else if (upcast(ProductionSite const, productionsite, building)) {
1735- if (upcast(MilitarySite const, militarysite, productionsite))
1736- write_militarysite
1737- (*militarysite,
1738- fw,
1739- ref_cast<Game, EditorGameBase>(egbase),
1740- mos);
1741- else if (upcast(TrainingSite const, trainingsite, productionsite))
1742- write_trainingsite
1743- (*trainingsite,
1744- fw,
1745- ref_cast<Game, EditorGameBase>(egbase),
1746- mos);
1747- else
1748- write_productionsite
1749- (*productionsite,
1750- fw,
1751- ref_cast<Game, EditorGameBase>(egbase),
1752- mos);
1753+ Game& game = dynamic_cast<Game&>(egbase);
1754+
1755+ if (upcast(ConstructionSite const, constructionsite, building)) {
1756+ write_constructionsite(*constructionsite, fw, game, mos);
1757+ } else if (upcast(DismantleSite const, dms, building)) {
1758+ write_dismantlesite(*dms, fw, game, mos);
1759+ } else if (upcast(Warehouse const, warehouse, building)) {
1760+ write_warehouse (*warehouse, fw, game, mos);
1761+ } else if (upcast(ProductionSite const, productionsite, building)) {
1762+ if (upcast(MilitarySite const, militarysite, productionsite)) {
1763+ write_militarysite(*militarysite, fw, game, mos);
1764+ }
1765+ else if (upcast(TrainingSite const, trainingsite, productionsite)) {
1766+ write_trainingsite(*trainingsite, fw, game, mos);
1767+ }
1768+ else {
1769+ write_productionsite(*productionsite, fw, game, mos);
1770+ }
1771 } else {
1772 assert(false);
1773 // type of building is not one of (or derived from)
1774 // {ConstructionSite, Warehouse, ProductionSite}
1775 }
1776-
1777 mos.mark_object_as_saved(*building);
1778 }
1779-
1780+ }
1781 fw.write(fs, "binary/building_data");
1782 }
1783
1784
1785=== modified file 'src/map_io/map_elemental_packet.cc'
1786--- src/map_io/map_elemental_packet.cc 2014-10-29 06:41:10 +0000
1787+++ src/map_io/map_elemental_packet.cc 2014-11-30 18:54:51 +0000
1788@@ -22,7 +22,6 @@
1789 #include <boost/algorithm/string.hpp>
1790 #include <boost/format.hpp>
1791
1792-#include "base/deprecated.h"
1793 #include "logic/editor_game_base.h"
1794 #include "logic/game_data_error.h"
1795 #include "logic/map.h"
1796
1797=== modified file 'src/map_io/map_flag_packet.cc'
1798--- src/map_io/map_flag_packet.cc 2014-09-20 09:37:47 +0000
1799+++ src/map_io/map_flag_packet.cc 2014-11-30 18:54:51 +0000
1800@@ -109,7 +109,7 @@
1801 mol.register_object<Flag>
1802 (serial,
1803 *new Flag
1804- (ref_cast<Game, EditorGameBase>(egbase),
1805+ (dynamic_cast<Game&>(egbase),
1806 egbase.player(owner),
1807 fc));
1808 } catch (const WException & e) {
1809
1810=== modified file 'src/map_io/map_flagdata_packet.cc'
1811--- src/map_io/map_flagdata_packet.cc 2014-09-20 09:37:47 +0000
1812+++ src/map_io/map_flagdata_packet.cc 2014-11-30 18:54:51 +0000
1813@@ -202,7 +202,7 @@
1814 Flag::flag_job_request_callback,
1815 wwWORKER);
1816 f.request->read
1817- (fr, ref_cast<Game, EditorGameBase>(egbase), mol);
1818+ (fr, dynamic_cast<Game&>(egbase), mol);
1819 } else {
1820 f.request = nullptr;
1821 }
1822@@ -302,7 +302,7 @@
1823 if (temp_job.request) {
1824 fw.unsigned_8(1);
1825 temp_job.request->write
1826- (fw, ref_cast<Game, EditorGameBase>(egbase), mos);
1827+ (fw, dynamic_cast<Game&>(egbase), mos);
1828 } else
1829 fw.unsigned_8(0);
1830
1831
1832=== modified file 'src/map_io/map_object_saver.cc'
1833--- src/map_io/map_object_saver.cc 2014-09-14 11:31:58 +0000
1834+++ src/map_io/map_object_saver.cc 2014-11-30 18:54:51 +0000
1835@@ -19,7 +19,6 @@
1836
1837 #include "map_io/map_object_saver.h"
1838
1839-#include "base/deprecated.h"
1840 #include "base/wexception.h"
1841 #include "economy/flag.h"
1842 #include "economy/fleet.h"
1843
1844=== modified file 'src/map_io/map_port_spaces_packet.cc'
1845--- src/map_io/map_port_spaces_packet.cc 2014-09-30 05:41:55 +0000
1846+++ src/map_io/map_port_spaces_packet.cc 2014-11-30 18:54:51 +0000
1847@@ -23,7 +23,6 @@
1848
1849 #include <boost/algorithm/string.hpp>
1850
1851-#include "base/deprecated.h"
1852 #include "base/log.h"
1853 #include "logic/editor_game_base.h"
1854 #include "logic/game_data_error.h"
1855
1856=== modified file 'src/map_io/map_roaddata_packet.cc'
1857--- src/map_io/map_roaddata_packet.cc 2014-09-20 09:37:47 +0000
1858+++ src/map_io/map_roaddata_packet.cc 2014-11-30 18:54:51 +0000
1859@@ -69,6 +69,7 @@
1860 break;
1861 }
1862 try {
1863+ Game& game = dynamic_cast<Game&>(egbase);
1864 Road & road = mol.get<Road>(serial);
1865 if (mol.is_object_loaded(road))
1866 throw GameDataError("already loaded");
1867@@ -124,7 +125,7 @@
1868
1869 // Now that all rudimentary data is set, init this road. Then
1870 // overwrite the initialization values.
1871- road._link_into_flags(ref_cast<Game, EditorGameBase>(egbase));
1872+ road._link_into_flags(game);
1873
1874 road.m_idle_index = fr.unsigned_32();
1875
1876@@ -166,8 +167,8 @@
1877 (road,
1878 0,
1879 Road::_request_carrier_callback,
1880- wwWORKER))
1881- ->read(fr, ref_cast<Game, EditorGameBase>(egbase), mol);
1882+ wwWORKER))
1883+ ->read(fr, game, mol);
1884 } else {
1885 carrier_request = nullptr;
1886 //log("No request in this slot");
1887@@ -190,13 +191,7 @@
1888 } else {
1889 delete carrier_request;
1890 if (carrier) {
1891- //carrier->set_location (0);
1892- carrier->reset_tasks
1893- (ref_cast<Game,
1894- EditorGameBase>(egbase));
1895- //carrier->send_signal
1896- //(ref_cast<Game,
1897- //EditorGameBase>(egbase), "location");
1898+ carrier->reset_tasks(dynamic_cast<Game&>(egbase));
1899 }
1900 }
1901 }
1902@@ -275,8 +270,7 @@
1903
1904 if (temp_slot.carrier_request) {
1905 fw.unsigned_8(1);
1906- temp_slot.carrier_request->write
1907- (fw, ref_cast<Game, EditorGameBase>(egbase), mos);
1908+ temp_slot.carrier_request->write(fw, dynamic_cast<Game&>(egbase), mos);
1909 } else {
1910 fw.unsigned_8(0);
1911 }
1912
1913=== modified file 'src/network/CMakeLists.txt'
1914--- src/network/CMakeLists.txt 2014-10-13 15:04:50 +0000
1915+++ src/network/CMakeLists.txt 2014-11-30 18:54:51 +0000
1916@@ -23,7 +23,6 @@
1917 USES_SDL2_NET
1918 DEPENDS
1919 ai
1920- base_deprecated
1921 base_exceptions
1922 base_i18n
1923 base_log
1924
1925=== modified file 'src/network/network_lan_promotion.cc'
1926--- src/network/network_lan_promotion.cc 2014-09-20 09:37:47 +0000
1927+++ src/network/network_lan_promotion.cc 2014-11-30 18:54:51 +0000
1928@@ -22,7 +22,6 @@
1929 #include <cstdio>
1930 #include <cstring>
1931
1932-#include "base/deprecated.h"
1933 #include "base/log.h"
1934 #include "base/macros.h"
1935 #include "build_info.h"
1936
1937=== modified file 'src/scripting/CMakeLists.txt'
1938--- src/scripting/CMakeLists.txt 2014-07-25 20:16:31 +0000
1939+++ src/scripting/CMakeLists.txt 2014-11-30 18:54:51 +0000
1940@@ -38,7 +38,6 @@
1941 scripting.h
1942 USES_BOOST_REGEX
1943 DEPENDS
1944- base_deprecated
1945 base_exceptions
1946 base_i18n
1947 base_log
1948
1949=== modified file 'src/scripting/lua_map.cc'
1950--- src/scripting/lua_map.cc 2014-10-27 10:14:10 +0000
1951+++ src/scripting/lua_map.cc 2014-11-30 18:54:51 +0000
1952@@ -21,8 +21,8 @@
1953
1954 #include <boost/format.hpp>
1955
1956-#include "base/deprecated.h"
1957 #include "base/log.h"
1958+#include "base/macros.h"
1959 #include "economy/wares_queue.h"
1960 #include "graphic/graphic.h"
1961 #include "logic/carrier.h"
1962@@ -444,7 +444,7 @@
1963 lua_rawset(L, -3);
1964 }
1965 } else {
1966- const SoldierDescr& soldier_descr = ref_cast<SoldierDescr const, WorkerDescr const>
1967+ const SoldierDescr& soldier_descr = dynamic_cast<const SoldierDescr&>
1968 (*tribe.get_worker_descr(tribe.worker_index("soldier")));
1969
1970 // Only return the number of those requested
1971@@ -470,7 +470,7 @@
1972
1973 const TribeDescr& tribe = owner->tribe();
1974 const SoldierDescr& soldier_descr = // soldiers
1975- ref_cast<SoldierDescr const, WorkerDescr const>
1976+ dynamic_cast<const SoldierDescr&>
1977 (*tribe.get_worker_descr(tribe.worker_index("soldier")));
1978 SoldiersMap setpoints = m_parse_set_soldiers_arguments(L, soldier_descr);
1979
1980@@ -517,7 +517,7 @@
1981 }
1982 } else if (d > 0) {
1983 for (; d; --d) {
1984- Soldier& soldier = ref_cast<Soldier, Worker>
1985+ Soldier& soldier = dynamic_cast<Soldier&>
1986 (soldier_descr.create(egbase, *owner, nullptr, building_position));
1987 soldier.set_level
1988 (sp.first.hp, sp.first.at, sp.first.de, sp.first.ev);
1989@@ -2586,11 +2586,12 @@
1990 for (Path::StepVector::size_type i = 0; i < idle_index; ++i)
1991 egbase.map().get_neighbour(idle_position, path[i], &idle_position);
1992
1993- Carrier & carrier = ref_cast<Carrier, Worker>
1994- (wdes->create (egbase, r.owner(), &r, idle_position));
1995+ Carrier& carrier = dynamic_cast<Carrier&>
1996+ (wdes->create(egbase, r.owner(), &r, idle_position));
1997
1998- if (upcast(Game, game, &egbase))
1999+ if (upcast(Game, game, &egbase)) {
2000 carrier.start_task_road(*game);
2001+ }
2002
2003 r.assign_carrier(carrier, 0);
2004 return 0;
2005
2006=== modified file 'src/sound/CMakeLists.txt'
2007--- src/sound/CMakeLists.txt 2014-10-13 15:04:50 +0000
2008+++ src/sound/CMakeLists.txt 2014-11-30 18:54:51 +0000
2009@@ -10,7 +10,6 @@
2010 USES_SDL2
2011 USES_SDL2_MIXER
2012 DEPENDS
2013- base_deprecated
2014 base_i18n
2015 base_log
2016 graphic
2017
2018=== modified file 'src/sound/sound_handler.cc'
2019--- src/sound/sound_handler.cc 2014-10-16 16:06:37 +0000
2020+++ src/sound/sound_handler.cc 2014-11-30 18:54:51 +0000
2021@@ -28,7 +28,6 @@
2022 #include <windows.h>
2023 #endif
2024
2025-#include "base/deprecated.h"
2026 #include "base/i18n.h"
2027 #include "base/log.h"
2028 #include "graphic/graphic.h"
2029
2030=== modified file 'src/ui_basic/CMakeLists.txt'
2031--- src/ui_basic/CMakeLists.txt 2014-11-22 11:00:04 +0000
2032+++ src/ui_basic/CMakeLists.txt 2014-11-30 18:54:51 +0000
2033@@ -51,7 +51,6 @@
2034 USES_BOOST_REGEX
2035 USES_SDL2
2036 DEPENDS
2037- base_deprecated
2038 base_exceptions
2039 base_geometry
2040 base_i18n
2041
2042=== modified file 'src/ui_basic/listselect.cc'
2043--- src/ui_basic/listselect.cc 2014-11-22 10:18:20 +0000
2044+++ src/ui_basic/listselect.cc 2014-11-30 18:54:51 +0000
2045@@ -23,7 +23,6 @@
2046
2047 #include <boost/bind.hpp>
2048
2049-#include "base/deprecated.h"
2050 #include "base/log.h"
2051 #include "graphic/font.h"
2052 #include "graphic/font_handler.h"
2053
2054=== modified file 'src/ui_basic/progresswindow.cc'
2055--- src/ui_basic/progresswindow.cc 2014-10-14 06:30:20 +0000
2056+++ src/ui_basic/progresswindow.cc 2014-11-30 18:54:51 +0000
2057@@ -23,7 +23,6 @@
2058 #include <sys/time.h>
2059 #endif
2060
2061-#include "base/deprecated.h"
2062 #include "base/i18n.h"
2063 #include "graphic/font.h"
2064 #include "graphic/font_handler.h"
2065
2066=== modified file 'src/ui_basic/spinbox.cc'
2067--- src/ui_basic/spinbox.cc 2014-09-30 05:41:55 +0000
2068+++ src/ui_basic/spinbox.cc 2014-11-30 18:54:51 +0000
2069@@ -23,7 +23,6 @@
2070
2071 #include <boost/format.hpp>
2072
2073-#include "base/deprecated.h"
2074 #include "base/i18n.h"
2075 #include "base/wexception.h"
2076 #include "ui_basic/button.h"
2077
2078=== modified file 'src/ui_basic/table.cc'
2079--- src/ui_basic/table.cc 2014-11-22 10:18:20 +0000
2080+++ src/ui_basic/table.cc 2014-11-30 18:54:51 +0000
2081@@ -21,7 +21,6 @@
2082
2083 #include <boost/bind.hpp>
2084
2085-#include "base/deprecated.h"
2086 #include "graphic/font.h"
2087 #include "graphic/font_handler.h"
2088 #include "graphic/font_handler1.h"
2089
2090=== modified file 'src/wui/CMakeLists.txt'
2091--- src/wui/CMakeLists.txt 2014-10-13 15:04:50 +0000
2092+++ src/wui/CMakeLists.txt 2014-11-30 18:54:51 +0000
2093@@ -129,7 +129,6 @@
2094 watchwindow.h
2095 USES_SDL2
2096 DEPENDS
2097- base_deprecated
2098 base_exceptions
2099 base_geometry
2100 base_i18n
2101
2102=== modified file 'src/wui/actionconfirm.cc'
2103--- src/wui/actionconfirm.cc 2014-11-13 08:25:45 +0000
2104+++ src/wui/actionconfirm.cc 2014-11-30 18:54:51 +0000
2105@@ -46,7 +46,7 @@
2106 Widelands::Ship & ship);
2107
2108 InteractivePlayer & iaplayer() const {
2109- return ref_cast<InteractivePlayer, UI::Panel>(*get_parent());
2110+ return dynamic_cast<InteractivePlayer&>(*get_parent());
2111 }
2112
2113 virtual void think() = 0;
2114
2115=== modified file 'src/wui/building_statistics_menu.cc'
2116--- src/wui/building_statistics_menu.cc 2014-10-28 14:57:52 +0000
2117+++ src/wui/building_statistics_menu.cc 2014-11-30 18:54:51 +0000
2118@@ -65,7 +65,7 @@
2119 namespace Columns {enum {Name, Size, Prod, Owned, Build};}
2120
2121 inline InteractivePlayer & BuildingStatisticsMenu::iplayer() const {
2122- return ref_cast<InteractivePlayer, UI::Panel>(*get_parent());
2123+ return dynamic_cast<InteractivePlayer&>(*get_parent());
2124 }
2125
2126 BuildingStatisticsMenu::BuildingStatisticsMenu
2127@@ -420,7 +420,7 @@
2128 ++nr_owned;
2129 if (productionsite)
2130 total_prod +=
2131- ref_cast<Widelands::ProductionSite, Widelands::BaseImmovable>
2132+ dynamic_cast<Widelands::ProductionSite&>
2133 (*map[vec[l].pos].get_immovable())
2134 .get_statistics_percent();
2135 }
2136
2137=== modified file 'src/wui/buildingwindow.cc'
2138--- src/wui/buildingwindow.cc 2014-11-24 07:25:21 +0000
2139+++ src/wui/buildingwindow.cc 2014-11-30 18:54:51 +0000
2140@@ -378,7 +378,7 @@
2141 igbase().game().send_player_bulldoze(m_building);
2142 }
2143 else {
2144- show_bulldoze_confirm(ref_cast<InteractivePlayer, InteractiveGameBase>(igbase()), m_building);
2145+ show_bulldoze_confirm(dynamic_cast<InteractivePlayer&>(igbase()), m_building);
2146 }
2147 }
2148
2149@@ -394,7 +394,7 @@
2150 igbase().game().send_player_dismantle(m_building);
2151 }
2152 else {
2153- show_dismantle_confirm(ref_cast<InteractivePlayer, InteractiveGameBase>(igbase()), m_building);
2154+ show_dismantle_confirm(dynamic_cast<InteractivePlayer&>(igbase()), m_building);
2155 }
2156 }
2157
2158@@ -438,7 +438,7 @@
2159 }
2160 else {
2161 show_enhance_confirm
2162- (ref_cast<InteractivePlayer, InteractiveGameBase>(igbase()),
2163+ (dynamic_cast<InteractivePlayer&>(igbase()),
2164 m_building,
2165 id);
2166 }
2167
2168=== modified file 'src/wui/buildingwindow.h'
2169--- src/wui/buildingwindow.h 2014-09-10 14:48:40 +0000
2170+++ src/wui/buildingwindow.h 2014-11-30 18:54:51 +0000
2171@@ -47,7 +47,7 @@
2172 Widelands::Building & building() {return m_building;}
2173
2174 InteractiveGameBase & igbase() const {
2175- return ref_cast<InteractiveGameBase, UI::Panel>(*get_parent());
2176+ return dynamic_cast<InteractiveGameBase&>(*get_parent());
2177 }
2178
2179 void draw(RenderTarget &) override;
2180
2181=== modified file 'src/wui/constructionsitewindow.cc'
2182--- src/wui/constructionsitewindow.cc 2014-09-10 14:48:40 +0000
2183+++ src/wui/constructionsitewindow.cc 2014-11-30 18:54:51 +0000
2184@@ -86,7 +86,7 @@
2185 BuildingWindow::think();
2186
2187 const Widelands::ConstructionSite & cs =
2188- ref_cast<Widelands::ConstructionSite, Widelands::Building>(building());
2189+ dynamic_cast<Widelands::ConstructionSite&>(building());
2190
2191 m_progress->set_state(cs.get_built_per64k());
2192 }
2193
2194=== modified file 'src/wui/dismantlesitewindow.cc'
2195--- src/wui/dismantlesitewindow.cc 2014-09-10 14:48:40 +0000
2196+++ src/wui/dismantlesitewindow.cc 2014-11-30 18:54:51 +0000
2197@@ -80,7 +80,7 @@
2198 BuildingWindow::think();
2199
2200 const Widelands::DismantleSite & ds =
2201- ref_cast<Widelands::DismantleSite, Widelands::Building>(building());
2202+ dynamic_cast<Widelands::DismantleSite&>(building());
2203
2204 m_progress->set_state(ds.get_built_per64k());
2205 }
2206
2207=== modified file 'src/wui/encyclopedia_window.cc'
2208--- src/wui/encyclopedia_window.cc 2014-10-28 14:57:52 +0000
2209+++ src/wui/encyclopedia_window.cc 2014-11-30 18:54:51 +0000
2210@@ -51,7 +51,7 @@
2211 using namespace Widelands;
2212
2213 inline InteractivePlayer & EncyclopediaWindow::iaplayer() const {
2214- return ref_cast<InteractivePlayer, UI::Panel>(*get_parent());
2215+ return dynamic_cast<InteractivePlayer&>(*get_parent());
2216 }
2217
2218
2219@@ -141,10 +141,8 @@
2220 condTable.clear();
2221 const TribeDescr & tribe = iaplayer().player().tribe();
2222
2223- const ProductionSiteDescr::Programs & programs =
2224- ref_cast<ProductionSiteDescr const, BuildingDescr const>
2225- (*tribe.get_building_descr(prodSites.get_selected()))
2226- .programs();
2227+ upcast(ProductionSiteDescr const, descr, tribe.get_building_descr(prodSites.get_selected()));
2228+ const ProductionSiteDescr::Programs & programs = descr->programs();
2229
2230 // TODO(unknown): This needs reworking. A program can indeed produce iron even if
2231 // the program name is not any of produce_iron, smelt_iron, prog_iron
2232
2233=== modified file 'src/wui/fieldaction.cc'
2234--- src/wui/fieldaction.cc 2014-11-13 08:25:45 +0000
2235+++ src/wui/fieldaction.cc 2014-11-30 18:54:51 +0000
2236@@ -177,7 +177,7 @@
2237 ~FieldActionWindow();
2238
2239 InteractiveBase & ibase() {
2240- return ref_cast<InteractiveBase, UI::Panel>(*get_parent());
2241+ return dynamic_cast<InteractiveBase&>(*get_parent());
2242 }
2243
2244 void think() override;
2245@@ -656,8 +656,8 @@
2246 */
2247 void FieldActionWindow::act_watch()
2248 {
2249- show_watch_window
2250- (ref_cast<InteractiveGameBase, InteractiveBase>(ibase()), m_node);
2251+ upcast(InteractiveGameBase, igbase, &ibase());
2252+ show_watch_window(*igbase, m_node);
2253 okdialog();
2254 }
2255
2256@@ -710,9 +710,10 @@
2257
2258 if (ibase().is_building_road())
2259 ibase().finish_build_road();
2260- else if (game)
2261- ref_cast<InteractivePlayer, InteractiveBase>(ibase())
2262- .set_flag_to_connect(m_node);
2263+ else if (game) {
2264+ upcast(InteractivePlayer, iaplayer, &ibase());
2265+ iaplayer->set_flag_to_connect(m_node);
2266+ }
2267
2268 okdialog();
2269 }
2270@@ -734,22 +735,22 @@
2271 {
2272 okdialog();
2273 Widelands::EditorGameBase & egbase = ibase().egbase();
2274+ upcast(Game, game, &egbase);
2275+ upcast(InteractivePlayer, iaplayer, &ibase());
2276+
2277 if (upcast(Widelands::Flag, flag, m_node.field->get_immovable())) {
2278 if (Building * const building = flag->get_building()) {
2279 if (building->get_playercaps() & Building::PCap_Bulldoze) {
2280 if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) {
2281- ref_cast<Game, EditorGameBase>(egbase).send_player_bulldoze
2282+ game->send_player_bulldoze
2283 (*flag, get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL));
2284 }
2285 else {
2286- show_bulldoze_confirm
2287- (ref_cast<InteractivePlayer, InteractiveBase>(ibase()),
2288- *building,
2289- flag);
2290+ show_bulldoze_confirm(*iaplayer, *building, flag);
2291 }
2292 }
2293 } else {
2294- ref_cast<Game, EditorGameBase>(egbase).send_player_bulldoze
2295+ game->send_player_bulldoze
2296 (*flag, get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL));
2297 }
2298 }
2299@@ -792,9 +793,11 @@
2300 void FieldActionWindow::act_removeroad()
2301 {
2302 Widelands::EditorGameBase & egbase = ibase().egbase();
2303- if (upcast(Widelands::Road, road, egbase.map().get_immovable(m_node)))
2304- ref_cast<Game, EditorGameBase>(egbase).send_player_bulldoze
2305+ if (upcast(Widelands::Road, road, egbase.map().get_immovable(m_node))) {
2306+ upcast(Game, game, &ibase().egbase());
2307+ game->send_player_bulldoze
2308 (*road, get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL));
2309+ }
2310 okdialog();
2311 }
2312
2313@@ -806,15 +809,12 @@
2314 */
2315 void FieldActionWindow::act_build(Widelands::BuildingIndex idx)
2316 {
2317- Widelands::Game & game = ref_cast<Game, EditorGameBase>(ibase().egbase());
2318- game.send_player_build
2319- (ref_cast<InteractivePlayer, InteractiveBase>(ibase()).player_number(),
2320- m_node,
2321- Widelands::BuildingIndex(idx));
2322- ibase().reference_player_tribe
2323- (m_plr->player_number(), &m_plr->tribe());
2324- ref_cast<InteractivePlayer, InteractiveBase>(ibase()).set_flag_to_connect
2325- (game.map().br_n(m_node));
2326+ upcast(Game, game, &ibase().egbase());
2327+ upcast(InteractivePlayer, iaplayer, &ibase());
2328+
2329+ game->send_player_build(iaplayer->player_number(), m_node, Widelands::BuildingIndex(idx));
2330+ ibase().reference_player_tribe(m_plr->player_number(), &m_plr->tribe());
2331+ iaplayer->set_flag_to_connect(game->map().br_n(m_node));
2332 okdialog();
2333 }
2334
2335@@ -848,10 +848,10 @@
2336 */
2337 void FieldActionWindow::act_geologist()
2338 {
2339- Game & game = ref_cast<Game, EditorGameBase>(ibase().egbase());
2340- if (upcast(Widelands::Flag, flag, game.map().get_immovable(m_node)))
2341- game.send_player_flagaction (*flag);
2342-
2343+ upcast(Game, game, &ibase().egbase());
2344+ if (upcast(Widelands::Flag, flag, game->map().get_immovable(m_node))) {
2345+ game->send_player_flagaction (*flag);
2346+ }
2347 okdialog();
2348 }
2349
2350@@ -863,15 +863,16 @@
2351 */
2352 void FieldActionWindow::act_attack ()
2353 {
2354- Game & game = ref_cast<Game, EditorGameBase>(ibase().egbase());
2355-
2356 assert(m_attack_box);
2357- if (upcast(Building, building, game.map().get_immovable(m_node)))
2358- if (m_attack_box->soldiers() > 0)
2359- game.send_player_enemyflagaction(
2360+ upcast(Game, game, &ibase().egbase());
2361+ if (upcast(Building, building, game->map().get_immovable(m_node)))
2362+ if (m_attack_box->soldiers() > 0) {
2363+ upcast(InteractivePlayer const, iaplayer, &ibase());
2364+ game->send_player_enemyflagaction(
2365 building->base_flag(),
2366- ref_cast<const InteractivePlayer, const InteractiveBase>(ibase()).player_number(),
2367+ iaplayer->player_number(),
2368 m_attack_box->soldiers() /* number of soldiers */);
2369+ }
2370 okdialog();
2371 }
2372
2373@@ -933,8 +934,8 @@
2374 finish = true;
2375 else if (dynamic_cast<const Widelands::Road *>(i))
2376 if (player->get_buildcaps(target) & Widelands::BUILDCAPS_FLAG) {
2377- ref_cast<Game, EditorGameBase>(player->egbase())
2378- .send_player_build_flag(player->player_number(), target);
2379+ upcast(Game, game, &player->egbase());
2380+ game->send_player_build_flag(player->player_number(), target);
2381 finish = true;
2382 }
2383 if (finish)
2384
2385=== modified file 'src/wui/game_debug_ui.cc'
2386--- src/wui/game_debug_ui.cc 2014-10-27 10:14:10 +0000
2387+++ src/wui/game_debug_ui.cc 2014-11-30 18:54:51 +0000
2388@@ -133,7 +133,7 @@
2389 MapObjectDebugWindow(InteractiveBase & parent, Widelands::MapObject &);
2390
2391 InteractiveBase & ibase() {
2392- return ref_cast<InteractiveBase, UI::Panel>(*get_parent());
2393+ return dynamic_cast<InteractiveBase&>(*get_parent());
2394 }
2395
2396 void think() override;
2397@@ -212,7 +212,7 @@
2398 FieldDebugWindow(InteractiveBase & parent, Widelands::Coords);
2399
2400 InteractiveBase & ibase() {
2401- return ref_cast<InteractiveBase, UI::Panel>(*get_parent());
2402+ return dynamic_cast<InteractiveBase&>(*get_parent());
2403 }
2404
2405 void think() override;
2406@@ -274,7 +274,7 @@
2407
2408 // Select information about the field itself
2409 const Widelands::EditorGameBase & egbase =
2410- ref_cast<InteractiveBase const, UI::Panel const>(*get_parent())
2411+ dynamic_cast<const InteractiveBase&>(*get_parent())
2412 .egbase();
2413 {
2414 Widelands::PlayerNumber const owner = m_coords.field->get_owned_by();
2415
2416=== modified file 'src/wui/game_main_menu_save_game.cc'
2417--- src/wui/game_main_menu_save_game.cc 2014-10-27 10:31:04 +0000
2418+++ src/wui/game_main_menu_save_game.cc 2014-11-30 18:54:51 +0000
2419@@ -35,7 +35,7 @@
2420 #include "wui/interactive_gamebase.h"
2421
2422 InteractiveGameBase & GameMainMenuSaveGame::igbase() {
2423- return ref_cast<InteractiveGameBase, UI::Panel>(*get_parent());
2424+ return dynamic_cast<InteractiveGameBase&>(*get_parent());
2425 }
2426
2427 #define WINDOW_WIDTH 440
2428@@ -262,7 +262,7 @@
2429 {}
2430
2431 GameMainMenuSaveGame & menu_save_game() {
2432- return ref_cast<GameMainMenuSaveGame, UI::Panel>(*get_parent());
2433+ return dynamic_cast<GameMainMenuSaveGame&>(*get_parent());
2434 }
2435
2436
2437@@ -328,7 +328,7 @@
2438 void pressed_yes() override
2439 {
2440 g_fs->fs_unlink(m_filename);
2441- ref_cast<GameMainMenuSaveGame, UI::Panel>(*get_parent()).fill_list();
2442+ dynamic_cast<GameMainMenuSaveGame&>(*get_parent()).fill_list();
2443 die();
2444 }
2445
2446
2447=== modified file 'src/wui/game_main_menu_save_game.h'
2448--- src/wui/game_main_menu_save_game.h 2014-09-10 13:03:40 +0000
2449+++ src/wui/game_main_menu_save_game.h 2014-11-30 18:54:51 +0000
2450@@ -20,7 +20,6 @@
2451 #ifndef WL_WUI_GAME_MAIN_MENU_SAVE_GAME_H
2452 #define WL_WUI_GAME_MAIN_MENU_SAVE_GAME_H
2453
2454-#include "base/deprecated.h"
2455 #include "base/i18n.h"
2456 #include "ui_basic/button.h"
2457 #include "ui_basic/editbox.h"
2458
2459=== modified file 'src/wui/game_message_menu.cc'
2460--- src/wui/game_message_menu.cc 2014-11-22 10:18:20 +0000
2461+++ src/wui/game_message_menu.cc 2014-11-30 18:54:51 +0000
2462@@ -21,7 +21,6 @@
2463
2464 #include <boost/bind.hpp>
2465
2466-#include "base/deprecated.h"
2467 #include "base/time_string.h"
2468 #include "graphic/graphic.h"
2469 #include "logic/instances.h"
2470@@ -35,7 +34,7 @@
2471 using Widelands::MessageQueue;
2472
2473 inline InteractivePlayer & GameMessageMenu::iplayer() const {
2474- return ref_cast<InteractivePlayer, UI::Panel>(*get_parent());
2475+ return dynamic_cast<InteractivePlayer&>(*get_parent());
2476 }
2477
2478
2479
2480=== modified file 'src/wui/game_message_menu.h'
2481--- src/wui/game_message_menu.h 2014-10-14 06:30:20 +0000
2482+++ src/wui/game_message_menu.h 2014-11-30 18:54:51 +0000
2483@@ -20,7 +20,6 @@
2484 #ifndef WL_WUI_GAME_MESSAGE_MENU_H
2485 #define WL_WUI_GAME_MESSAGE_MENU_H
2486
2487-#include "base/deprecated.h"
2488 #include "base/i18n.h"
2489 #include "logic/message_queue.h"
2490 #include "ui_basic/button.h"
2491
2492=== modified file 'src/wui/game_objectives_menu.cc'
2493--- src/wui/game_objectives_menu.cc 2014-10-27 10:31:04 +0000
2494+++ src/wui/game_objectives_menu.cc 2014-11-30 18:54:51 +0000
2495@@ -31,7 +31,7 @@
2496
2497
2498 inline InteractivePlayer & GameObjectivesMenu::iplayer() const {
2499- return ref_cast<InteractivePlayer, UI::Panel>(*get_parent());
2500+ return dynamic_cast<InteractivePlayer&>(*get_parent());
2501 }
2502
2503
2504
2505=== modified file 'src/wui/general_statistics_menu.cc'
2506--- src/wui/general_statistics_menu.cc 2014-11-22 11:32:06 +0000
2507+++ src/wui/general_statistics_menu.cc 2014-11-30 18:54:51 +0000
2508@@ -284,7 +284,7 @@
2509 }
2510
2511 GeneralStatisticsMenu::~GeneralStatisticsMenu() {
2512- Game & game = ref_cast<InteractiveGameBase, UI::Panel>(*get_parent()).game();
2513+ Game & game = dynamic_cast<InteractiveGameBase&>(*get_parent()).game();
2514 if (game.is_loaded()) {
2515 // Save informations for recreation, if window is reopened
2516 m_my_registry->selected_information = m_selected_information;
2517@@ -321,7 +321,7 @@
2518 */
2519 void GeneralStatisticsMenu::radiogroup_changed(int32_t const id) {
2520 size_t const statistics_size =
2521- ref_cast<InteractiveGameBase, UI::Panel>(*get_parent()).game()
2522+ dynamic_cast<InteractiveGameBase&>(*get_parent()).game()
2523 .get_general_statistics().size();
2524 for (uint32_t i = 0; i < statistics_size; ++i)
2525 if (m_cbs[i]) {
2526
2527=== modified file 'src/wui/interactive_gamebase.cc'
2528--- src/wui/interactive_gamebase.cc 2014-09-20 09:37:47 +0000
2529+++ src/wui/interactive_gamebase.cc 2014-11-30 18:54:51 +0000
2530@@ -53,7 +53,7 @@
2531
2532 Widelands::Game & InteractiveGameBase:: game() const
2533 {
2534- return ref_cast<Widelands::Game, Widelands::EditorGameBase>(egbase());
2535+ return dynamic_cast<Widelands::Game&>(egbase());
2536 }
2537
2538 void InteractiveGameBase::set_chat_provider(ChatProvider & chat)
2539
2540=== modified file 'src/wui/interactive_player.cc'
2541--- src/wui/interactive_player.cc 2014-11-23 14:34:38 +0000
2542+++ src/wui/interactive_player.cc 2014-11-30 18:54:51 +0000
2543@@ -304,7 +304,7 @@
2544 (Widelands::MessageId const id, const Widelands::Message & message)
2545 {
2546 m_message_menu.create();
2547- ref_cast<GameMessageMenu, UI::UniqueWindow>(*m_message_menu.window)
2548+ dynamic_cast<GameMessageMenu&>(*m_message_menu.window)
2549 .show_new_message(id, message);
2550 }
2551
2552@@ -473,7 +473,7 @@
2553 if
2554 (UI::UniqueWindow * const building_statistics_window =
2555 m_mainm_windows.building_stats.window)
2556- ref_cast<BuildingStatisticsMenu, UI::UniqueWindow>
2557+ dynamic_cast<BuildingStatisticsMenu&>
2558 (*building_statistics_window)
2559 .update();
2560 }
2561
2562=== modified file 'src/wui/interactive_spectator.cc'
2563--- src/wui/interactive_spectator.cc 2014-11-23 14:34:38 +0000
2564+++ src/wui/interactive_spectator.cc 2014-11-30 18:54:51 +0000
2565@@ -275,8 +275,7 @@
2566 if (!m_chat.window)
2567 GameChatMenu::create_chat_console(this, m_chat, *m_chatProvider);
2568
2569- ref_cast<GameChatMenu, UI::UniqueWindow>(*m_chat.window)
2570- .enter_chat_message();
2571+ dynamic_cast<GameChatMenu*>(m_chat.window)->enter_chat_message();
2572 return true;
2573
2574 default:
2575
2576=== modified file 'src/wui/militarysitewindow.cc'
2577--- src/wui/militarysitewindow.cc 2014-09-10 13:03:40 +0000
2578+++ src/wui/militarysitewindow.cc 2014-11-30 18:54:51 +0000
2579@@ -38,7 +38,7 @@
2580 UI::Window * & registry);
2581
2582 MilitarySite & militarysite() {
2583- return ref_cast<MilitarySite, Widelands::Building>(building());
2584+ return dynamic_cast<MilitarySite&>(building());
2585 }
2586
2587 protected:
2588
2589=== modified file 'src/wui/minimap.cc'
2590--- src/wui/minimap.cc 2014-11-24 07:10:03 +0000
2591+++ src/wui/minimap.cc 2014-11-30 18:54:51 +0000
2592@@ -98,7 +98,7 @@
2593
2594 m_ibase.egbase().map().normalize_coords(c);
2595
2596- ref_cast<MiniMap, UI::Panel>(*get_parent()).warpview(c.x * TRIANGLE_WIDTH, c.y * TRIANGLE_HEIGHT);
2597+ dynamic_cast<MiniMap&>(*get_parent()).warpview(c.x * TRIANGLE_WIDTH, c.y * TRIANGLE_HEIGHT);
2598
2599 return true;
2600 }
2601
2602=== modified file 'src/wui/productionsitewindow.h'
2603--- src/wui/productionsitewindow.h 2014-09-10 13:03:40 +0000
2604+++ src/wui/productionsitewindow.h 2014-11-30 18:54:51 +0000
2605@@ -31,7 +31,7 @@
2606 UI::Window * & registry);
2607
2608 Widelands::ProductionSite & productionsite() {
2609- return ref_cast<Widelands::ProductionSite, Widelands::Building>(building());
2610+ return dynamic_cast<Widelands::ProductionSite&>(building());
2611 }
2612 void update_worker_table();
2613 protected:
2614
2615=== modified file 'src/wui/shipwindow.cc'
2616--- src/wui/shipwindow.cc 2014-11-22 10:18:20 +0000
2617+++ src/wui/shipwindow.cc 2014-11-30 18:54:51 +0000
2618@@ -295,7 +295,7 @@
2619 m_igbase.game().send_player_sink_ship(m_ship);
2620 }
2621 else {
2622- show_ship_sink_confirm(ref_cast<InteractivePlayer, InteractiveGameBase>(m_igbase), m_ship);
2623+ show_ship_sink_confirm(dynamic_cast<InteractivePlayer&>(m_igbase), m_ship);
2624 }
2625 }
2626
2627@@ -307,7 +307,7 @@
2628 }
2629 else {
2630 show_ship_cancel_expedition_confirm
2631- (ref_cast<InteractivePlayer, InteractiveGameBase>(m_igbase), m_ship);
2632+ (dynamic_cast<InteractivePlayer&>(m_igbase), m_ship);
2633 }
2634 }
2635
2636
2637=== modified file 'src/wui/soldierlist.cc'
2638--- src/wui/soldierlist.cc 2014-11-22 10:18:20 +0000
2639+++ src/wui/soldierlist.cc 2014-11-30 18:54:51 +0000
2640@@ -22,7 +22,6 @@
2641 #include <boost/bind.hpp>
2642 #include <boost/format.hpp>
2643
2644-#include "base/deprecated.h"
2645 #include "base/macros.h"
2646 #include "graphic/font.h"
2647 #include "graphic/graphic.h"
2648
2649=== modified file 'src/wui/trainingsitewindow.cc'
2650--- src/wui/trainingsitewindow.cc 2014-09-10 13:03:40 +0000
2651+++ src/wui/trainingsitewindow.cc 2014-11-30 18:54:51 +0000
2652@@ -37,7 +37,7 @@
2653 (InteractiveGameBase & parent, TrainingSite &, UI::Window * & registry);
2654
2655 TrainingSite & trainingsite() {
2656- return ref_cast<TrainingSite, Widelands::Building>(building());
2657+ return dynamic_cast<TrainingSite&>(building());
2658 }
2659
2660 protected:
2661
2662=== modified file 'src/wui/transport_ui.cc'
2663--- src/wui/transport_ui.cc 2014-11-22 11:32:06 +0000
2664+++ src/wui/transport_ui.cc 2014-11-30 18:54:51 +0000
2665@@ -159,7 +159,7 @@
2666 m_economy.ware_target_quantity(id);
2667 if (1 < tq.permanent) {
2668 Widelands::Player & player = m_economy.owner();
2669- Game & game = ref_cast<Game, EditorGameBase>(player.egbase());
2670+ Game & game = dynamic_cast<Game&>(player.egbase());
2671 game.send_player_command
2672 (*new Widelands::CmdSetWareTargetQuantity
2673 (game.get_gametime(), player.player_number(),
2674@@ -181,7 +181,7 @@
2675 const Economy::TargetQuantity & tq =
2676 m_economy.ware_target_quantity(id);
2677 Widelands::Player & player = m_economy.owner();
2678- Game & game = ref_cast<Game, EditorGameBase>(player.egbase());
2679+ Game & game = dynamic_cast<Game&>(player.egbase());
2680 game.send_player_command
2681 (*new Widelands::CmdSetWareTargetQuantity
2682 (game.get_gametime(), player.player_number(),
2683@@ -200,7 +200,7 @@
2684 {
2685 if (m_display.ware_selected(id)) {
2686 Widelands::Player & player = m_economy.owner();
2687- Game & game = ref_cast<Game, EditorGameBase>(player.egbase());
2688+ Game & game = dynamic_cast<Game&>(player.egbase());
2689 game.send_player_command
2690 (*new Widelands::CmdResetWareTargetQuantity
2691 (game.get_gametime(), player.player_number(),
2692@@ -256,7 +256,7 @@
2693 m_economy.worker_target_quantity(id);
2694 if (1 < tq.permanent) {
2695 Widelands::Player & player = m_economy.owner();
2696- Game & game = ref_cast<Game, EditorGameBase>(player.egbase());
2697+ Game & game = dynamic_cast<Game&>(player.egbase());
2698 game.send_player_command
2699 (*new Widelands::CmdSetWorkerTargetQuantity
2700 (game.get_gametime(), player.player_number(),
2701@@ -278,7 +278,7 @@
2702 const Economy::TargetQuantity & tq =
2703 m_economy.worker_target_quantity(id);
2704 Widelands::Player & player = m_economy.owner();
2705- Game & game = ref_cast<Game, EditorGameBase>(player.egbase());
2706+ Game & game = dynamic_cast<Game&>(player.egbase());
2707 game.send_player_command
2708 (*new Widelands::CmdSetWorkerTargetQuantity
2709 (game.get_gametime(), player.player_number(),
2710@@ -296,7 +296,7 @@
2711 {
2712 if (m_display.ware_selected(id)) {
2713 Widelands::Player & player = m_economy.owner();
2714- Game & game = ref_cast<Game, EditorGameBase>(player.egbase());
2715+ Game & game = dynamic_cast<Game&>(player.egbase());
2716 game.send_player_command
2717 (*new Widelands::CmdResetWorkerTargetQuantity
2718 (game.get_gametime(), player.player_number(),
2719@@ -313,11 +313,10 @@
2720 // users can register for change updates. The registry should be
2721 // moved to InteractivePlayer or some other UI component.
2722 void Economy::show_options_window() {
2723- if (m_optionswindow_registry.window)
2724+ if (m_optionswindow_registry.window) {
2725 m_optionswindow_registry.window->move_to_top();
2726- else
2727- new EconomyOptionsWindow
2728- (ref_cast<InteractiveGameBase, InteractiveBase>
2729- (*owner().egbase().get_ibase()),
2730- *this);
2731+ } else {
2732+ new EconomyOptionsWindow(dynamic_cast<InteractiveGameBase&>
2733+ (*owner().egbase().get_ibase()), *this);
2734+ }
2735 }
2736
2737=== modified file 'src/wui/warehousewindow.cc'
2738--- src/wui/warehousewindow.cc 2014-09-10 13:03:40 +0000
2739+++ src/wui/warehousewindow.cc 2014-11-30 18:54:51 +0000
2740@@ -176,7 +176,7 @@
2741 (InteractiveGameBase & parent, Warehouse &, UI::Window * & registry);
2742
2743 Warehouse & warehouse() {
2744- return ref_cast<Warehouse, Widelands::Building>(building());
2745+ return dynamic_cast<Warehouse&>(building());
2746 }
2747 };
2748
2749
2750=== modified file 'src/wui/watchwindow.cc'
2751--- src/wui/watchwindow.cc 2014-11-22 11:32:06 +0000
2752+++ src/wui/watchwindow.cc 2014-11-30 18:54:51 +0000
2753@@ -56,7 +56,7 @@
2754 ~WatchWindow();
2755
2756 Widelands::Game & game() const {
2757- return ref_cast<InteractiveGameBase, UI::Panel>(*get_parent()).game();
2758+ return dynamic_cast<InteractiveGameBase&>(*get_parent()).game();
2759 }
2760
2761 boost::signals2::signal<void (Point)> warp_mainview;

Subscribers

People subscribed via source and target branches

to status/vote changes: