GridManager now works on net objects
This commit is contained in:
parent
67507a9a39
commit
ceafbf8bb6
20 changed files with 214 additions and 222 deletions
|
|
@ -1,38 +1,37 @@
|
|||
#pragma once
|
||||
#include "Helpers/NetworkingObjects/NetObjPtr.decl.hpp"
|
||||
#include "WorldGrid.hpp"
|
||||
#include <Helpers/NetworkingObjects/NetObjOrderedList.hpp>
|
||||
|
||||
class World;
|
||||
|
||||
class GridManager {
|
||||
public:
|
||||
GridManager(World& w);
|
||||
void init_client_callbacks();
|
||||
|
||||
ServerClientID add_default_grid(const std::string& newName);
|
||||
void add_default_grid(const std::string& newName);
|
||||
|
||||
template <typename Archive> void save(Archive& a) const {
|
||||
a(grids);
|
||||
a(grids->size());
|
||||
for(uint32_t i = 0; i < grids->size(); i++)
|
||||
a(*grids->at(i));
|
||||
}
|
||||
|
||||
template <typename Archive> void load(Archive& a) {
|
||||
a(grids);
|
||||
changed = true;
|
||||
uint32_t newSize = grids->size();
|
||||
for(uint32_t i = 0; i < newSize; i++) {
|
||||
WorldGrid b;
|
||||
a(b);
|
||||
grids->emplace_back_direct(grids, b);
|
||||
}
|
||||
}
|
||||
|
||||
void send_grid_info(WorldGrid oldGrid, ServerClientID gridID);
|
||||
void remove_grid(ServerClientID idToRemove);
|
||||
void remove_grid(uint32_t indexToRemove);
|
||||
void draw_back(SkCanvas* canvas, const DrawData& drawData);
|
||||
void draw_front(SkCanvas* canvas, const DrawData& drawData);
|
||||
void draw_coordinates(SkCanvas* canvas, const DrawData& drawData);
|
||||
void scale_up(const WorldScalar& scaleUpAmount);
|
||||
|
||||
ClientPortionID get_max_id(ServerPortionID serverID) const;
|
||||
|
||||
const std::vector<ServerClientID>& sorted_grid_ids();
|
||||
|
||||
std::unordered_map<ServerClientID, WorldGrid> grids;
|
||||
NetworkingObjects::NetObjPtr<NetworkingObjects::NetObjOrderedList<WorldGrid>> grids;
|
||||
World& world;
|
||||
private:
|
||||
bool changed = true;
|
||||
std::vector<ServerClientID> sortedGridIDs;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue