Add protocol version parameter to GameProperties’ constructor
This commit is contained in:
parent
22cda2a1fe
commit
821c392ade
@ -34,13 +34,19 @@ namespace spades {
|
||||
* Construct and initialize `GameProperties` with values optimal for the compatibility
|
||||
* with the original client.
|
||||
*/
|
||||
GameProperties() {}
|
||||
GameProperties(ProtocolVersion protocol) : protocolVersion{protocol} {}
|
||||
|
||||
/**
|
||||
* Parse a given server message and speculatively update the properties.
|
||||
*/
|
||||
void HandleServerMessage(const std::string &msg);
|
||||
|
||||
/**
|
||||
* The protocol version affecting various physics properties
|
||||
* e.g., weapon spread values.
|
||||
*/
|
||||
ProtocolVersion protocolVersion;
|
||||
|
||||
/**
|
||||
* Indicates whether the server does not provide the game properties in a way OpenSpades
|
||||
* can reliably parse and it must speculate them using non-program friendly information
|
||||
|
@ -379,8 +379,6 @@ namespace spades {
|
||||
|
||||
std::fill(savedPlayerTeam.begin(), savedPlayerTeam.end(), -1);
|
||||
|
||||
properties.reset(new GameProperties());
|
||||
|
||||
bandwidthMonitor.reset(new BandwidthMonitor(host));
|
||||
}
|
||||
NetClient::~NetClient() {
|
||||
@ -421,6 +419,8 @@ namespace spades {
|
||||
SPRaise("Failed to create ENet peer");
|
||||
}
|
||||
|
||||
properties.reset(new GameProperties(hostname.GetProtocolVersion()));
|
||||
|
||||
status = NetClientStatusConnecting;
|
||||
statusString = _Tr("NetClient", "Connecting to the server");
|
||||
timeToTryMapLoad = 0;
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include "PhysicsConstants.h"
|
||||
#include "Player.h"
|
||||
#include <Core/Debug.h>
|
||||
#include <Core/Math.h>
|
||||
#include <Core/ServerAddress.h>
|
||||
#include <Core/Stopwatch.h>
|
||||
@ -119,7 +120,7 @@ namespace spades {
|
||||
std::string DisconnectReasonString(uint32_t);
|
||||
|
||||
void MapLoaded();
|
||||
|
||||
|
||||
void SendVersion();
|
||||
void SendVersionEnhanced(const std::set<std::uint8_t> &propertyIds);
|
||||
|
||||
@ -133,8 +134,12 @@ namespace spades {
|
||||
|
||||
/**
|
||||
* Return a non-null reference to `GameProperties` for this connection.
|
||||
* Must be the connected state.
|
||||
*/
|
||||
std::shared_ptr<GameProperties>& GetGameProperties() { return properties; }
|
||||
std::shared_ptr<GameProperties> &GetGameProperties() {
|
||||
SPAssert(properties);
|
||||
return properties;
|
||||
}
|
||||
|
||||
void Connect(const ServerAddress &hostname);
|
||||
void Disconnect();
|
||||
|
Loading…
x
Reference in New Issue
Block a user