mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-07 01:07:25 +00:00
chore: use IObjWriter directly instead of indirection of ObjWriting
This commit is contained in:
27
src/ObjWriting/IObjWriter.cpp
Normal file
27
src/ObjWriting/IObjWriter.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "IObjWriter.h"
|
||||
|
||||
#include "Game/IW3/ObjWriterIW3.h"
|
||||
#include "Game/IW4/ObjWriterIW4.h"
|
||||
#include "Game/IW5/ObjWriterIW5.h"
|
||||
#include "Game/T5/ObjWriterT5.h"
|
||||
#include "Game/T6/ObjWriterT6.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
const IObjWriter* IObjWriter::GetObjWriterForGame(GameId game)
|
||||
{
|
||||
static const IObjWriter* zoneCreators[static_cast<unsigned>(GameId::COUNT)]{
|
||||
new IW3::ObjWriter(),
|
||||
new IW4::ObjWriter(),
|
||||
new IW5::ObjWriter(),
|
||||
new T5::ObjWriter(),
|
||||
new T6::ObjWriter(),
|
||||
};
|
||||
static_assert(std::extent_v<decltype(zoneCreators)> == static_cast<unsigned>(GameId::COUNT));
|
||||
|
||||
assert(static_cast<unsigned>(game) < static_cast<unsigned>(GameId::COUNT));
|
||||
const auto* result = zoneCreators[static_cast<unsigned>(game)];
|
||||
assert(result);
|
||||
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user