Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/the-merge' into feature/RB-161-b…
Browse files Browse the repository at this point in the history
…utton-create-main-server
  • Loading branch information
Saverio976 committed Nov 5, 2023
2 parents 4596392 + 74b73e8 commit bb1769b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion assets/Json/playerData.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"player": {
"spritePath": "assets/R-TypeSheet/spaceship.png",
"damage": 10.0,
"health": 10.0,
"health": 2.0,
"deadTime": 1000,
"width": 350,
"height" : 350,
Expand Down
4 changes: 3 additions & 1 deletion src/Client/Systems/Events/EventsSystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ namespace Systems {
{
bool found = false;
const Raylib::Vector2 pos = {0, 2};
constexpr std::size_t fontSize = 2;
const int fontSize = 2;
Types::FontSize fsz = {fontSize};
const std::string textKeywordWaveEnd = "WaveText";
const std::string textKeyWordGameEnd = "endGameText";

Expand All @@ -265,6 +266,7 @@ namespace Systems {
Raylib::Color(Raylib::ColorDef::White),
textKeyWordGameEnd);
Registry::getInstance().getComponents<Raylib::TextShared>().insertBack(endGameText);
Registry::getInstance().getComponents<Types::FontSize>().insertBack(fsz);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/Game/GameCustomTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "GameCustomTypes.hpp"
#ifdef CLIENT
#include "B-luga-graphics/GraphicsCustomTypes.hpp"
#include "B-luga-graphics/Raylib/Raylib.hpp"
#endif

Expand Down Expand Up @@ -43,6 +44,7 @@ namespace Types {
} else {
unsigned int previousWave = getWaveId();
const std::string text = "Wave " + std::to_string(previousWave) + " survived";
Types::FontSize fsz = {fontSize};

for (auto &id : ids) {
if (arrCol[id]->getKeyword() == textKeyword) {
Expand All @@ -58,6 +60,7 @@ namespace Types {
Raylib::Color(Raylib::ColorDef::White),
textKeyword);
Registry::getInstance().getComponents<Raylib::TextShared>().insertBack(endWaveText);
Registry::getInstance().getComponents<Types::FontSize>().insertBack(fsz);
}
#endif
_waitingForNextWave = value;
Expand Down
10 changes: 7 additions & 3 deletions src/Nitwork/NitworkServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@

#if defined(_WIN32)
#define _CRT_SECURE_NO_WARNINGS
#include <sstream>
#include <tchar.h>
#endif
#include "NitworkServer.hpp"
#include <boost/asio.hpp>
#include "B-luga-physics/ECSSystems.hpp"
#include "B-luga/Logger.hpp"
#include "B-luga/Registry.hpp"
#include "B-luga/SceneManager.hpp"
#include "B-luga/SystemManagers/SystemManagersDirector.hpp"
#include "GameSystems.hpp"
#include "NitworkServer.hpp"
#include "ResourcesManager.hpp"
#include "WaveSystem.hpp"
#include "init.hpp"
Expand Down Expand Up @@ -326,7 +328,9 @@ namespace Nitwork {
return;
}
free(cmd);
_lobbyPids.emplace_back(pi.dwProcessId);
sendLobbyPid(
boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(ownerIp), ownerPort),
pi.dwProcessId);
#else
pid_t c_pid = fork();

Expand Down Expand Up @@ -378,7 +382,7 @@ namespace Nitwork {
_serverInfos.ownerInfos.port);
}

void NitworkServer::sendLobbyPid(const boost::asio::ip::udp::endpoint &endpoint, pid_t pid)
void NitworkServer::sendLobbyPid(const boost::asio::ip::udp::endpoint &endpoint, int pid)
{
struct packetReplaceLobbyPid_s packetLobbyPid = {
.header = {0, 0, 0, 0, 1, 0},
Expand Down
5 changes: 4 additions & 1 deletion src/Nitwork/NitworkServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

#pragma once

#if defined(_WIN32)
#include <tchar.h>
#endif
#include "ANitwork.hpp"
#include "ServerNetwork.hpp"

Expand Down Expand Up @@ -223,7 +226,7 @@ namespace Nitwork {
* @param endpoint The endpoint of the client that sent the packet
* @param pid The pid of the lobby
*/
void sendLobbyPid(const boost::asio::ip::udp::endpoint &endpoint, pid_t pid);
void sendLobbyPid(const boost::asio::ip::udp::endpoint &endpoint, int pid);

/**
* @brief A map that contain the endpoint of the clients and their infos
Expand Down

0 comments on commit bb1769b

Please sign in to comment.