shooter/Server.h

46 lines
1.0 KiB
C
Raw Normal View History

2021-09-13 15:53:43 +03:00
//
// Created by Иван Ильин on 25.05.2021.
//
#ifndef SHOOTER_SERVER_H
#define SHOOTER_SERVER_H
2021-10-09 13:41:12 +03:00
#include "engine/network/ServerUDP.h"
2021-09-13 15:53:43 +03:00
#include "Player.h"
#include "Bonus.h"
struct BonusInfo {
2021-10-09 13:41:12 +03:00
Point4D position{};
double lastTake = std::numeric_limits<double>::min();
bool onTheMap = false;
2021-09-13 15:53:43 +03:00
};
class Server final : public ServerUDP {
2021-09-13 15:53:43 +03:00
private:
std::map<sf::Uint16, std::shared_ptr<Player>> _players{};
std::map<std::string, BonusInfo> _bonuses{};
double _bonusRechargeTime = 60;
public:
Server() = default;
void broadcast() override;
void processConnect(sf::Uint16 senderId) override;
void processClientUpdate(sf::Uint16 senderId, sf::Packet& packet) override;
void processDisconnect(sf::Uint16 senderId) override;
void processCustomPacket(MsgType type, sf::Packet& packet, sf::Uint16 senderId) override;
void processStop() override;
void generateBonuses();
void updateInfo() override;
2021-10-16 20:22:55 +03:00
~Server() override;
2021-09-13 15:53:43 +03:00
};
#endif //MINECRAFT_3DZAVR_SERVER_H