Files
OpenRCT2-Web/src/openrct2/TrackImporter.cpp
T

38 lines
1.1 KiB
C++
Raw Normal View History

2019-04-08 19:34:24 +01:00
/*****************************************************************************
2024-12-31 20:30:04 +01:00
* Copyright (c) 2014-2025 OpenRCT2 developers
2019-04-08 19:34:24 +01:00
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "TrackImporter.h"
#include "core/Path.hpp"
#include "core/String.hpp"
#include <memory>
namespace OpenRCT2::TrackImporter
2019-04-08 19:34:24 +01:00
{
std::unique_ptr<ITrackImporter> Create(const std::string& hintPath)
{
std::unique_ptr<ITrackImporter> trackImporter;
std::string extension = Path::GetExtension(hintPath);
if (ExtensionIsRCT1(extension))
{
2019-05-02 18:39:45 +01:00
trackImporter = CreateTD4();
2019-04-08 19:34:24 +01:00
}
else
{
trackImporter = CreateTD6();
}
return trackImporter;
}
bool ExtensionIsRCT1(const std::string& extension)
{
2024-12-11 22:28:31 +01:00
return String::iequals(extension, ".td4");
2019-04-08 19:34:24 +01:00
}
} // namespace OpenRCT2::TrackImporter