1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-18 16:32:32 +02:00

Fix some warnings

openrw/rwengine/src/engine/GameData.cpp:358:26: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
    textureslots[slot] = std::move(loadTextureArchive(name));
                         ^
openrw/rwengine/src/engine/GameData.cpp:358:26: note: remove std::move call here
    textureslots[slot] = std::move(loadTextureArchive(name));
                         ^~~~~~~~~~                        ~

openrw/rwengine/src/objects/CharacterObject.cpp:16:18: warning: unused variable 'enter_offset' [-Wunused-variable]
static glm::vec3 enter_offset(0.81756252f, 0.34800607f, -0.486281008f);
                 ^

In file included from openrw/rwgame/RWGame.cpp:5:
openrw/rwgame/states/BenchmarkState.hpp:33:23: warning: 'BenchmarkState::getCamera' hides overloaded virtual function
      [-Woverloaded-virtual]
    const ViewCamera& getCamera();
                      ^
openrw/rwgame/State.hpp:51:31: note: hidden overloaded virtual function 'State::getCamera' declared here: different number of
      parameters (1 vs 0)
    virtual const ViewCamera& getCamera(float alpha);
                              ^
In file included from openrw/rwgame/RWGame.cpp:6:
openrw/rwgame/states/IngameState.hpp:53:18: warning: 'draw' overrides a member function but is not marked 'override'
      [-Winconsistent-missing-override]
    virtual void draw(GameRenderer* r);
                 ^
