Merge with develop

This commit is contained in:
kervala 2016-01-16 23:50:23 +01:00
parent 8bda57bf89
commit 6995adfbc7
8 changed files with 98 additions and 33 deletions

View file

@ -30,7 +30,9 @@ script:
- cmake --build build -- -j 2 - cmake --build build -- -j 2
notifications: notifications:
irc: "chat.freenode.net#ryzom" irc:
channels:
- "chat.freenode.net#ryzom"
template: template:
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}" - "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}"
- "Description : %{commit_message}" - "Description : %{commit_message}"

View file

@ -31,6 +31,11 @@ IF(COMMAND cmake_policy)
# Works around warnings about escaped quotes in ADD_DEFINITIONS # Works around warnings about escaped quotes in ADD_DEFINITIONS
# statements # statements
cmake_policy(SET CMP0005 OLD) cmake_policy(SET CMP0005 OLD)
# allow to link to qtmain automatically under Windows
IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF()
ENDIF(COMMAND cmake_policy) ENDIF(COMMAND cmake_policy)
INCLUDE(nel) INCLUDE(nel)

View file

@ -253,7 +253,9 @@ inline lua_Integer CLuaState::toInteger(int index)
{ {
//H_AUTO(Lua_CLuaState_toInteger) //H_AUTO(Lua_CLuaState_toInteger)
checkIndex(index); checkIndex(index);
#if LUA_VERSION_NUM >= 503
sint isnum = 0; sint isnum = 0;
// lua_tointeger fails with decimal numbers under Lua 5.3
lua_Integer res = lua_tointegerx(_State, index, &isnum); lua_Integer res = lua_tointegerx(_State, index, &isnum);
if (!isnum) if (!isnum)
{ {
@ -262,6 +264,9 @@ inline lua_Integer CLuaState::toInteger(int index)
res = (lua_Integer)d; res = (lua_Integer)d;
} }
return res; return res;
#else
return lua_tointeger(_State, index);
#endif
} }
//================================================================================ //================================================================================

View file

@ -70,7 +70,7 @@ void CCmdArgs::addArg(const std::string &helpName, const std::string &helpDescri
bool CCmdArgs::haveArg(const std::string &argName) const bool CCmdArgs::haveArg(const std::string &argName) const
{ {
// process each argument // process each argument
for(uint i = 0; i < _Args.size(); i) for(uint i = 0; i < _Args.size(); ++i)
{ {
const TArg &arg = _Args[i]; const TArg &arg = _Args[i];

View file

@ -15,7 +15,6 @@ SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES}) QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES})
CMAKE_POLICY(SET CMP0020 NEW)
ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC} ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC}
${SRCS} ${SRCS}
${HDRS} ${HDRS}

View file

@ -11,7 +11,6 @@ SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES}) QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES})
CMAKE_POLICY(SET CMP0020 NEW)
NL_TARGET_LIB(shared_widgets ${SRCS} ${HDRS} ${RSRC} ${RESOURCE_ADDED}) NL_TARGET_LIB(shared_widgets ${SRCS} ${HDRS} ${RSRC} ${RESOURCE_ADDED})
TARGET_LINK_LIBRARIES(shared_widgets nelmisc nel3d Qt5::Widgets) TARGET_LINK_LIBRARIES(shared_widgets nelmisc nel3d Qt5::Widgets)

View file

