From 3b23cddbdb76b935fe7825abcc897162b4d4c0c8 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 25 Sep 2016 10:37:42 +0200 Subject: [PATCH] Merge with develop --- code/ryzom/CMakeLists.txt | 6 +- code/ryzom/tools/CMakeLists.txt | 3 - .../tools/sheets_packer/sheets_packer.cpp | 79 ++++++++--- .../sheets_packer/sheets_packer_init.cpp | 126 ------------------ .../tools/sheets_packer/sheets_packer_init.h | 35 ----- code/ryzom/tools/sheets_packer/stdpch.cpp | 15 +++ code/ryzom/tools/sheets_packer/stdpch.h | 31 ++++- 7 files changed, 107 insertions(+), 188 deletions(-) delete mode 100644 code/ryzom/tools/sheets_packer/sheets_packer_init.cpp delete mode 100644 code/ryzom/tools/sheets_packer/sheets_packer_init.h diff --git a/code/ryzom/CMakeLists.txt b/code/ryzom/CMakeLists.txt index 46c8bcb68..5ce811872 100644 --- a/code/ryzom/CMakeLists.txt +++ b/code/ryzom/CMakeLists.txt @@ -13,6 +13,8 @@ ADD_SUBDIRECTORY(client) IF(WITH_RYZOM_SERVER OR WITH_RYZOM_TOOLS) # Need servershare for build packed collision tool # Need aishare for build wmap tool - FIND_PACKAGE(MySQL REQUIRED) - ADD_SUBDIRECTORY(server) + FIND_PACKAGE(MySQL) + IF(MYSQL_FOUND) + ADD_SUBDIRECTORY(server) + ENDIF() ENDIF() diff --git a/code/ryzom/tools/CMakeLists.txt b/code/ryzom/tools/CMakeLists.txt index 2c4118e24..9061d1e0f 100644 --- a/code/ryzom/tools/CMakeLists.txt +++ b/code/ryzom/tools/CMakeLists.txt @@ -43,9 +43,6 @@ ADD_SUBDIRECTORY(server) #test_files #build_data -# Folders with subfolders, TODO -#client - # folders not handled yet. #connection_stats #reynolds diff --git a/code/ryzom/tools/sheets_packer/sheets_packer.cpp b/code/ryzom/tools/sheets_packer/sheets_packer.cpp index 9b6eef725..25e53b57c 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer.cpp +++ b/code/ryzom/tools/sheets_packer/sheets_packer.cpp @@ -21,17 +21,11 @@ // INCLUDES // ////////////// #include "stdpch.h" -// Misc. -#include "nel/misc/types_nl.h" -#include "nel/misc/debug.h" -#if defined(NL_OS_WINDOWS) -#include -#include -#endif - -// Client -#include "sheets_packer_init.h" +// Application +#include "sheets_packer_cfg.h" +#include "sheet_manager.h" +#include "continent_manager_build.h" /////////// @@ -43,7 +37,7 @@ using namespace NLMISC; ///////////// // GLOBALS // ///////////// -static uint32 Version = 1; // Client Version. +NLLIGO::CLigoConfig LigoConfig; /////////////// @@ -57,13 +51,61 @@ static uint32 Version = 1; // Client Version. //--------------------------------------------------- int main(int argc, char **argv) { + CApplicationContext applicationContext; + + // Parse Command Line. + NLMISC::CCmdArgs args; + + args.setDescription("Pack all sheets needed by client. All parameters must be defined in sheets_packer.cfg and there is no parameters from command-line."); + + if (!args.parse(argc, argv)) return 1; + + CFileDisplayer *fd = NULL; + ///////////////////////////////// // Initialize the application. // try { - // If the init fail -> return Failure. - if(!init()) - return EXIT_FAILURE; + // Add a displayer for Debug Infos, disable log.log. + createDebug(NULL, false); + + CLog::setProcessName("sheets_packer"); + + fd = new CFileDisplayer(getLogDirectory() + "sheets_packer.log", true, "SHEETS_PACKER.LOG"); + + // register ligo 'standard' class + NLLIGO::Register(); + + DebugLog->addDisplayer(fd); + InfoLog->addDisplayer(fd); + WarningLog->addDisplayer(fd); + ErrorLog->addDisplayer(fd); + AssertLog->addDisplayer(fd); + + // Load the application configuration. + nlinfo("Loading config file..."); + AppCfg.init(ConfigFileName); + + // Define the root path that contains all data needed for the application. + nlinfo("Adding search paths..."); + for (uint i = 0; i < AppCfg.DataPath.size(); i++) + CPath::addSearchPath(NLMISC::expandEnvironmentVariables(AppCfg.DataPath[i]), true, false); + + // Initialize Sheet IDs. + nlinfo("Init SheetId..."); + CSheetId::init(true); + + // load packed sheets + nlinfo("Loading sheets..."); + IProgressCallback callback; + SheetMngr.setOutputDataPath(NLMISC::expandEnvironmentVariables(AppCfg.OutputDataPath)); + SheetMngr.load(callback, true, true, AppCfg.DumpVisualSlotsIndex); + + // Make the lmconts.packed file + if (!LigoConfig.readPrimitiveClass(AppCfg.LigoPrimitiveClass.c_str(), false)) + nlwarning("Can't load primitive class file %s", AppCfg.LigoPrimitiveClass.c_str()); + NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; + buildLMConts(AppCfg.WorldSheet, NLMISC::expandEnvironmentVariables(AppCfg.PrimitivesPath), NLMISC::expandEnvironmentVariables(AppCfg.OutputDataPath)); } catch(const EFatalError &) { return EXIT_FAILURE; /* nothing to do */ } catch(const Exception &e) @@ -85,7 +127,14 @@ int main(int argc, char **argv) // Release all the memory. // try { - release(); + DebugLog->removeDisplayer("SHEETS_PACKER.LOG"); + InfoLog->removeDisplayer("SHEETS_PACKER.LOG"); + WarningLog->removeDisplayer("SHEETS_PACKER.LOG"); + ErrorLog->removeDisplayer("SHEETS_PACKER.LOG"); + AssertLog->removeDisplayer("SHEETS_PACKER.LOG"); + + if (fd) delete fd; + fd = NULL; } catch(const EFatalError &) { return EXIT_FAILURE; /* nothing to do */ } catch(const Exception &e) diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp b/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp deleted file mode 100644 index 1490895c6..000000000 --- a/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// 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 . - - - - -////////////// -// INCLUDES // -////////////// -#include "stdpch.h" -// Misc. -#include "nel/misc/debug.h" -#include "nel/misc/displayer.h" -#include "nel/misc/path.h" -#include "nel/misc/log.h" -#include "nel/misc/sheet_id.h" - -#include "nel/ligo/ligo_config.h" -#include "nel/ligo/primitive.h" -// Application -#include "sheets_packer_init.h" -#include "sheets_packer_cfg.h" -#include "sheet_manager.h" - -#include "continent_manager_build.h" - -/////////// -// USING // -/////////// -using namespace NLMISC; -//using namespace NL3D; -using namespace std; - - -///////////// -// GLOBALS // -///////////// -CFileDisplayer *fd = NULL; - -NLLIGO::CLigoConfig LigoConfig; - -/////////////// -// FUNCTIONS // -/////////////// -//--------------------------------------------------- -// init : -// Initialize the application. -// Return false if the init fails. -//--------------------------------------------------- -bool init() -{ - // Add a displayer for Debug Infos. - createDebug(); - - fd = new CFileDisplayer(getLogDirectory() + "sheets_packer.log", true, "SHEETS_PACKER.LOG"); - - // register ligo 'standard' class - NLLIGO::Register(); - - DebugLog->addDisplayer (fd); - InfoLog->addDisplayer (fd); - WarningLog->addDisplayer (fd); - ErrorLog->addDisplayer (fd); - AssertLog->addDisplayer (fd); - - // Load the application configuration. - nlinfo("Loading config file..."); - AppCfg.init(ConfigFileName); - - // Define the root path that contains all data needed for the application. - nlinfo("Adding search paths..."); - for(uint i = 0; i < AppCfg.DataPath.size(); i++) - CPath::addSearchPath(NLMISC::expandEnvironmentVariables(AppCfg.DataPath[i]), true, false); - - // Initialize Sheet IDs. - nlinfo("Init SheetId..."); - CSheetId::init(true); - - // load packed sheets - nlinfo("Loading sheets..."); - IProgressCallback callback; - SheetMngr.setOutputDataPath(AppCfg.OutputDataPath); - SheetMngr.load (callback, true, true, AppCfg.DumpVisualSlotsIndex); - - // Make the lmconts.packed file - if (!LigoConfig.readPrimitiveClass (AppCfg.LigoPrimitiveClass.c_str(), false)) - nlwarning ("Can't load primitive class file %s", AppCfg.LigoPrimitiveClass.c_str()); - NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; - buildLMConts(AppCfg.WorldSheet, AppCfg.PrimitivesPath, AppCfg.OutputDataPath); - - // The init is a success. - return true; -}// init // - -//--------------------------------------------------- -// release : -// Release all the memory. -//--------------------------------------------------- -void release() -{ - DebugLog->removeDisplayer ("SHEETS_PACKER.LOG"); - InfoLog->removeDisplayer ("SHEETS_PACKER.LOG"); - WarningLog->removeDisplayer ("SHEETS_PACKER.LOG"); - ErrorLog->removeDisplayer ("SHEETS_PACKER.LOG"); - AssertLog->removeDisplayer ("SHEETS_PACKER.LOG"); - - delete fd; - fd = NULL; -}// release // - -void outputSomeDebugInfoForPackedSheetCrash() -{ -} diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_init.h b/code/ryzom/tools/sheets_packer/sheets_packer_init.h deleted file mode 100644 index 4015679ea..000000000 --- a/code/ryzom/tools/sheets_packer/sheets_packer_init.h +++ /dev/null @@ -1,35 +0,0 @@ -// 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 . - - - - -#ifndef TL_SHEETS_PACKER_INIT_H -#define TL_SHEETS_PACKER_INIT_H - - - -#include "nel/misc/types_nl.h" - -// Initialize the application. -bool init(); - -// Release all. -void release(); - -#endif // TL_SHEETS_PACKER_INIT_H - -/* End of sheets_packer_init.h */ diff --git a/code/ryzom/tools/sheets_packer/stdpch.cpp b/code/ryzom/tools/sheets_packer/stdpch.cpp index 99215b203..a3d45576c 100644 --- a/code/ryzom/tools/sheets_packer/stdpch.cpp +++ b/code/ryzom/tools/sheets_packer/stdpch.cpp @@ -1,2 +1,17 @@ +// 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" diff --git a/code/ryzom/tools/sheets_packer/stdpch.h b/code/ryzom/tools/sheets_packer/stdpch.h index df8f1370f..5938546dc 100644 --- a/code/ryzom/tools/sheets_packer/stdpch.h +++ b/code/ryzom/tools/sheets_packer/stdpch.h @@ -1,3 +1,22 @@ +// 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 . + +#ifndef STDPCH_H +#define STDPCH_H + #include #include @@ -12,11 +31,9 @@ #include #include #include -//#include #include #include #include -#include #include #include @@ -31,9 +48,9 @@ #include #include #include +#include +#include +#include +#include -#ifdef NL_OS_WINDOWS -#define NOMINMAX -#include -#include -#endif // NL_OS_WINDOWS +#endif