← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~qcumber-some/widelands/cppcheck_const_refs into lp:widelands

 

Jens Beyer (Qcumber-some) has proposed merging lp:~qcumber-some/widelands/cppcheck_const_refs into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #986611 in widelands: "Issues reported by cppcheck"
  https://bugs.launchpad.net/widelands/+bug/986611

For more details, see:
https://code.launchpad.net/~qcumber-some/widelands/cppcheck_const_refs/+merge/114312

I did my share of tedious work to get rid of >100 (const) reference recommendations by cppcheck 1.55

Most of them were simple, but about a few I'm not sure. But it compiles and runs, so I guess it is right ;-)
-- 
https://code.launchpad.net/~qcumber-some/widelands/cppcheck_const_refs/+merge/114312
Your team Widelands Developers is requested to review the proposed merge of lp:~qcumber-some/widelands/cppcheck_const_refs into lp:widelands.
=== modified file 'src/descr_maintainer.h'
--- src/descr_maintainer.h	2012-04-25 07:26:30 +0000
+++ src/descr_maintainer.h	2012-07-11 00:26:24 +0000
@@ -66,7 +66,7 @@
 	typename T::Index nitemsw;
 	T * * items;
 
-	void reserve(const typename T::Index n) {
+	void reserve(const typename T::Index & n) {
 		T * * const new_items =
 			static_cast<T * *>(realloc(items, sizeof(T *) * n));
 		if (not new_items)
@@ -130,7 +130,7 @@
 			idx == -1 ? T_Index::Null() :
 			T_Index(static_cast<typename T_Index::value_t>(idx));
 	}
-	T * get(T_Index const idx) const {
+	T * get(T_Index const & idx) const {
 		return idx ? Descr_Maintainer<T>::get(idx.value()) : 0;
 	}
 };

=== modified file 'src/economy/economy.h'
--- src/economy/economy.h	2012-02-15 21:25:34 +0000
+++ src/economy/economy.h	2012-07-11 00:26:24 +0000
@@ -109,10 +109,10 @@
 	void remove_supply(Supply &);
 
 	/// information about this economy
-	WareList::count_type stock_ware  (Ware_Index const i) {
+	WareList::count_type stock_ware  (Ware_Index const & i) {
 		return m_wares  .stock(i);
 	}
-	WareList::count_type stock_worker(Ware_Index const i) {
+	WareList::count_type stock_worker(Ware_Index const & i) {
 		return m_workers.stock(i);
 	}
 
@@ -126,16 +126,16 @@
 	/// ware type by overproducing a worker type from it.
 	bool needs_worker(Ware_Index) const;
 
-	Target_Quantity const & ware_target_quantity  (Ware_Index const i) const {
-		return m_ware_target_quantities[i.value()];
-	}
-	Target_Quantity       & ware_target_quantity  (Ware_Index const i)       {
-		return m_ware_target_quantities[i.value()];
-	}
-	Target_Quantity const & worker_target_quantity(Ware_Index const i) const {
+	Target_Quantity const & ware_target_quantity  (Ware_Index const & i) const {
+		return m_ware_target_quantities[i.value()];
+	}
+	Target_Quantity       & ware_target_quantity  (Ware_Index const & i)       {
+		return m_ware_target_quantities[i.value()];
+	}
+	Target_Quantity const & worker_target_quantity(Ware_Index const & i) const {
 		return m_worker_target_quantities[i.value()];
 	}
-	Target_Quantity       & worker_target_quantity(Ware_Index const i)       {
+	Target_Quantity       & worker_target_quantity(Ware_Index const & i)       {
 		return m_worker_target_quantities[i.value()];
 	}
 

=== modified file 'src/economy/test/test_road.cc'
--- src/economy/test/test_road.cc	2012-03-03 19:23:20 +0000
+++ src/economy/test/test_road.cc	2012-07-11 00:26:24 +0000
@@ -32,7 +32,7 @@
 /* Helper classes */
 /******************/
 struct TestingFlag : public Flag {
-	TestingFlag(Editor_Game_Base &, Coords const c) : Flag() {
+	TestingFlag(Editor_Game_Base &, Coords const & c) : Flag() {
 		set_flag_position(c);
 	}
 

=== modified file 'src/economy/test/test_routing.cc'
--- src/economy/test/test_routing.cc	2012-04-06 19:26:17 +0000
+++ src/economy/test/test_routing.cc	2012-07-11 00:26:24 +0000
@@ -408,7 +408,7 @@
 	  */
 	TestingRoutingNode * new_node_w_neighbour
 		(TestingRoutingNode * const d,
-		 Coords               const pos      = Coords(0, 0),
+		 Coords               const & pos    = Coords(0, 0),
 		 int32_t                             = 1,
 		 int32_t              const waitcost = 0)
 	{

=== modified file 'src/economy/warehousesupply.h'
--- src/economy/warehousesupply.h	2012-02-15 21:25:34 +0000
+++ src/economy/warehousesupply.h	2012-07-11 00:26:24 +0000
@@ -41,10 +41,10 @@
 
 	WareList const & get_wares  () const {return m_wares;}
 	WareList const & get_workers() const {return m_workers;}
-	uint32_t stock_wares  (Ware_Index const i) const {
+	uint32_t stock_wares  (Ware_Index const & i) const {
 		return m_wares  .stock(i);
 	}
-	uint32_t stock_workers(Ware_Index const i) const {
+	uint32_t stock_workers(Ware_Index const & i) const {
 		return m_workers.stock(i);
 	}
 	void add_wares     (Ware_Index, uint32_t count);

=== modified file 'src/gamesettings.h'
--- src/gamesettings.h	2012-02-15 21:25:34 +0000
+++ src/gamesettings.h	2012-07-11 00:26:24 +0000
@@ -146,7 +146,7 @@
 	virtual void setPlayerTribe    (uint8_t number, std::string const &, bool const random_tribe = false) = 0;
 	virtual void setPlayerInit     (uint8_t number, uint8_t index) = 0;
 	virtual void setPlayerName     (uint8_t number, std::string const &) = 0;
-	virtual void setPlayer         (uint8_t number, PlayerSettings) = 0;
+	virtual void setPlayer         (uint8_t number, PlayerSettings const &) = 0;
 	virtual void setPlayerNumber   (uint8_t number) = 0;
 	virtual void setPlayerTeam     (uint8_t number, Widelands::TeamNumber team) = 0;
 	virtual void setPlayerCloseable(uint8_t number, bool closeable) = 0;

=== modified file 'src/graphic/animation_gfx.h'
--- src/graphic/animation_gfx.h	2012-02-15 21:25:34 +0000
+++ src/graphic/animation_gfx.h	2012-07-11 00:26:24 +0000
@@ -38,7 +38,7 @@
 	}
 
 	const PictureID & get_frame
-		(Index                    const i,
+		(Index                    const & i,
 		 Widelands::Player_Number const player_number,
 		 const RGBColor & playercolor)
 	{
@@ -54,7 +54,7 @@
 		return m_plrframes[player_number][i];
 	}
 
-	const PictureID & get_frame(Index const i) const {
+	const PictureID & get_frame(Index const & i) const {
 		assert(i < nr_frames());
 		return m_plrframes[0][i];
 	}

=== modified file 'src/graphic/render/gameview.cc'
--- src/graphic/render/gameview.cc	2012-06-08 22:33:16 +0000
+++ src/graphic/render/gameview.cc	2012-07-11 00:26:24 +0000
@@ -1127,8 +1127,8 @@
 template<typename T>
 static bool draw_minimap_frameborder
 	(Widelands::FCoords  const f,
-	 Point               const ptopleft,
-	 Point               const pbottomright,
+	 Point               const & ptopleft,
+	 Point               const & pbottomright,
 	 int32_t             const mapwidth,
 	 int32_t             const mapheight,
 	 int32_t             const modx,
@@ -1188,9 +1188,9 @@
 	 int32_t                            const mapwidth,
 	 Widelands::Editor_Game_Base const &       egbase,
 	 Widelands::Player           const * const player,
-	 Rect                                const rc,
-	 Point                               const viewpoint,
-	 Point                               const framepoint,
+	 Rect                                const & rc,
+	 Point                               const & viewpoint,
+	 Point                               const & framepoint,
 	 uint32_t                            const flags)
 {
 	Widelands::Map const & map = egbase.map();

=== modified file 'src/graphic/render/terrain_sdl.h'
--- src/graphic/render/terrain_sdl.h	2012-02-15 21:25:34 +0000
+++ src/graphic/render/terrain_sdl.h	2012-07-11 00:26:24 +0000
@@ -533,7 +533,7 @@
 }
 
 template<typename T> static void render_road_horiz
-	(SurfaceSDL & dst, Point const start, Point const end, SurfaceSDL const & src)
+	(SurfaceSDL & dst, Point const & start, Point const & end, SurfaceSDL const & src)
 {
 	int32_t const dstw = dst.get_w();
 	int32_t const dsth = dst.get_h();
@@ -560,7 +560,7 @@
 }
 
 template<typename T> static void render_road_vert
-	(SurfaceSDL & dst, Point const start, Point const end, SurfaceSDL const & src)
+	(SurfaceSDL & dst, Point const & start, Point const & end, SurfaceSDL const & src)
 {
 	int32_t const dstw = dst.get_w();
 	int32_t const dsth = dst.get_h();

=== modified file 'src/io/basic_fileread.h'
--- src/io/basic_fileread.h	2012-05-06 16:28:43 +0000
+++ src/io/basic_fileread.h	2012-07-11 00:26:24 +0000
@@ -95,7 +95,7 @@
 
 	/// Set the file pointer to the given location.
 	/// \throws File_Boundary_Exceeded if the pointer is out of bound.
-	void SetFilePos(Pos const pos) {
+	void SetFilePos(Pos const & pos) {
 		assert(data);
 		if (pos >= length)
 			throw File_Boundary_Exceeded();
@@ -114,7 +114,7 @@
 		return read;
 	}
 
-	char * Data(uint32_t const bytes, const Pos pos = Pos::Null()) {
+	char * Data(uint32_t const bytes, const Pos & pos = Pos::Null()) {
 		assert(data);
 
 		Pos i = pos;
@@ -127,7 +127,7 @@
 		return data + i;
 	}
 
-	char * CString(Pos const pos) {
+	char * CString(Pos const & pos) {
 		assert(data);
 
 		Pos i = pos.isNull() ? filepos : pos;

=== modified file 'src/io/basic_filewrite.h'
--- src/io/basic_filewrite.h	2012-02-15 21:25:34 +0000
+++ src/io/basic_filewrite.h	2012-07-11 00:26:24 +0000
@@ -76,14 +76,14 @@
 
 	/// Set the file pointer to a new location. The position can be beyond the
 	/// current end of file.
-	void SetPos(const Pos pos) throw () {filepos = pos;}
+	void SetPos(const Pos & pos) throw () {filepos = pos;}
 
 	/**
 	 * Write data at the given location. If pos is NoPos(), write at the
 	 * file pointer and advance the file pointer.
 	 */
 	void Data
-		(const void * const src, const size_t size, Pos const pos = Pos::Null())
+		(const void * const src, const size_t size, Pos const & pos = Pos::Null())
 	{
 		assert(data or not filelength);
 

=== modified file 'src/journal.cc'
--- src/journal.cc	2012-02-15 21:25:34 +0000
+++ src/journal.cc	2012-07-11 00:26:24 +0000
@@ -216,7 +216,7 @@
 		m_record = true;
 		log("Recording into %s\n", m_recordname.c_str());
 	}
-	catch (std::ofstream::failure e) {
+	catch (std::ofstream::failure & e) {
 		//TODO: use exception mask to find out what happened
 		//TODO: there should be a messagebox to tell the user.
 		log
@@ -266,7 +266,7 @@
 		m_playback = true;
 		log("Playing back from %s\n", m_playbackname.c_str());
 	}
-	catch (std::ifstream::failure e) {
+	catch (std::ifstream::failure & e) {
 		//TODO: use exception mask to find out what happened
 		//TODO: there should be a messagebox to tell the user.
 		log

=== modified file 'src/logic/cmd_expire_message.h'
--- src/logic/cmd_expire_message.h	2012-02-15 21:25:34 +0000
+++ src/logic/cmd_expire_message.h	2012-07-11 00:26:24 +0000
@@ -35,7 +35,7 @@
 /// the savegame.
 struct Cmd_ExpireMessage : public Command {
 	Cmd_ExpireMessage
-		(int32_t const t, Player_Number const p, Message_Id const m)
+		(int32_t const t, Player_Number const p, Message_Id const & m)
 		: Command(t), player(p), message(m)
 	{}
 

=== modified file 'src/logic/dismantlesite.cc'
--- src/logic/dismantlesite.cc	2012-06-25 21:25:22 +0000
+++ src/logic/dismantlesite.cc	2012-07-11 00:26:24 +0000
@@ -64,7 +64,7 @@
 {}
 
 DismantleSite::DismantleSite
-	(const DismantleSite_Descr & descr, Editor_Game_Base & egbase, Coords const c,
+	(const DismantleSite_Descr & descr, Editor_Game_Base & egbase, Coords const & c,
 	 Player & plr, const Building_Descr & bdscr, bool loading)
 :
 Partially_Finished_Building(descr)

=== modified file 'src/logic/dismantlesite.h'
--- src/logic/dismantlesite.h	2012-06-25 21:25:22 +0000
+++ src/logic/dismantlesite.h	2012-07-11 00:26:24 +0000
@@ -63,7 +63,7 @@
 	DismantleSite(const DismantleSite_Descr & descr);
 	DismantleSite
 		(const DismantleSite_Descr & descr, Editor_Game_Base &,
-		 Coords const, Player &, const Building_Descr &, bool);
+		 Coords const &, Player &, const Building_Descr &, bool);
 
 	char const * type_name() const throw () {return "dismantlesite";}
 	virtual std::string get_statistics_string();

=== modified file 'src/logic/immovable.cc'
--- src/logic/immovable.cc	2012-06-08 22:33:16 +0000
+++ src/logic/immovable.cc	2012-07-11 00:26:24 +0000
@@ -506,7 +506,7 @@
 }
 
 void Immovable::draw_construction
-	(const Editor_Game_Base & game, RenderTarget & dst, const Point pos)
+	(const Editor_Game_Base & game, RenderTarget & dst, const Point & pos)
 {
 	const ImmovableProgram::ActConstruction * constructionact = 0;
 	if (m_program_ptr < m_program->size())

=== modified file 'src/logic/immovable.h'
--- src/logic/immovable.h	2012-02-15 21:25:34 +0000
+++ src/logic/immovable.h	2012-07-11 00:26:24 +0000
@@ -252,7 +252,7 @@
 	void increment_program_pointer();
 
 	void draw_construction
-		(const Editor_Game_Base &, RenderTarget &, const Point);
+		(const Editor_Game_Base &, RenderTarget &, const Point &);
 };
 
 

=== modified file 'src/logic/map.cc'
--- src/logic/map.cc	2012-03-09 10:37:34 +0000
+++ src/logic/map.cc	2012-07-11 00:26:24 +0000
@@ -809,7 +809,7 @@
 	FindBobsCallback(std::vector<Bob *> * const list, FindBob const & functor)
 		: m_list(list), m_functor(functor), m_found(0) {}
 
-	void operator()(const Map &, const FCoords cur) {
+	void operator()(const Map &, const FCoords & cur) {
 		for
 			(Bob * bob = cur.field->get_first_bob();
 			 bob;
@@ -896,7 +896,7 @@
 		(std::vector<ImmovableFound> * const list, FindImmovable const & functor)
 		: m_list(list), m_functor(functor), m_found(0) {}
 
-	void operator()(const Map &, const FCoords cur) {
+	void operator()(const Map &, const FCoords & cur) {
 		BaseImmovable * const imm = cur.field->get_immovable();
 
 		if (!imm)
@@ -1005,7 +1005,7 @@
 		(std::vector<Coords> * const list, FindNode const & functor)
 		: m_list(list), m_functor(functor), m_found(0) {}
 
-	void operator()(const Map & map, const FCoords cur) {
+	void operator()(const Map & map, const FCoords & cur) {
 		if (m_functor.accept(map, cur)) {
 			if (m_list)
 				m_list->push_back(cur);

=== modified file 'src/logic/message_id.h'
--- src/logic/message_id.h	2012-02-15 21:25:34 +0000
+++ src/logic/message_id.h	2012-07-11 00:26:24 +0000
@@ -46,9 +46,9 @@
 	/// Constant value for no message.
 	static Message_Id Null() {Message_Id result; result.id = 0; return result;}
 
-	bool operator== (Message_Id const other) const {return id == other.id;}
-	bool operator!= (Message_Id const other) const {return id != other.id;}
-	bool operator<  (Message_Id const other) const {return id <  other.id;}
+	bool operator== (Message_Id const & other) const {return id == other.id;}
+	bool operator!= (Message_Id const & other) const {return id != other.id;}
+	bool operator<  (Message_Id const & other) const {return id <  other.id;}
 	operator bool     () const {return *this != Null();}
 	uint32_t value() const {return id;}
 

=== modified file 'src/logic/message_queue.h'
--- src/logic/message_queue.h	2012-04-07 11:22:36 +0000
+++ src/logic/message_queue.h	2012-07-11 00:26:24 +0000
@@ -67,7 +67,7 @@
 	}
 
 	/// \returns a pointer to the message if it exists, otherwise 0.
-	Message const * operator[](Message_Id const id) const {
+	Message const * operator[](Message_Id const & id) const {
 		assert_counts();
 		const_iterator const it = find(Message_Id(id));
 		return it != end() ? it->second : 0;
@@ -106,7 +106,7 @@
 	}
 
 	/// Sets the status of the message with the given id, if it exists.
-	void set_message_status(Message_Id const id, Message::Status const status) {
+	void set_message_status(Message_Id const & id, Message::Status const status) {
 		assert_counts();
 		assert(status < 3);
 		iterator const it = find(id);
@@ -122,7 +122,7 @@
 
 	/// Expire the message with the given id so that it no longer exists.
 	/// Assumes that a message with the given id exists.
-	void expire_message(Message_Id const id) {
+	void expire_message(Message_Id const & id) {
 		assert_counts();
 		iterator const it = find(id);
 		assert(it != end());

=== modified file 'src/logic/path.cc'
--- src/logic/path.cc	2012-02-15 21:25:34 +0000
+++ src/logic/path.cc	2012-07-11 00:26:24 +0000
@@ -147,7 +147,7 @@
 Truncate the path after the given number of steps
 ===============
 */
-void CoordPath::truncate(const std::vector<char>::size_type after) {
+void CoordPath::truncate(const std::vector<char>::size_type & after) {
 	assert(after <= m_path.size());
 
 	m_path.erase(m_path.begin() + after, m_path.end());
@@ -159,7 +159,7 @@
 Opposite of truncate: remove the first n steps of the path.
 ===============
 */
-void CoordPath::starttrim(const std::vector<char>::size_type before) {
+void CoordPath::starttrim(const std::vector<char>::size_type & before) {
 	assert(before <= m_path.size());
 
 	m_path.erase(m_path.begin(), m_path.begin() + before);

=== modified file 'src/logic/path.h'
--- src/logic/path.h	2012-02-15 21:25:34 +0000
+++ src/logic/path.h	2012-07-11 00:26:24 +0000
@@ -51,7 +51,7 @@
 
 	typedef std::vector<Direction> Step_Vector;
 	Step_Vector::size_type get_nsteps() const throw () {return m_path.size();}
-	Direction operator[](Step_Vector::size_type const i) const {
+	Direction operator[](Step_Vector::size_type const & i) const {
 		assert(i < m_path.size());
 		return m_path[m_path.size() - i - 1];
 	}
@@ -84,7 +84,7 @@
 
 	typedef std::vector<Direction> Step_Vector;
 	Step_Vector::size_type get_nsteps() const throw () {return m_path.size();}
-	Direction operator[](Step_Vector::size_type const i) const {
+	Direction operator[](Step_Vector::size_type const & i) const {
 		assert(i < m_path.size());
 		return m_path[i];
 	}
@@ -93,8 +93,8 @@
 	int32_t get_index(Coords field) const;
 
 	void reverse();
-	void truncate (const std::vector<char>::size_type after);
-	void starttrim(const std::vector<char>::size_type before);
+	void truncate (const std::vector<char>::size_type & after);
+	void starttrim(const std::vector<char>::size_type & before);
 	void append(const Map & map, const Path & tail);
 	void append(CoordPath const & tail);
 

=== modified file 'src/logic/player.cc'
--- src/logic/player.cc	2012-07-07 17:09:03 +0000
+++ src/logic/player.cc	2012-07-11 00:26:24 +0000
@@ -612,7 +612,7 @@
 	_enhance_or_dismantle(building);
 }
 void Player::_enhance_or_dismantle
-	(Building * building, Building_Index const index_of_new_building)
+	(Building * building, Building_Index const & index_of_new_building)
 {
 	if
 		(&building->owner() == this
@@ -1126,7 +1126,7 @@
  * Get current ware production statistics
  */
 const std::vector<uint32_t> * Player::get_ware_production_statistics
-		(Ware_Index const ware) const
+		(Ware_Index const & ware) const
 {
 	assert(ware.value() < m_ware_productions.size());
 
@@ -1138,7 +1138,7 @@
  * Get current ware consumption statistics
  */
 const std::vector<uint32_t> * Player::get_ware_consumption_statistics
-		(Ware_Index const ware) const {
+		(Ware_Index const & ware) const {
 
 	assert(ware.value() < m_ware_consumptions.size());
 
@@ -1146,7 +1146,7 @@
 }
 
 const std::vector<uint32_t> * Player::get_ware_stock_statistics
-		(Ware_Index const ware) const
+		(Ware_Index const & ware) const
 {
 	assert(ware.value() < m_ware_stocks.size());
 

=== modified file 'src/logic/player.h'
--- src/logic/player.h	2012-04-30 12:32:59 +0000
+++ src/logic/player.h	2012-07-11 00:26:24 +0000
@@ -99,7 +99,7 @@
 	Message_Id add_message_with_timeout
 		(Game &, Message &, uint32_t timeout, uint32_t radius);
 
-	void set_message_status(Message_Id const id, Message::Status const status) {
+	void set_message_status(Message_Id const & id, Message::Status const status) {
 		messages().set_message_status(id, status);
 	}
 
@@ -420,13 +420,13 @@
 		return m_fields[i].military_influence;
 	}
 
-	bool is_worker_type_allowed(Ware_Index const i) const throw () {
+	bool is_worker_type_allowed(Ware_Index const & i) const throw () {
 		return m_allowed_worker_types.at(i);
 	}
 	void allow_worker_type(Ware_Index, bool allow);
 
 	// Allowed buildings
-	bool is_building_type_allowed(Building_Index const i) const throw () {
+	bool is_building_type_allowed(Building_Index const & i) const throw () {
 		return m_allowed_building_types[i];
 	}
 	void allow_building_type(Building_Index, bool allow);
@@ -465,7 +465,7 @@
 	bool    has_economy(Economy &) const throw ();
 	typedef std::vector<Economy *> Economies;
 	Economies::size_type get_economy_number(Economy const *) const throw ();
-	Economy * get_economy_by_number(Economies::size_type const i) const {
+	Economy * get_economy_by_number(Economies::size_type const & i) const {
 		return m_economies[i];
 	}
 	uint32_t get_nr_economies() const {return m_economies.size();}
@@ -523,19 +523,19 @@
 
 	// Statistics
 	Building_Stats_vector const & get_building_statistics
-		(Building_Index const i) const
+		(Building_Index const & i) const
 	{
 		return m_building_stats[i];
 	}
 
 	std::vector<uint32_t> const * get_ware_production_statistics
-		(Ware_Index const) const;
+		(Ware_Index const &) const;
 
 	std::vector<uint32_t> const * get_ware_consumption_statistics
-		(Ware_Index const) const;
+		(Ware_Index const &) const;
 
 	std::vector<uint32_t> const * get_ware_stock_statistics
-		(Ware_Index const) const;
+		(Ware_Index const &) const;
 
 	void ReadStatistics(FileRead &, uint32_t version);
 	void WriteStatistics(FileWrite &) const;
@@ -563,7 +563,7 @@
 	void update_team_players();
 	void play_message_sound(const std::string & sender);
 	void _enhance_or_dismantle
-		(Building *, Building_Index const index_of_new_building = Building_Index::Null());
+		(Building *, Building_Index const & index_of_new_building = Building_Index::Null());
 
 private:
 	MessageQueue           m_messages;

=== modified file 'src/logic/playercommand.h'
--- src/logic/playercommand.h	2012-02-15 21:25:34 +0000
+++ src/logic/playercommand.h	2012-07-11 00:26:24 +0000
@@ -89,8 +89,8 @@
 	Cmd_Build
 		(int32_t        const _duetime,
 		 int32_t        const p,
-		 Coords         const c,
-		 Building_Index const i)
+		 Coords         const & c,
+		 Building_Index const & i)
 		: PlayerCommand(_duetime, p), coords(c), bi(i)
 	{}
 
@@ -111,7 +111,7 @@
 
 struct Cmd_BuildFlag:public PlayerCommand {
 	Cmd_BuildFlag() : PlayerCommand() {} // For savegame loading
-	Cmd_BuildFlag (int32_t const t, int32_t const p, Coords const c) :
+	Cmd_BuildFlag (int32_t const t, int32_t const p, Coords const & c) :
 		PlayerCommand(t, p), coords(c)
 	{}
 
@@ -198,7 +198,7 @@
 		(int32_t        const _duetime,
 		 int32_t        const p,
 		 Building     &       b,
-		 Building_Index const i)
+		 Building_Index const & i)
 		: PlayerCommand(_duetime, p), serial(b.serial()), bi(i)
 	{}
 
@@ -540,7 +540,7 @@
 struct PlayerMessageCommand : public PlayerCommand {
 	PlayerMessageCommand () : PlayerCommand() {} //  for savegames
 	PlayerMessageCommand
-		(uint32_t const t, Player_Number const p, Message_Id const i)
+		(uint32_t const t, Player_Number const p, Message_Id const & i)
 		: PlayerCommand(t, p), m_message_id(i)
 	{}
 
@@ -558,7 +558,7 @@
 struct Cmd_MessageSetStatusRead : public PlayerMessageCommand {
 	Cmd_MessageSetStatusRead () : PlayerMessageCommand() {}
 	Cmd_MessageSetStatusRead
-		(uint32_t const t, Player_Number const p, Message_Id const i)
+		(uint32_t const t, Player_Number const p, Message_Id const & i)
 		: PlayerMessageCommand(t, p, i)
 	{}
 
@@ -573,7 +573,7 @@
 struct Cmd_MessageSetStatusArchived : public PlayerMessageCommand {
 	Cmd_MessageSetStatusArchived () : PlayerMessageCommand() {}
 	Cmd_MessageSetStatusArchived
-		(uint32_t const t, Player_Number const p, Message_Id const i)
+		(uint32_t const t, Player_Number const p, Message_Id const & i)
 		: PlayerMessageCommand(t, p, i)
 	{}
 

=== modified file 'src/logic/production_program.h'
--- src/logic/production_program.h	2012-02-15 21:25:34 +0000
+++ src/logic/production_program.h	2012-07-11 00:26:24 +0000
@@ -177,7 +177,7 @@
 
 		/// Tests whether the economy needs a ware of type ware_type.
 		struct Economy_Needs_Ware : public Condition {
-			Economy_Needs_Ware(Ware_Index const i) : ware_type(i) {}
+			Economy_Needs_Ware(Ware_Index const & i) : ware_type(i) {}
 			virtual bool evaluate(ProductionSite const &) const;
 			std::string description(Tribe_Descr const &) const;
 #ifdef WRITE_GAME_DATA_AS_HTML
@@ -190,7 +190,7 @@
 
 		/// Tests whether the economy needs a worker of type worker_type.
 		struct Economy_Needs_Worker : public Condition {
-			Economy_Needs_Worker(Ware_Index const i) : worker_type(i) {}
+			Economy_Needs_Worker(Ware_Index const & i) : worker_type(i) {}
 			virtual bool evaluate(ProductionSite const &) const;
 			std::string description(Tribe_Descr const &) const;
 #ifdef WRITE_GAME_DATA_AS_HTML

=== modified file 'src/logic/productionsite.h'
--- src/logic/productionsite.h	2012-06-06 14:51:03 +0000
+++ src/logic/productionsite.h	2012-07-11 00:26:24 +0000
@@ -74,10 +74,10 @@
 	Ware_Types const & working_positions() const throw () {
 		return m_working_positions;
 	}
-	bool is_output_ware_type  (Ware_Index const i) const throw () {
+	bool is_output_ware_type  (Ware_Index const & i) const throw () {
 		return m_output_ware_types  .count(i);
 	}
-	bool is_output_worker_type(Ware_Index const i) const throw () {
+	bool is_output_worker_type(Ware_Index const & i) const throw () {
 		return m_output_worker_types.count(i);
 	}
 	Ware_Types const & inputs() const throw () {return m_inputs;}
@@ -265,7 +265,7 @@
  * releasing some wares out of a building
 */
 struct Input {
-	Input(Ware_Index const Ware, uint8_t const Max) : m_ware(Ware), m_max(Max)
+	Input(Ware_Index const & Ware, uint8_t const Max) : m_ware(Ware), m_max(Max)
 	{}
 	~Input() {}
 

=== modified file 'src/logic/soldier.cc'
--- src/logic/soldier.cc	2012-06-06 19:32:13 +0000
+++ src/logic/soldier.cc	2012-07-11 00:26:24 +0000
@@ -533,7 +533,7 @@
  * Draw this soldier. This basically draws him as a worker, but add hitpoints
  */
 void Soldier::draw
-	(Editor_Game_Base const & game, RenderTarget & dst, Point const pos) const
+	(Editor_Game_Base const & game, RenderTarget & dst, Point const & pos) const
 {
 	if (const uint32_t anim = get_current_anim()) {
 

=== modified file 'src/logic/soldier.h'
--- src/logic/soldier.h	2012-02-15 21:25:34 +0000
+++ src/logic/soldier.h	2012-07-11 00:26:24 +0000
@@ -200,7 +200,7 @@
 	Point calc_drawpos(Editor_Game_Base const &, Point) const;
 	/// Draw this soldier
 	virtual void draw
-		(const Editor_Game_Base &, RenderTarget &, const Point) const;
+		(const Editor_Game_Base &, RenderTarget &, const Point &) const;
 
 	static void calc_info_icon_size
 		(Tribe_Descr const &, uint32_t & w, uint32_t & h);

=== modified file 'src/logic/tribe.h'
--- src/logic/tribe.h	2012-03-10 16:58:50 +0000
+++ src/logic/tribe.h	2012-07-11 00:26:24 +0000
@@ -74,7 +74,7 @@
 	const World & world() const throw () {return m_world;}
 
 	Ware_Index get_nrworkers() const {return m_workers.get_nitems();}
-	Worker_Descr const * get_worker_descr(Ware_Index const index) const {
+	Worker_Descr const * get_worker_descr(Ware_Index const & index) const {
 		return m_workers.get(index);
 	}
 	Ware_Index worker_index(std::string const & workername) const {
@@ -93,13 +93,13 @@
 	Ware_Index safe_ware_index(const char * const warename) const;
 	Ware_Index ware_index(std::string const & warename) const;
 	Ware_Index ware_index(char const * const warename) const;
-	Item_Ware_Descr const * get_ware_descr(Ware_Index const index) const {
+	Item_Ware_Descr const * get_ware_descr(Ware_Index const & index) const {
 		return m_wares.get(index);
 	}
-	void set_ware_type_has_demand_check(Ware_Index const index) const {
+	void set_ware_type_has_demand_check(Ware_Index const & index) const {
 		m_wares.get(index)->set_has_demand_check();
 	}
-	void set_worker_type_has_demand_check(Ware_Index const index) const {
+	void set_worker_type_has_demand_check(Ware_Index const & index) const {
 		m_workers.get(index)->set_has_demand_check();
 	}
 	Ware_Index safe_worker_index(std::string const & workername) const;
@@ -108,7 +108,7 @@
 		return m_buildings.get_nitems();
 	}
 	Building_Index safe_building_index(char const * name) const;
-	Building_Descr const * get_building_descr(Building_Index const index) const
+	Building_Descr const * get_building_descr(Building_Index const & index) const
 	{
 		return m_buildings.get(index);
 	}

=== modified file 'src/logic/warelist.h'
--- src/logic/warelist.h	2012-02-15 21:25:34 +0000
+++ src/logic/warelist.h	2012-07-11 00:26:24 +0000
@@ -52,7 +52,7 @@
 	void remove(WareList const & wl);
 	count_type stock(Ware_Index) const;
 
-	void set_nrwares(Ware_Index const i) {
+	void set_nrwares(Ware_Index const & i) {
 		assert(m_wares.empty());
 		m_wares.resize(i.value(), 0);
 	}

=== modified file 'src/manager.h'
--- src/manager.h	2012-02-15 21:25:34 +0000
+++ src/manager.h	2012-07-11 00:26:24 +0000
@@ -94,11 +94,11 @@
 	typedef std::vector<T *> container;
 	typedef typename container::size_type Index;
 	Index size() const {return items.size();}
-	T const & operator[](Index const i) const {
+	T const & operator[](Index const & i) const {
 		assert(i < size());
 		return *items[i];
 	}
-	T       & operator[](Index const i)       {
+	T       & operator[](Index const & i)       {
 		assert(i < size());
 		return *items[i];
 	}

=== modified file 'src/map_generator.cc'
--- src/map_generator.cc	2012-02-15 21:25:34 +0000
+++ src/map_generator.cc	2012-07-11 00:26:24 +0000
@@ -130,7 +130,7 @@
 	 uint32_t            const * const random2,
 	 uint32_t            const * const random3,
 	 uint32_t            const * const random4,
-	 FCoords                     const fc)
+	 FCoords                     const & fc)
 {
 	// We'll take the "D" terrain at first...
 	// TODO: Check how the editor handles this...
@@ -439,7 +439,7 @@
 	(uint32_t                  * const random2,
 	 uint32_t                  * const random3,
 	 uint32_t                  * const random4,
-	 Coords const c0, Coords const c1, Coords const c2,
+	 Coords const & c0, Coords const & c1, Coords const & c2,
 	 uint32_t const h1, uint32_t const h2, uint32_t const h3,
 	 RNG                       &       rng,
 	 MapGenAreaInfo::MapGenTerrainType & terrType)

=== modified file 'src/map_generator.h'
--- src/map_generator.h	2012-02-15 21:25:34 +0000
+++ src/map_generator.h	2012-07-11 00:26:24 +0000
@@ -98,7 +98,7 @@
 		 uint32_t            const * const random2,
 		 uint32_t            const * const random3,
 		 uint32_t            const * const random4,
-		 FCoords                     const fc);
+		 FCoords                     const & fc);
 
 	uint8_t make_node_elevation
 		(double elevation, Coords);
@@ -110,7 +110,7 @@
 		(uint32_t                  * const random2,
 		 uint32_t                  * const random3,
 		 uint32_t                  * const random4,
-		 Coords const c0, Coords const c1, Coords const c2,
+		 Coords const & c0, Coords const & c1, Coords const & c2,
 		 uint32_t const h1, uint32_t const h2, uint32_t const h3,
 		 RNG                       &       rng,
 		 MapGenAreaInfo::MapGenTerrainType & terrType);

=== modified file 'src/map_io/widelands_map_message_saver.h'
--- src/map_io/widelands_map_message_saver.h	2012-02-15 21:25:34 +0000
+++ src/map_io/widelands_map_message_saver.h	2012-07-11 00:26:24 +0000
@@ -40,11 +40,11 @@
 /// that will be used as the id of the message when the game is loaded.
 struct Map_Message_Saver : private std::map<Message_Id, Message_Id> {
 	Map_Message_Saver() : counter(0) {}
-	void add(Message_Id const id) {
+	void add(Message_Id const & id) {
 		assert(find(id) == end());
 		insert(std::pair<Message_Id, Message_Id>(id, ++counter));
 	}
-	Message_Id operator[](Message_Id const id) const {
+	Message_Id operator[](Message_Id const & id) const {
 		return find(id) != end() ? find(id)->second : Message_Id::Null();
 	}
 private:

=== modified file 'src/network/netclient.cc'
--- src/network/netclient.cc	2012-06-08 22:33:16 +0000
+++ src/network/netclient.cc	2012-07-11 00:26:24 +0000
@@ -490,7 +490,7 @@
 	// launchgame-menu, here properly should be a set_name function
 }
 
-void NetClient::setPlayer(uint8_t, PlayerSettings)
+void NetClient::setPlayer(uint8_t, PlayerSettings const &)
 {
 	// do nothing here - the request for a positionchange is send in
 	// setPlayerNumber(uint8_t) to the host.

=== modified file 'src/network/netclient.h'
--- src/network/netclient.h	2012-02-15 21:25:34 +0000
+++ src/network/netclient.h	2012-07-11 00:26:24 +0000
@@ -81,7 +81,7 @@
 	virtual void setPlayerTribe   (uint8_t number, std::string const & tribe, bool const random_tribe = false);
 	virtual void setPlayerInit     (uint8_t number, uint8_t index);
 	virtual void setPlayerName     (uint8_t number, std::string const & name);
-	virtual void setPlayer         (uint8_t number, PlayerSettings ps);
+	virtual void setPlayer         (uint8_t number, PlayerSettings const & ps);
 	virtual void setPlayerNumber   (uint8_t number);
 	virtual void setPlayerTeam     (uint8_t number, Widelands::TeamNumber team);
 	virtual void setPlayerCloseable(uint8_t number, bool closeable);

=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc	2012-07-04 18:51:43 +0000
+++ src/network/nethost.cc	2012-07-11 00:26:24 +0000
@@ -261,7 +261,7 @@
 		h->setPlayerName(number, name);
 	}
 
-	virtual void setPlayer(uint8_t const number, PlayerSettings const ps) {
+	virtual void setPlayer(uint8_t const number, PlayerSettings const & ps) {
 		if (number >= h->settings().players.size())
 			return;
 		h->setPlayer(number, ps);

=== modified file 'src/rect.h'
--- src/rect.h	2012-02-15 21:25:34 +0000
+++ src/rect.h	2012-07-11 00:26:24 +0000
@@ -24,7 +24,7 @@
 
 struct Rect : public Point {
 	Rect() throw () {}
-	Rect(const Point p, const uint32_t W, const uint32_t H) throw ()
+	Rect(const Point  & p, const uint32_t W, const uint32_t H) throw ()
 		: Point(p), w(W), h(H)
 	{}
 	Point bottom_right() const {return *this + Point(w, h);}

=== modified file 'src/ui_basic/checkbox.h'
--- src/ui_basic/checkbox.h	2012-06-06 15:15:12 +0000
+++ src/ui_basic/checkbox.h	2012-07-11 00:26:24 +0000
@@ -94,7 +94,7 @@
 struct Checkbox : public Statebox {
 	Checkbox
 		(Panel             * const parent,
-		 Point               const p,
+		 Point               const & p,
 		 PictureID           const picid        = g_gr->get_no_picture(),
 		 std::string const &       tooltip_text = std::string())
 		: Statebox(parent, p, picid, tooltip_text)

=== modified file 'src/vector.h'
--- src/vector.h	2012-02-15 21:25:34 +0000
+++ src/vector.h	2012-07-11 00:26:24 +0000
@@ -41,12 +41,12 @@
 	}
 
 	// vector addition
-	Vector operator+ (Vector const other) const {
+	Vector operator+ (Vector const & other) const {
 		return Vector(x + other.x, y + other.y, z + other.z);
 	}
 
 	// inner product
-	float operator* (Vector const other) const {
+	float operator* (Vector const & other) const {
 		return x * other.x + y * other.y + z * other.z;
 	}
 

=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc	2012-05-27 07:29:33 +0000
+++ src/wlapplication.cc	2012-07-11 00:26:24 +0000
@@ -123,11 +123,11 @@
 			 	(std::string(INSTALL_PREFIX) + '/' + INSTALL_DATADIR));
 #endif
 	}
-	catch (FileNotFound_error e) {}
-	catch (FileAccessDenied_error e) {
+	catch (FileNotFound_error & e) {}
+	catch (FileAccessDenied_error & e) {
 		log("Access denied on %s. Continuing.\n", e.m_filename.c_str());
 	}
-	catch (FileType_error e) {
+	catch (FileType_error & e) {
 		//TODO: handle me
 	}
 
@@ -138,11 +138,11 @@
 		g_fs->AddFileSystem(FileSystem::Create("/usr/share/games/widelands"));
 #endif
 	}
-	catch (FileNotFound_error e) {}
-	catch (FileAccessDenied_error e) {
+	catch (FileNotFound_error & e) {}
+	catch (FileAccessDenied_error & e) {
 		log("Access denied on %s. Continuing.\n", e.m_filename.c_str());
 	}
-	catch (FileType_error e) {
+	catch (FileType_error & e) {
 		//TODO: handle me
 	}
 
@@ -156,11 +156,11 @@
 		g_fs->AddFileSystem(FileSystem::Create("."));
 #endif
 	}
-	catch (FileNotFound_error e) {}
-	catch (FileAccessDenied_error e) {
+	catch (FileNotFound_error & e) {}
+	catch (FileAccessDenied_error & e) {
 		log("Access denied on %s. Continuing.\n", e.m_filename.c_str());
 	}
-	catch (FileType_error e) {
+	catch (FileType_error & e) {
 		//TODO: handle me
 	}
 
@@ -186,11 +186,11 @@
 				g_fs->AddFileSystem(new Datafile(argv0.c_str()));
 #endif
 			}
-			catch (FileNotFound_error e) {}
-			catch (FileAccessDenied_error e) {
+			catch (FileNotFound_error & e) {}
+			catch (FileAccessDenied_error & e) {
 				log ("Access denied on %s. Continuing.\n", e.m_filename.c_str());
 			}
-			catch (FileType_error e) {
+			catch (FileType_error & e) {
 				//TODO: handle me
 			}
 		}
@@ -1246,7 +1246,7 @@
 
 		try {
 			journal->start_recording(m_commandline["record"]);
-		} catch (Journalfile_error e) {
+		} catch (Journalfile_error & e) {
 			wout << "Journal file error: " << e.what() << endl;
 		}
 
@@ -1260,7 +1260,7 @@
 		try {
 			journal->start_playback(m_commandline["playback"]);
 		}
-		catch (Journalfile_error e) {
+		catch (Journalfile_error & e) {
 			wout << "Journal file error: " << e.what() << endl;
 		}
 
@@ -1916,7 +1916,7 @@
 			s.players[number].name = name;
 	}
 
-	virtual void setPlayer(uint8_t const number, PlayerSettings const ps) {
+	virtual void setPlayer(uint8_t const number, PlayerSettings const & ps) {
 		if (number < s.players.size())
 			s.players[number] = ps;
 	}

=== modified file 'src/wui/encyclopedia_window.h'
--- src/wui/encyclopedia_window.h	2012-02-15 21:25:34 +0000
+++ src/wui/encyclopedia_window.h	2012-07-11 00:26:24 +0000
@@ -49,7 +49,7 @@
 		Widelands::Ware_Index m_i;
 		const Widelands::Item_Ware_Descr * m_descr;
 
-		bool operator<(const Ware o) const {
+		bool operator<(const Ware & o) const {
 			return m_descr->descname() < o.m_descr->descname();
 		}
 	};

=== modified file 'src/wui/overlay_manager.h'
--- src/wui/overlay_manager.h	2012-02-15 21:25:34 +0000
+++ src/wui/overlay_manager.h	2012-07-11 00:26:24 +0000
@@ -65,11 +65,11 @@
 		static Job_Id Null() {Job_Id result; result.id = 0; return result;}
 
 		operator bool() const throw () {return id;}
-		bool operator<(const Job_Id other) const throw () {return id < other.id;}
+		bool operator<(const Job_Id & other) const throw () {return id < other.id;}
 	private:
 		friend struct Overlay_Manager;
 		Job_Id operator++() throw () {++id; return *this;}
-		bool operator== (Job_Id const other) const throw () {
+		bool operator== (Job_Id const & other) const throw () {
 			return id == other.id;
 		}
 		uint32_t id;
@@ -168,10 +168,10 @@
 private:
 	struct Registered_Overlays {
 		Registered_Overlays
-			(const Job_Id    Jobid,
-			 const PictureID Picid,
-			 const Point     Hotspot,
-			 const int32_t   Level)
+			(const Job_Id    & Jobid,
+			 const PictureID & Picid,
+			 const Point     & Hotspot,
+			 const int32_t     Level)
 			:
 			picid(Picid),
 			hotspot(Hotspot),


Follow ups