mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-26 09:06:19 +00:00
Add AIS sheets to shard sheets packer tool
This commit is contained in:
parent
2555e93771
commit
2289285c14
6 changed files with 79 additions and 36 deletions
|
@ -2889,35 +2889,6 @@ NLMISC_COMMAND(unloadPrimitiveFile,"unload a primitive file","<file name>")
|
|||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// MULTI_LINE_FORMATER //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int const MULTI_LINE_FORMATER_maxn = 78;
|
||||
void MULTI_LINE_FORMATER::pushTitle(std::vector<std::string>& container, std::string const& text)
|
||||
{
|
||||
const sint maxn = MULTI_LINE_FORMATER_maxn;
|
||||
sint n = maxn - (sint)text.length() - 4;
|
||||
container.push_back(" _/");
|
||||
container.back() += text;
|
||||
container.back() += "\\" + std::string(n, '_');
|
||||
container.push_back("/");
|
||||
container.back() += std::string(maxn - 1, ' ');
|
||||
}
|
||||
|
||||
void MULTI_LINE_FORMATER::pushEntry(std::vector<std::string>& container, std::string const& text)
|
||||
{
|
||||
container.push_back("| ");
|
||||
container.back() += text;
|
||||
}
|
||||
|
||||
void MULTI_LINE_FORMATER::pushFooter(std::vector<std::string>& container)
|
||||
{
|
||||
int const maxn = MULTI_LINE_FORMATER_maxn;
|
||||
container.push_back("\\");
|
||||
container.back() += std::string(maxn - 1, '_');
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Bug simulation //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
52
code/ryzom/server/src/ai_service/commands_mlf.cpp
Normal file
52
code/ryzom/server/src/ai_service/commands_mlf.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
#include "stdpch.h"
|
||||
|
||||
using namespace NLMISC;
|
||||
using namespace NLNET;
|
||||
using namespace std;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// MULTI_LINE_FORMATER //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int const MULTI_LINE_FORMATER_maxn = 78;
|
||||
void MULTI_LINE_FORMATER::pushTitle(std::vector<std::string>& container, std::string const& text)
|
||||
{
|
||||
const sint maxn = MULTI_LINE_FORMATER_maxn;
|
||||
sint n = maxn - (sint)text.length() - 4;
|
||||
container.push_back(" _/");
|
||||
container.back() += text;
|
||||
container.back() += "\\" + std::string(n, '_');
|
||||
container.push_back("/");
|
||||
container.back() += std::string(maxn - 1, ' ');
|
||||
}
|
||||
|
||||
void MULTI_LINE_FORMATER::pushEntry(std::vector<std::string>& container, std::string const& text)
|
||||
{
|
||||
container.push_back("| ");
|
||||
container.back() += text;
|
||||
}
|
||||
|
||||
void MULTI_LINE_FORMATER::pushFooter(std::vector<std::string>& container)
|
||||
{
|
||||
int const maxn = MULTI_LINE_FORMATER_maxn;
|
||||
container.push_back("\\");
|
||||
container.back() += std::string(maxn - 1, '_');
|
||||
}
|
|
@ -625,7 +625,7 @@ void AISHEETS::CCreature::readGeorges(NLMISC::CSmartPtr<NLGEORGES::UForm> const&
|
|||
{
|
||||
std::string scriptCompStr;
|
||||
scriptCompNode->getArrayValue(scriptCompStr, arrayIndex);
|
||||
|
||||
#ifndef NO_AI_COMP
|
||||
CFightScriptComp* scriptComp;
|
||||
try
|
||||
{
|
||||
|
@ -636,6 +636,7 @@ void AISHEETS::CCreature::readGeorges(NLMISC::CSmartPtr<NLGEORGES::UForm> const&
|
|||
{
|
||||
nlwarning("script read error (ignored): %s", ex.what());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Creature race
|
||||
|
@ -763,6 +764,7 @@ void AISHEETS::CCreature::serial(NLMISC::IStream &s)
|
|||
string scriptCompStr;
|
||||
s.serial(scriptCompStr);
|
||||
|
||||
#ifndef NO_AI_COMP
|
||||
CFightScriptComp* scriptComp;
|
||||
try
|
||||
{
|
||||
|
@ -773,6 +775,7 @@ void AISHEETS::CCreature::serial(NLMISC::IStream &s)
|
|||
{
|
||||
nlwarning("script read error (ignored): %s", ex.what());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -881,8 +884,14 @@ void AISHEETS::CSheets::init()
|
|||
nlassert(_PlayerGroupIndex!=~0);
|
||||
#endif
|
||||
|
||||
CConfigFile::CVar *varPtr=IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"));
|
||||
const std::string writeFilesDirectoryName=IService::getInstance()->WriteFilesDirectory.toString();
|
||||
packSheets(IService::getInstance()->WriteFilesDirectory.toString());
|
||||
|
||||
_Initialised=true;
|
||||
}
|
||||
|
||||
void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
|
||||
{
|
||||
CConfigFile::CVar *varPtr = IService::isServiceInitialized() ? IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths")) : NULL;
|
||||
|
||||
// if config file variable 'GeorgePaths' exists then only do a minimal loadForms otherwise do the full works
|
||||
if (varPtr!=NULL)
|
||||
|
@ -947,8 +956,6 @@ void AISHEETS::CSheets::init()
|
|||
loadForm2("creature", writeFilesDirectoryName+AISPackedSheetsFilename, _Sheets, true);
|
||||
loadForm2("race_stats", writeFilesDirectoryName+AISPackedRaceStatsSheetsFilename, _RaceStatsSheets, true);
|
||||
}
|
||||
|
||||
_Initialised=true;
|
||||
}
|
||||
|
||||
void AISHEETS::CSheets::release()
|
||||
|
|
|
@ -689,6 +689,7 @@ public:
|
|||
public:
|
||||
// load the creature data from the george files
|
||||
void init();
|
||||
void packSheets(const std::string &writeFilesDirectoryName);
|
||||
|
||||
// display the creature data for all known creature types
|
||||
void display(NLMISC::CSmartPtr<CStringWriter> stringWriter, uint infoSelect = 0);
|
||||
|
|
|
@ -7,7 +7,10 @@ ADD_EXECUTABLE(sheets_packer_shard ${SRC} ${EGSSHEETS}
|
|||
${CMAKE_SOURCE_DIR}/ryzom/server/src/gpm_service/sheets.cpp
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/gpm_service/sheets.h
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/entity_structure/resists.cpp
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/entity_structure/resists.h)
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/entity_structure/resists.h
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/ai_service/sheets.cpp
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/ai_service/sheets.h
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/ai_service/commands_mlf.cpp)
|
||||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/ryzom/common/src ${CMAKE_SOURCE_DIR}/ryzom/server/src ${CMAKE_SOURCE_DIR}/ryzom/tools/sheets_packer_shard ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service)
|
||||
TARGET_LINK_LIBRARIES(sheets_packer_shard
|
||||
|
@ -25,6 +28,7 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
|||
NL_DEFAULT_PROPS(sheets_packer_shard "Ryzom, Tools: Sheets Packer Shard")
|
||||
NL_ADD_RUNTIME_FLAGS(sheets_packer_shard)
|
||||
|
||||
SET_TARGET_PROPERTIES(sheets_packer_shard PROPERTIES COMPILE_FLAGS -DNO_EGS_VARS)
|
||||
ADD_DEFINITIONS(-DNO_EGS_VARS)
|
||||
ADD_DEFINITIONS(-DNO_AI_COMP)
|
||||
|
||||
INSTALL(TARGETS sheets_packer_shard RUNTIME DESTINATION ${RYZOM_BIN_PREFIX} COMPONENT tools)
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include <server_share/continent_container.h>
|
||||
#include <entities_game_service/egs_sheets/egs_sheets.h>
|
||||
#include <game_share/time_weather_season/time_date_season_manager.h>
|
||||
#include <ai_service/stdpch.h>
|
||||
#include <ai_service/sheets.h>
|
||||
|
||||
// Project includes
|
||||
// ...
|
||||
|
@ -160,6 +162,12 @@ int main(int nNbArg, char **ppArgs)
|
|||
{
|
||||
CTimeDateSeasonManager::packSheets(s_WriteDirectory);
|
||||
}
|
||||
|
||||
// AIS
|
||||
{
|
||||
AISHEETS::CSheets::getInstance()->packSheets(s_WriteDirectory);
|
||||
AISHEETS::CSheets::destroyInstance();
|
||||
}
|
||||
|
||||
// and that's all folks
|
||||
return EXIT_SUCCESS;
|
||||
|
|
Loading…
Reference in a new issue