mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 01:06:19 +00:00
Merge with develop
This commit is contained in:
parent
8d905df095
commit
6a5fc56ce0
20 changed files with 246 additions and 175 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include "nel/misc/debug.h"
|
#include "nel/misc/debug.h"
|
||||||
#include "nel/misc/stream.h"
|
#include "nel/misc/stream.h"
|
||||||
#include "nel/misc/rgba.h"
|
#include "nel/misc/rgba.h"
|
||||||
|
#include "nel/misc/path.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -82,8 +83,8 @@ public:
|
||||||
// not free
|
// not free
|
||||||
_Flags&=~NL3D_CTILE_FREE_FLAG;
|
_Flags&=~NL3D_CTILE_FREE_FLAG;
|
||||||
|
|
||||||
// set filename
|
// set filename, replacing \\ by / if needed
|
||||||
_BitmapName[bitmapType]=name;
|
_BitmapName[bitmapType] = NLMISC::CPath::standardizePath(name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getFileName (TBitmap bitmapType) const
|
std::string getFileName (TBitmap bitmapType) const
|
||||||
|
|
|
@ -360,6 +360,11 @@ sint launchProgramAndWaitForResult (const std::string &programName, const std::s
|
||||||
/// This function executes a program and returns output as a string
|
/// This function executes a program and returns output as a string
|
||||||
std::string getCommandOutput(const std::string &command);
|
std::string getCommandOutput(const std::string &command);
|
||||||
|
|
||||||
|
/// This function replace all environment variables in a string by their content.
|
||||||
|
/// Environment variables names can use both Windows (%NAME%) and UNIX syntax ($NAME)
|
||||||
|
/// Authorized characters in names are A-Z, a-z, 0-9 and _
|
||||||
|
std::string expandEnvironmentVariables(const std::string &s);
|
||||||
|
|
||||||
/// This function kills a program using his pid (on unix, it uses the kill() POSIX function)
|
/// This function kills a program using his pid (on unix, it uses the kill() POSIX function)
|
||||||
bool killProgram(uint32 pid);
|
bool killProgram(uint32 pid);
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,7 @@ public:
|
||||||
static void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
|
static void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
|
||||||
|
|
||||||
/** Create a list of file having the requested string in the path and the requested extension
|
/** Create a list of file having the requested string in the path and the requested extension
|
||||||
*/
|
*/
|
||||||
static void getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames);
|
static void getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames);
|
||||||
|
|
||||||
/** Make a path relative to another if possible, else doesn't change it.
|
/** Make a path relative to another if possible, else doesn't change it.
|
||||||
|
@ -508,18 +508,24 @@ public:
|
||||||
static bool makePathRelative (const char *basePath, std::string &relativePath);
|
static bool makePathRelative (const char *basePath, std::string &relativePath);
|
||||||
|
|
||||||
/** Make path absolute
|
/** Make path absolute
|
||||||
* \param relativePath - The relative path
|
* \param relativePath - The relative path
|
||||||
* \param directory - the directory to which the path is relative to
|
* \param directory - the directory to which the path is relative to
|
||||||
* returns the absolute path, or empty if something went wrong.
|
* returns the absolute path, or empty if something went wrong.
|
||||||
*/
|
*/
|
||||||
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory );
|
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory );
|
||||||
|
|
||||||
|
/** Return if a path is absolute or not.
|
||||||
|
* \param path - The path
|
||||||
|
* returns true if path is absolute or false if relative.
|
||||||
|
*/
|
||||||
|
static bool isAbsolutePath (const std::string &path);
|
||||||
|
|
||||||
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
|
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
|
||||||
*/
|
*/
|
||||||
static void addIgnoredDoubleFile(const std::string &ignoredFile);
|
static void addIgnoredDoubleFile(const std::string &ignoredFile);
|
||||||
|
|
||||||
/** For the moment after memoryCompress you cant addsearchpath anymore
|
/** For the moment after memoryCompress you cant addsearchpath anymore
|
||||||
*/
|
*/
|
||||||
static void memoryCompress();
|
static void memoryCompress();
|
||||||
|
|
||||||
static void memoryUncompress();
|
static void memoryUncompress();
|
||||||
|
@ -527,17 +533,17 @@ public:
|
||||||
static bool isMemoryCompressed() { return getInstance()->_FileContainer.isMemoryCompressed(); }
|
static bool isMemoryCompressed() { return getInstance()->_FileContainer.isMemoryCompressed(); }
|
||||||
|
|
||||||
/** Get the ms windows directory (in standardized way with end slash), or returns an empty string on other os
|
/** Get the ms windows directory (in standardized way with end slash), or returns an empty string on other os
|
||||||
*/
|
*/
|
||||||
static std::string getWindowsDirectory();
|
static std::string getWindowsDirectory();
|
||||||
|
|
||||||
/** Get application directory.
|
/** Get application directory.
|
||||||
* \return directory where applications should write files.
|
* \return directory where applications should write files.
|
||||||
*/
|
*/
|
||||||
static std::string getApplicationDirectory(const std::string &appName = "");
|
static std::string getApplicationDirectory(const std::string &appName = "");
|
||||||
|
|
||||||
/** Get a temporary directory.
|
/** Get a temporary directory.
|
||||||
* \return temporary directory where applications should write files.
|
* \return temporary directory where applications should write files.
|
||||||
*/
|
*/
|
||||||
static std::string getTemporaryDirectory();
|
static std::string getTemporaryDirectory();
|
||||||
|
|
||||||
// release singleton
|
// release singleton
|
||||||
|
@ -612,7 +618,7 @@ struct CFile
|
||||||
* Return the position between [begin,end[ of the last separator between path and filename ('/' or '\').
|
* Return the position between [begin,end[ of the last separator between path and filename ('/' or '\').
|
||||||
* If there's no separator, it returns string::npos.
|
* If there's no separator, it returns string::npos.
|
||||||
*/
|
*/
|
||||||
static int getLastSeparator (const std::string &filename);
|
static std::string::size_type getLastSeparator (const std::string &filename);
|
||||||
|
|
||||||
static std::string getFilenameWithoutExtension (const std::string &filename);
|
static std::string getFilenameWithoutExtension (const std::string &filename);
|
||||||
static std::string getExtension (const std::string &filename);
|
static std::string getExtension (const std::string &filename);
|
||||||
|
|
|
@ -913,6 +913,80 @@ std::string getCommandOutput(const std::string &command)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string expandEnvironmentVariables(const std::string &s)
|
||||||
|
{
|
||||||
|
size_t len = s.length();
|
||||||
|
std::string ret;
|
||||||
|
|
||||||
|
std::string::size_type pos1 = 0, pos2 = 0;
|
||||||
|
|
||||||
|
// look for environement variables delimiters
|
||||||
|
while(pos2 < len && (pos1 = s.find_first_of("%$", pos2)) != std::string::npos)
|
||||||
|
{
|
||||||
|
// copy string unprocessed part
|
||||||
|
ret += s.substr(pos2, pos1-pos2);
|
||||||
|
|
||||||
|
// extract a valid variable name (a-zA-Z0-9_)
|
||||||
|
pos2 = pos1+1;
|
||||||
|
|
||||||
|
while(pos2 < len && (isalnum(s[pos2]) || s[pos2] == '_')) ++pos2;
|
||||||
|
|
||||||
|
// check if variable name is empty
|
||||||
|
bool found = pos2 > pos1+1;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
// found at least 1 character
|
||||||
|
name = s.substr(pos1+1, pos2-pos1-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Windows format needs a trailing % delimiter
|
||||||
|
if (found && s[pos1] == '%')
|
||||||
|
{
|
||||||
|
if (pos2 >= len || s[pos2] != '%')
|
||||||
|
{
|
||||||
|
// not a variable name, because no trailing %
|
||||||
|
found = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// found a trailing %, next character to check
|
||||||
|
++pos2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// get variable value if name found
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
const char *value = getenv(name.c_str());
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
// value found
|
||||||
|
ret += std::string(value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// value not found
|
||||||
|
found = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
// variable or value not found, don't evaluate variable
|
||||||
|
ret += s.substr(pos1, pos2-pos1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy last unprocessed part
|
||||||
|
ret += s.substr(pos2);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display the bits (with 0 and 1) composing a byte (from right to left)
|
* Display the bits (with 0 and 1) composing a byte (from right to left)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1854,7 +1854,7 @@ std::string CFileContainer::getTemporaryDirectory()
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int CFile::getLastSeparator (const string &filename)
|
std::string::size_type CFile::getLastSeparator (const string &filename)
|
||||||
{
|
{
|
||||||
string::size_type pos = filename.find_last_of ('/');
|
string::size_type pos = filename.find_last_of ('/');
|
||||||
if (pos == string::npos)
|
if (pos == string::npos)
|
||||||
|
@ -1865,7 +1865,7 @@ int CFile::getLastSeparator (const string &filename)
|
||||||
pos = filename.find_last_of ('@');
|
pos = filename.find_last_of ('@');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (int)pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CFile::getFilename (const string &filename)
|
string CFile::getFilename (const string &filename)
|
||||||
|
@ -2597,6 +2597,25 @@ std::string CPath::makePathAbsolute( const std::string &relativePath, const std:
|
||||||
return npath;
|
return npath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CPath::isAbsolutePath(const std::string &path)
|
||||||
|
{
|
||||||
|
if (path.empty()) return false;
|
||||||
|
|
||||||
|
#ifdef NL_OS_WINDOWS
|
||||||
|
// Windows root of current disk. Eg.: "\" or
|
||||||
|
// Windows network address. Eg.: \\someshare\path
|
||||||
|
if (path[0] == '\\') return true;
|
||||||
|
|
||||||
|
// Normal Windows absolute path. Eg.: C:\something
|
||||||
|
if (path.length() > 2 && isalpha(path[0]) && (path[1] == ':' ) && ((path[2] == '\\') || (path[2] == '/' ))) return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Unix filesystem absolute path (works also under Windows)
|
||||||
|
if (path[0] == '/') return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CFile::setRWAccess(const std::string &filename)
|
bool CFile::setRWAccess(const std::string &filename)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
|
@ -1169,7 +1169,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < var->size(); i++)
|
for (uint i = 0; i < var->size(); i++)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath (var->asString(i), true, false);
|
CPath::addSearchPath (NLMISC::expandEnvironmentVariables(var->asString(i)), true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1177,7 +1177,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < var->size(); i++)
|
for (uint i = 0; i < var->size(); i++)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath (var->asString(i), false, false);
|
CPath::addSearchPath (NLMISC::expandEnvironmentVariables(var->asString(i)), false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,16 +50,6 @@ bool recompute (const char* f1, const char* f2)
|
||||||
return buf1.st_mtime > buf2.st_mtime;
|
return buf1.st_mtime > buf2.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if the file exist
|
|
||||||
bool isFileExist (const char* sName)
|
|
||||||
{
|
|
||||||
FILE *pFile=fopen (sName, "rb");
|
|
||||||
if (!pFile)
|
|
||||||
return false;
|
|
||||||
fclose (pFile);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill tile far pixel with this bitmap
|
// Fill tile far pixel with this bitmap
|
||||||
bool fillTileFar (uint tile, const char* sName, CTileFarBank::TFarType type, CTileFarBank& farBank, bool _256, uint8 rotate)
|
bool fillTileFar (uint tile, const char* sName, CTileFarBank::TFarType type, CTileFarBank& farBank, bool _256, uint8 rotate)
|
||||||
{
|
{
|
||||||
|
@ -90,7 +80,7 @@ bool fillTileFar (uint tile, const char* sName, CTileFarBank::TFarType type, CTi
|
||||||
// Get bitmap size
|
// Get bitmap size
|
||||||
uint width=bitmap.getWidth();
|
uint width=bitmap.getWidth();
|
||||||
uint height=bitmap.getHeight();
|
uint height=bitmap.getHeight();
|
||||||
|
|
||||||
|
|
||||||
// Check size..
|
// Check size..
|
||||||
if ((!((_256&&(width==256)&&(height==256))||((!_256)&&(width==128)&&(height==128)))))
|
if ((!((_256&&(width==256)&&(height==256))||((!_256)&&(width==128)&&(height==128)))))
|
||||||
|
@ -163,8 +153,6 @@ int main (int argc, char **argv)
|
||||||
outputVersion=true;
|
outputVersion=true;
|
||||||
if (strcmp (argv[n], "-?")==0)
|
if (strcmp (argv[n], "-?")==0)
|
||||||
outputHelp=true;
|
outputHelp=true;
|
||||||
if (strcmp (argv[n], "-?")==0)
|
|
||||||
outputHelp=true;
|
|
||||||
if (strncmp (argv[n], "-d", 2)==0)
|
if (strncmp (argv[n], "-d", 2)==0)
|
||||||
{
|
{
|
||||||
rootDir = argv[n];
|
rootDir = argv[n];
|
||||||
|
@ -192,7 +180,6 @@ int main (int argc, char **argv)
|
||||||
"\t-d#: change the root directory of the small bank. # is the new directory\n"
|
"\t-d#: change the root directory of the small bank. # is the new directory\n"
|
||||||
"\t-p#: postfix tiles filename by #\n"
|
"\t-p#: postfix tiles filename by #\n"
|
||||||
"\t-r: load the bitmaps from the current directory\n"
|
"\t-r: load the bitmaps from the current directory\n"
|
||||||
"\t-r: load the bitmaps from the current directory\n"
|
|
||||||
"\t-f: force recomputation of all the tiles\n"
|
"\t-f: force recomputation of all the tiles\n"
|
||||||
"\t-v: print the version\n"
|
"\t-v: print the version\n"
|
||||||
"\t-?: print help\n"
|
"\t-?: print help\n"
|
||||||
|
@ -223,7 +210,7 @@ int main (int argc, char **argv)
|
||||||
// Serial the bank in input
|
// Serial the bank in input
|
||||||
farBank.serial (inputFarBank);
|
farBank.serial (inputFarBank);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force recomputation ?
|
// Force recomputation ?
|
||||||
if (recompute (argv[1], argv[2]))
|
if (recompute (argv[1], argv[2]))
|
||||||
{
|
{
|
||||||
|
@ -287,8 +274,8 @@ int main (int argc, char **argv)
|
||||||
if (pTile->getRelativeFileName (CTile::diffuse)!="")
|
if (pTile->getRelativeFileName (CTile::diffuse)!="")
|
||||||
{
|
{
|
||||||
// File exist ?
|
// File exist ?
|
||||||
string tileFilename = bank.getAbsPath()+pTile->getRelativeFileName (CTile::diffuse);
|
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::diffuse), false);
|
||||||
if (isFileExist (tileFilename.c_str()))
|
if (CFile::fileExists(tileFilename))
|
||||||
{
|
{
|
||||||
// Recompute it?
|
// Recompute it?
|
||||||
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
||||||
|
@ -307,7 +294,7 @@ int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
// One more tile
|
// One more tile
|
||||||
tileCount++;
|
tileCount++;
|
||||||
|
|
||||||
printf ("Skipping %s...\n", tileFilename.c_str());
|
printf ("Skipping %s...\n", tileFilename.c_str());
|
||||||
bDeleteDiffuse=false;
|
bDeleteDiffuse=false;
|
||||||
}
|
}
|
||||||
|
@ -318,8 +305,8 @@ int main (int argc, char **argv)
|
||||||
if (pTile->getRelativeFileName (CTile::additive)!="")
|
if (pTile->getRelativeFileName (CTile::additive)!="")
|
||||||
{
|
{
|
||||||
// File exist ?
|
// File exist ?
|
||||||
string tileFilename = bank.getAbsPath()+pTile->getRelativeFileName (CTile::additive);
|
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::additive), false);
|
||||||
if (isFileExist (tileFilename.c_str()))
|
if (CFile::fileExists(tileFilename))
|
||||||
{
|
{
|
||||||
// Recompute it?
|
// Recompute it?
|
||||||
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
||||||
|
@ -349,8 +336,8 @@ int main (int argc, char **argv)
|
||||||
if (pTile->getRelativeFileName (CTile::alpha)!="")
|
if (pTile->getRelativeFileName (CTile::alpha)!="")
|
||||||
{
|
{
|
||||||
// File exist ?
|
// File exist ?
|
||||||
string tileFilename = bank.getAbsPath()+pTile->getRelativeFileName (CTile::alpha);
|
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::alpha), false);
|
||||||
if (isFileExist (tileFilename.c_str()))
|
if (CFile::fileExists(tileFilename))
|
||||||
{
|
{
|
||||||
// Recompute it?
|
// Recompute it?
|
||||||
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
||||||
|
@ -418,7 +405,7 @@ int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
nlwarning ("ERROR Can't open file %s for reading\n", argv[1]);
|
nlwarning ("ERROR Can't open file %s for reading\n", argv[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// exit
|
// exit
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -616,6 +616,63 @@ void initStereoDisplayDevice()
|
||||||
IStereoDisplay::releaseUnusedLibraries();
|
IStereoDisplay::releaseUnusedLibraries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void addPaths(IProgressCallback &progress, const std::vector<std::string> &paths, bool recurse)
|
||||||
|
{
|
||||||
|
// all prefixes for paths
|
||||||
|
std::vector<std::string> directoryPrefixes;
|
||||||
|
|
||||||
|
// current directory has priority everywhere
|
||||||
|
directoryPrefixes.push_back("");
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
char path[MAX_PATH];
|
||||||
|
GetModuleFileNameA(GetModuleHandleA(NULL), path, MAX_PATH);
|
||||||
|
|
||||||
|
// check in same directory as executable
|
||||||
|
directoryPrefixes.push_back(CPath::standardizePath(CFile::getPath(path)));
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
// check in bundle (Installer)
|
||||||
|
directoryPrefixes.push_back(CPath::standardizePath(getAppBundlePath() + "/Contents/Resources"));
|
||||||
|
|
||||||
|
// check in same directory as bundle (Steam)
|
||||||
|
directoryPrefixes.push_back(CPath::standardizePath(getAppBundlePath());
|
||||||
|
#elif defined(NL_OS_UNIX)
|
||||||
|
if (CFile::isDirectory(getRyzomSharePrefix())) directoryPrefixes.push_back(CPath::standardizePath(getRyzomSharePrefix()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float total = (float)(directoryPrefixes.size() * paths.size());
|
||||||
|
float current = 0.f, next = 0.f;
|
||||||
|
|
||||||
|
for (uint j = 0; j < directoryPrefixes.size(); j++)
|
||||||
|
{
|
||||||
|
std::string directoryPrefix = directoryPrefixes[j];
|
||||||
|
|
||||||
|
for (uint i = 0; i < paths.size(); i++)
|
||||||
|
{
|
||||||
|
std::string directory = NLMISC::expandEnvironmentVariables(paths[i]);
|
||||||
|
|
||||||
|
// only prepend default directory if path is relative
|
||||||
|
if (!directory.empty() && !directoryPrefix.empty() && !CPath::isAbsolutePath(directory))
|
||||||
|
{
|
||||||
|
directory = directoryPrefix + directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update next progress value
|
||||||
|
next += 1.f;
|
||||||
|
|
||||||
|
progress.progress (current/total);
|
||||||
|
progress.pushCropedValues (current/total, next/total);
|
||||||
|
|
||||||
|
// next is current value
|
||||||
|
current = next;
|
||||||
|
|
||||||
|
CPath::addSearchPath(directory, recurse, false, &progress);
|
||||||
|
|
||||||
|
progress.popCropedValues ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void addSearchPaths(IProgressCallback &progress)
|
void addSearchPaths(IProgressCallback &progress)
|
||||||
{
|
{
|
||||||
// Add search path of UI addon. Allow only a subset of files.
|
// Add search path of UI addon. Allow only a subset of files.
|
||||||
|
@ -625,54 +682,13 @@ void addSearchPaths(IProgressCallback &progress)
|
||||||
// Add Standard search paths
|
// Add Standard search paths
|
||||||
{
|
{
|
||||||
H_AUTO(InitRZAddSearchPath2)
|
H_AUTO(InitRZAddSearchPath2)
|
||||||
for (uint i = 0; i < ClientCfg.DataPath.size(); i++)
|
|
||||||
{
|
|
||||||
progress.progress ((float)i/(float)ClientCfg.DataPath.size());
|
|
||||||
progress.pushCropedValues ((float)i/(float)ClientCfg.DataPath.size(), (float)(i+1)/(float)ClientCfg.DataPath.size());
|
|
||||||
|
|
||||||
CPath::addSearchPath(ClientCfg.DataPath[i], true, false, &progress);
|
addPaths(progress, ClientCfg.DataPath, true);
|
||||||
|
|
||||||
progress.popCropedValues ();
|
|
||||||
}
|
|
||||||
|
|
||||||
CPath::loadRemappedFiles("remap_files.csv");
|
CPath::loadRemappedFiles("remap_files.csv");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i = 0; i < ClientCfg.DataPathNoRecurse.size(); i++)
|
addPaths(progress, ClientCfg.DataPathNoRecurse, false);
|
||||||
{
|
|
||||||
progress.progress ((float)i/(float)ClientCfg.DataPathNoRecurse.size());
|
|
||||||
progress.pushCropedValues ((float)i/(float)ClientCfg.DataPathNoRecurse.size(), (float)(i+1)/(float)ClientCfg.DataPathNoRecurse.size());
|
|
||||||
|
|
||||||
CPath::addSearchPath(ClientCfg.DataPathNoRecurse[i], false, false, &progress);
|
|
||||||
|
|
||||||
progress.popCropedValues ();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string defaultDirectory;
|
|
||||||
|
|
||||||
#ifdef NL_OS_MAC
|
|
||||||
defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources");
|
|
||||||
#elif defined(NL_OS_UNIX)
|
|
||||||
if (CFile::isDirectory(getRyzomSharePrefix())) defaultDirectory = CPath::standardizePath(getRyzomSharePrefix());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// add in last position, a specific possibly read only directory
|
|
||||||
if (!defaultDirectory.empty())
|
|
||||||
{
|
|
||||||
for (uint i = 0; i < ClientCfg.DataPath.size(); i++)
|
|
||||||
{
|
|
||||||
// don't prepend default directory if path is absolute
|
|
||||||
if (!ClientCfg.DataPath[i].empty() && ClientCfg.DataPath[i][0] != '/')
|
|
||||||
{
|
|
||||||
progress.progress ((float)i/(float)ClientCfg.DataPath.size());
|
|
||||||
progress.pushCropedValues ((float)i/(float)ClientCfg.DataPath.size(), (float)(i+1)/(float)ClientCfg.DataPath.size());
|
|
||||||
|
|
||||||
CPath::addSearchPath(defaultDirectory + ClientCfg.DataPath[i], true, false, &progress);
|
|
||||||
|
|
||||||
progress.popCropedValues ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPreDataPaths(NLMISC::IProgressCallback &progress)
|
void addPreDataPaths(NLMISC::IProgressCallback &progress)
|
||||||
|
@ -681,43 +697,9 @@ void addPreDataPaths(NLMISC::IProgressCallback &progress)
|
||||||
|
|
||||||
H_AUTO(InitRZAddSearchPaths);
|
H_AUTO(InitRZAddSearchPaths);
|
||||||
|
|
||||||
for (uint i = 0; i < ClientCfg.PreDataPath.size(); i++)
|
addPaths(progress, ClientCfg.PreDataPath, true);
|
||||||
{
|
|
||||||
progress.progress ((float)i/(float)ClientCfg.PreDataPath.size());
|
|
||||||
progress.pushCropedValues ((float)i/(float)ClientCfg.PreDataPath.size(), (float)(i+1)/(float)ClientCfg.PreDataPath.size());
|
|
||||||
|
|
||||||
CPath::addSearchPath(ClientCfg.PreDataPath[i], true, false, &progress);
|
|
||||||
|
|
||||||
progress.popCropedValues ();
|
|
||||||
}
|
|
||||||
|
|
||||||
//nlinfo ("PROFILE: %d seconds for Add search paths Predata", (uint32)(ryzomGetLocalTime ()-initPaths)/1000);
|
//nlinfo ("PROFILE: %d seconds for Add search paths Predata", (uint32)(ryzomGetLocalTime ()-initPaths)/1000);
|
||||||
|
|
||||||
std::string defaultDirectory;
|
|
||||||
|
|
||||||
#ifdef NL_OS_MAC
|
|
||||||
defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources");
|
|
||||||
#elif defined(NL_OS_UNIX)
|
|
||||||
if (CFile::isDirectory(getRyzomSharePrefix())) defaultDirectory = CPath::standardizePath(getRyzomSharePrefix());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// add in last position, a specific possibly read only directory
|
|
||||||
if (!defaultDirectory.empty())
|
|
||||||
{
|
|
||||||
for (uint i = 0; i < ClientCfg.PreDataPath.size(); i++)
|
|
||||||
{
|
|
||||||
// don't prepend default directory if path is absolute
|
|
||||||
if (!ClientCfg.PreDataPath[i].empty() && ClientCfg.PreDataPath[i][0] != '/')
|
|
||||||
{
|
|
||||||
progress.progress ((float)i/(float)ClientCfg.PreDataPath.size());
|
|
||||||
progress.pushCropedValues ((float)i/(float)ClientCfg.PreDataPath.size(), (float)(i+1)/(float)ClientCfg.PreDataPath.size());
|
|
||||||
|
|
||||||
CPath::addSearchPath(defaultDirectory + ClientCfg.PreDataPath[i], true, false, &progress);
|
|
||||||
|
|
||||||
progress.popCropedValues ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addPackedSheetUpdatePaths(NLMISC::IProgressCallback &progress)
|
static void addPackedSheetUpdatePaths(NLMISC::IProgressCallback &progress)
|
||||||
|
@ -726,7 +708,7 @@ static void addPackedSheetUpdatePaths(NLMISC::IProgressCallback &progress)
|
||||||
{
|
{
|
||||||
progress.progress((float)i/(float)ClientCfg.UpdatePackedSheetPath.size());
|
progress.progress((float)i/(float)ClientCfg.UpdatePackedSheetPath.size());
|
||||||
progress.pushCropedValues ((float)i/(float)ClientCfg.UpdatePackedSheetPath.size(), (float)(i+1)/(float)ClientCfg.UpdatePackedSheetPath.size());
|
progress.pushCropedValues ((float)i/(float)ClientCfg.UpdatePackedSheetPath.size(), (float)(i+1)/(float)ClientCfg.UpdatePackedSheetPath.size());
|
||||||
CPath::addSearchPath(ClientCfg.UpdatePackedSheetPath[i], true, false, &progress);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(ClientCfg.UpdatePackedSheetPath[i]), true, false, &progress);
|
||||||
progress.popCropedValues();
|
progress.popCropedValues();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,70 +94,59 @@ void CVisualSlotManager::init()
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
// Display elements read.
|
// Display elements read.
|
||||||
// for(uint i=0; i<_VisualSlot.size(); ++i)
|
for(uint i=0, len = _VisualSlot.size(); i<len; ++i)
|
||||||
// {
|
{
|
||||||
|
_VisualSlot[i].updateMaps();
|
||||||
// for(uint j=0; j<_VisualSlot[i].Element.size(); ++j)
|
// for(uint j=0; j<_VisualSlot[i].Element.size(); ++j)
|
||||||
// nlinfo("Visu: %d Num: %d Id: %d sheet: %s", i, _VisualSlot[i].Element[j].Index, _VisualSlot[i].Element[j].SheetId.asInt(), _VisualSlot[i].Element[j].SheetId.toString().c_str());
|
// nlinfo("Visu: %d Num: %d Id: %d sheet: %s", i, _VisualSlot[i].Element[j].Index, _VisualSlot[i].Element[j].SheetId.asInt(), _VisualSlot[i].Element[j].SheetId.toString().c_str());
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nlwarning("VSMngr:load: cannot open the file '%s'.", filename.c_str());
|
nlwarning("VSMngr:load: cannot open the file '%s'.", filename.c_str());
|
||||||
}// init //
|
}// init //
|
||||||
|
|
||||||
|
void CVisualSlotManager::TElementList::updateMaps()
|
||||||
|
{
|
||||||
|
SheetIdToIndexMap.clear();
|
||||||
|
|
||||||
|
for(uint i=0, len = Element.size(); i<len; ++i)
|
||||||
|
{
|
||||||
|
const TElement &e = Element[i];
|
||||||
|
SheetIdToIndexMap[e.SheetId] = e.Index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
// rightItem2Index :
|
// rightItem2Index :
|
||||||
// Return the visual slot index from a sheet Id for items in right hand.
|
// Return the visual slot index from a sheet Id for items in right hand.
|
||||||
// \todo GUIGUI : Use map for faster search for example
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
uint32 CVisualSlotManager::rightItem2Index(const NLMISC::CSheetId &id)
|
uint32 CVisualSlotManager::rightItem2Index(const NLMISC::CSheetId &id)
|
||||||
{
|
{
|
||||||
if(SLOTTYPE::RIGHT_HAND_SLOT < _VisualSlot.size())
|
return sheet2Index(id, SLOTTYPE::RIGHT_HAND_SLOT);
|
||||||
{
|
|
||||||
for(uint i=0; i<_VisualSlot[SLOTTYPE::RIGHT_HAND_SLOT].Element.size(); ++i)
|
|
||||||
if(_VisualSlot[SLOTTYPE::RIGHT_HAND_SLOT].Element[i].SheetId == id)
|
|
||||||
return _VisualSlot[SLOTTYPE::RIGHT_HAND_SLOT].Element[i].Index;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nlwarning("VSMngr:rightItem2Index: Bad slot -> you probably need to rebuild the tab.");
|
|
||||||
|
|
||||||
// No Item
|
|
||||||
return 0;
|
|
||||||
}// rightItem2Index //
|
}// rightItem2Index //
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
// leftItem2Index :
|
// leftItem2Index :
|
||||||
// Return the visual slot index from a sheet Id for items in left hand.
|
// Return the visual slot index from a sheet Id for items in left hand.
|
||||||
// \todo GUIGUI : Use map for faster search for example
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
uint32 CVisualSlotManager::leftItem2Index(const NLMISC::CSheetId &id)
|
uint32 CVisualSlotManager::leftItem2Index(const NLMISC::CSheetId &id)
|
||||||
{
|
{
|
||||||
if(SLOTTYPE::LEFT_HAND_SLOT < _VisualSlot.size())
|
return sheet2Index(id, SLOTTYPE::LEFT_HAND_SLOT);
|
||||||
{
|
|
||||||
for(uint i=0; i<_VisualSlot[SLOTTYPE::LEFT_HAND_SLOT].Element.size(); ++i)
|
|
||||||
if(_VisualSlot[SLOTTYPE::LEFT_HAND_SLOT].Element[i].SheetId == id)
|
|
||||||
return _VisualSlot[SLOTTYPE::LEFT_HAND_SLOT].Element[i].Index;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nlwarning("VSMngr:leftItem2Index: Bad slot -> you probably need to rebuild the tab.");
|
|
||||||
|
|
||||||
// No Item
|
|
||||||
return 0;
|
|
||||||
}// leftItem2Index //
|
}// leftItem2Index //
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
// sheet2Index :
|
// sheet2Index :
|
||||||
// Return the visual index from a sheet Id and the visual slot.
|
// Return the visual index from a sheet Id and the visual slot.
|
||||||
// \todo GUIGUI : Use map for faster search for example
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
uint32 CVisualSlotManager::sheet2Index(const NLMISC::CSheetId &id, SLOTTYPE::EVisualSlot slot)
|
uint32 CVisualSlotManager::sheet2Index(const NLMISC::CSheetId &id, SLOTTYPE::EVisualSlot slot)
|
||||||
{
|
{
|
||||||
if((uint)slot < _VisualSlot.size())
|
if((uint)slot < _VisualSlot.size())
|
||||||
{
|
{
|
||||||
for(uint i=0; i<_VisualSlot[slot].Element.size(); ++i)
|
const TElementList &el = _VisualSlot[slot];
|
||||||
if(_VisualSlot[slot].Element[i].SheetId == id)
|
TElementList::SheetIdToIndexMapType::const_iterator it = el.SheetIdToIndexMap.find(id);
|
||||||
return _VisualSlot[slot].Element[i].Index;
|
if (it != el.SheetIdToIndexMap.end()) return it->second;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nlwarning("VSMngr:sheet2Index: Bad slot '%d' -> you probably need to rebuild the tab.", (sint)slot);
|
nlwarning("VSMngr:sheet2Index: Bad slot '%d' -> you probably need to rebuild the tab.", (sint)slot);
|
||||||
|
|
|
@ -71,11 +71,17 @@ public:
|
||||||
// elements list for a visual slot.
|
// elements list for a visual slot.
|
||||||
std::vector<TElement> Element;
|
std::vector<TElement> Element;
|
||||||
|
|
||||||
|
// std::map to increase access speed
|
||||||
|
typedef std::map<NLMISC::CSheetId, uint32> SheetIdToIndexMapType;
|
||||||
|
SheetIdToIndexMapType SheetIdToIndexMap;
|
||||||
|
|
||||||
/// Load/Save the values using the serial system
|
/// Load/Save the values using the serial system
|
||||||
void serial(class NLMISC::IStream &s) throw(NLMISC::EStream)
|
void serial(class NLMISC::IStream &s) throw(NLMISC::EStream)
|
||||||
{
|
{
|
||||||
s.serialCont(Element);
|
s.serialCont(Element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateMaps();
|
||||||
} TElementList;
|
} TElementList;
|
||||||
|
|
||||||
typedef std::vector <TElementList> TVisualSlot;
|
typedef std::vector <TElementList> TVisualSlot;
|
||||||
|
|
|
@ -906,7 +906,7 @@ void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
|
||||||
{
|
{
|
||||||
addSearchPath=true;
|
addSearchPath=true;
|
||||||
for (uint32 i=0;i<varPtr->size();++i)
|
for (uint32 i=0;i<varPtr->size();++i)
|
||||||
CPath::addSearchPath(varPtr->asString(i).c_str(), true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false);
|
||||||
}
|
}
|
||||||
loadForm2("aiaction", writeFilesDirectoryName+AISPackedActionSheetsFilename, _ActionSheets, true);
|
loadForm2("aiaction", writeFilesDirectoryName+AISPackedActionSheetsFilename, _ActionSheets, true);
|
||||||
}
|
}
|
||||||
|
@ -918,7 +918,7 @@ void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
|
||||||
{
|
{
|
||||||
addSearchPath=true;
|
addSearchPath=true;
|
||||||
for (uint32 i=0;i<varPtr->size();++i)
|
for (uint32 i=0;i<varPtr->size();++i)
|
||||||
CPath::addSearchPath(varPtr->asString(i).c_str(), true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false);
|
||||||
}
|
}
|
||||||
loadForm("actionlist", writeFilesDirectoryName+AISPackedFightConfigSheetsFilename, _ActionListSheets, true);
|
loadForm("actionlist", writeFilesDirectoryName+AISPackedFightConfigSheetsFilename, _ActionListSheets, true);
|
||||||
}
|
}
|
||||||
|
@ -931,7 +931,7 @@ void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
|
||||||
{
|
{
|
||||||
addSearchPath=true;
|
addSearchPath=true;
|
||||||
for (uint32 i=0;i<varPtr->size();++i)
|
for (uint32 i=0;i<varPtr->size();++i)
|
||||||
CPath::addSearchPath(varPtr->asString(i).c_str(), true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false);
|
||||||
}
|
}
|
||||||
loadForm2("creature", writeFilesDirectoryName+AISPackedSheetsFilename, _Sheets, true);
|
loadForm2("creature", writeFilesDirectoryName+AISPackedSheetsFilename, _Sheets, true);
|
||||||
}
|
}
|
||||||
|
@ -943,7 +943,7 @@ void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
|
||||||
{
|
{
|
||||||
addSearchPath=true;
|
addSearchPath=true;
|
||||||
for (uint32 i=0;i<varPtr->size();++i)
|
for (uint32 i=0;i<varPtr->size();++i)
|
||||||
CPath::addSearchPath(varPtr->asString(i).c_str(), true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false);
|
||||||
}
|
}
|
||||||
loadForm2("race_stats", writeFilesDirectoryName+AISPackedRaceStatsSheetsFilename, _RaceStatsSheets, true);
|
loadForm2("race_stats", writeFilesDirectoryName+AISPackedRaceStatsSheetsFilename, _RaceStatsSheets, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
for(uint i = 0; i < ClientCfg.PreDataPath.size(); ++i)
|
for(uint i = 0; i < ClientCfg.PreDataPath.size(); ++i)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath(ClientCfg.PreDataPath[i], true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(ClientCfg.PreDataPath[i]), true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,7 +390,7 @@ int main()
|
||||||
// add the search paths
|
// add the search paths
|
||||||
for (uint i=0; i<paths.size(); ++i)
|
for (uint i=0; i<paths.size(); ++i)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath(paths.asString(i), true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(paths.asString(i)), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// init ligo
|
// init ligo
|
||||||
|
|
|
@ -145,7 +145,7 @@ void LoadCraftParts()
|
||||||
void LoadCreatureFiles()
|
void LoadCreatureFiles()
|
||||||
{
|
{
|
||||||
printf( "-- REGISTERING CREATURE FILES --\n" );
|
printf( "-- REGISTERING CREATURE FILES --\n" );
|
||||||
CSString inputSheetPath = LEVEL_DESIGN_PATH + "leveldesign\\Game_elem\\Creature\\Fauna\\bestiary";
|
CSString inputSheetPath = LEVEL_DESIGN_PATH + "leveldesign/Game_elem/Creature/Fauna/bestiary";
|
||||||
CPath::addSearchPath( inputSheetPath, true, false );
|
CPath::addSearchPath( inputSheetPath, true, false );
|
||||||
|
|
||||||
vector<string> files;
|
vector<string> files;
|
||||||
|
@ -1472,6 +1472,7 @@ void SetupDirectories()
|
||||||
|
|
||||||
data.readFromFile( "raw_material_generation.cfg" );
|
data.readFromFile( "raw_material_generation.cfg" );
|
||||||
|
|
||||||
|
// beurk :s Use CConfigFile instead
|
||||||
LEVEL_DESIGN_PATH = data.splitFrom( "LevelDesignPath = \"").splitTo( "\"" );
|
LEVEL_DESIGN_PATH = data.splitFrom( "LevelDesignPath = \"").splitTo( "\"" );
|
||||||
TRANSLATION_PATH = data.splitFrom( "TranslationPath = \"" ).splitTo( "\"" );
|
TRANSLATION_PATH = data.splitFrom( "TranslationPath = \"" ).splitTo( "\"" );
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ int main( int argc, char ** argv )
|
||||||
sint i;
|
sint i;
|
||||||
for( i = 0; i< (sint)cvSheetPaths.size(); ++i)
|
for( i = 0; i< (sint)cvSheetPaths.size(); ++i)
|
||||||
{
|
{
|
||||||
sheetPaths.push_back( cvSheetPaths.asString(i) );
|
sheetPaths.push_back(NLMISC::expandEnvironmentVariables(cvSheetPaths.asString(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const EUnknownVar &)
|
catch(const EUnknownVar &)
|
||||||
|
|
|
@ -108,7 +108,7 @@ int main(int argc, char* argv[])
|
||||||
//
|
//
|
||||||
for(uint k = 0; k < builderConfig.SearchPaths.size(); ++k)
|
for(uint k = 0; k < builderConfig.SearchPaths.size(); ++k)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath(builderConfig.SearchPaths[k], true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(builderConfig.SearchPaths[k]), true, false);
|
||||||
}
|
}
|
||||||
CPath::remapExtension("dds", "tga", true);
|
CPath::remapExtension("dds", "tga", true);
|
||||||
CPath::remapExtension("dds", "png", true);
|
CPath::remapExtension("dds", "png", true);
|
||||||
|
|
|
@ -83,7 +83,7 @@ bool init()
|
||||||
// Define the root path that contains all data needed for the application.
|
// Define the root path that contains all data needed for the application.
|
||||||
nlinfo("Adding search paths...");
|
nlinfo("Adding search paths...");
|
||||||
for(uint i = 0; i < AppCfg.DataPath.size(); i++)
|
for(uint i = 0; i < AppCfg.DataPath.size(); i++)
|
||||||
CPath::addSearchPath(AppCfg.DataPath[i], true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(AppCfg.DataPath[i]), true, false);
|
||||||
|
|
||||||
// Initialize Sheet IDs.
|
// Initialize Sheet IDs.
|
||||||
nlinfo("Init SheetId...");
|
nlinfo("Init SheetId...");
|
||||||
|
|
|
@ -542,7 +542,6 @@ sint main( sint argc, char ** argv )
|
||||||
|
|
||||||
|
|
||||||
// output begin skill.h file
|
// output begin skill.h file
|
||||||
//if( ! fo.open( string( "r:/code/ryzom/src_v2/game_share/skills.h" ) ) )
|
|
||||||
if( ! fo.open( srcDir + string( "skills.h" ) ) )
|
if( ! fo.open( srcDir + string( "skills.h" ) ) )
|
||||||
{
|
{
|
||||||
nlwarning(" Can't open file %s for writing", "skills.h" );
|
nlwarning(" Can't open file %s for writing", "skills.h" );
|
||||||
|
@ -648,7 +647,6 @@ sint main( sint argc, char ** argv )
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// begin output skill.cpp file
|
// begin output skill.cpp file
|
||||||
// if( ! fo.open( string( "r:/code/ryzom/src_v2/game_share/skills.cpp" ) ) )
|
|
||||||
if( ! fo.open( srcDir + string( "skills.cpp" ) ) )
|
if( ! fo.open( srcDir + string( "skills.cpp" ) ) )
|
||||||
{
|
{
|
||||||
nlwarning(" Can't open file skills.cpp for writing");
|
nlwarning(" Can't open file skills.cpp for writing");
|
||||||
|
|
|
@ -256,11 +256,11 @@ int extractBotNames(int argc, char *argv[])
|
||||||
|
|
||||||
for (uint i=0; i<paths.size(); ++i)
|
for (uint i=0; i<paths.size(); ++i)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath(paths.asString(i), true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(paths.asString(i)), true, false);
|
||||||
}
|
}
|
||||||
for (uint i=0; i<pathNoRecurse.size(); ++i)
|
for (uint i=0; i<pathNoRecurse.size(); ++i)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath(pathNoRecurse.asString(i), false, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(pathNoRecurse.asString(i)), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i=0; i<filtersVar.size(); ++i)
|
for (uint i=0; i<filtersVar.size(); ++i)
|
||||||
|
@ -278,7 +278,7 @@ int extractBotNames(int argc, char *argv[])
|
||||||
if (Creatures.empty())
|
if (Creatures.empty())
|
||||||
{
|
{
|
||||||
for (uint i=0;i<georgesPaths.size();++i)
|
for (uint i=0;i<georgesPaths.size();++i)
|
||||||
CPath::addSearchPath(georgesPaths.asString(i).c_str(), true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(georgesPaths.asString(i)), true, false);
|
||||||
|
|
||||||
loadForm("creature", PACKED_SHEETS_NAME, Creatures, true);
|
loadForm("creature", PACKED_SHEETS_NAME, Creatures, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,19 +356,22 @@ int extractNewSheetNames(int argc, char *argv[])
|
||||||
CConfigFile::CVar &paths = cf.getVar("Paths");
|
CConfigFile::CVar &paths = cf.getVar("Paths");
|
||||||
CConfigFile::CVar &pathNoRecurse= cf.getVar("PathsNoRecurse");
|
CConfigFile::CVar &pathNoRecurse= cf.getVar("PathsNoRecurse");
|
||||||
CConfigFile::CVar &ligoClassFile= cf.getVar("LigoClassFile");
|
CConfigFile::CVar &ligoClassFile= cf.getVar("LigoClassFile");
|
||||||
|
CConfigFile::CVar &leveldesignDataPathVar = cf.getVar("LeveldesignDataPath");
|
||||||
|
|
||||||
// parse path
|
// parse path
|
||||||
for (uint i=0; i<paths.size(); ++i)
|
for (uint i=0; i<paths.size(); ++i)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath(paths.asString(i), true, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(paths.asString(i)), true, false);
|
||||||
}
|
}
|
||||||
for (uint i=0; i<pathNoRecurse.size(); ++i)
|
for (uint i=0; i<pathNoRecurse.size(); ++i)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath(pathNoRecurse.asString(i), false, false);
|
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(pathNoRecurse.asString(i)), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string leveldesignDataPath = NLMISC::expandEnvironmentVariables(leveldesignDataPathVar.asString());
|
||||||
|
|
||||||
// init ligo config once
|
// init ligo config once
|
||||||
string ligoPath = CPath::lookup(ligoClassFile.asString(), true, true);
|
string ligoPath = CPath::lookup(NLMISC::expandEnvironmentVariables(ligoClassFile.asString()), true, true);
|
||||||
LigoConfig.readPrimitiveClass(ligoPath.c_str(), false);
|
LigoConfig.readPrimitiveClass(ligoPath.c_str(), false);
|
||||||
NLLIGO::Register();
|
NLLIGO::Register();
|
||||||
CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig;
|
CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig;
|
||||||
|
@ -382,10 +385,10 @@ int extractNewSheetNames(int argc, char *argv[])
|
||||||
// 2nd is the Key column identifier.
|
// 2nd is the Key column identifier.
|
||||||
// 3rd is the sheet extension
|
// 3rd is the sheet extension
|
||||||
// 4th is the directory where to find new sheets
|
// 4th is the directory where to find new sheets
|
||||||
"work/item_words_wk.txt", "item ID", "sitem", "l:/leveldesign/game_element/sitem",
|
"work/item_words_wk.txt", "item ID", "sitem", "leveldesign/game_element/sitem",
|
||||||
"work/creature_words_wk.txt", "creature ID", "creature", "l:/leveldesign/game_elem/creature/fauna", // take fauna only because other are special
|
"work/creature_words_wk.txt", "creature ID", "creature", "leveldesign/game_elem/creature/fauna", // take fauna only because other are special
|
||||||
"work/sbrick_words_wk.txt", "sbrick ID", "sbrick", "l:/leveldesign/game_element/sbrick",
|
"work/sbrick_words_wk.txt", "sbrick ID", "sbrick", "leveldesign/game_element/sbrick",
|
||||||
"work/sphrase_words_wk.txt", "sphrase ID", "sphrase", "l:/leveldesign/game_element/sphrase",
|
"work/sphrase_words_wk.txt", "sphrase ID", "sphrase", "leveldesign/game_element/sphrase",
|
||||||
};
|
};
|
||||||
uint numSheetDefs= sizeof(sheetDefs) / (4*sizeof(sheetDefs[0]));
|
uint numSheetDefs= sizeof(sheetDefs) / (4*sizeof(sheetDefs[0]));
|
||||||
|
|
||||||
|
@ -394,7 +397,7 @@ int extractNewSheetNames(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
CSheetWordListBuilder builder;
|
CSheetWordListBuilder builder;
|
||||||
builder.SheetExt= sheetDefs[i*4+2];
|
builder.SheetExt= sheetDefs[i*4+2];
|
||||||
builder.SheetPath= sheetDefs[i*4+3];
|
builder.SheetPath= CPath::standardizePath(leveldesignDataPath) + sheetDefs[i*4+3];
|
||||||
extractNewWords(sheetDefs[i*4+0], sheetDefs[i*4+1], builder);
|
extractNewWords(sheetDefs[i*4+0], sheetDefs[i*4+1], builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,7 +406,7 @@ int extractNewSheetNames(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// build place names
|
// build place names
|
||||||
CRegionPrimWordListBuilder builder;
|
CRegionPrimWordListBuilder builder;
|
||||||
builder.PrimPath= "l:/primitives";
|
builder.PrimPath= leveldesignDataPath;
|
||||||
builder.PrimFilter.push_back("region_*.primitive");
|
builder.PrimFilter.push_back("region_*.primitive");
|
||||||
builder.PrimFilter.push_back("indoors_*.primitive");
|
builder.PrimFilter.push_back("indoors_*.primitive");
|
||||||
extractNewWords("work/place_words_wk.txt", "placeId", builder);
|
extractNewWords("work/place_words_wk.txt", "placeId", builder);
|
||||||
|
|
Loading…
Reference in a new issue