Index: ps/trunk/source/graphics/LOSTexture.h =================================================================== --- ps/trunk/source/graphics/LOSTexture.h +++ ps/trunk/source/graphics/LOSTexture.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -83,7 +83,7 @@ void RecomputeTexture(int unit); size_t GetBitmapSize(size_t w, size_t h, size_t* pitch); - void GenerateBitmap(ICmpRangeManager::CLosQuerier los, u8* losData, size_t w, size_t h, size_t pitch); + void GenerateBitmap(const ICmpRangeManager::CLosQuerier& los, u8* losData, size_t w, size_t h, size_t pitch); CSimulation2& m_Simulation; Index: ps/trunk/source/graphics/LOSTexture.cpp =================================================================== --- ps/trunk/source/graphics/LOSTexture.cpp +++ ps/trunk/source/graphics/LOSTexture.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -364,7 +364,7 @@ return *pitch * (h + g_BlurSize - 1); } -void CLOSTexture::GenerateBitmap(ICmpRangeManager::CLosQuerier los, u8* losData, size_t w, size_t h, size_t pitch) +void CLOSTexture::GenerateBitmap(const ICmpRangeManager::CLosQuerier& los, u8* losData, size_t w, size_t h, size_t pitch) { u8 *dataPtr = losData; Index: ps/trunk/source/gui/CGUISprite.h =================================================================== --- ps/trunk/source/gui/CGUISprite.h +++ ps/trunk/source/gui/CGUISprite.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -161,6 +161,7 @@ CGUISpriteInstance(); CGUISpriteInstance(const CStr& SpriteName); CGUISpriteInstance(const CGUISpriteInstance& Sprite); + CGUISpriteInstance& operator=(const CGUISpriteInstance&); CGUISpriteInstance& operator=(const CStr& SpriteName); void Draw(CRect Size, int CellID, std::map& Sprites, float Z) const; void Invalidate(); Index: ps/trunk/source/gui/CGUISprite.cpp =================================================================== --- ps/trunk/source/gui/CGUISprite.cpp +++ ps/trunk/source/gui/CGUISprite.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -71,6 +71,11 @@ { } +CGUISpriteInstance& CGUISpriteInstance::operator=(const CGUISpriteInstance& Sprite) +{ + return this->operator=(Sprite.m_SpriteName); +} + CGUISpriteInstance& CGUISpriteInstance::operator=(const CStr& SpriteName) { m_SpriteName = SpriteName; Index: ps/trunk/source/lib/path.h =================================================================== --- ps/trunk/source/lib/path.h +++ ps/trunk/source/lib/path.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -84,6 +84,12 @@ DetectSeparator(); } + Path(const Path& p) + : path(p.path) + { + DetectSeparator(); + } + Path(const char* p) : path((const unsigned char*)p, (const unsigned char*)p+strlen(p)) // interpret bytes as unsigned; makes no difference for ASCII, Index: ps/trunk/source/ps/Shapes.h =================================================================== --- ps/trunk/source/ps/Shapes.h +++ ps/trunk/source/ps/Shapes.h @@ -43,6 +43,7 @@ CRect(const CPos &upperleft, const CPos &bottomright); CRect(const CPos &pos, const CSize &size); CRect(const float l, const float t, const float r, const float b); + CRect(const CRect&); CRect& operator=(const CRect& a); bool operator==(const CRect& a) const; @@ -133,6 +134,7 @@ { public: CPos(); + CPos(const CPos& pos); CPos(const CSize &pos); CPos(const float px, const float py); @@ -172,6 +174,7 @@ CSize(); CSize(const CRect &rect); CSize(const CPos &pos); + CSize(const CSize& size); CSize(const float sx, const float sy); CSize& operator=(const CSize& a); Index: ps/trunk/source/ps/Shapes.cpp =================================================================== --- ps/trunk/source/ps/Shapes.cpp +++ ps/trunk/source/ps/Shapes.cpp @@ -24,6 +24,11 @@ { } +CRect::CRect(const CRect& rect) : + left(rect.left), top(rect.top), right(rect.right), bottom(rect.bottom) +{ +} + CRect::CRect(const CPos &pos) : left(pos.x), top(pos.y), right(pos.x), bottom(pos.y) { @@ -218,6 +223,10 @@ { } +CPos::CPos(const CPos& pos) : x(pos.x), y(pos.y) +{ +} + CPos::CPos(const CSize& s) : x(s.cx), y(s.cy) { } @@ -303,6 +312,10 @@ { } +CSize::CSize(const CSize& size) : cx(size.cx), cy(size.cy) +{ +} + CSize::CSize(const CRect &rect) : cx(rect.GetWidth()), cy(rect.GetHeight()) { } Index: ps/trunk/source/simulation2/components/CCmpProjectileManager.cpp =================================================================== --- ps/trunk/source/simulation2/components/CCmpProjectileManager.cpp +++ ps/trunk/source/simulation2/components/CCmpProjectileManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -114,7 +114,7 @@ virtual void RemoveProjectile(uint32_t); void RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, const CFrustum& frustum, bool culling, - ICmpRangeManager::CLosQuerier los, bool losRevealAll) const; + const ICmpRangeManager::CLosQuerier& los, bool losRevealAll) const; private: struct Projectile @@ -358,7 +358,7 @@ } void CCmpProjectileManager::RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, - const CFrustum& frustum, bool culling, ICmpRangeManager::CLosQuerier los, bool losRevealAll) const + const CFrustum& frustum, bool culling, const ICmpRangeManager::CLosQuerier& los, bool losRevealAll) const { // Don't display objects outside the visible area ssize_t posi = (ssize_t)(0.5f + position.X / TERRAIN_TILE_SIZE); Index: ps/trunk/source/simulation2/tests/test_Serializer.h =================================================================== --- ps/trunk/source/simulation2/tests/test_Serializer.h +++ ps/trunk/source/simulation2/tests/test_Serializer.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -283,8 +283,8 @@ CDebugSerializer serialize(script, stream); serialize.NumberI32("x", 16, -16, 16); serialize.NumberI32("x", -16, -16, 16); - TS_ASSERT_THROWS(serialize.NumberI32("x", 17, -16, 16), PSERROR_Serialize_OutOfBounds); - TS_ASSERT_THROWS(serialize.NumberI32("x", -17, -16, 16), PSERROR_Serialize_OutOfBounds); + TS_ASSERT_THROWS(serialize.NumberI32("x", 99, -16, 16), const PSERROR_Serialize_OutOfBounds&); + TS_ASSERT_THROWS(serialize.NumberI32("x", -17, -16, 16), const PSERROR_Serialize_OutOfBounds&); } // TODO: test exceptions more thoroughly @@ -766,7 +766,7 @@ TestLogger logger; TS_ASSERT(script.Eval("([1, 2, function () { }])", &obj)); - TS_ASSERT_THROWS(serialize.ScriptVal("script", &obj), PSERROR_Serialize_InvalidScriptValue); + TS_ASSERT_THROWS(serialize.ScriptVal("script", &obj), const PSERROR_Serialize_InvalidScriptValue&); } void test_script_splice() Index: ps/trunk/source/tools/atlas/AtlasObject/AtlasObject.h =================================================================== --- ps/trunk/source/tools/atlas/AtlasObject/AtlasObject.h +++ ps/trunk/source/tools/atlas/AtlasObject/AtlasObject.h @@ -131,6 +131,11 @@ public: AtObj() {} AtObj(const AtObj& r) : m_Node(r.m_Node) {} + AtObj& operator=(const AtObj& r) + { + m_Node = r.m_Node; + return *this; + } // Return an iterator to the children matching 'key' const AtIter operator[] (const char* key) const; Index: ps/trunk/source/tools/atlas/GameInterface/Handlers/TerrainHandlers.cpp =================================================================== --- ps/trunk/source/tools/atlas/GameInterface/Handlers/TerrainHandlers.cpp +++ ps/trunk/source/tools/atlas/GameInterface/Handlers/TerrainHandlers.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -175,8 +175,9 @@ } else { - sTerrainTexturePreview noPreview; + sTerrainTexturePreview noPreview{}; noPreview.name = std::wstring(); + noPreview.loaded = false; noPreview.imageHeight = 0; noPreview.imageWidth = 0; msg->preview = noPreview; Index: ps/trunk/source/tools/atlas/GameInterface/MessagesSetup.h =================================================================== --- ps/trunk/source/tools/atlas/GameInterface/MessagesSetup.h +++ ps/trunk/source/tools/atlas/GameInterface/MessagesSetup.h @@ -91,7 +91,7 @@ #define COMMANDDATASTRUCT(t) \ struct d##t { \ private: \ - const d##t& operator=(const d##t&); \ + d##t& operator=(const d##t&) = delete; \ public: #define COMMANDSTRUCT(t, merge) \