Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MapGenerator.cpp
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | |||||
bool CMapGeneratorWorker::TemplateExists(const std::string& templateName) | bool CMapGeneratorWorker::TemplateExists(const std::string& templateName) | ||||
{ | { | ||||
return m_TemplateLoader.TemplateExists(templateName); | return m_TemplateLoader.TemplateExists(templateName); | ||||
} | } | ||||
std::vector<std::string> CMapGeneratorWorker::FindTemplates(const std::string& path, bool includeSubdirectories) | std::vector<std::string> CMapGeneratorWorker::FindTemplates(const std::string& path, bool includeSubdirectories) | ||||
{ | { | ||||
return m_TemplateLoader.FindTemplates(path, includeSubdirectories, SIMULATION_TEMPLATES); | std::vector<std::string> templates_to_ignore { | ||||
Stan: Might be better to use `std::array<CStr, 3>` or at least `std::array<std::string, 3>`
First… | |||||
FreagarachAuthorUnsubmitted Done Inline Actions
Baby steps. ;) Freagarach: > Bonus, would be nice to read them from a file :)
Baby steps. ;) | |||||
phositUnsubmitted Done Inline ActionsI would use constexpr std::array<std::string_view, 3> and as a concequence PS::span<const std::string_view> phosit: I would use `constexpr std::array<std::string_view, 3>` and as a concequence `PS::span<const… | |||||
FreagarachAuthorUnsubmitted Done Inline Actions
Also, the next step would be to let the caller request the types to list (entity, technology etc.). Freagarach: > Bonus, would be nice to read them from a file :)
Also, the next step would be to let the… | |||||
StanUnsubmitted Not Done Inline ActionsWell you could add those to the enum I suppose. enum class ETemplatesType { ACTOR_TEMPLATES = 1, SIMULATION_TEMPLATES = 2, MIXIN_TEMPLATES = 4, SPECIAL_TEMPLATES = 8, ROOT_TEMPLATES = 16, ATLAS_TEMPLATES = 1 + 2 ALL_TEMPLATES = 1 + 2 + 4 + 8 + 16 }; then define patterns matching those. eg ROOT_TEMPLATES_PATTERN = "template_" and get that from a file in the mod. Stan: Well you could add those to the enum I suppose.
```lines=4,lang=cpp
enum class ETemplatesType… | |||||
// We want to ignore template_*.xml templates, since they should never be built in the editor | |||||
"template_", | |||||
// Also ignore some subfolders. | |||||
"mixins/", | |||||
"special/" | |||||
Not Done Inline ActionsIs it intended to have these lists duplicated? vladislavbelov: Is it intended to have these lists duplicated? | |||||
}; | |||||
return m_TemplateLoader.FindTemplates(path, includeSubdirectories, SIMULATION_TEMPLATES, templates_to_ignore); | |||||
Not Done Inline ActionsWrong CC for the name (and below), no space before {. vladislavbelov: Wrong CC for the name (and below), no space before `{`. | |||||
} | } | ||||
std::vector<std::string> CMapGeneratorWorker::FindActorTemplates(const std::string& path, bool includeSubdirectories) | std::vector<std::string> CMapGeneratorWorker::FindActorTemplates(const std::string& path, bool includeSubdirectories) | ||||
{ | { | ||||
return m_TemplateLoader.FindTemplates(path, includeSubdirectories, ACTOR_TEMPLATES); | std::vector<std::string> templates_to_ignore { | ||||
// We want to ignore template_*.xml templates, since they should never be built in the editor | |||||
"template_", | |||||
// Also ignore some subfolders. | |||||
"mixins/", | |||||
"special/" | |||||
}; | |||||
return m_TemplateLoader.FindTemplates(path, includeSubdirectories, ACTOR_TEMPLATES, templates_to_ignore); | |||||
} | } | ||||
bool CMapGeneratorWorker::LoadScripts(const VfsPath& libraryName) | bool CMapGeneratorWorker::LoadScripts(const VfsPath& libraryName) | ||||
{ | { | ||||
// Ignore libraries that are already loaded | // Ignore libraries that are already loaded | ||||
if (m_LoadedLibraries.find(libraryName) != m_LoadedLibraries.end()) | if (m_LoadedLibraries.find(libraryName) != m_LoadedLibraries.end()) | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Might be better to use std::array<CStr, 3> or at least std::array<std::string, 3>
First argument is type, other is size. don't forget to #include <array>
Bonus, would be nice to read them from a file :)