openrw/rwgame/State.hpp:28:18: note: overridden virtual function is here
    virtual void draw(GameRenderer* r) {
                 ^
In file included from openrw/rwgame/RWGame.cpp:6:
openrw/rwgame/states/IngameState.hpp:60:23: warning: 'getCamera' overrides a member function but is not marked 'override'
      [-Winconsistent-missing-override]
    const ViewCamera& getCamera(float alpha);
                      ^
openrw/rwgame/State.hpp:51:31: note: overridden virtual function is here
    virtual const ViewCamera& getCamera(float alpha);
                              ^
openrw/rwgame/RWGame.cpp:242:22: warning: unused variable 'vehicleModel' [-Wunused-variable]
            uint16_t vehicleModel = 110;  // @todo Which cars are spawned?!
                     ^

In file included from openrw/rwengine/src/script/modules/GTA3Module.cpp:1:
In file included from openrw/rwengine/src/engine/GameState.hpp:7:
openrw/rwengine/src/engine/ScreenText.hpp:140:63: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        const std::array<GameString, sizeof...(args)> vals = {args...};
                                                              ^~~~
                                                              {   }
openrw/rwengine/src/script/modules/GTA3ModuleImpl.inl:5669:16: note: in instantiation of function template specialization
      'ScreenText::format<std::__1::basic_string<unsigned short, std::__1::char_traits<unsigned short>, std::__1::allocator<unsigned short> > >'
      requested here
                        ScreenText::format(
                                    ^
In file included from openrw/rwengine/src/script/modules/GTA3Module.cpp:1:
In file included from openrw/rwengine/src/engine/GameState.hpp:7:
openrw/rwengine/src/engine/ScreenText.hpp:140:63: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        const std::array<GameString, sizeof...(args)> vals = {args...};
                                                              ^~~~
                                                              {   }
openrw/rwengine/src/script/modules/GTA3ModuleImpl.inl:10214:18: note: in instantiation of function template specialization
      'ScreenText::format<std::__1::basic_string<unsigned short, std::__1::char_traits<unsigned short>, std::__1::allocator<unsigned short> >,
      std::__1::basic_string<unsigned short, std::__1::char_traits<unsigned short>, std::__1::allocator<unsigned short> > >' requested here
            ScreenText::format(script::gxt(args, gxtEntry),
                        ^

openrw/rwgame/State.cpp:40:42: warning: unused parameter 'alpha' [-Wunused-parameter]
const ViewCamera& State::getCamera(float alpha) {
                                         ^

openrw/rwengine/src/render/ObjectRenderer.cpp:20:17: warning: unused variable 'kWorldDrawDistanceFactor'
      [-Wunused-const-variable]
constexpr float kWorldDrawDistanceFactor = kDrawDistanceFactor;
                ^
This commit is contained in:
Christoph Heiss 2017-09-21 16:45:44 +02:00 committed by Daniel Evans
parent fab9047ef9
commit 6cab5ee31a
10 changed files with 9 additions and 13 deletions

View File

@ -355,7 +355,7 @@ void GameData::loadTXD(const std::string& name) {
return;
}
textureslots[slot] = std::move(loadTextureArchive(name));
textureslots[slot] = loadTextureArchive(name);
}
TextureArchive GameData::loadTextureArchive(const std::string& name) {

View File

@ -137,7 +137,7 @@ public:
template <class... Args>
static GameString format(GameString format, Args&&... args) {
static auto kReplacementMarker = GameStringUtil::fromString("~1~");
const std::array<GameString, sizeof...(args)> vals = {args...};
const std::array<GameString, sizeof...(args)> vals = {{args...}};
size_t x = 0, val = 0;
// We're only looking for numerical replacement markers
while ((x = format.find(kReplacementMarker)) != GameString::npos &&

View File

@ -12,9 +12,6 @@
#warning Unable to find BT_BULLET_VERSION
#endif
// TODO: make this not hardcoded
static glm::vec3 enter_offset(0.81756252f, 0.34800607f, -0.486281008f);
const float CharacterObject::DefaultJumpSpeed = 2.f;
CharacterObject::CharacterObject(GameWorld* engine, const glm::vec3& pos,

View File

@ -17,7 +17,6 @@
#endif
constexpr float kDrawDistanceFactor = 1.5f;
constexpr float kWorldDrawDistanceFactor = kDrawDistanceFactor;
constexpr float kVehicleDrawDistanceFactor = kDrawDistanceFactor;
#if 0 // There's no distance based culling for these types of objects yet
constexpr float kPedestrianDrawDistanceFactor = kDrawDistanceFactor;

View File

@ -37,7 +37,7 @@ void State::handleEvent(const SDL_Event& e) {
}
}
const ViewCamera& State::getCamera(float alpha) {
const ViewCamera& State::getCamera(float) {
return defaultView;
}

View File

@ -97,6 +97,6 @@ void BenchmarkState::handleEvent(const SDL_Event& e) {
State::handleEvent(e);
}
const ViewCamera& BenchmarkState::getCamera() {
const ViewCamera& BenchmarkState::getCamera(float) {
return trackCam;
}

View File

@ -30,7 +30,7 @@ public:
virtual void handleEvent(const SDL_Event& event) override;
const ViewCamera& getCamera();
const ViewCamera& getCamera(float) override;
};
#endif

View File

@ -373,6 +373,6 @@ void DebugState::giveItem(int slot) {
}
}
const ViewCamera& DebugState::getCamera(float alpha) {
const ViewCamera& DebugState::getCamera(float) {
return _debugCam;
}

View File

@ -35,7 +35,7 @@ public:
void spawnFollower(unsigned int id);
void giveItem(int slot);
const ViewCamera& getCamera(float alpha);
const ViewCamera& getCamera(float) override;
};
#endif // DEBUGSTATE_HPP

View File

@ -50,14 +50,14 @@ public:
virtual void exit() override;
virtual void tick(float dt) override;
virtual void draw(GameRenderer* r);
virtual void draw(GameRenderer* r) override;
virtual void handleEvent(const SDL_Event& event) override;
virtual void handlePlayerInput(const SDL_Event& event);
virtual bool shouldWorldUpdate() override;
const ViewCamera& getCamera(float alpha);
const ViewCamera& getCamera(float alpha) override;
private:
GameObject* getCameraTarget() const;
float getViewDistance() const;