Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8392a53bcb | |||
| de30c3bc96 | |||
| 4324bad41b | |||
| 7271681175 | |||
| 9afe4e6250 | |||
| ddc658be12 | |||
| 3b99463213 | |||
| b0114e4ddf | |||
| 8fc1b70288 | |||
| 28803c2848 | |||
| 179151c90c | |||
| 0f1947e43e | |||
| 59e449b665 | |||
| 5fff416d42 | |||
| 0b00fd02c2 | |||
| c4810bd878 | |||
| 7c1909584f | |||
| 4b47a44b0d | |||
| 6ba6c0b21d | |||
| b9f14cb830 | |||
| 80baf2b59f | |||
| 8b0b1371e5 | |||
| fbef0cc660 | |||
| 8c181e5353 | |||
| c36db6b15f | |||
| 3c3a68f1d1 | |||
| fb2f1343c8 | |||
| c4143be864 | |||
| 6ca5afe81c | |||
| 6a65358e37 | |||
| aac3410755 | |||
| eff94cf05c | |||
| 5e97a0ac1c | |||
| 6cfa32a2c2 | |||
| 3282af2752 | |||
| 4511676dc6 | |||
| 06f5e3038a | |||
| 9496e03cf0 | |||
| 3afdaccff1 | |||
| 3fdb5ce45e | |||
| 8e9a90259d | |||
| c3eee424b6 | |||
| a4e1d4a84d | |||
| 3b62da6489 | |||
| 6c5d5f4921 | |||
| 2cc571c0ce | |||
| ae84abc14d | |||
| 171005b06a | |||
| cdb6753d52 | |||
| 746f2cd383 | |||
| 4050ef8322 | |||
| dd91750e28 | |||
| edc6f40799 | |||
| bfd22b9de0 | |||
| 695ef540f2 | |||
| 331d95573d | |||
| 26ccf3334d | |||
| 3360f4acdb | |||
| 8ead200eb7 | |||
| d5e24635c7 | |||
| 3defa497b6 | |||
| a241589025 | |||
| 911fe7cc10 | |||
| a6a71cb487 | |||
| 3e8cf5e290 | |||
| c62f114087 | |||
| 237c6d9981 | |||
| ece20e0e1f | |||
| 3eecfa7df1 | |||
| 80bdf130dc | |||
| 4338fd3895 | |||
| 3a334b3227 | |||
| 186ca76345 | |||
| da3439cc03 | |||
| 5a1f71e5c0 | |||
| 93d587d463 | |||
| bad65f89d0 | |||
| 3c04810496 | |||
| ec538c1783 | |||
| 01bd4621b3 | |||
| 2ef4f091f1 | |||
| bc4e1f1f35 | |||
| 7c4ed3910f | |||
| 90c834cc49 | |||
| d23761dc10 | |||
| 3d8fd2e519 | |||
| 4bd32e8d0b | |||
| 09bba12814 | |||
| bb76e9493f | |||
|
|
808ef7b3f6 | ||
|
|
23938a0cb5 | ||
|
|
5631efcf9e | ||
|
|
8e7b446003 | ||
|
|
51ec035490 | ||
| 1f94ae2586 | |||
| 7b8c13612c | |||
| a36716d8e4 | |||
| debf9e974c | |||
| 380ecf3a27 | |||
| b3157be641 | |||
| 1e3b672897 | |||
| d1aa5cd8aa | |||
| dbe91b52fd | |||
| 7ab8c79fdf | |||
| 8f2a22762a | |||
| f0c3325141 | |||
| 1d00e0098a | |||
| ee5a27ac54 | |||
| 49a5a09537 | |||
| f9f80fc4fb | |||
| 4997715672 | |||
| 3fe480d121 | |||
| c46226c1ae | |||
| 8630421734 | |||
| 60b81003c0 | |||
| 7986e55846 | |||
| 0c0fd155ed | |||
| 7f650f282c | |||
| 118a04cd01 | |||
| d529c79150 | |||
| ddbba997e5 | |||
| 50c17e8ed1 |
25
.gitea/workflows/linux.yaml
Normal file
25
.gitea/workflows/linux.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Linux arm64
|
||||
run-name: Build And Test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
runs-on: ubuntu-test
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Packages cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/.packages
|
||||
|
||||
- name: XMake config
|
||||
run: xmake f -p linux -y
|
||||
|
||||
- name: Build
|
||||
run: xmake
|
||||
|
||||
- name: Test
|
||||
run: xmake test
|
||||
@@ -1,17 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "ClientConnexion.h"
|
||||
#include "ClientGame.h"
|
||||
#include "client/ClientConnexion.h"
|
||||
#include "client/game/ClientGame.h"
|
||||
|
||||
#include "game/Team.h"
|
||||
#include "game/Player.h"
|
||||
#include "td/game/Team.h"
|
||||
#include "td/game/Player.h"
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "protocol/packets/SendMobsPacket.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/protocol/packets/SendMobsPacket.h"
|
||||
|
||||
#include "render/Renderer.h"
|
||||
#include "client/render/Renderer.h"
|
||||
|
||||
#include "network/Network.h"
|
||||
#include "td/network/Network.h"
|
||||
|
||||
namespace td {
|
||||
namespace client {
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/PacketHandler.h"
|
||||
#include "network/TCPSocket.h"
|
||||
#include "game/Connexion.h"
|
||||
#include "td/protocol/PacketHandler.h"
|
||||
#include "td/network/TCPSocket.h"
|
||||
#include "td/network/Connexion.h"
|
||||
|
||||
namespace td {
|
||||
namespace client {
|
||||
@@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
#include "protocol/PacketHandler.h"
|
||||
#include "td/protocol/PacketHandler.h"
|
||||
|
||||
#include "WorldClient.h"
|
||||
|
||||
#include "render/WorldRenderer.h"
|
||||
#include "render/Renderer.h"
|
||||
#include "client/render/WorldRenderer.h"
|
||||
#include "client/render/Renderer.h"
|
||||
|
||||
namespace td {
|
||||
namespace client {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/World.h"
|
||||
#include "protocol/PacketHandler.h"
|
||||
#include "td/game/World.h"
|
||||
#include "td/protocol/PacketHandler.h"
|
||||
|
||||
namespace td {
|
||||
namespace client {
|
||||
@@ -13,12 +13,14 @@ private:
|
||||
ClientGame* m_Game;
|
||||
public:
|
||||
WorldClient(ClientGame* game);
|
||||
virtual ~WorldClient();
|
||||
|
||||
virtual void HandlePacket(const protocol::WorldBeginDataPacket* packet) override;
|
||||
virtual void HandlePacket(const protocol::WorldDataPacket* packet) override;
|
||||
virtual void HandlePacket(const protocol::SpawnMobPacket* packet) override;
|
||||
virtual void HandlePacket(const protocol::UpgradeTowerPacket* packet) override;
|
||||
virtual void HandlePacket(const protocol::WorldAddTowerPacket* packet) override;
|
||||
virtual void HandlePacket(const protocol::RemoveMobPacket* packet) override;
|
||||
virtual void HandlePacket(const protocol::RemoveTowerPacket* packet) override;
|
||||
virtual void HandlePacket(const protocol::UpdateMobStatesPacket* packet) override;
|
||||
virtual void HandlePacket(const protocol::UpdateCastleLifePacket* packet) override;
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Defines.h"
|
||||
#include "td/Defines.h"
|
||||
#include <memory>
|
||||
#include "loader/GLLoader.h"
|
||||
#include "render/shaders/WorldShader.h"
|
||||
#include "render/shaders/EntityShader.h"
|
||||
#include "client/render/shaders/WorldShader.h"
|
||||
#include "client/render/shaders/EntityShader.h"
|
||||
|
||||
namespace td {
|
||||
namespace render {
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
void SetCamAngularMovement(const Vec2f& mov);
|
||||
void SetCamMovement(const Vec2f& lastCursorPos, const Vec2f& currentCursorPos);
|
||||
void SetCamLook(const Vec2f& worldPos);
|
||||
void ResetCamLook();
|
||||
|
||||
void SetBackgroundColor(const Vec3f& color) { m_BackgroundColor = color; }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "render/loader/GLLoader.h"
|
||||
#include "client/render/loader/GLLoader.h"
|
||||
|
||||
|
||||
namespace td {
|
||||
@@ -1,14 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/World.h"
|
||||
#include "td/game/World.h"
|
||||
|
||||
#include "render/Renderer.h"
|
||||
#include "render/VertexCache.h"
|
||||
#include "client/render/Renderer.h"
|
||||
#include "client/render/VertexCache.h"
|
||||
|
||||
#include "render/gui/TowerPlacePopup.h"
|
||||
#include "render/gui/TowerUpgradePopup.h"
|
||||
#include "render/gui/MobTooltip.h"
|
||||
#include "render/gui/CastleTooltip.h"
|
||||
#include "client/render/gui/TowerPlacePopup.h"
|
||||
#include "client/render/gui/TowerUpgradePopup.h"
|
||||
#include "client/render/gui/MobTooltip.h"
|
||||
#include "client/render/gui/CastleTooltip.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
void Update();
|
||||
void Render();
|
||||
|
||||
void ResetCam();
|
||||
void SetCamPos(float camX, float camY);
|
||||
|
||||
void MoveCam(float relativeX, float relativeY);
|
||||
@@ -1,16 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "SummonMenu.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
|
||||
class GameMenu : public GuiWidget {
|
||||
class GameMenu : public GuiWidget, public game::GameListener {
|
||||
private:
|
||||
std::unique_ptr<SummonMenu> m_SummonMenu;
|
||||
public:
|
||||
GameMenu(client::Client* client);
|
||||
|
||||
virtual void OnGameBegin();
|
||||
|
||||
virtual void Render();
|
||||
private:
|
||||
void ShowTPS();
|
||||
@@ -18,6 +21,8 @@ private:
|
||||
void ShowPlayers();
|
||||
void ShowLobbyProgress();
|
||||
void ShowTeamSelection();
|
||||
|
||||
void DisconnectButton();
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "render/gui/imgui/imgui.h"
|
||||
#include "game/Team.h"
|
||||
#include "client/render/gui/imgui/imgui.h"
|
||||
#include "td/game/Team.h"
|
||||
|
||||
namespace td {
|
||||
namespace render {
|
||||
@@ -4,13 +4,15 @@
|
||||
|
||||
#include "imgui/imgui_filebrowser.h"
|
||||
|
||||
#include "game/server/Server.h"
|
||||
#include "server/Server.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
|
||||
class ServerGui;
|
||||
|
||||
class MainMenu : public GuiWidget {
|
||||
private:
|
||||
bool m_TriedToConnect = false;
|
||||
@@ -22,6 +24,7 @@ private:
|
||||
imgui_addons::ImGuiFileBrowser m_FileDialog;
|
||||
|
||||
std::unique_ptr<server::Server> m_Server;
|
||||
std::unique_ptr<ServerGui> m_ServerGui;
|
||||
public:
|
||||
MainMenu(client::Client* client);
|
||||
~MainMenu();
|
||||
19
include/client/render/gui/ServerGui.h
Normal file
19
include/client/render/gui/ServerGui.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "GuiWidget.h"
|
||||
#include "server/Server.h"
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
|
||||
class ServerGui : public GuiWidget {
|
||||
private:
|
||||
server::Server* m_Server;
|
||||
public:
|
||||
ServerGui(client::Client* client, server::Server* server);
|
||||
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
} // namespace td
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "GuiWidget.h"
|
||||
|
||||
#include <array>
|
||||
#include "game/Mobs.h"
|
||||
#include "td/game/Mobs.h"
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "render/gui/GuiManager.h"
|
||||
#include "client/render/gui/GuiManager.h"
|
||||
|
||||
struct SDL_Window;
|
||||
typedef void* SDL_GLContext;
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "GuiWidget.h"
|
||||
|
||||
#include "Defines.h"
|
||||
#include "td/Defines.h"
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "GuiWidget.h"
|
||||
|
||||
#include "Defines.h"
|
||||
#include "td/Defines.h"
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
@@ -107,7 +107,7 @@ namespace ImGui
|
||||
}
|
||||
*/
|
||||
|
||||
#include "render/GL.h"
|
||||
#include "client/render/GL.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_ES3
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef IMGUIFILEBROWSER_H
|
||||
#define IMGUIFILEBROWSER_H
|
||||
|
||||
#include "render/gui/imgui/imgui.h"
|
||||
#include "client/render/gui/imgui/imgui.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/World.h"
|
||||
#include "td/game/World.h"
|
||||
#include "GLLoader.h"
|
||||
|
||||
namespace td {
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Defines.h"
|
||||
#include "render/GL.h"
|
||||
#include "td/Defines.h"
|
||||
#include "client/render/GL.h"
|
||||
|
||||
namespace td {
|
||||
namespace shader {
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "misc/DataBuffer.h"
|
||||
#include "td/misc/DataBuffer.h"
|
||||
|
||||
#define TD_VERSION "alpha-0.3.0"
|
||||
#define TD_VERSION "alpha-0.4.0"
|
||||
|
||||
namespace td {
|
||||
namespace utils {
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "misc/Time.h"
|
||||
#include "td/misc/Time.h"
|
||||
|
||||
namespace td {
|
||||
namespace server {
|
||||
@@ -12,7 +12,7 @@ class Server;
|
||||
class Lobby {
|
||||
private:
|
||||
Server* m_Server;
|
||||
bool m_GameStarted = false;
|
||||
bool m_LobbyOpened = false;
|
||||
std::uint64_t m_StartTimerTime = 0;
|
||||
std::vector<std::uint8_t> m_Players;
|
||||
utils::AutoTimer m_Timer;
|
||||
@@ -22,6 +22,8 @@ public:
|
||||
void OnPlayerJoin(std::uint8_t playerID);
|
||||
void OnPlayerLeave(std::uint8_t playerID);
|
||||
|
||||
void OpenLobby();
|
||||
|
||||
void SendTimeRemaining();
|
||||
|
||||
void Tick();
|
||||
@@ -3,13 +3,13 @@
|
||||
#include <map>
|
||||
#include <thread>
|
||||
|
||||
#include "network/TCPListener.h"
|
||||
#include "protocol/Protocol.h"
|
||||
#include "protocol/PacketDispatcher.h"
|
||||
#include "protocol/PacketHandler.h"
|
||||
#include "ServerGame.h"
|
||||
#include "ServerConnexion.h"
|
||||
#include "Lobby.h"
|
||||
#include "td/network/TCPListener.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/protocol/PacketDispatcher.h"
|
||||
#include "td/protocol/PacketHandler.h"
|
||||
#include "server/game/ServerGame.h"
|
||||
#include "server/ServerConnexion.h"
|
||||
#include "server/Lobby.h"
|
||||
|
||||
#define SERVER_TPS 20
|
||||
#define SERVER_TICK 1000 / SERVER_TPS
|
||||
@@ -63,17 +63,23 @@ private:
|
||||
std::thread m_Thread;
|
||||
bool m_ServerRunning;
|
||||
public:
|
||||
Server(const std::string& worldFilePath);
|
||||
Server();
|
||||
virtual ~Server();
|
||||
|
||||
bool Start(std::uint16_t port);
|
||||
bool Start(std::uint16_t port, bool blocking);
|
||||
void Stop(); // force the server to stop
|
||||
void Close(); // at the end of a game
|
||||
|
||||
void Restart(); // go back to lobby state
|
||||
|
||||
bool LoadMap(const std::string& worldFilePath);
|
||||
bool IsMapLoaded();
|
||||
|
||||
void RemoveConnexion(std::uint8_t connexionID);
|
||||
|
||||
void BroadcastPacket(const protocol::Packet* packet);
|
||||
|
||||
float GetMSPT() const { return m_TickCounter.GetMSPT(); }
|
||||
float GetTPS() const { return m_TickCounter.GetTPS(); }
|
||||
|
||||
bool IsRunning() { return m_ServerRunning; }
|
||||
@@ -95,6 +101,7 @@ private:
|
||||
void Clean();
|
||||
void StartThread();
|
||||
void StopThread();
|
||||
void ServerLoop();
|
||||
void Tick(std::uint64_t delta);
|
||||
|
||||
void OnPlayerJoin(std::uint8_t id);
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "network/TCPSocket.h"
|
||||
#include "protocol/PacketHandler.h"
|
||||
#include "protocol/PacketDispatcher.h"
|
||||
#include "game/Player.h"
|
||||
#include "game/Connexion.h"
|
||||
#include "td/network/TCPSocket.h"
|
||||
#include "td/protocol/PacketHandler.h"
|
||||
#include "td/protocol/PacketDispatcher.h"
|
||||
#include "td/game/Player.h"
|
||||
#include "td/network/Connexion.h"
|
||||
|
||||
namespace td {
|
||||
namespace server {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/BaseGame.h"
|
||||
#include "misc/Time.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
#include "td/misc/Time.h"
|
||||
#include "ServerWorld.h"
|
||||
|
||||
namespace td {
|
||||
@@ -23,6 +23,8 @@ public:
|
||||
ServerWorld* GetServerWorld() { return &m_ServerWorld; }
|
||||
|
||||
virtual void Tick(std::uint64_t delta);
|
||||
virtual void Reset() override;
|
||||
|
||||
void StartGame();
|
||||
|
||||
// GameListener
|
||||
@@ -31,6 +33,9 @@ public:
|
||||
virtual void OnGameBegin() override;
|
||||
virtual void OnGameEnd() override;
|
||||
virtual void OnGameClose() override;
|
||||
|
||||
virtual void OnPlayerJoin(game::PlayerID id) override;
|
||||
virtual void OnPlayerLeave(game::PlayerID id) override;
|
||||
private:
|
||||
void BalanceTeams();
|
||||
void InitPlayerStats();
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/World.h"
|
||||
#include "td/game/World.h"
|
||||
|
||||
namespace td {
|
||||
namespace server {
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#define SAFE_CHECK(expr) if(!(expr)) return
|
||||
|
||||
|
||||
namespace td {
|
||||
|
||||
static constexpr float PI = 3.141592653f;
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/Team.h"
|
||||
#include "game/World.h"
|
||||
#include "game/Player.h"
|
||||
#include "td/game/Team.h"
|
||||
#include "td/game/World.h"
|
||||
#include "td/game/Player.h"
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
|
||||
virtual void Tick(std::uint64_t delta);
|
||||
|
||||
virtual void Reset();
|
||||
|
||||
Team& GetRedTeam() { return m_Teams[static_cast<std::uint8_t>(TeamColor::Red)]; }
|
||||
const Team& GetRedTeam() const { return m_Teams[static_cast<std::uint8_t>(TeamColor::Red)]; }
|
||||
|
||||
@@ -65,6 +67,8 @@ public:
|
||||
|
||||
const TeamList& GetTeams() const { return m_Teams; }
|
||||
|
||||
void RemovePlayer(PlayerID pId);
|
||||
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Defines.h"
|
||||
#include "td/Defines.h"
|
||||
#include "Towers.h"
|
||||
#include "Types.h"
|
||||
#include "Team.h"
|
||||
|
||||
#include "misc/ObjectNotifier.h"
|
||||
#include "td/misc/ObjectNotifier.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
utils::CooldownTimer m_AttackTimer;
|
||||
|
||||
public:
|
||||
Mob(MobID id, MobLevel level, PlayerID sender) : m_Sender(sender), m_Level(level),
|
||||
Mob(MobID id, MobLevel level, PlayerID sender) : m_ID(id), m_Sender(sender), m_Level(level),
|
||||
m_HitCooldown(0), m_EffectFireTimer(1000), m_EffectPoisonTimer(1000),
|
||||
m_EffectHealTimer(1000), m_CastleTarget(nullptr), m_AttackTimer(1000) {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "game/Team.h"
|
||||
#include "game/PlayerUpgrades.h"
|
||||
#include "td/game/Team.h"
|
||||
#include "td/game/PlayerUpgrades.h"
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "Types.h"
|
||||
|
||||
#include "misc/Shapes.h"
|
||||
#include "td/misc/Shapes.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
|
||||
void AddPlayer(Player* newPlayer);
|
||||
void RemovePlayer(const Player* player);
|
||||
void ClearPlayers();
|
||||
|
||||
TeamColor GetColor() const;
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "misc/Time.h"
|
||||
#include "misc/Shapes.h"
|
||||
#include "td/misc/Time.h"
|
||||
#include "td/misc/Shapes.h"
|
||||
|
||||
#include "game/Types.h"
|
||||
#include "td/game/Types.h"
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cstdint>
|
||||
|
||||
// include Log for every files
|
||||
#include "misc/Log.h"
|
||||
#include "td/misc/Log.h"
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
@@ -171,7 +171,10 @@ public:
|
||||
|
||||
void Tick(std::uint64_t delta);
|
||||
|
||||
void Reset(); // clear mobs and towers
|
||||
|
||||
void SpawnMobAt(MobID id, MobType type, std::uint8_t level, PlayerID sender, float x, float y, Direction dir);
|
||||
MobPtr RemoveMob(MobID id);
|
||||
|
||||
TowerPtr PlaceTowerAt(TowerID id, TowerType type, std::int32_t x, std::int32_t y, PlayerID builder);
|
||||
TowerPtr RemoveTower(TowerID id);
|
||||
@@ -217,7 +220,9 @@ public:
|
||||
|
||||
const TeamList& GetTeams() const;
|
||||
|
||||
TowerList& GetTowers() { return m_Towers; }
|
||||
const TowerList& GetTowers() const { return m_Towers; }
|
||||
|
||||
TowerPtr GetTowerById(TowerID tower);
|
||||
|
||||
const Player* GetPlayerById(PlayerID id) const;
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Defines.h"
|
||||
#include "td/Defines.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace td {
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "network/TCPSocket.h"
|
||||
#include "protocol/PacketHandler.h"
|
||||
#include "protocol/PacketDispatcher.h"
|
||||
#include "game/Player.h"
|
||||
#include "td/network/TCPSocket.h"
|
||||
#include "td/protocol/PacketHandler.h"
|
||||
#include "td/protocol/PacketDispatcher.h"
|
||||
#include "td/game/Player.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -12,10 +12,10 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "network/Socket.h"
|
||||
#include "network/IPAddress.h"
|
||||
#include "network/UDPSocket.h"
|
||||
#include "network/TCPSocket.h"
|
||||
#include "td/network/Socket.h"
|
||||
#include "td/network/IPAddress.h"
|
||||
#include "td/network/UDPSocket.h"
|
||||
#include "td/network/TCPSocket.h"
|
||||
|
||||
namespace td {
|
||||
namespace network {
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "misc/DataBuffer.h"
|
||||
#include "td/misc/DataBuffer.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ws2tcpip.h>
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef NETWORK_TCP_SOCKET_H_
|
||||
#define NETWORK_TCP_SOCKET_H_
|
||||
|
||||
#include "network/IPAddress.h"
|
||||
#include "network/Socket.h"
|
||||
#include "td/network/IPAddress.h"
|
||||
#include "td/network/Socket.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef NETWORK_UDP_SOCKET_H_
|
||||
#define NETWORK_UDP_SOCKET_H_
|
||||
|
||||
#include "network/IPAddress.h"
|
||||
#include "network/Socket.h"
|
||||
#include "td/network/IPAddress.h"
|
||||
#include "td/network/Socket.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "protocol/PacketsForward.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/protocol/PacketsForward.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
virtual void HandlePacket(const PlayerLeavePacket* packet) {}
|
||||
virtual void HandlePacket(const PlayerListPacket* packet) {}
|
||||
virtual void HandlePacket(const PlayerLoginPacket* packet) {}
|
||||
virtual void HandlePacket(const RemoveMobPacket* packet) {}
|
||||
virtual void HandlePacket(const RemoveTowerPacket* packet) {}
|
||||
virtual void HandlePacket(const SelectTeamPacket* packet) {}
|
||||
virtual void HandlePacket(const SendMobsPacket* packet) {}
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "packets/PlayerLeavePacket.h"
|
||||
#include "packets/PlayerListPacket.h"
|
||||
#include "packets/PlayerLoginPacket.h"
|
||||
#include "packets/RemoveMobPacket.h"
|
||||
#include "packets/RemoveTowerPacket.h"
|
||||
#include "packets/SelectTeamPacket.h"
|
||||
#include "packets/SendMobsPacket.h"
|
||||
@@ -29,6 +29,7 @@ class UpdateCastleLifePacket;
|
||||
class UpdateMobStatesPacket;
|
||||
class PlayerBuyItemPacket;
|
||||
class PlayerBuyMobUpgradePacket;
|
||||
class RemoveMobPacket;
|
||||
|
||||
} // namespace protocol
|
||||
} // namespace td
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "misc/DataBuffer.h"
|
||||
#include "td/misc/DataBuffer.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -13,7 +13,6 @@ enum class PacketType : std::uint8_t {
|
||||
// client --> server
|
||||
PlayerLogin = 0,
|
||||
SelectTeam,
|
||||
SpawnMob,
|
||||
SendMobs,
|
||||
PlaceTower,
|
||||
|
||||
@@ -33,6 +32,8 @@ enum class PacketType : std::uint8_t {
|
||||
WorldAddTower,
|
||||
UpdateMobStates,
|
||||
UpdateCastleLife,
|
||||
SpawnMob,
|
||||
RemoveMob,
|
||||
|
||||
// client <--> server
|
||||
KeepAlive,
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
27
include/td/protocol/packets/RemoveMobPacket.h
Normal file
27
include/td/protocol/packets/RemoveMobPacket.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
|
||||
class RemoveMobPacket : public Packet {
|
||||
private:
|
||||
game::MobID m_MobID;
|
||||
public:
|
||||
RemoveMobPacket() {}
|
||||
RemoveMobPacket(game::MobID id) : m_MobID(id) {}
|
||||
virtual ~RemoveMobPacket() {}
|
||||
|
||||
virtual DataBuffer Serialize(bool packetID = true) const;
|
||||
virtual void Deserialize(DataBuffer& data);
|
||||
virtual void Dispatch(PacketHandler* handler) const;
|
||||
|
||||
game::MobID GetMobID() const { return m_MobID; }
|
||||
|
||||
virtual PacketType GetType() const { return PacketType::RemoveMob; }
|
||||
};
|
||||
|
||||
} // namespace protocol
|
||||
} // namespace td
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "protocol/Protocol.h"
|
||||
#include "game/BaseGame.h"
|
||||
#include "td/protocol/Protocol.h"
|
||||
#include "td/game/BaseGame.h"
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user