Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MapGenerator.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | bool CMapGeneratorWorker::LoadScripts(const std::wstring& libraryName) | ||||
// Mark this as loaded, to prevent it recursively loading itself | // Mark this as loaded, to prevent it recursively loading itself | ||||
m_LoadedLibraries.insert(libraryName); | m_LoadedLibraries.insert(libraryName); | ||||
VfsPath path = L"maps/random/" + libraryName + L"/"; | VfsPath path = L"maps/random/" + libraryName + L"/"; | ||||
VfsPaths pathnames; | VfsPaths pathnames; | ||||
// Load all scripts in mapgen directory | // Load all scripts in mapgen directory | ||||
Status ret = vfs::GetPathnames(g_VFS, path, L"*.js", pathnames); | // Sort them, so that modders can extend code from previously loaded files. | ||||
Status ret = vfs::GetPathnames(g_VFS, path, L"*.js", pathnames, true); | |||||
if (ret == INFO::OK) | if (ret == INFO::OK) | ||||
{ | { | ||||
for (const VfsPath& p : pathnames) | for (const VfsPath& p : pathnames) | ||||
{ | { | ||||
LOGMESSAGE("Loading map generator script '%s'", p.string8()); | LOGMESSAGE("Loading map generator script '%s'", p.string8()); | ||||
if (!m_ScriptInterface->LoadGlobalScriptFile(p)) | if (!m_ScriptInterface->LoadGlobalScriptFile(p)) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator