コード例 #1
0
ファイル: GameFactory.cpp プロジェクト: ViruZz/vaultmp
void GameFactory::DestroyAll() noexcept
{
	BaseList copy;

	cs.Operate([&copy]() {
		copy = move(instances);
		index.clear();
		typecount.clear();
		delrefs.clear();
	});

	for (const auto& instance : copy)
	{
		Base* reference = static_cast<Base*>(instance.first->StartSession());
		reference->freecontents();

#ifdef VAULTMP_DEBUG
		debug.print("Base ", std::dec, instance.first->GetNetworkID(), " (type: ", typeid(*(instance.first)).name(), ") to be destructed (", instance.first.get(), ")");
#endif

		reference->Finalize();
	}

	Lockable::Reset();
}