Working on the server
This commit is contained in:
1 parent
075750442f
commit
28c6e83eda
30 files changed
+646
-362
No files matched your search
+31
-5
@@ -3,11 +3,41 @@
|
||||
#include "ISaveable.h"
|
||||
#include "NpcCar.h"
|
||||
#include "navigation/PathFinder.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace FRG {
|
||||
|
||||
struct LocationState : public ISaveable {
|
||||
inline constexpr int kSinglePlayerPersistenceVersion = 1;
|
||||
|
||||
struct LocationLocalState : public ISaveable {
|
||||
float cameraAzimuth = -2.35f;
|
||||
float cameraInclination = 1.1036f;
|
||||
|
||||
void save(nlohmann::json& out) const override;
|
||||
void load(const nlohmann::json& in) override;
|
||||
};
|
||||
|
||||
struct ClientLocationState : public ISaveable {
|
||||
std::unordered_map<std::string, std::shared_ptr<LocationLocalState>> locations;
|
||||
|
||||
std::shared_ptr<LocationLocalState> getOrCreate(const std::string& locationId);
|
||||
void clear();
|
||||
void save(nlohmann::json& out) const override;
|
||||
void load(const nlohmann::json& in) override;
|
||||
};
|
||||
|
||||
void saveSinglePlayerPersistence(
|
||||
const nlohmann::json& networkState,
|
||||
const ClientLocationState& localState,
|
||||
nlohmann::json& out);
|
||||
void loadSinglePlayerPersistence(
|
||||
const nlohmann::json& in,
|
||||
nlohmann::json& networkState,
|
||||
ClientLocationState& localState);
|
||||
|
||||
struct LocationNetworkState : public ISaveable {
|
||||
//This value is populated from the JSON configs and should not be changed during the regular gameplay.
|
||||
//It might be changed only in the editor mode during development.
|
||||
std::vector<PathFinder> navigationMaps;
|
||||
@@ -16,10 +46,6 @@ struct LocationState : public ISaveable {
|
||||
const std::vector<std::string>& paths,
|
||||
const std::string& zipFile = std::string());
|
||||
|
||||
// ---- Camera ----
|
||||
float cameraAzimuth = -2.35f;
|
||||
float cameraInclination = 1.1036f;
|
||||
|
||||
// ---- Navigation ----
|
||||
int activeNavigationIndex = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user