@ -59,19 +59,19 @@ struct CSheetWordListBuilder : public IWordListBuilder
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName) virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName)
{ {
SheetExt= toLower(SheetExt); SheetExt= toLower(SheetExt);
// verify the directory is correct // verify the directory is correct
if(!CFile::isDirectory(SheetPath)) if(!CFile::isDirectory(SheetPath))
{ {
nlwarning("Error: Directory '%s' not found. '%s' Aborted", SheetPath.c_str(), workSheetFileName.c_str()); nlwarning("Error: Directory '%s' not found. '%s' Aborted", SheetPath.c_str(), workSheetFileName.c_str());
return false; return false;
} }
// list all files. // list all files.
std::vector<string> allFiles; std::vector<string> allFiles;
allFiles.reserve(100000); allFiles.reserve(100000);
CPath::getPathContent(SheetPath, true, false, true, allFiles, NULL); CPath::getPathContent(SheetPath, true, false, true, allFiles, NULL);
// Keep only the extension we want, and remove "_" (parent) // Keep only the extension we want, and remove "_" (parent)
allWords.clear(); allWords.clear();
allWords.reserve(allFiles.size()); allWords.reserve(allFiles.size());
@ -91,7 +91,7 @@ struct CSheetWordListBuilder : public IWordListBuilder
return true; return true;
} }
}; };
@ -103,7 +103,7 @@ struct CRegionPrimWordListBuilder : public IWordListBuilder
{ {
string PrimPath; string PrimPath;
vector<string> PrimFilter; vector<string> PrimFilter;
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName) virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName)
{ {
// verify the directory is correct // verify the directory is correct
@ -112,12 +112,12 @@ struct CRegionPrimWordListBuilder : public IWordListBuilder
nlwarning("Error: Directory '%s' not found. '%s' Aborted", PrimPath.c_str(), workSheetFileName.c_str()); nlwarning("Error: Directory '%s' not found. '%s' Aborted", PrimPath.c_str(), workSheetFileName.c_str());
return false; return false;
} }
// list all files. // list all files.
std::vector<string> allFiles; std::vector<string> allFiles;
allFiles.reserve(100000); allFiles.reserve(100000);
CPath::getPathContent(PrimPath, true, false, true, allFiles, NULL); CPath::getPathContent(PrimPath, true, false, true, allFiles, NULL);
// parse all primitive that match the filter // parse all primitive that match the filter
allWords.clear(); allWords.clear();
allWords.reserve(100000); allWords.reserve(100000);
@ -146,11 +146,11 @@ struct CRegionPrimWordListBuilder : public IWordListBuilder
return false; return false;
} }
CPrimitiveContext::instance().CurrentPrimitive = NULL; CPrimitiveContext::instance().CurrentPrimitive = NULL;
// For all primitives of interest // For all primitives of interest
const char *listClass[]= {"continent", "region", "place", "stable", const char *listClass[]= {"continent", "region", "place", "stable",
"teleport_destination", "room_template"}; "teleport_destination", "room_template"};
const char *listProp[]= {"name", "name", "name", "name", const char *listProp[]= {"name", "name", "name", "name",
"place_name", "place_name"}; "place_name", "place_name"};
const uint numListClass= sizeof(listClass)/sizeof(listClass[0]); const uint numListClass= sizeof(listClass)/sizeof(listClass[0]);
const uint numListProp= sizeof(listProp)/sizeof(listProp[0]); const uint numListProp= sizeof(listProp)/sizeof(listProp[0]);
@ -178,7 +178,7 @@ struct CRegionPrimWordListBuilder : public IWordListBuilder
} }
} }
} }
return true; return true;
} }
}; };
@ -199,7 +199,7 @@ void extractNewWords(string workSheetFileName, string columnId, IWordListBuilder
} }
// get the key column index // get the key column index
uint keyColIndex = 0; uint keyColIndex = 0;
if(!workSheet.findCol(columnId, keyColIndex)) if(!workSheet.findCol(columnId, keyColIndex))
{ {
nlwarning("Error: Don't find the column '%s'. '%s' Aborted", columnId.c_str(), workSheetFileName.c_str()); nlwarning("Error: Don't find the column '%s'. '%s' Aborted", columnId.c_str(), workSheetFileName.c_str());
@ -220,7 +220,7 @@ void extractNewWords(string workSheetFileName, string columnId, IWordListBuilder
ucstring key= workSheetLwr.getData(i, keyColIndex); ucstring key= workSheetLwr.getData(i, keyColIndex);
workSheetLwr.setData(i, keyColIndex, toLower(key)); workSheetLwr.setData(i, keyColIndex, toLower(key));
} }
// **** List all words with the builder given // **** List all words with the builder given
std::vector<string> allWords; std::vector<string> allWords;
@ -247,7 +247,7 @@ void extractNewWords(string workSheetFileName, string columnId, IWordListBuilder
workSheet.resize(workSheet.size()+1); workSheet.resize(workSheet.size()+1);
workSheet.setData(rowIdx, keyColIndex, keyName); workSheet.setData(rowIdx, keyColIndex, keyName);
workSheet.setData(rowIdx, nameColIndex, string("<GEN>")+keyName); workSheet.setData(rowIdx, nameColIndex, string("<GEN>")+keyName);
nbAdd++; nbAdd++;
} }
} }
@ -284,7 +284,7 @@ void extractNewWords(string workSheetFileName, string columnId, IWordListBuilder
{ {
nbRemove++; nbRemove++;
// log // log
NLMISC::InfoLog->displayRawNL("'%s': '%s' entry erased at line '%d'.", workSheetFileName.c_str(), NLMISC::InfoLog->displayRawNL("'%s': '%s' entry erased at line '%d'.", workSheetFileName.c_str(),
keyStr.c_str(), i); keyStr.c_str(), i);
} }
} }
@ -343,12 +343,12 @@ int extractNewSheetNames(int argc, char *argv[])
return -1; return -1;
} }
} }
// **** avoid some flood // **** avoid some flood
NLMISC::createDebug(); NLMISC::createDebug();
NLMISC::DebugLog->addNegativeFilter("numCol changed to"); NLMISC::DebugLog->addNegativeFilter("numCol changed to");
NLMISC::InfoLog->addNegativeFilter("CPath::addSearchPath"); NLMISC::InfoLog->addNegativeFilter("CPath::addSearchPath");
// **** read the configuration file // **** read the configuration file
CConfigFile cf; CConfigFile cf;
@ -368,21 +368,19 @@ int extractNewSheetNames(int argc, char *argv[])
CPath::addSearchPath(NLMISC::expandEnvironmentVariables(pathNoRecurse.asString(i)), false, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(pathNoRecurse.asString(i)), false, false);
} }
std::string leveldesignDataPath = NLMISC::expandEnvironmentVariables(leveldesignDataPathVar.asString()); std::string leveldesignDataPath = CPath::standardizePath(NLMISC::expandEnvironmentVariables(leveldesignDataPathVar.asString()));
// init ligo config once // init ligo config once
string ligoPath = CPath::lookup(NLMISC::expandEnvironmentVariables(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;
// **** Parse all the different type of sheets // **** Parse all the different type of sheets
const char *sheetDefs[]= const char *sheetDefs[]=
{ {
// 1st is the name of the worksheet file. // 1st is the name of the worksheet file.
// 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", "leveldesign/game_element/sitem", "work/item_words_wk.txt", "item ID", "sitem", "leveldesign/game_element/sitem",
@ -391,28 +389,26 @@ int extractNewSheetNames(int argc, char *argv[])
"work/sphrase_words_wk.txt", "sphrase ID", "sphrase", "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]));
// For all different type of sheet // For all different type of sheet
for(uint i=0;i<numSheetDefs;i++) for(uint i=0;i<numSheetDefs;i++)
{ {
CSheetWordListBuilder builder; CSheetWordListBuilder builder;
builder.SheetExt= sheetDefs[i*4+2]; builder.SheetExt= sheetDefs[i*4+2];
builder.SheetPath= CPath::standardizePath(leveldesignDataPath) + sheetDefs[i*4+3]; builder.SheetPath= 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);
} }
// **** Parse place and region names // **** Parse place and region names
{ {
// build place names // build place names
CRegionPrimWordListBuilder builder; CRegionPrimWordListBuilder builder;
builder.PrimPath= leveldesignDataPath; builder.PrimPath= leveldesignDataPath + "primitives";
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);
} }
return 0; return 0;
} }

