MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / World

Method World

src/World.cpp:58–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56#endif
57
58World::World(MainProgram& initMain, const CustomEvents::OpenInfiniPaintFileEvent& worldInfo):
59 netObjMan(!worldInfo.isClient),
60 main(initMain),
61 undo(*this),
62 rMan(*this),
63 drawProg(*this),
64 bMan(*this),
65 gridMan(*this),
66 canvasTheme(*this)
67{
68 saveThumbnail = worldInfo.saveThumbnail;
69
70 init_net_obj_type_list();
71 netObjMan.set_netobj_destroy_callback([&undo = undo](const NetworkingObjects::NetObjID& idToDestroy) {
72 undo.remove_by_netid(idToDestroy);
73 });
74 netObjMan.set_netid_reassign_callback([&undo = undo](const NetworkingObjects::NetObjID& oldID, const NetworkingObjects::NetObjID& newID) {
75 undo.reassign_netid(oldID, newID);
76 });
77
78 netSource = worldInfo.netSource;
79
80 drawData.rMan = &rMan;
81 drawData.main = &main;
82 drawData.cam.set_viewing_area(main.window.size.cast<float>());
83
84 if(worldInfo.isClient)
85 init_client(worldInfo.netSource);
86 else {
87 init_client_data_list();
88 set_name(name);
89 if(worldInfo.filePathSource.has_value())
90 load_from_file(worldInfo.filePathSource.value(), worldInfo.fileDataBuffer);
91 else
92 load_empty_canvas(worldInfo.filePathEmptyAutoSaveDir);
93 #ifdef ENABLE_ORDERED_LIST_TEST
94 listDebugTest = netObjMan.make_obj<NetworkingObjects::NetObjOrderedList<uint16_t>>();
95 #endif
96 }
97}
98
99void World::init_client_data_list() {
100 clients = netObjMan.make_obj<NetworkingObjects::NetObjUnorderedSet<ClientData>>();

Callers

nothing calls this directly

Calls 6

remove_by_netidMethod · 0.80
reassign_netidMethod · 0.80
set_viewing_areaMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected