From e6a12fbc526a0e68b59916ed30ec460f27f22751 Mon Sep 17 00:00:00 2001 From: tenshi Date: Mon, 30 Oct 2023 18:56:43 +0100 Subject: [PATCH 1/2] CLIENT-GAME: Add MAX_MISSILE_TYPE PATCH --- src/ECS/MessageTypes.h | 3 ++- src/ECS/Systems/BulletsSystems.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ECS/MessageTypes.h b/src/ECS/MessageTypes.h index 47bab376..1fe90d4b 100644 --- a/src/ECS/MessageTypes.h +++ b/src/ECS/MessageTypes.h @@ -21,7 +21,8 @@ enum missileTypes_e { CLASSIC = 0, FAST, BOUNCE, - PERFORANT + PERFORANT, + MAX_MISSILE_TYPE }; enum physicsType_e { diff --git a/src/ECS/Systems/BulletsSystems.cpp b/src/ECS/Systems/BulletsSystems.cpp index 37869f49..6be88002 100644 --- a/src/ECS/Systems/BulletsSystems.cpp +++ b/src/ECS/Systems/BulletsSystems.cpp @@ -105,6 +105,9 @@ namespace Systems { void createMissile(Types::Position pos, Types::Missiles &typeOfMissile) { + if (typeOfMissile.type >= MAX_MISSILE_TYPE || typeOfMissile.type < 0) { + throw std::runtime_error("Unknown missile type"); + } Json &json = Json::getInstance(); Registry::getInstance().addEntity(); nlohmann::json bulletData = From ce0d425da35ac6419638b1d1a7c03607131dd078 Mon Sep 17 00:00:00 2001 From: tenshi Date: Mon, 30 Oct 2023 19:12:10 +0100 Subject: [PATCH 2/2] CLIENT-GAME: Remove strcpy warnings --- src/Nitwork/NitworkClient.cpp | 3 +++ src/Nitwork/NitworkServer.cpp | 3 +++ src/Server/Systems/Network/MainServerNetwork.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/Nitwork/NitworkClient.cpp b/src/Nitwork/NitworkClient.cpp index 09d51b07..75300e02 100644 --- a/src/Nitwork/NitworkClient.cpp +++ b/src/Nitwork/NitworkClient.cpp @@ -5,6 +5,9 @@ ** NitworkClient */ +#if defined(_WIN32) + #define _CRT_SECURE_NO_WARNINGS +#endif #include "NitworkClient.hpp" #include "Registry.hpp" diff --git a/src/Nitwork/NitworkServer.cpp b/src/Nitwork/NitworkServer.cpp index 75b666e8..cf3b7060 100644 --- a/src/Nitwork/NitworkServer.cpp +++ b/src/Nitwork/NitworkServer.cpp @@ -5,6 +5,9 @@ ** NitworkServer */ +#if defined(_WIN32) + #define _CRT_SECURE_NO_WARNINGS +#endif #include "NitworkServer.hpp" #include "ECSCustomTypes.hpp" #include "Logger.hpp" diff --git a/src/Server/Systems/Network/MainServerNetwork.cpp b/src/Server/Systems/Network/MainServerNetwork.cpp index 8ca5739e..67fac5dd 100644 --- a/src/Server/Systems/Network/MainServerNetwork.cpp +++ b/src/Server/Systems/Network/MainServerNetwork.cpp @@ -5,6 +5,9 @@ ** MainServerNetwork */ +#if defined(_WIN32) + #define _CRT_SECURE_NO_WARNINGS +#endif #include "MainServerNetwork.hpp" #include "Nitwork.h" #include "NitworkMainServer.hpp"