MCPcopy Create free account
hub / github.com/OpenArkStudio/ARK / CreateMapInstance

Method CreateMapInstance

src/plugin/kernel/src/AFCMapModule.cpp:236–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236int AFCMapModule::CreateMapInstance(const int map_id)
237{
238 auto pMapInfo = map_infos_.find_value(map_id);
239 if (pMapInfo == nullptr)
240 {
241 return -1;
242 }
243
244 int new_inst_id = pMapInfo->CreateInstanceID();
245
246 if (pMapInfo->ExistInstance(new_inst_id))
247 {
248 return -1;
249 }
250
251 auto pMapInstance = std::make_shared<AFMapInstance>(new_inst_id);
252 if (pMapInstance == nullptr)
253 {
254 return -1;
255 }
256
257 pMapInfo->AddInstance(new_inst_id, pMapInstance);
258 return new_inst_id;
259}
260
261bool AFCMapModule::ReleaseMapInstance(const int map_id, const int inst_id)
262{

Callers

nothing calls this directly

Calls 4

CreateInstanceIDMethod · 0.80
ExistInstanceMethod · 0.80
AddInstanceMethod · 0.80
find_valueMethod · 0.45

Tested by

no test coverage detected