1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

Cleanup, use c++11 override

Maybe some of replace with
final, what do think?
This commit is contained in:
Filip Gawin 2018-01-01 04:14:01 +01:00 committed by Daniel Evans
parent 4a3a6daa9f
commit 6d80ce6424
23 changed files with 78 additions and 67 deletions

View File

@ -13,9 +13,9 @@ public:
: CharacterController() {
}
glm::vec3 getTargetPosition();
glm::vec3 getTargetPosition() override;
virtual void update(float dt);
void update(float dt) override;
};
#endif

View File

@ -31,9 +31,9 @@ public:
void enterNearestVehicle();
virtual void update(float dt);
void update(float dt) override;
virtual glm::vec3 getTargetPosition();
glm::vec3 getTargetPosition() override;
void jump();

View File

@ -55,5 +55,5 @@ private:
};
class StdOutReceiver : public Logger::MessageReceiver {
virtual void messageReceived(const Logger::LogMessage&);
void messageReceived(const Logger::LogMessage&) override;
};

View File

@ -9,7 +9,7 @@ public:
GameObjectMotionState(GameObject* object) : m_object(object) {
}
virtual void getWorldTransform(btTransform& tform) const {
void getWorldTransform(btTransform& tform) const override {
auto& position = m_object->getPosition();
auto& rotation = m_object->getRotation();
tform.setOrigin(btVector3(position.x, position.y, position.z));
@ -17,7 +17,7 @@ public:
btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w));
}
virtual void setWorldTransform(const btTransform& tform) {
void setWorldTransform(const btTransform& tform) override {
auto& o = tform.getOrigin();
auto r = tform.getRotation();
glm::vec3 position(o.x(), o.y(), o.z());

View File

@ -14,8 +14,8 @@ public:
: ClosestRayResultCallback(from, to), _self(self) {
}
virtual btScalar addSingleResult(
btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) {
btScalar addSingleResult(
btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) override {
if (rayResult.m_collisionObject == _self) {
return 1.0;
}

View File

@ -38,7 +38,7 @@ public:
}
bool needsResponse(const btCollisionObject* obA,
const btCollisionObject* obB) {
const btCollisionObject* obB) override {
if (!(obA->getUserPointer() && obB->getUserPointer())) {
return btCollisionDispatcher::needsResponse(obA, obB);
}

View File

@ -84,7 +84,7 @@ public:
const glm::quat& rot, BaseModelInfo* modelinfo,
CharacterController* controller);
~CharacterObject();
~CharacterObject() override;
Type type() const override {
return Character;
@ -113,7 +113,7 @@ public:
*/
void updateCharacter(float dt);
virtual void setPosition(const glm::vec3& pos) override;
void setPosition(const glm::vec3& pos) override;
bool isPlayer() const;

View File

@ -14,7 +14,7 @@ public:
CutsceneObject(GameWorld* engine, const glm::vec3& pos,
const glm::quat& rot, ClumpPtr model,
BaseModelInfo* modelinfo);
~CutsceneObject();
~CutsceneObject() override;
Type type() const override {
return Cutscene;

View File

@ -29,7 +29,7 @@ public:
const glm::quat& rot, const glm::vec3& scale,
BaseModelInfo* modelinfo,
std::shared_ptr<DynamicObjectData> dyn);
~InstanceObject();
~InstanceObject() override;
Type type() const override {
return Instance;
@ -43,10 +43,11 @@ public:
void changeModel(BaseModelInfo* incoming);
virtual void setPosition(const glm::vec3& pos) override;
virtual void setRotation(const glm::quat& r) override;
void setPosition(const glm::vec3& pos) override;
virtual bool takeDamage(const DamageInfo& damage) override;
void setRotation(const glm::quat& r) override;
bool takeDamage(const DamageInfo& damage) override;
void setSolid(bool solid);

View File

@ -15,7 +15,7 @@ public:
ItemPickup(GameWorld* world, const glm::vec3& position,
BaseModelInfo* modelinfo, PickupType type, WeaponData* item);
bool onCharacterTouch(CharacterObject* character);
bool onCharacterTouch(CharacterObject* character) override;
};
#endif

View File

@ -40,7 +40,7 @@ public:
PickupObject(GameWorld* world, const glm::vec3& position, BaseModelInfo *modelinfo,
PickupType type);
~PickupObject();
~PickupObject() override;
Type type() const override {
return Pickup;

View File

@ -51,7 +51,7 @@ public:
ProjectileObject(GameWorld* world, const glm::vec3& position,
const ProjectileInfo& info);
~ProjectileObject();
~ProjectileObject() override;
void tick(float dt) override;

View File

@ -25,7 +25,7 @@ public:
}
void* castRay(const btVector3& from, const btVector3& to,
btVehicleRaycasterResult& result) {
btVehicleRaycasterResult& result) override {
ClosestNotMeRayResultCallback rayCallback(
_vehicle->collision->getBulletBody(), from, to);
const void* res = 0;
@ -55,7 +55,7 @@ public:
: m_object(object), m_part(part) {
}
virtual void getWorldTransform(btTransform& tform) const {
void getWorldTransform(btTransform& tform) const override {
const auto& p = m_part->dummy->getDefaultTranslation();
const auto& o = glm::toQuat(m_part->dummy->getDefaultRotation());
tform.setOrigin(btVector3(p.x, p.y, p.z));
@ -64,7 +64,7 @@ public:
m_object->collision->getBulletBody()->getWorldTransform() * tform;
}
virtual void setWorldTransform(const btTransform& tform) {
void setWorldTransform(const btTransform& tform) override {
auto inv = glm::inverse(m_object->getRotation());
const auto& rot = tform.getRotation();
auto r2 = inv * glm::quat(rot.w(), rot.x(), rot.y(), rot.z());

View File

@ -57,7 +57,7 @@ public:
BaseModelInfo* modelinfo, VehicleInfoHandle info,
const glm::u8vec3& prim, const glm::u8vec3& sec);
virtual ~VehicleObject();
~VehicleObject() override;
void setPosition(const glm::vec3& pos) override;
@ -131,7 +131,7 @@ public:
Part* getSeatEntryDoor(size_t seat);
virtual bool takeDamage(const DamageInfo& damage) override;
bool takeDamage(const DamageInfo& damage) override;
enum FrameState { OK, DAM, BROKEN };

View File

@ -7,17 +7,17 @@
class DebugDraw : public btIDebugDraw {
public:
DebugDraw();
~DebugDraw();
~DebugDraw() override;
void drawLine(const btVector3 &from, const btVector3 &to,
const btVector3 &color);
const btVector3 &color) override;
void drawContactPoint(const btVector3 &pointOnB, const btVector3 &normalOnB,
btScalar distance, int lifeTime,
const btVector3 &color);
void reportErrorWarning(const char *warningString);
void draw3dText(const btVector3 &location, const char *textString);
void setDebugMode(int debugMode);
int getDebugMode() const;
const btVector3 &color) override;
void reportErrorWarning(const char *warningString) override;
void draw3dText(const btVector3 &location, const char *textString) override;
void setDebugMode(int debugMode) override;
int getDebugMode() const override;
void flush(GameRenderer *renderer);

View File

@ -301,8 +301,9 @@ public:
void invalidate() override;
virtual void pushDebugGroup(const std::string& title) override;
virtual const ProfileInfo& popDebugGroup() override;
void pushDebugGroup(const std::string& title) override;
const ProfileInfo& popDebugGroup() override;
private:
struct Buffer {

View File

@ -41,7 +41,7 @@ struct IllegalInstruction : SCMException {
: opcode(opcode), offset(offset), thread(thread) {
}
std::string what() const {
std::string what() const override {
std::stringstream ss;
ss << "Illegal Instruction " << std::setfill('0') << std::setw(4)
<< std::hex << opcode << " encountered at offset "
@ -60,7 +60,7 @@ struct UnknownType : SCMException {
: type(type), offset(offset), thread(thread) {
}
std::string what() const {
std::string what() const override {
std::stringstream ss;
ss << "Unkown data type " << std::setfill('0') << std::hex
<< static_cast<unsigned int>(type) << " encountered at offset "

View File

@ -22,13 +22,15 @@ class BenchmarkState : public State {
public:
BenchmarkState(RWGame* game, const std::string& benchfile);
virtual void enter() override;
virtual void exit() override;
void enter() override;
virtual void tick(float dt) override;
virtual void draw(GameRenderer* r) override;
void exit() override;
virtual void handleEvent(const SDL_Event& event) override;
void tick(float dt) override;
void draw(GameRenderer* r) override;
void handleEvent(const SDL_Event& event) override;
const ViewCamera& getCamera(float) override;
};

View File

@ -21,13 +21,15 @@ public:
DebugState(RWGame* game, const glm::vec3& vp = {},
const glm::quat& vd = {});
virtual void enter() override;
virtual void exit() override;
void enter() override;
virtual void tick(float dt) override;
virtual void draw(GameRenderer* r) override;
void exit() override;
virtual void handleEvent(const SDL_Event& event) override;
void tick(float dt) override;
void draw(GameRenderer* r) override;
void handleEvent(const SDL_Event& event) override;
void printCameraDetails();

View File

@ -46,16 +46,18 @@ public:
void startTest();
void startGame();
virtual void enter() override;
virtual void exit() override;
void enter() override;
virtual void tick(float dt) override;
virtual void draw(GameRenderer* r) override;
void exit() override;
virtual void handleEvent(const SDL_Event& event) override;
void tick(float dt) override;
void draw(GameRenderer* r) override;
void handleEvent(const SDL_Event& event) override;
virtual void handlePlayerInput(const SDL_Event& event);
virtual bool shouldWorldUpdate() override;
bool shouldWorldUpdate() override;
const ViewCamera& getCamera(float alpha) override;
private:

View File

@ -10,16 +10,17 @@ class LoadingState : public State {
public:
LoadingState(RWGame* game, std::function<void(void)> callback);
virtual void enter() override;
virtual void exit() override;
void enter() override;
virtual void tick(float dt) override;
void exit() override;
virtual void draw(GameRenderer* r) override;
void tick(float dt) override;
virtual bool shouldWorldUpdate() override;
void draw(GameRenderer* r) override;
virtual void handleEvent(const SDL_Event& event) override;
bool shouldWorldUpdate() override;
void handleEvent(const SDL_Event& event) override;
};
#endif // LOADINGSTATE_HPP

View File

@ -7,15 +7,16 @@ class MenuState : public State {
public:
MenuState(RWGame* game);
virtual void enter() override;
virtual void exit() override;
void enter() override;
virtual void tick(float dt) override;
void exit() override;
void tick(float dt) override;
virtual void enterMainMenu();
virtual void enterLoadMenu();
virtual void handleEvent(const SDL_Event& event) override;
void handleEvent(const SDL_Event& event) override;
};
#endif // MENUSTATE_HPP

View File

@ -7,14 +7,15 @@ class PauseState : public State {
public:
PauseState(RWGame* game);
virtual void enter() override;
virtual void exit() override;
void enter() override;
virtual void tick(float dt) override;
void exit() override;
virtual void draw(GameRenderer* r) override;
void tick(float dt) override;
virtual void handleEvent(const SDL_Event& event) override;
void draw(GameRenderer* r) override;
void handleEvent(const SDL_Event& event) override;
};
#endif // PAUSESTATE_HPP