View file

@ -0,0 +1,59 @@
// This cfg is used for bot names extraction
// This paths are recursives
Paths =
{
// word editor class config file are here
"$RYZOM_LEVELDESIGN/leveldesign/world_editor_files",
// all the primitives we want to parse are here
"$RYZOM_LEVELDESIGN/primitives"
};
// This paths are non recursives
PathsNoRecurse =
{
// allow the prog to load the sheet_id.bin file.
"$RYZOM_LEVELDESIGN/leveldesign/Game_elem",
// path for world_editor_class.xml
"$RYZOM_LEVELDESIGN/leveldesign/world_editor_files",
};
LeveldesignDataPath = "$RYZOM_LEVELDESIGN";
// This paths are recursive and parsed only if the creature data packed sheet is not found (this take time)
GeorgesPaths =
{
// the DFNs
"$RYZOM_LEVELDESIGN/leveldesign/DFN",
// All the creature and npc sheets
"$RYZOM_LEVELDESIGN/leveldesign/Game_elem/creature"
};
// The filters, if the fullpath to a file contains a part of this filter, it is rejected
Filters =
{
// we don't want backuped primitives !
"backup_old",
// nor the test primitives !
"test_",
/* "botobject",
"deposit",
"dynfauna",
"dynnpc",
"invasion",
"staticfauna",
"task"
*/
};
// This is the name of the world_editor_classes.xml file.
LigoClassFile = "world_editor_classes.xml";
// Path to the working bot name file
WorkBotNamesFile = "work/bot_names.txt";
// Path to the translated bot names file
TransBotNamesFile = "translated/bot_names.txt";
// Path to the work title file
WorkTitleFile = "work/title_words_wk.txt";