#include "GameWorldMpLinker.h" namespace BSP { GameWorldMpLinker::GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) : m_memory(memory), m_search_path(searchPath), m_context(context) { } AssetCreationResult GameWorldMpLinker::linkGameWorldMp(BSPData* bsp) { GameWorldMp* gameWorldMp = m_memory.Alloc(); gameWorldMp->name = m_memory.Dup(bsp->bspName.c_str()); gameWorldMp->path.nodeCount = 0; gameWorldMp->path.originalNodeCount = 0; gameWorldMp->path.visBytes = 0; gameWorldMp->path.smoothBytes = 0; gameWorldMp->path.nodeTreeCount = 0; // The game has 128 empty nodes allocated int extraNodeCount = gameWorldMp->path.nodeCount + 128; gameWorldMp->path.nodes = m_memory.Alloc(extraNodeCount); gameWorldMp->path.basenodes = m_memory.Alloc(extraNodeCount); gameWorldMp->path.pathVis = nullptr; gameWorldMp->path.smoothCache = nullptr; gameWorldMp->path.nodeTree = nullptr; auto gameWorldMpAsset = m_context.AddAsset(gameWorldMp->name, gameWorldMp); return AssetCreationResult::Success(gameWorldMpAsset); } }