diff --git a/code/ryzom/server/src/input_output_service/string_manager.cpp b/code/ryzom/server/src/input_output_service/string_manager.cpp index 56a351fea..1e1215594 100644 --- a/code/ryzom/server/src/input_output_service/string_manager.cpp +++ b/code/ryzom/server/src/input_output_service/string_manager.cpp @@ -246,60 +246,6 @@ void CStringManager::clearCache(NLMISC::CLog *log) -// load the values using the george sheet -void CStringManager::TSheetInfo::readGeorges (const NLMISC::CSmartPtr &form, const NLMISC::CSheetId &sheetId) -{ - if (form) - { - SheetName = sheetId.toString(); - - std::string ext = NLMISC::CSheetId::fileExtensionFromType(sheetId.getSheetType()); - - SheetName = SheetName.substr(0, SheetName.find(ext)); - // remove ending '.' - if (!SheetName.empty() && *SheetName.rbegin() == '.') - SheetName.resize(SheetName.size()-1); - - std::string gender; - - if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("creature")) - { - form->getRootNode ().getValueByName (gender, "Basics.Gender"); - sint genderId; - NLMISC::fromString(gender, genderId); - Gender = GSGENDER::EGender(genderId); - - form->getRootNode ().getValueByName (Race, "Basics.Race"); - -// form->getRootNode ().getValueByName (DisplayName, "Basics.First Name"); -// std::string s; -// form->getRootNode ().getValueByName (s, "Basics.CharacterName"); -// if (!DisplayName.empty()) -// DisplayName+=' '; -// DisplayName+=s; - - form->getRootNode ().getValueByName (Profile, "Basics.Profile"); - form->getRootNode ().getValueByName (ChatProfile, "Basics.ChatProfile"); - } - else if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("race_stats")) - { - form->getRootNode ().getValueByName (Race, "Race"); - } -/* else if (sheetId.getType() == NLMISC::CSheetId::typeFromFileExtension("sitem")) - { - // read any item specific data - } -*/ else - { - nlwarning("CStringManager::TEntityInfo : Do not know the type of the sheet '%s'.", sheetId.toString().c_str()); - return; - } - } -} - - - - const CStringManager::CEntityWords &CStringManager::getEntityWords(TLanguages lang, STRING_MANAGER::TParamType type) const { nlassert(lang < NB_LANGUAGES); diff --git a/code/ryzom/server/src/input_output_service/string_manager_parser.cpp b/code/ryzom/server/src/input_output_service/string_manager_parser.cpp index dfa8098a3..6022b449d 100644 --- a/code/ryzom/server/src/input_output_service/string_manager_parser.cpp +++ b/code/ryzom/server/src/input_output_service/string_manager_parser.cpp @@ -1864,7 +1864,7 @@ void CStringManager::init(NLMISC::CLog *log) if (_SheetInfo.empty()) { - std::map container; + // std::map container; // Load the sheet std::vector exts; exts.push_back("creature"); diff --git a/code/ryzom/server/src/input_output_service/string_manager_sheet.cpp b/code/ryzom/server/src/input_output_service/string_manager_sheet.cpp new file mode 100644 index 000000000..bb51b987e --- /dev/null +++ b/code/ryzom/server/src/input_output_service/string_manager_sheet.cpp @@ -0,0 +1,75 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stdpch.h" +#include "string_manager.h" +#include "nel/misc/i18n.h" +#include "nel/misc/path.h" +#include "nel/misc/file.h" +#include "nel/georges/u_form_elm.h" +#include "nel/georges/load_form.h" +#include + +// load the values using the george sheet +void CStringManager::TSheetInfo::readGeorges (const NLMISC::CSmartPtr &form, const NLMISC::CSheetId &sheetId) +{ + if (form) + { + SheetName = sheetId.toString(); + + std::string ext = NLMISC::CSheetId::fileExtensionFromType(sheetId.getSheetType()); + + SheetName = SheetName.substr(0, SheetName.find(ext)); + // remove ending '.' + if (!SheetName.empty() && *SheetName.rbegin() == '.') + SheetName.resize(SheetName.size()-1); + + std::string gender; + + if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("creature")) + { + form->getRootNode ().getValueByName (gender, "Basics.Gender"); + sint genderId; + NLMISC::fromString(gender, genderId); + Gender = GSGENDER::EGender(genderId); + + form->getRootNode ().getValueByName (Race, "Basics.Race"); + +// form->getRootNode ().getValueByName (DisplayName, "Basics.First Name"); +// std::string s; +// form->getRootNode ().getValueByName (s, "Basics.CharacterName"); +// if (!DisplayName.empty()) +// DisplayName+=' '; +// DisplayName+=s; + + form->getRootNode ().getValueByName (Profile, "Basics.Profile"); + form->getRootNode ().getValueByName (ChatProfile, "Basics.ChatProfile"); + } + else if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("race_stats")) + { + form->getRootNode ().getValueByName (Race, "Race"); + } +/* else if (sheetId.getType() == NLMISC::CSheetId::typeFromFileExtension("sitem")) + { + // read any item specific data + } +*/ else + { + nlwarning("CStringManager::TEntityInfo : Do not know the type of the sheet '%s'.", sheetId.toString().c_str()); + return; + } + } +} diff --git a/code/ryzom/tools/CMakeLists.txt b/code/ryzom/tools/CMakeLists.txt index 631a3ad28..20a15f783 100644 --- a/code/ryzom/tools/CMakeLists.txt +++ b/code/ryzom/tools/CMakeLists.txt @@ -14,6 +14,7 @@ IF(WITH_NET) ADD_SUBDIRECTORY(stats_scan) ADD_SUBDIRECTORY(pdr_util) ADD_SUBDIRECTORY(patch_gen) + ADD_SUBDIRECTORY(sheets_packer_shard) ENDIF(WITH_NET) IF(WITH_LIGO AND WITH_NET) diff --git a/code/ryzom/tools/sheets_packer_shard/CMakeLists.txt b/code/ryzom/tools/sheets_packer_shard/CMakeLists.txt new file mode 100644 index 000000000..bd568121a --- /dev/null +++ b/code/ryzom/tools/sheets_packer_shard/CMakeLists.txt @@ -0,0 +1,21 @@ +FILE(GLOB SRC *.cpp *.h) + +ADD_EXECUTABLE(sheets_packer_shard ${SRC} + ${CMAKE_SOURCE_DIR}/ryzom/server/src/input_output_service/string_manager_sheet.cpp + ${CMAKE_SOURCE_DIR}/ryzom/server/src/input_output_service/string_manager.h) + +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/ryzom/common/src ${CMAKE_SOURCE_DIR}/ryzom/server/src) +TARGET_LINK_LIBRARIES(sheets_packer_shard + ryzom_gameshare + nelmisc + nelgeorges + nelnet + nelligo + ${LIBXML2_LIBRARIES}) + +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) + +NL_DEFAULT_PROPS(sheets_packer_shard "Ryzom, Tools: Sheets Packer Shard") +NL_ADD_RUNTIME_FLAGS(sheets_packer_shard) + +INSTALL(TARGETS sheets_packer_shard RUNTIME DESTINATION ${RYZOM_BIN_PREFIX} COMPONENT tools) diff --git a/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp b/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp new file mode 100644 index 000000000..3f0333a85 --- /dev/null +++ b/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp @@ -0,0 +1,116 @@ +// NeL - MMORPG Framework +// Copyright (C) 2014 by authors +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +// Author: Jan Boon + +#include + +// STL includes +#include +#include +#include +#include +#include + +// NeL includes +#include +#include +#include +#include +#include +#include +#include + +// Project includes +// ... + +namespace { + +} /* anonymous namespace */ + +//////////////////////////////////////////////////////////////////////// +// note: *.packed_sheets files are placed in // +// and will need to be moved to the right location by // +// your build script system. // +//////////////////////////////////////////////////////////////////////// + +int main(int nNbArg, char **ppArgs) +{ + // create debug stuff + NLMISC::createDebug(); + + // verify all params + if (nNbArg < 5) + { + nlinfo("ERROR : Wrong number of arguments\n"); + nlinfo("USAGE : sheets_packer_shard \n"); + return EXIT_FAILURE; + } + std::string leveldesignDir = std::string(ppArgs[1]); + if (!NLMISC::CFile::isDirectory(leveldesignDir)) + { + nlerrornoex("Directory leveldesign '%s' does not exist", leveldesignDir.c_str()); + return EXIT_FAILURE; + } + std::string dfnDir = std::string(ppArgs[2]); + if (!NLMISC::CFile::isDirectory(dfnDir)) + { + nlerrornoex("Directory dfn '%s' does not exist", dfnDir.c_str()); + return EXIT_FAILURE; + } + std::string datasetsDir = std::string(ppArgs[3]); + if (!NLMISC::CFile::isDirectory(datasetsDir)) + { + nlerrornoex("Directory datasets '%s' does not exist", datasetsDir.c_str()); + return EXIT_FAILURE; + } + std::string exportDir = std::string(ppArgs[4]); + if (!NLMISC::CFile::isDirectory(exportDir)) + { + nlerrornoex("Directory build_packed_sheets '%s' does not exist", exportDir.c_str()); + return EXIT_FAILURE; + } + + // add search paths + NLMISC::CPath::addSearchPath(leveldesignDir, true, false); + NLMISC::CPath::addSearchPath(dfnDir, true, false); + NLMISC::CPath::addSearchPath(datasetsDir, true, false); + + // this here does the magic + // MS + { + // Used by mirror_service.cpp + // Used by range_mirror_manager.cpp + // Used by mirror.cpp + TSDataSetSheets sDataSetSheets; + loadForm("dataset", exportDir + "/datasets.packed_sheets", sDataSetSheets); + } + + // IOS + { + // Used by string_manager_parcer.cpp + std::map container; + std::vector exts; + exts.push_back("creature"); + exts.push_back("race_stats"); + loadForm(exts, exportDir + "/ios_sheets.packed_sheets", container); + } + + // and that's all folks + return EXIT_SUCCESS; +} + +/* end of file */