Skip to content

Commit

Permalink
CLIENT-GAME: Fix windows compile
Browse files Browse the repository at this point in the history
  • Loading branch information
TTENSHII committed Nov 5, 2023
1 parent 9c9da26 commit 2a1cb3b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 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 @@ -8,6 +8,7 @@
#include "GameCustomTypes.hpp"
#ifdef CLIENT
#include "B-luga-graphics/Raylib/Raylib.hpp"
#include "B-luga-graphics/GraphicsCustomTypes.hpp"
#endif

unsigned int Types::Enemy::_enemyNb = 0;
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
8 changes: 6 additions & 2 deletions src/Nitwork/NitworkServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#if defined(_WIN32)
#define _CRT_SECURE_NO_WARNINGS
#include <sstream>
#include <tchar.h>
#endif
#include "NitworkServer.hpp"
#include <boost/asio.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 2a1cb3b

Please sign in to comment.