http: add /player/{name}/vehicles

This commit is contained in:
Lion Kortlepel
2022-05-24 21:05:10 +02:00
parent b0021d42b5
commit 9fccc27741
6 changed files with 57 additions and 7 deletions

View File

@@ -216,6 +216,7 @@ void RegisterThread(const std::string& str);
#define beammp_errorf(...) beammp_error(fmt::format(__VA_ARGS__))
#define beammp_infof(...) beammp_info(fmt::format(__VA_ARGS__))
#define beammp_warnf(...) beammp_warn(fmt::format(__VA_ARGS__))
#define beammp_debugf(...) beammp_debug(fmt::format(__VA_ARGS__))
#define beammp_tracef(...) beammp_trace(fmt::format(__VA_ARGS__))
#define beammp_lua_errorf(...) beammp_lua_error(fmt::format(__VA_ARGS__))
#define beammp_lua_warnf(...) beammp_lua_warn(fmt::format(__VA_ARGS__))

View File

@@ -1,10 +1,13 @@
#pragma once
#include <nlohmann/json.hpp>
#include <string>
using json = nlohmann::json;
class TVehicleData final {
public:
TVehicleData(int ID, std::string Data);
TVehicleData(int ID, const std::string& Data);
~TVehicleData();
// We cannot delete this, since vector needs to be able to copy when it resizes.
// Deleting this causes some wacky template errors which are hard to decipher,
@@ -19,9 +22,12 @@ public:
bool operator==(const TVehicleData& v) const { return mID == v.mID; }
const json& Json() const;
private:
int mID { -1 };
std::string mData;
json mJson;
};
// TODO: unused now, remove?