Add "final" to all classes from which we dont need to inherit.
parent
4dae42a3ef
commit
1fa718f491
2
Bonus.h
2
Bonus.h
|
@ -8,7 +8,7 @@
|
|||
#include "engine/World.h"
|
||||
#include "Player.h"
|
||||
|
||||
class Bonus : public RigidBody {
|
||||
class Bonus final : public RigidBody {
|
||||
protected:
|
||||
std::string _name;
|
||||
public:
|
||||
|
|
2
Client.h
2
Client.h
|
@ -8,7 +8,7 @@
|
|||
#include "engine/network/ClientUDP.h"
|
||||
#include "Player.h"
|
||||
|
||||
class Client : public ClientUDP {
|
||||
class Client final : public ClientUDP {
|
||||
private:
|
||||
std::map<sf::Uint16, std::shared_ptr<Player>> _players{};
|
||||
std::shared_ptr<Player> _player;
|
||||
|
|
2
Player.h
2
Player.h
|
@ -16,7 +16,7 @@
|
|||
#include "weapon/Gold_Ak47.h"
|
||||
#include "weapon/Rifle.h"
|
||||
|
||||
class Player : public RigidBody{
|
||||
class Player final : public RigidBody{
|
||||
private:
|
||||
double _healthMax = 100;
|
||||
double _health = _healthMax;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "engine/Keyboard.h"
|
||||
#include "engine/Mouse.h"
|
||||
|
||||
class PlayerController {
|
||||
class PlayerController final {
|
||||
private:
|
||||
std::shared_ptr<Player> _player;
|
||||
std::shared_ptr<Keyboard> _keyboard;
|
||||
|
|
2
Server.h
2
Server.h
|
@ -15,7 +15,7 @@ struct BonusInfo {
|
|||
bool onTheMap = false;
|
||||
};
|
||||
|
||||
class Server : public ServerUDP {
|
||||
class Server final : public ServerUDP {
|
||||
private:
|
||||
std::map<sf::Uint16, std::shared_ptr<Player>> _players{};
|
||||
std::map<std::string, BonusInfo> _bonuses{};
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "Server.h"
|
||||
|
||||
|
||||
class Shooter : public Engine {
|
||||
class Shooter final : public Engine {
|
||||
private:
|
||||
std::shared_ptr<Player> player;
|
||||
std::shared_ptr<PlayerController> playerController;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "Plane.h"
|
||||
#include "Mesh.h"
|
||||
|
||||
class Camera : public Object{
|
||||
class Camera final : public Object{
|
||||
private:
|
||||
Matrix4x4 _S; // screen space matrix
|
||||
Matrix4x4 _P; // projections matrix
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
class Keyboard {
|
||||
class Keyboard final {
|
||||
private:
|
||||
std::map<sf::Keyboard::Key, double> _tappedKeys;
|
||||
public:
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "Point4D.h"
|
||||
#include "Vec3D.h"
|
||||
|
||||
class Matrix4x4 {
|
||||
class Matrix4x4 final {
|
||||
private:
|
||||
std::array<std::array<double, 4>, 4> _arr{};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <SFML/Graphics.hpp>
|
||||
#include "Vec2D.h"
|
||||
|
||||
class Mouse {
|
||||
class Mouse final {
|
||||
private:
|
||||
std::shared_ptr<sf::RenderWindow> _window;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "Point4D.h"
|
||||
#include "Triangle.h"
|
||||
|
||||
class Plane {
|
||||
class Plane final {
|
||||
private:
|
||||
// You can define plane by defining the points in 3D space
|
||||
Triangle _triangle;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <array>
|
||||
#include "Consts.h"
|
||||
|
||||
class Point4D {
|
||||
class Point4D final {
|
||||
private:
|
||||
std::array<double, 4> _arr_point{};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "utils/Time.h"
|
||||
#include "Mouse.h"
|
||||
|
||||
class Screen {
|
||||
class Screen final {
|
||||
private:
|
||||
int _w = 1920;
|
||||
int _h = 1080;
|
||||
|
|
|
@ -10,12 +10,11 @@
|
|||
#include "Matrix4x4.h"
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
class Triangle {
|
||||
class Triangle final {
|
||||
private:
|
||||
sf::Color _color;
|
||||
std::vector<Point4D> _points;
|
||||
public:
|
||||
|
||||
Triangle ();
|
||||
Triangle (const Triangle& triangle);
|
||||
Triangle (const Point4D& p1, const Point4D& p2, const Point4D& p3, sf::Color color = {0, 0, 0});
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
#include <array>
|
||||
#include "Point4D.h"
|
||||
|
||||
class Vec2D {
|
||||
class Vec2D final {
|
||||
private:
|
||||
std::array<double, 2> _arr_point{};
|
||||
|
||||
public:
|
||||
Vec2D () = default;
|
||||
Vec2D (const Vec2D& vec);
|
||||
Vec2D (const Point4D& point4D);
|
||||
explicit Vec2D (const Point4D& point4D);
|
||||
explicit Vec2D (double x, double y = 0.0);
|
||||
Vec2D& operator=(const Vec2D&) = delete;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <array>
|
||||
#include "Point4D.h"
|
||||
|
||||
class Vec3D {
|
||||
class Vec3D final {
|
||||
private:
|
||||
std::array<double, 3> _arr_point{};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "Camera.h"
|
||||
#include "physics/RigidBody.h"
|
||||
|
||||
class World {
|
||||
class World final {
|
||||
private:
|
||||
std::map<std::string, std::shared_ptr<RigidBody>> _objects;
|
||||
public:
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "Animation.h"
|
||||
#include "../Mesh.h"
|
||||
|
||||
class AColor : public Animation {
|
||||
class AColor final : public Animation {
|
||||
private:
|
||||
std::shared_ptr<Mesh> _mesh;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#ifndef ENGINE_AFUNCTION_H
|
||||
#define ENGINE_AFUNCTION_H
|
||||
|
||||
class AFunction : public Animation {
|
||||
class AFunction final : public Animation {
|
||||
private:
|
||||
int _calls = 0;
|
||||
int _allCalls = 1;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "Animation.h"
|
||||
#include "../Object.h"
|
||||
|
||||
class ARotate : public Animation {
|
||||
class ARotate final : public Animation {
|
||||
private:
|
||||
std::shared_ptr<Object> _object;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "Animation.h"
|
||||
#include "Mesh.h"
|
||||
|
||||
class AScale : public Animation {
|
||||
class AScale final : public Animation {
|
||||
private:
|
||||
std::shared_ptr<Mesh> _mesh;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "Animation.h"
|
||||
#include "../Object.h"
|
||||
|
||||
class ATranslate : public Animation {
|
||||
class ATranslate final : public Animation {
|
||||
private:
|
||||
std::shared_ptr<Object> _object;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "Animation.h"
|
||||
#include "../Object.h"
|
||||
|
||||
class ATranslateToPoint : public Animation {
|
||||
class ATranslateToPoint final : public Animation {
|
||||
private:
|
||||
std::shared_ptr<Object> _object;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Animation.h"
|
||||
|
||||
class AWait : public Animation {
|
||||
class AWait final : public Animation {
|
||||
public:
|
||||
explicit AWait(double duration = 1) {
|
||||
_duration = duration;
|
||||
|
|
|
@ -14,7 +14,7 @@ struct tPos {
|
|||
int ty;
|
||||
};
|
||||
|
||||
class Button {
|
||||
class Button final {
|
||||
private:
|
||||
int _x{};
|
||||
int _y{};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../Screen.h"
|
||||
#include "../Mouse.h"
|
||||
|
||||
class Window {
|
||||
class Window final {
|
||||
private:
|
||||
std::string _name;
|
||||
std::string _backTexture;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <SFML/Network.hpp>
|
||||
|
||||
class ReliableMsg
|
||||
class ReliableMsg final
|
||||
{
|
||||
private:
|
||||
sf::Packet packet;
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
#include <SFML/Network.hpp>
|
||||
|
||||
class UDPConnection
|
||||
{
|
||||
class UDPConnection final {
|
||||
private:
|
||||
sf::Uint16 _id;
|
||||
sf::IpAddress _ip;
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
#include "UDPConnection.h"
|
||||
#include "MsgType.h"
|
||||
|
||||
class UDPSocket
|
||||
{
|
||||
class UDPSocket final {
|
||||
private:
|
||||
sf::UdpSocket _socket;
|
||||
sf::Uint16 _nextRelyMsgId;
|
||||
|
|
|
@ -16,7 +16,7 @@ enum class SimplexType {
|
|||
Tetrahedron
|
||||
};
|
||||
|
||||
struct Simplex {
|
||||
struct Simplex final {
|
||||
private:
|
||||
std::deque<Vec3D> _points{};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "RigidBody.h"
|
||||
|
||||
class Solver {
|
||||
class Solver final {
|
||||
public:
|
||||
static void solveCollision(std::shared_ptr<RigidBody> obj1, std::shared_ptr<RigidBody> obj2, const CollisionPoint& collision);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Weapon.h"
|
||||
|
||||
class Ak47 : public Weapon {
|
||||
class Ak47 final : public Weapon {
|
||||
public:
|
||||
explicit Ak47(int ammo = 100, const std::string& weaponName = "ak47");
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Weapon.h"
|
||||
|
||||
class Gold_Ak47 : public Weapon {
|
||||
class Gold_Ak47 final : public Weapon {
|
||||
public:
|
||||
explicit Gold_Ak47(int ammo = 200, const std::string& weaponName = "gold_ak47") : Weapon(weaponName, "obj/ak47.obj", "obj/gold_ak47_mat.txt", Vec3D{3, 3, 3}, Vec3D{-0.8, 1.3, 0.3}, Vec3D{0, Consts::PI, 0}) {
|
||||
fireSound.setBuffer(*ResourceManager::loadSoundBuffer("sound/weapons/ak47.ogg"));
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Weapon.h"
|
||||
|
||||
class Gun : public Weapon {
|
||||
class Gun final : public Weapon {
|
||||
public:
|
||||
explicit Gun(int ammo = 30, const std::string& weaponName = "gun");
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Weapon.h"
|
||||
|
||||
class Rifle : public Weapon {
|
||||
class Rifle final : public Weapon {
|
||||
public:
|
||||
explicit Rifle(int ammo = 5, const std::string& weaponName = "rifle");
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Weapon.h"
|
||||
|
||||
class Shotgun : public Weapon {
|
||||
class Shotgun final : public Weapon {
|
||||
public:
|
||||
explicit Shotgun(int ammo = 15, const std::string& weaponName = "shotgun");
|
||||
std::map<std::string, double> processFire(std::function<std::pair<Vec3D, std::string>(const Vec3D&, const Vec3D&)> rayCastFunction, const Vec3D& position, const Vec3D& direction) override;
|
||||
|
|
Loading…
Reference in New Issue