← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/fix_name_collision into lp:widelands

 

Tino has proposed merging lp:~widelands-dev/widelands/fix_name_collision into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/fix_name_collision/+merge/309320

It was not possible to compile current trunk on windows, because of a name collision with a MSDN function DrawText : https://msdn.microsoft.com/en-us/library/windows/desktop/dd162498(v=vs.85).aspx

I've renamed the function to WLDrawText, but perhaps there is also a better fix by using namespaces?
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fix_name_collision into lp:widelands.
=== modified file 'src/economy/flag.h'
--- src/economy/flag.h	2016-10-22 11:20:33 +0000
+++ src/economy/flag.h	2016-10-26 08:26:48 +0000
@@ -146,7 +146,7 @@
 	void cleanup(EditorGameBase&) override;
 
 	void draw(uint32_t gametime,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Vector2f& point_on_dst,
 				 float scale,
 	          RenderTarget* dst) override;

=== modified file 'src/economy/portdock.cc'
--- src/economy/portdock.cc	2016-10-24 14:04:00 +0000
+++ src/economy/portdock.cc	2016-10-26 08:26:48 +0000
@@ -141,7 +141,7 @@
 		expedition_bootstrap_->set_economy(e);
 }
 
-void PortDock::draw(uint32_t, const DrawText, const Vector2f&, float, RenderTarget*) {
+void PortDock::draw(uint32_t, const WLDrawText, const Vector2f&, float, RenderTarget*) {
 	// do nothing
 }
 

=== modified file 'src/economy/portdock.h'
--- src/economy/portdock.h	2016-10-22 11:20:33 +0000
+++ src/economy/portdock.h	2016-10-26 08:26:48 +0000
@@ -97,7 +97,7 @@
 	Flag& base_flag() override;
 	PositionList get_positions(const EditorGameBase&) const override;
 	void draw(uint32_t gametime,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Vector2f& point_on_dst,
 				 float scale,
 	          RenderTarget* dst) override;

=== modified file 'src/economy/road.h'
--- src/economy/road.h	2016-10-22 11:20:33 +0000
+++ src/economy/road.h	2016-10-26 08:26:48 +0000
@@ -119,7 +119,7 @@
 	void cleanup(EditorGameBase&) override;
 
 	void draw(uint32_t gametime,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Vector2f& point_on_dst,
 				 float scale,
 	          RenderTarget* dst) override;

=== modified file 'src/graphic/game_renderer.cc'
--- src/graphic/game_renderer.cc	2016-10-24 20:07:22 +0000
+++ src/graphic/game_renderer.cc	2016-10-26 08:26:48 +0000
@@ -100,29 +100,29 @@
 void draw_objects_for_visible_field(const EditorGameBase& egbase,
                                     const FieldsToDraw::Field& field,
                                     const float zoom,
-                                    const DrawText draw_text,
+                                    const WLDrawText draw_text,
                                     const Player* player,
                                     RenderTarget* dst) {
 	BaseImmovable* const imm = field.fcoords.field->get_immovable();
 	if (imm != nullptr && imm->get_positions(egbase).front() == field.fcoords) {
-		DrawText draw_text_for_this_immovable = draw_text;
+		WLDrawText draw_text_for_this_immovable = draw_text;
 		const Player* owner = imm->get_owner();
 		if (player != nullptr && owner != nullptr && !player->see_all() &&
 		    player->is_hostile(*owner)) {
 			draw_text_for_this_immovable =
-			   static_cast<DrawText>(draw_text_for_this_immovable & ~DrawText::kStatistics);
+			   static_cast<WLDrawText>(draw_text_for_this_immovable & ~WLDrawText::kStatistics);
 		}
 
 		imm->draw(
 		   egbase.get_gametime(), draw_text_for_this_immovable, field.rendertarget_pixel, zoom, dst);
 	}
 	for (Bob* bob = field.fcoords.field->get_first_bob(); bob; bob = bob->get_next_bob()) {
-		DrawText draw_text_for_this_bob = draw_text;
+		WLDrawText draw_text_for_this_bob = draw_text;
 		const Player* owner = bob->get_owner();
 		if (player != nullptr && owner != nullptr && !player->see_all() &&
 		    player->is_hostile(*owner)) {
 			draw_text_for_this_bob =
-			   static_cast<DrawText>(draw_text_for_this_bob & ~DrawText::kStatistics);
+			   static_cast<WLDrawText>(draw_text_for_this_bob & ~WLDrawText::kStatistics);
 		}
 		bob->draw(egbase, draw_text_for_this_bob, field.rendertarget_pixel, zoom, dst);
 	}
@@ -215,7 +215,7 @@
                   const float zoom,
                   const FieldsToDraw& fields_to_draw,
                   const Player* player,
-                  const DrawText draw_text,
+                  const WLDrawText draw_text,
                   RenderTarget* dst) {
 	std::vector<FieldOverlayManager::OverlayInfo> overlay_info;
 	for (size_t current_index = 0; current_index < fields_to_draw.size(); ++current_index) {
@@ -319,7 +319,7 @@
                              const Vector2f& viewpoint,
                              const float zoom,
                              const Widelands::Player& player,
-                             const DrawText draw_text,
+                             const WLDrawText draw_text,
                              RenderTarget* dst) {
 	draw(egbase, viewpoint, zoom, draw_text, &player, dst);
 }
@@ -327,7 +327,7 @@
 void GameRenderer::rendermap(const Widelands::EditorGameBase& egbase,
                              const Vector2f& viewpoint,
                              const float zoom,
-                             const DrawText draw_text,
+                             const WLDrawText draw_text,
                              RenderTarget* dst) {
 	draw(egbase, viewpoint, zoom, draw_text, nullptr, dst);
 }
@@ -335,7 +335,7 @@
 void GameRenderer::draw(const EditorGameBase& egbase,
                         const Vector2f& viewpoint,
                         const float zoom,
-                        const DrawText draw_text,
+                        const WLDrawText draw_text,
                         const Player* player,
                         RenderTarget* dst) {
 	assert(viewpoint.x >= 0);  // divisions involving negative numbers are bad

=== modified file 'src/graphic/game_renderer.h'
--- src/graphic/game_renderer.h	2016-10-22 11:20:33 +0000
+++ src/graphic/game_renderer.h	2016-10-26 08:26:48 +0000
@@ -47,7 +47,7 @@
 	               const Vector2f& viewpoint,
 	               float scale,
 	               const Widelands::Player& player,
-	               DrawText draw_text,
+	               WLDrawText draw_text,
 	               RenderTarget* dst);
 
 	// Renders the map from an omniscient perspective. This is used
@@ -55,7 +55,7 @@
 	void rendermap(const Widelands::EditorGameBase& egbase,
 	               const Vector2f& viewpoint,
 	               float scale,
-	               DrawText draw_text,
+	               WLDrawText draw_text,
 	               RenderTarget* dst);
 
 private:
@@ -64,7 +64,7 @@
 	void draw(const Widelands::EditorGameBase& egbase,
 	          const Vector2f& viewpoint,
 	          float scale,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Widelands::Player* player,
 	          RenderTarget* dst);
 

=== modified file 'src/logic/map_objects/bob.cc'
--- src/logic/map_objects/bob.cc	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/bob.cc	2016-10-26 08:26:48 +0000
@@ -756,7 +756,7 @@
 /// Note that the current node is actually the node that we are walking to, not
 /// the the one that we start from.
 void Bob::draw(const EditorGameBase& egbase,
-               const DrawText&,
+               const WLDrawText&,
                const Vector2f& field_on_dst,
                const float scale,
                RenderTarget* dst) const {

=== modified file 'src/logic/map_objects/bob.h'
--- src/logic/map_objects/bob.h	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/bob.h	2016-10-26 08:26:48 +0000
@@ -264,7 +264,7 @@
 	// starting field) in pixel space of 'dst' (including scale). The 'scale' is
 	// required to draw the bob in the right size.
 	virtual void draw(const EditorGameBase&,
-	                  const DrawText& draw_text,
+	                  const WLDrawText& draw_text,
 	                  const Vector2f& field_on_dst,
 	                  float scale,
 	                  RenderTarget* dst) const;

=== modified file 'src/logic/map_objects/draw_text.h'
--- src/logic/map_objects/draw_text.h	2016-10-24 20:07:22 +0000
+++ src/logic/map_objects/draw_text.h	2016-10-26 08:26:48 +0000
@@ -20,14 +20,14 @@
 #ifndef WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H
 #define WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H
 
-enum DrawText {
+enum WLDrawText {
 	kNone = 0,
 	kCensus = 1,
 	kStatistics = 2,
 };
 
-inline DrawText operator|(DrawText a, DrawText b) {
-	return static_cast<DrawText>(static_cast<int>(a) | static_cast<int>(b));
+inline WLDrawText operator|(WLDrawText a, WLDrawText b) {
+	return static_cast<WLDrawText>(static_cast<int>(a) | static_cast<int>(b));
 }
 
 #endif  // end of include guard: WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H

=== modified file 'src/logic/map_objects/immovable.cc'
--- src/logic/map_objects/immovable.cc	2016-10-25 07:07:14 +0000
+++ src/logic/map_objects/immovable.cc	2016-10-26 08:26:48 +0000
@@ -437,7 +437,7 @@
 }
 
 void Immovable::draw(uint32_t gametime,
-                     const DrawText draw_text,
+                     const WLDrawText draw_text,
                      const Vector2f& point_on_dst,
                      float scale,
                      RenderTarget* dst) {
@@ -452,7 +452,7 @@
 }
 
 void Immovable::draw_construction(const uint32_t gametime,
-                                  const DrawText draw_text,
+                                  const WLDrawText draw_text,
                                   const Vector2f& point_on_dst,
                                   const float scale,
                                   RenderTarget* dst) {

=== modified file 'src/logic/map_objects/immovable.h'
--- src/logic/map_objects/immovable.h	2016-10-24 20:07:22 +0000
+++ src/logic/map_objects/immovable.h	2016-10-26 08:26:48 +0000
@@ -100,7 +100,7 @@
 	// the point for the hotspot of the animation and 'scale' determines how big
 	// the immovable will be plotted.
 	virtual void draw(uint32_t gametime,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Vector2f& point_on_dst,
 				 float scale,
 	          RenderTarget* dst) = 0;
@@ -222,7 +222,7 @@
 	void cleanup(EditorGameBase&) override;
 	void act(Game&, uint32_t data) override;
 	void draw(uint32_t gametime,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Vector2f& point_on_dst,
 	          float scale,
 	          RenderTarget* dst) override;
@@ -301,7 +301,7 @@
 private:
 	void increment_program_pointer();
 	void draw_construction(uint32_t gametime,
-	                       DrawText draw_text,
+	                       WLDrawText draw_text,
 	                       const Vector2f& point_on_dst,
 	                       float scale,
 	                       RenderTarget* dst);

=== modified file 'src/logic/map_objects/map_object.cc'
--- src/logic/map_objects/map_object.cc	2016-10-23 12:59:11 +0000
+++ src/logic/map_objects/map_object.cc	2016-10-26 08:26:48 +0000
@@ -445,13 +445,13 @@
 	egbase.objects().remove(*this);
 }
 
-void MapObject::do_draw_info(const DrawText& draw_text,
+void MapObject::do_draw_info(const WLDrawText& draw_text,
                              const std::string& census,
                              const std::string& statictics,
                              const Vector2f& field_on_dst,
                              float scale,
                              RenderTarget* dst) const {
-	if (draw_text == DrawText::kNone) {
+	if (draw_text == WLDrawText::kNone) {
 		return;
 	}
 
@@ -468,11 +468,11 @@
 
 	// Rounding guarantees that text aligns with pixels to avoid subsampling.
 	const Vector2f census_pos = round(field_on_dst - Vector2f(0, 48) * scale).cast<float>();
-	if (draw_text & DrawText::kCensus) {
+	if (draw_text & WLDrawText::kCensus) {
 		dst->blit(census_pos, rendered_census_info, BlendMode::UseAlpha, UI::Align::kCenter);
 	}
 
-	if (draw_text & DrawText::kStatistics && !statictics.empty()) {
+	if (draw_text & WLDrawText::kStatistics && !statictics.empty()) {
 		const Vector2f statistics_pos =
 		   round(census_pos + Vector2f(0, rendered_census_info->height() / 2.f + 10 * scale))
 		      .cast<float>();

=== modified file 'src/logic/map_objects/map_object.h'
--- src/logic/map_objects/map_object.h	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/map_object.h	2016-10-26 08:26:48 +0000
@@ -406,7 +406,7 @@
 	virtual void cleanup(EditorGameBase&);
 
 	/// Draws census and statistics on screen
-	void do_draw_info(const DrawText& draw_text,
+	void do_draw_info(const WLDrawText& draw_text,
 	                  const std::string& census,
 	                  const std::string& statictics,
 	                  const Vector2f& field_on_dst,

=== modified file 'src/logic/map_objects/tribes/building.cc'
--- src/logic/map_objects/tribes/building.cc	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/building.cc	2016-10-26 08:26:48 +0000
@@ -588,7 +588,7 @@
 
 
 void Building::draw(uint32_t gametime,
-                    const DrawText draw_text,
+                    const WLDrawText draw_text,
                     const Vector2f& point_on_dst,
                     const float scale,
                     RenderTarget* dst) {
@@ -606,12 +606,12 @@
 Draw overlay help strings when enabled.
 ===============
 */
-void Building::draw_info(const DrawText draw_text,
+void Building::draw_info(const WLDrawText draw_text,
                          const Vector2f& point_on_dst,
 								 const float scale,
                          RenderTarget* dst) {
 	const std::string statistics_string =
-	   (draw_text & DrawText::kStatistics) ? info_string(InfoStringFormat::kStatistics) : "";
+	   (draw_text & WLDrawText::kStatistics) ? info_string(InfoStringFormat::kStatistics) : "";
 	do_draw_info(draw_text, info_string(InfoStringFormat::kCensus), statistics_string, point_on_dst,
 	             scale, dst);
 }

=== modified file 'src/logic/map_objects/tribes/building.h'
--- src/logic/map_objects/tribes/building.h	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/building.h	2016-10-26 08:26:48 +0000
@@ -312,11 +312,11 @@
 	void act(Game&, uint32_t data) override;
 
 	void draw(uint32_t gametime,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Vector2f& point_on_dst,
 				 float scale,
 	          RenderTarget* dst) override;
-	void draw_info(DrawText draw_text, const Vector2f& point_on_dst, float scale, RenderTarget* dst);
+	void draw_info(WLDrawText draw_text, const Vector2f& point_on_dst, float scale, RenderTarget* dst);
 
 	virtual void create_options_window(InteractiveGameBase&, UI::Window*& registry) = 0;
 

=== modified file 'src/logic/map_objects/tribes/constructionsite.cc'
--- src/logic/map_objects/tribes/constructionsite.cc	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/constructionsite.cc	2016-10-26 08:26:48 +0000
@@ -298,7 +298,7 @@
 ===============
 */
 void ConstructionSite::draw(uint32_t gametime,
-                            DrawText draw_text,
+                            WLDrawText draw_text,
                             const Vector2f& point_on_dst,
                             float scale,
                             RenderTarget* dst) {

=== modified file 'src/logic/map_objects/tribes/constructionsite.h'
--- src/logic/map_objects/tribes/constructionsite.h	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/constructionsite.h	2016-10-26 08:26:48 +0000
@@ -115,7 +115,7 @@
 	static void wares_queue_callback(Game&, WaresQueue*, DescriptionIndex, void* data);
 
 	void draw(uint32_t gametime,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Vector2f& point_on_dst,
 				 float scale,
 	          RenderTarget* dst) override;

=== modified file 'src/logic/map_objects/tribes/dismantlesite.cc'
--- src/logic/map_objects/tribes/dismantlesite.cc	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/dismantlesite.cc	2016-10-26 08:26:48 +0000
@@ -213,7 +213,7 @@
 ===============
 */
 void DismantleSite::draw(uint32_t gametime,
-                         const DrawText draw_text,
+                         const WLDrawText draw_text,
                          const Vector2f& point_on_dst,
                          float scale,
                          RenderTarget* dst) {

=== modified file 'src/logic/map_objects/tribes/dismantlesite.h'
--- src/logic/map_objects/tribes/dismantlesite.h	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/dismantlesite.h	2016-10-26 08:26:48 +0000
@@ -90,7 +90,7 @@
 	void create_options_window(InteractiveGameBase&, UI::Window*& registry) override;
 
 	void draw(uint32_t gametime,
-	          DrawText draw_text,
+	          WLDrawText draw_text,
 	          const Vector2f& point_on_dst,
 				 float scale,
 	          RenderTarget* dst) override;

=== modified file 'src/logic/map_objects/tribes/ship.cc'
--- src/logic/map_objects/tribes/ship.cc	2016-10-24 14:04:00 +0000
+++ src/logic/map_objects/tribes/ship.cc	2016-10-26 08:26:48 +0000
@@ -940,7 +940,7 @@
 }
 
 void Ship::draw(const EditorGameBase& egbase,
-                const DrawText& draw_text,
+                const WLDrawText& draw_text,
                 const Vector2f& field_on_dst,
                 const float scale,
                 RenderTarget* dst) const {
@@ -948,7 +948,7 @@
 
 	// Show ship name and current activity
 	std::string statistics_string = "";
-	if (draw_text & DrawText::kStatistics) {
+	if (draw_text & WLDrawText::kStatistics) {
 		switch (ship_state_) {
 		case (ShipStates::kTransport):
 			/** TRANSLATORS: This is a ship state */

=== modified file 'src/logic/map_objects/tribes/ship.h'
--- src/logic/map_objects/tribes/ship.h	2016-10-24 14:04:00 +0000
+++ src/logic/map_objects/tribes/ship.h	2016-10-26 08:26:48 +0000
@@ -240,7 +240,7 @@
 
 protected:
 	void draw(const EditorGameBase&,
-	          const DrawText& draw_text,
+	          const WLDrawText& draw_text,
 	          const Vector2f& field_on_dst,
 	          float scale,
 	          RenderTarget* dst) const override;

=== modified file 'src/logic/map_objects/tribes/soldier.cc'
--- src/logic/map_objects/tribes/soldier.cc	2016-10-22 11:24:18 +0000
+++ src/logic/map_objects/tribes/soldier.cc	2016-10-26 08:26:48 +0000
@@ -440,7 +440,7 @@
  * Draw this soldier. This basically draws him as a worker, but add health points
  */
 void Soldier::draw(const EditorGameBase& game,
-                   const DrawText&,
+                   const WLDrawText&,
                    const Vector2f& field_on_dst,
                    const float scale,
                    RenderTarget* dst) const {

=== modified file 'src/logic/map_objects/tribes/soldier.h'
--- src/logic/map_objects/tribes/soldier.h	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/soldier.h	2016-10-26 08:26:48 +0000
@@ -209,7 +209,7 @@
 
 	/// Draw this soldier
 	void draw(const EditorGameBase&,
-	          const DrawText& draw_text,
+	          const WLDrawText& draw_text,
 	          const Vector2f& point_on_dst,
 	          float scale,
 	          RenderTarget* dst) const override;

=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/worker.cc	2016-10-26 08:26:48 +0000
@@ -2535,7 +2535,7 @@
  * Draw the worker, taking the carried ware into account.
  */
 void Worker::draw(const EditorGameBase& egbase,
-                  const DrawText&,
+                  const WLDrawText&,
                   const Vector2f& field_on_dst,
                   const float scale,
                   RenderTarget* dst) const {

=== modified file 'src/logic/map_objects/tribes/worker.h'
--- src/logic/map_objects/tribes/worker.h	2016-10-22 11:20:33 +0000
+++ src/logic/map_objects/tribes/worker.h	2016-10-26 08:26:48 +0000
@@ -181,7 +181,7 @@
 	                const float scale,
 	                RenderTarget* dst) const;
 	void draw(const EditorGameBase&,
-	          const DrawText& draw_text,
+	          const WLDrawText& draw_text,
 	          const Vector2f& field_on_dst,
 	          float scale,
 	          RenderTarget* dst) const override;

=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc	2016-10-24 20:56:32 +0000
+++ src/wui/mapview.cc	2016-10-26 08:26:48 +0000
@@ -131,20 +131,20 @@
 			return;
 	}
 
-	DrawText draw_text = DrawText::kNone;
+	WLDrawText draw_text = WLDrawText::kNone;
 	auto display_flags = intbase().get_display_flags();
 	if (display_flags & InteractiveBase::dfShowCensus) {
-		draw_text = draw_text | DrawText::kCensus;
+		draw_text = draw_text | WLDrawText::kCensus;
 	}
 	if (display_flags & InteractiveBase::dfShowStatistics) {
-		draw_text = draw_text | DrawText::kStatistics;
+		draw_text = draw_text | WLDrawText::kStatistics;
 	}
 
 	if (upcast(InteractivePlayer const, interactive_player, &intbase())) {
 		renderer_->rendermap(
 		   egbase, viewpoint_, zoom_, interactive_player->player(), draw_text, &dst);
 	} else {
-		renderer_->rendermap(egbase, viewpoint_, zoom_, static_cast<DrawText>(draw_text), &dst);
+		renderer_->rendermap(egbase, viewpoint_, zoom_, static_cast<WLDrawText>(draw_text), &dst);
 	}
 }
 

=== modified file 'src/wui/transport_draw.cc'
--- src/wui/transport_draw.cc	2016-10-24 14:07:28 +0000
+++ src/wui/transport_draw.cc	2016-10-26 08:26:48 +0000
@@ -27,7 +27,7 @@
 namespace Widelands {
 
 void Flag::draw(uint32_t gametime,
-                const DrawText,
+                const WLDrawText,
                 const Vector2f& point_on_dst,
                 float scale,
                 RenderTarget* dst) {
@@ -54,6 +54,6 @@
 }
 
 /** The road is drawn by the terrain renderer via marked fields. */
-void Road::draw(uint32_t, const DrawText, const Vector2f&, float, RenderTarget*) {
+void Road::draw(uint32_t, const WLDrawText, const Vector2f&, float, RenderTarget*) {
 }
 }


Follow ups