From 6e1ecf6840b17b934cc31499f20a4591320c6955 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 1 Jul 2010 10:50:57 +0200 Subject: [PATCH] Removed: useless backup files --- .../Backup 1 of admin_modules.cpp | 24 - .../server/src/admin_modules/CMakeLists.txt | 4 - .../ags_test/Backup 1 of actor_manager.cpp | 485 -------- .../src/ags_test/Backup 1 of ags_timer.cpp | 61 - .../ai_service/Backup 1 of ai_profile_fauna.h | 359 ------ .../src/ai_service/Backup 1 of profile.h | 266 ---- .../src/ai_service/Backup 1 of stdpch.h | 184 --- .../server/src/ai_service/CMakeLists.txt | 5 +- .../src/gameplay_module_lib/CMakeLists.txt | 3 - .../Backup 1 of stat_job_manager.h | 98 -- .../general_utilities_service/CMakeLists.txt | 3 +- .../Backup 1 of file_repository.h | 173 --- .../src/patchman_service/CMakeLists.txt | 3 +- .../server/src/server_share/CMakeLists.txt | 3 - .../tools/assoc_mem/Backup 1 of record.cpp | 56 - .../tools/assoc_mem/Backup 2 of record.cpp | 72 -- code/ryzom/tools/assoc_mem/CMakeLists.txt | 4 - .../Backup 1 of named_items_2_csv.cpp | 546 --------- .../named_items_2_csv/CMakeLists.txt | 2 - .../Backup 1 of plugin.cpp | 290 ----- .../Backup 1 of test_col_world.cpp | 1084 ----------------- .../Backup 1 of village.cpp | 289 ----- .../Backup 1 of village.h | 72 -- .../stats_scan/Backup 1 of char_commands.cpp | 283 ----- code/ryzom/tools/stats_scan/CMakeLists.txt | 2 - 25 files changed, 3 insertions(+), 4368 deletions(-) delete mode 100644 code/ryzom/server/src/admin_modules/Backup 1 of admin_modules.cpp delete mode 100644 code/ryzom/server/src/ags_test/Backup 1 of actor_manager.cpp delete mode 100644 code/ryzom/server/src/ags_test/Backup 1 of ags_timer.cpp delete mode 100644 code/ryzom/server/src/ai_service/Backup 1 of ai_profile_fauna.h delete mode 100644 code/ryzom/server/src/ai_service/Backup 1 of profile.h delete mode 100644 code/ryzom/server/src/ai_service/Backup 1 of stdpch.h delete mode 100644 code/ryzom/server/src/general_utilities_service/Backup 1 of stat_job_manager.h delete mode 100644 code/ryzom/server/src/patchman_service/Backup 1 of file_repository.h delete mode 100644 code/ryzom/tools/assoc_mem/Backup 1 of record.cpp delete mode 100644 code/ryzom/tools/assoc_mem/Backup 2 of record.cpp delete mode 100644 code/ryzom/tools/leveldesign/named_items_2_csv/Backup 1 of named_items_2_csv.cpp delete mode 100644 code/ryzom/tools/leveldesign/world_editor/world_editor_plugin/Backup 1 of plugin.cpp delete mode 100644 code/ryzom/tools/server/build_world_packed_col/Backup 1 of test_col_world.cpp delete mode 100644 code/ryzom/tools/server/build_world_packed_col/Backup 1 of village.cpp delete mode 100644 code/ryzom/tools/server/build_world_packed_col/Backup 1 of village.h delete mode 100644 code/ryzom/tools/stats_scan/Backup 1 of char_commands.cpp diff --git a/code/ryzom/server/src/admin_modules/Backup 1 of admin_modules.cpp b/code/ryzom/server/src/admin_modules/Backup 1 of admin_modules.cpp deleted file mode 100644 index c82be8cac..000000000 --- a/code/ryzom/server/src/admin_modules/Backup 1 of admin_modules.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/** This file declare a pure nel module library */ - - -#include "nel/net/module_manager.h" -#include "nel/net/module.h" -#include "nel/net/module_builder_parts.h" - -using namespace std; -using namespace NLMISC; -using namespace NLNET; - -extern void as_forceLink(); -extern void aes_forceLink(); -extern void aesclient_forceLink(); - -void admin_modules_forceLink() -{ - as_forceLink(); - aes_forceLink(); - aesclient_forceLink(); -} - -//NLMISC_DECL_PURE_LIB(CNelModuleLibrary); - diff --git a/code/ryzom/server/src/admin_modules/CMakeLists.txt b/code/ryzom/server/src/admin_modules/CMakeLists.txt index a31ca9921..87056bd6d 100644 --- a/code/ryzom/server/src/admin_modules/CMakeLists.txt +++ b/code/ryzom/server/src/admin_modules/CMakeLists.txt @@ -1,9 +1,5 @@ FILE(GLOB SRC *.cpp *.h) -# Filter out the source files not actually compiled. -LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ admin_modules.cpp) - - ADD_LIBRARY(admin_modules STATIC ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/code/ryzom/server/src/ags_test/Backup 1 of actor_manager.cpp b/code/ryzom/server/src/ags_test/Backup 1 of actor_manager.cpp deleted file mode 100644 index 36441a546..000000000 --- a/code/ryzom/server/src/ags_test/Backup 1 of actor_manager.cpp +++ /dev/null @@ -1,485 +0,0 @@ -/** \file actor_manager.cpp - * - * the actor manager for AgS_Test - * - * $Id: actor_manager.cpp,v 1.34 2004/06/14 12:34:17 brigand Exp $ - * $Log: actor_manager.cpp,v $ - * Revision 1.34 2004/06/14 12:34:17 brigand - * CHANGED : updated to new PDS people enum - * - * Revision 1.33 2004/03/01 19:18:37 lecroart - * REMOVED: bad headers - * - * Revision 1.32 2004/01/13 18:47:07 cado - * ADDED: Mirror tests - * - * Revision 1.31 2003/10/21 08:48:19 legros - * ADDED: multi target commands - * - * Revision 1.30 2003/10/02 16:13:15 legros - * no message - * - * Revision 1.29 2003/10/01 14:29:32 legros - * no message - * - * Revision 1.28 2003/09/30 16:03:15 legros - * CHANGED: ags test is now up to date... - * - * Revision 1.27 2003/07/16 15:51:19 cado - * CHANGED: First-pass to re-adapt to mirror system V1.4 - * - * Revision 1.26 2003/07/16 14:34:06 boucher - * no message - * - * Revision 1.25 2003/02/26 10:24:19 cado - * CHANGED: changed all properties to new mirror, no more old mirror - * - * Revision 1.24 2003/02/24 10:44:44 cado - * ADDED: Adapted for new mirror system - * - * Revision 1.23 2003/01/28 20:36:51 miller - * Changed header comments from 'Nel Network Services' to Ryzom - * - * Revision 1.22 2002/11/29 10:17:50 portier - * #ADDED: ia_player.id - * - * Revision 1.21.2.1 2003/01/03 18:18:02 cado - * ADDED: Integration with new mirror system - * - * Revision 1.21 2002/11/15 16:22:42 fleury - * CHANGED : the OPS has been replaced by the EGS - * - * Revision 1.20 2002/08/30 08:47:34 miller - * another quick test (non destructive) - * - * Revision 1.19 2002/08/30 08:46:09 miller - * quick test (non destructive) - * - */ - - - -// Nel -//#include "nel/net/service.h" - - -// Local headers -#include "position_generator.h" -#include "actor_manager.h" -#include "sheets.h" -#include -#include "game_share/people.h" -#include "game_share/synchronised_message.h" - -#include "nel/misc/variable.h" - -#include - -using namespace NLMISC; -using namespace NLNET; -using namespace std; - - -namespace AGS_TEST -{ - -//------------------------------------------------------------------------- -// Some global variables -extern uint32 GlobalActorCount; -extern uint32 GlobalActorUpdates; -extern uint32 GlobalActorMoves; - -CEntityId LastActorId; - -NLMISC_DYNVARIABLE(string, LastActorId, "Last created actor") -{ - if (get) - *pointer = LastActorId.toString(); - else - LastActorId.fromString((*pointer).c_str()); -} - -//------------------------------------------------------------------------- -// Some function prototypes - -static void cbServiceUp( const string& serviceName, uint16 serviceId, void * ); -static void cbServiceDown( const string& serviceName, uint16 serviceId, void * ); - -//------------------------------------------------------------------------ -// static data for CActorManager - -std::vector CActorManager::_actors; -std::vector CActorManager::_actorGroups; -int CActorManager::_nextActorID=0; -std::set CActorManager::_visionHandlingServices; -CActorGroup *CActorManager::_defaultActorGroup; - -//------------------------------------------------------------------------ -// basic functionality for CActorManager singleton - -void CActorManager::init() -{ - static bool first_time=true; - - if (first_time) - { - // Init callback for service up / down - CUnifiedNetwork::getInstance()->setServiceUpCallback ("*", cbServiceUp, NULL); - CUnifiedNetwork::getInstance()->setServiceDownCallback("*", cbServiceDown, NULL); - first_time=false; - } - else - release(); - - _nextActorID=0; -/* - CPositionGenerator::setPattern(std::string("grid")); - CPositionGenerator::setPosition(17981,-33200); - CPositionGenerator::setSpacing(2000); -*/ - _defaultActorGroup = newActorGroup("defaultGroup"); -} - -void CActorManager::update() -{ - set< pair > iaZones; - - std::vector::iterator itg; - for (itg=_actorGroups.begin(); itg!=_actorGroups.end(); ++itg) - (*itg)->update(); - - - // iterate through all known actors, calling their update - uint16 positionChangeCount=0; - uint16 updateCount=0; - std::vector::iterator it; - for (it=_actors.begin(); it!=_actors.end(); ++it) - { - bool updated= (*it)->update(); - if (updated) - updateCount++; -/* - if ((*it)->positionChanged()) - positionChangeCount++; - - sint32 zx = (*it)->getX()/160000; - sint32 zy = -(*it)->getY()/160000; - - iaZones.insert(make_pair(zx, zy)); -*/ - } - - - // for all entities, request vision zones - /*CMessage msg("AGENT_VISON"); - sint64 fakeId = 0; - msg.serial(fakeId); - sint32 pos = msg.getPos(); - set< pair >::iterator itz; - for (itz=iaZones.begin(); itz!=iaZones.end(); ++itz) - { - sint32 x = (*itz).first, - y = (*itz).second; - msg.serial(x); - msg.serial(y); - } - if (msg.getPos() > pos) - CUnifiedNetwork::getInstance()->send("GPMS", msg);*/ -/* - // build the position changed message and send it to GPMS - if (positionChangeCount>0) - { - NLNET::CMessage gpmPosMsg("UPDATE_ENTITIES_POSITIONS"); - gpmPosMsg.serial(positionChangeCount); - for (it=_actors.begin(); it!=_actors.end(); ++it) - (*it)->addPositionChangesToMessage(gpmPosMsg); - - sendMessageViaMirror( "GPMS", gpmPosMsg ); - } -*/ - GlobalActorUpdates=updateCount; - //GlobalActorMoves=positionChangeCount; -} - -void CActorManager::release() -{ - std::vector::iterator it; - for (it=_actors.begin(); it!=_actors.end(); ++it) - { - (*it)->removeFromOtherServices(); - } - _actors.clear(); -} - -// Callback called at service connexion -static void cbServiceUp( const string& serviceName, uint16 serviceId, void * ) -{ - /*if (serviceName==std::string("EGS")) - CActorManager::reconnectEGS((uint8)serviceId); - - if (serviceName==std::string("IOS")) - CActorManager::reconnectIOS((uint8)serviceId); - - if (serviceName==std::string("GPMS")) - CActorManager::reconnectGPMS((uint8)serviceId);*/ - - /*CMessage reqVision("ASK_VISION_ZONE"); - CUnifiedNetwork::getInstance()->send(serviceId, reqVision);*/ -} - -// -static void cbServiceDown( const string& serviceName, uint16 serviceId, void * ) -{ - CActorManager::removeVisionService(serviceId); -} - -//--------------------------------------------------------------------------------- -// methods for dealing with tardy connection of a key service -/*void CActorManager::reconnectEGS(uint8 serviceId) -{ -} - -void CActorManager::reconnectIOS(uint8 serviceId) -{ - std::vector::iterator it; - for (it=_actors.begin(); it!=_actors.end(); ++it) - { - (*it)->addToIOS(serviceId); - } -} - -void CActorManager::reconnectGPMS(uint8 serviceId) -{ - std::vector::iterator it; - for (it=_actors.begin(); it!=_actors.end(); ++it) - { - (*it)->addToGPMS(serviceId); - } -}*/ - - -//--------------------------------------------------------------------------------- -// CActorManager methods for creating and killing actors - -// method for adding a new actor to the scene -CActor *CActorManager::newActor(const std::string &type, const std::string &name) -{ - LastActorId = CEntityId::Unknown; - - if (getActor(name)!=NULL) - { - nlinfo("Actor already exists: %s",name.c_str()); - return NULL; - } - - CSheetId sheetId(type); - const CSheets::CSheet *sheet=CSheets::lookup(sheetId); - if (!sheet) - { - nlwarning("ERROR: Can't find static type data for '%s'(%d) for entity %s", type.c_str(), sheetId.asInt(), name.c_str()); - return NULL; - } - - // create a new actor record and COPY it into the actor vector - -// EGSPD::CPeople::TPeople p_type = EGSPD::CPeople::fromString( type ); - bool success = false; - CActor *aNewActor; - if ( sheet->isNpc /*EGSPD::CPeople::isPlayableRace( p_type )*/ ) - aNewActor = new CActor(type,name,CEntityId(RYZOMID::npc,_nextActorID++),success); - else - aNewActor = new CActor(type,name,CEntityId(RYZOMID::creature,_nextActorID++),success); - - if ( ! success ) - { - if (aNewActor) - delete aNewActor; - return NULL; - } - - LastActorId = aNewActor->_id; - - int x,y; - CPositionGenerator::next(x,y); - aNewActor->setPos(x, y, 0); - aNewActor->setAngle(0); - _actors.push_back(aNewActor); - - // get hold of a pointer of the copy of the actor in the actor vector - CActor *theActor=getActor(name); - - // add the actor to the GPMS, the IOS, etc - if (theActor!=0) - theActor->addToOtherServices(); -/* - CMessage msgMode("SET_MODE"); - TDataSetRow index = CMirrors::DataSet->getDataSetRow(theActor->_id); - msgMode.serial(index); - MBEHAV::TMode mode(MBEHAV::NORMAL, x, y); - msgMode.serial(mode); - sendMessageViaMirror("EGS", msgMode); -*/ - CMirrors::initSheet( aNewActor->getSid(), sheetId ); // initialize out the sheet - // Let the position & angle & tick be sent ("UPDATE_ENTITIES_POSITIONS") in update - //aNewActor->initMode(); - - MBEHAV::TMode mode(MBEHAV::NORMAL, x, y); - theActor->_mode = mode.RawModeAndParam; - - aNewActor->display(); - theActor->setGroup(_defaultActorGroup); - - GlobalActorCount++; - return theActor; -} - -// method for retrievng a pointer to a named actor -// returns NULL if the actor doesn't exist -CActor *CActorManager::getActor(const std::string &name) -{ - std::vector::iterator it; - for (it=_actors.begin(); it!=_actors.end(); ++it) - { - if ((*it)->getName()==name) - return (*it); - } - - return 0; -} - -// method for retrievng a pointer to given actor -CActor *CActorManager::getActor(unsigned index) -{ - if (index>=_actors.size()) - return NULL; - else - return (_actors[index]); -} - -// method for retrievng a pointer to given actor -CActor *CActorManager::getActor(const NLMISC::CEntityId &id) -{ - std::vector::iterator it; - for (it=_actors.begin(); it!=_actors.end(); ++it) - { - if ((*it)->getSid()==id) - return (*it); - } - - return NULL; -} - -void CActorManager::killActor(const std::string &name) -{ - std::vector::iterator it; - for (it=_actors.begin(); it!=_actors.end(); ++it) - { - if ((*it)->getName()==name) - { - // remove from net refferences - (*it)->removeFromOtherServices(); - - // remove from vision xrefs - std::vector::iterator it2; - for (it2=_actors.begin(); it2!=_actors.end(); ++it2) - { - (*it2)->removeRefs(*it); - } - - for (int i=_actorGroups.size();i--;) - _actorGroups[i]->removeActor(*it); - - // remove from container - delete *it; - _actors.erase(it); - GlobalActorCount--; - return; - } - } -} - -//------------------------------------------------------------------------ -// basic functionality for actor group management - -// method for adding a new actorGroup to the scene -CActorGroup *CActorManager::newActorGroup(const std::string &name) -{ - if (!getActorGroup(name)) - { - // create a new actorGroup record and COPY it into the actorGroup vector - CActorGroup *aNewActorGroup = new CActorGroup(name); - _actorGroups.push_back(aNewActorGroup); - aNewActorGroup->display(); - } - - // get hold of a pointer of the copy of the actorGroup in the actorGroup vector - return getActorGroup(name); -} - -// method for retrievng a pointer to a named actorGroup -// returns NULL if the actorGroup doesn't exist -CActorGroup *CActorManager::getActorGroup(const std::string &name) -{ - std::vector::iterator it; - for (it=_actorGroups.begin(); it!=_actorGroups.end(); ++it) - { - if ((*it)->getName()==name) - return (*it); - } - - return NULL; -} - -// method for retrievng a pointer to given actorGroup -CActorGroup *CActorManager::getActorGroup(unsigned index) -{ - if (index>=_actorGroups.size()) - return NULL; - else - return (_actorGroups[index]); -} - -void CActorManager::removeActorGroup(const std::string &name) -{ - std::vector::iterator it; - for (it=_actorGroups.begin(); it!=_actorGroups.end(); ++it) - { - if ((*it)->getName()==name) - { - // remove all actors from this group into default group - uint i; - for (i=0; i<(*it)->actorCount(); ++i) - (*(*it))[i]->setGroup(_defaultActorGroup); - - // remove from container - delete (*it); - _actorGroups.erase(it); - return; - } - } -} - -// -void CActorManager::setActorsToGroup(const std::string &sourceActorGroup, const std::string &destActorGroup) -{ - CActorGroup *srcGroup = getActorGroup(sourceActorGroup); - if (srcGroup == NULL) - { - nlwarning("source actor group '%s' is unknown, abort setActorsToGroup(%s, %s)", sourceActorGroup.c_str(), sourceActorGroup.c_str(), destActorGroup.c_str()); - return; - } - - CActorGroup *destGroup = getActorGroup(destActorGroup); - if (destGroup == NULL) - { - nlwarning("destination actor group '%s' is unknown, abort setActorsToGroup(%s, %s)", destActorGroup.c_str(), sourceActorGroup.c_str(), destActorGroup.c_str()); - return; - } - - uint i; - for (i=0; iactorCount(); ++i) - (*srcGroup)[i]->setGroup(destGroup); -} - - -} // end of namespace AGS_TEST diff --git a/code/ryzom/server/src/ags_test/Backup 1 of ags_timer.cpp b/code/ryzom/server/src/ags_test/Backup 1 of ags_timer.cpp deleted file mode 100644 index b9d3549b2..000000000 --- a/code/ryzom/server/src/ags_test/Backup 1 of ags_timer.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/** \file actor_manager.cpp - * - * the actor manager for AgS_Test - * - * $Id: ags_timer.cpp,v 1.3 2004/03/01 19:18:37 lecroart Exp $ - * $Log: ags_timer.cpp,v $ - * Revision 1.3 2004/03/01 19:18:37 lecroart - * REMOVED: bad headers - * - * Revision 1.2 2003/01/28 20:36:51 miller - * Changed header comments from 'Nel Network Services' to Ryzom - * - * Revision 1.1 2002/11/28 14:57:17 portier - * #ADDED: ia_player.id - * - * Revision 1.21 2002/11/15 16:22:42 fleury - * CHANGED : the OPS has been replaced by the EGS - * - * Revision 1.20 2002/08/30 08:47:34 miller - * another quick test (non destructive) - * - * Revision 1.19 2002/08/30 08:46:09 miller - * quick test (non destructive) - * - */ - - - - -#include "ags_timer.h" -#include "game_share/tick_event_handler.h" - -namespace AGS_TEST -{ - CAGSTimer::CAGSTimer(uint32 dt /*= 0*/) - { - _dt = dt; - } - - void CAGSTimer::set(uint32 dt) - { - _start = (uint32)CTickEventHandler::getGameCycle(); - _dt = dt; - } - - void CAGSTimer::add(uint32 dt) - { - _start = (uint32)CTickEventHandler::getGameCycle(); - _dt += dt; - } - - bool CAGSTimer::test() - { - uint32 curent = (uint32) CTickEventHandler::getGameCycle(); - - uint32 elapsed = curent - _start; - - return ( elapsed >= _dt ); - } - -} diff --git a/code/ryzom/server/src/ai_service/Backup 1 of ai_profile_fauna.h b/code/ryzom/server/src/ai_service/Backup 1 of ai_profile_fauna.h deleted file mode 100644 index 0e906253d..000000000 --- a/code/ryzom/server/src/ai_service/Backup 1 of ai_profile_fauna.h +++ /dev/null @@ -1,359 +0,0 @@ -/** \file ai_profile_fauna.h - * - * $Id: ai_profile_fauna.h,v 1.8 2005/08/09 12:38:24 vuarand Exp $ - * - * This file defines the classes: - * - CPlanteIdleFaunaProfile - * - CStaticPlanteIdleFaunaProfile - * - CAIFaunaActivityBaseSpawnProfile - * - CWanderFaunaProfile - * - CStaticWanderFaunaProfile - * - CGrazeFaunaProfile - * - CStaticGrazeFaunaProfile - * - CRestFaunaProfile - * - CStaticRestFaunaProfile - * - CStaticFightFaunaProfile - * - CCorpseFaunaProfileFactory - * - CEatCorpseFaunaProfile - * - CStaticEatCorpseFaunaProfile - * - CCuriosityFaunaProfile - * - CStaticCuriosityFaunaProfile - */ - -#ifndef AI_PROFILE_FAUNA_H -#define AI_PROFILE_FAUNA_H - -#include "profile.h" // for CAIBaseProfile -#include "path_behaviors.h" // for CPathPosition -#include "ai_bot_fauna.h" // for CCorpseFaunaProfile -#include "ai_grp_fauna.h" -#include "ai_mgr_fauna.h" - -class CSpawnBotFauna; -class CMovementMagnet; - -// --------------------------------------------------------------------------- -// Debug defines -// --------------------------------------------------------------------------- -// COMPACT_POS_WARNINGS compress flooding warnings concerning path problems. -// Positions where the problems occures are stored and displayed and cleared -// every minute. -// :TODO: /!\ As it cannot be tested without long-time run with several -// players the following define can be commented to restore previous behavior. -#define COMPACT_POS_WARNINGS 1 - -class CFaunaProfileFloodLogger -{ -public: - typedef std::map TLogPositions; - -public: - CFaunaProfileFloodLogger(int period) - : logLastTick(0) - , logPeriod(period) - { - } - -public: - TLogPositions logPositions; - int logLastTick; - int logPeriod; -}; - -////////////////////////////////////////////////////////////////////////////// -// CPlanteIdleFaunaProfile // -////////////////////////////////////////////////////////////////////////////// - -class CPlanteIdleFaunaProfile -: public CAIBaseProfile -{ -public: - CPlanteIdleFaunaProfile(CProfileOwner* owner); - - /// @name IAIProfile implementation - //@{ - virtual void beginProfile(); - virtual void updateProfile(uint ticksSinceLastUpdate); - virtual void endProfile(); - virtual AITYPES::TProfiles getAIProfileType() const { return AITYPES::ACTIVITY_PLANTIDLE; } - virtual std::string getOneLineInfoString() const; - //@} - -protected: - CSpawnBotFauna* _Bot; -}; - -////////////////////////////////////////////////////////////////////////////// -// CAIFaunaActivityBaseSpawnProfile // -////////////////////////////////////////////////////////////////////////////// - -class CAIFaunaActivityBaseSpawnProfile -: public CAIBaseProfile -, public IMouvementMagnetOwner -{ -public: - CAIFaunaActivityBaseSpawnProfile(CProfileOwner* owner); - - virtual NLMISC::CSmartPtr const& getMovementMagnet() const; - -protected: - NLMISC::CSmartPtr _MovementMagnet; - CPathPosition _PathPos; - bool _OutOfMagnet; -}; - -////////////////////////////////////////////////////////////////////////////// -// CWanderFaunaProfile // -////////////////////////////////////////////////////////////////////////////// - -class CWanderFaunaProfile -: public CAIFaunaActivityBaseSpawnProfile -{ -public: - CWanderFaunaProfile(CProfileOwner* owner); - - /// @name IAIProfile implementation - //@{ - virtual void beginProfile(); - virtual void updateProfile(uint ticksSinceLastUpdate); - virtual void endProfile(); - virtual AITYPES::TProfiles getAIProfileType() const { return AITYPES::ACTIVITY_WANDERING; } - virtual std::string getOneLineInfoString() const; - //@} - -protected: - RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags; - CSpawnBotFauna* _Bot; - double _magnetDist; ///< distance from bot to his magnet at last move - static CFaunaProfileFloodLogger _FloodLogger; -}; - -////////////////////////////////////////////////////////////////////////////// -// CGrazeFaunaProfile // -////////////////////////////////////////////////////////////////////////////// - -class CGrazeFaunaProfile -: public CAIFaunaActivityBaseSpawnProfile -{ -public: - CGrazeFaunaProfile(CProfileOwner* owner); - - /// @name IAIProfile implementation - //@{ - virtual void beginProfile(); - virtual void updateProfile(uint ticksSinceLastUpdate); - virtual void endProfile(); - virtual AITYPES::TProfiles getAIProfileType() const { return AITYPES::ACTIVITY_GRAZING; } - virtual std::string getOneLineInfoString() const; - //@} - -protected: - CSpawnBotFauna* _Bot; -private: - CAITimer _CycleTimer; - uint _CycleTimerBaseTime; - bool _ArrivedInZone; - double _magnetDist; ///< distance from bot to his magnet at last move - RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags; - static CFaunaProfileFloodLogger _FloodLogger; -}; - -////////////////////////////////////////////////////////////////////////////// -// CRestFaunaProfile // -////////////////////////////////////////////////////////////////////////////// - -class CRestFaunaProfile -: public CAIFaunaActivityBaseSpawnProfile -{ -public: - CRestFaunaProfile(CProfileOwner* owner); - - /// @name IAIProfile implementation - //@{ - virtual void beginProfile(); - virtual void updateProfile(uint ticksSinceLastUpdate); - virtual void endProfile(); - virtual AITYPES::TProfiles getAIProfileType() const { return AITYPES::ACTIVITY_RESTING; } - virtual std::string getOneLineInfoString() const; - //@} - -protected: - CSpawnBotFauna* _Bot; -private: - CAITimer _CycleTimer; - uint _CycleTimerBaseTime; - bool _ArrivedInZone; - double _magnetDist; // distance from bot to his magnet at last move - RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags; - static CFaunaProfileFloodLogger _FloodLogger; -}; - -////////////////////////////////////////////////////////////////////////////// -// CEatCorpseFaunaProfile // -////////////////////////////////////////////////////////////////////////////// - -class CEatCorpseFaunaProfile -: public CAIBaseProfile -{ -public: - CEatCorpseFaunaProfile(CProfileOwner* owner, TDataSetRow const& corpse, RYAI_MAP_CRUNCH::TAStarFlag flag); - - /// @name IAIProfile implementation - //@{ - virtual void beginProfile(); - virtual void updateProfile(uint ticksSinceLastUpdate); - virtual void endProfile(); - virtual AITYPES::TProfiles getAIProfileType() const { return AITYPES::ACTIVITY_EAT_CORPSE; } - virtual std::string getOneLineInfoString() const; - //@} - - TDataSetRow _eated; -protected: - CSpawnBotFauna* _Bot; -private: - bool _atGoodDist; - CAITimer _eatTimer; - CPathPosition _PathPos; - CPathCont _PathCont; -}; - -////////////////////////////////////////////////////////////////////////////// -// CCuriosityFaunaProfile // -////////////////////////////////////////////////////////////////////////////// - -class CCuriosityFaunaProfile -: public CAIBaseProfile -{ -public: - CCuriosityFaunaProfile(CProfileOwner* owner, TDataSetRow const& player, RYAI_MAP_CRUNCH::TAStarFlag flag); - - /// @name IAIProfile implementation - //@{ - virtual void beginProfile(); - virtual void updateProfile(uint ticksSinceLastUpdate); - virtual void endProfile(); - virtual AITYPES::TProfiles getAIProfileType() const { return AITYPES::ACTIVITY_CURIOSITY; } - virtual std::string getOneLineInfoString() const; - //@} - - TDataSetRow _player; -protected: - CSpawnBotFauna* _Bot; -private: - bool _atGoodDist; - CAITimer _curiosityTimer; - CPathPosition _PathPos; - CPathCont _PathCont; - uint32 _addCuriosityTime; - bool _TooFar; - RYAI_MAP_CRUNCH::TAStarFlag _Flag; -}; - -////////////////////////////////////////////////////////////////////////////// -// CCorpseFaunaProfile // -////////////////////////////////////////////////////////////////////////////// - -class CCorpseFaunaProfile -: public CAIBaseProfile -{ -public: - CCorpseFaunaProfile(CProfileOwner* owner); - - virtual void beginProfile(); - - virtual void endProfile() { } - - virtual void updateProfile(uint ticksSinceLastUpdate) { } - - virtual std::string getOneLineInfoString() const { return NLMISC::toString("corpse fauna profile"); } - - virtual AITYPES::TProfiles getAIProfileType() const { return AITYPES::ACTIVITY_CORPSE; } - - bool eated() const { return _Eated; } - void setEated(bool eated) { _Eated = eated; } - - void setEater(bool eater) { _HaveEater = eater; } - bool haveEater() const { return _HaveEater; } - -protected: - CSpawnBotFauna* _Bot; - -private: - bool _HaveEater; - bool _Eated; -}; - -/****************************************************************************/ -/* Profile factories */ -/****************************************************************************/ - -//- Simple profile factories ------------------------------------------------- - -// CPlanteIdleFaunaProfileFactory -typedef CAIGenericProfileFactory CPlanteIdleFaunaProfileFactory; - -// CWanderFaunaProfileFactory -typedef CAIGenericProfileFactory CWanderFaunaProfileFactory; - -// CGrazeFaunaProfileFactory -typedef CAIGenericProfileFactory CGrazeFaunaProfileFactory; - -// CRestFaunaProfileFactory -typedef CAIGenericProfileFactory CRestFaunaProfileFactory; - -// CCorpseFaunaProfileFactory -typedef CAIGenericProfileFactory CCorpseFaunaProfileFactory; - -//- Complex profile factories ------------------------------------------------ - -// CStaticFightFaunaProfile -class CFightFaunaProfileFactory -: public IAIProfileFactory -{ -public: - NLMISC::CSmartPtr createAIProfile(CProfileOwner* owner) - { - return NULL; - } -}; - -// CStaticEatCorpseFaunaProfile -class CEatCorpseFaunaProfileFactory -: public IAIProfileFactory -{ -public: - NLMISC::CSmartPtr createAIProfile(CProfileOwner* owner) - { - #ifdef NL_DEBUG - nlassert(false); - #endif - return NULL; - } -}; - -// CStaticCuriosityFaunaProfile -class CCuriosityFaunaProfileFactory -: public IAIProfileFactory -{ -public: - NLMISC::CSmartPtr createAIProfile(CProfileOwner* owner) - { -#ifdef NL_DEBUG - nlassert(false); -#endif - return NULL; - } -}; - -//- Profile factories singletons --------------------------------------------- - -extern CPlanteIdleFaunaProfileFactory PlanteIdleFaunaProfileFactory; -extern CWanderFaunaProfileFactory WanderFaunaProfileFactory; -extern CGrazeFaunaProfileFactory GrazeFaunaProfileFactory; -extern CRestFaunaProfileFactory RestFaunaProfileFactory; -extern CFightFaunaProfileFactory FightFaunaProfileFactory; -extern CCorpseFaunaProfileFactory CorpseFaunaProfileFactory; -extern CEatCorpseFaunaProfileFactory EatCorpseFaunaProfileFactory; -extern CCuriosityFaunaProfileFactory CuriosityFaunaProfileFactory; - -#endif diff --git a/code/ryzom/server/src/ai_service/Backup 1 of profile.h b/code/ryzom/server/src/ai_service/Backup 1 of profile.h deleted file mode 100644 index 51d7097c0..000000000 --- a/code/ryzom/server/src/ai_service/Backup 1 of profile.h +++ /dev/null @@ -1,266 +0,0 @@ -/** \file profile.h - * - * $Id: profile.h,v 1.34 2006/10/31 16:09:01 blanchard Exp $ - * - * This file defines the classes: - * - CProfileOwner - * - IAIProfileFactory - * - CAIGenericProfileFactory - * - CAIBaseProfile - * - CProfilePtr - */ - -#ifndef RYAI_AI_PROFILE_H -#define RYAI_AI_PROFILE_H - - -//#pragma warning (disable : 4355) // warning C4355: 'this' : used in base member initializer list - -// This is the base class for defining NPC behaviour profiles -// The team infrastructure manages the allocation of AI profiles to bots - -class CProfilePtr; -class IAIProfile; - -////////////////////////////////////////////////////////////////////////////// -// CProfileOwner // -////////////////////////////////////////////////////////////////////////////// - -class CProfileOwner -{ -public: - virtual ~CProfileOwner() { } -}; - -////////////////////////////////////////////////////////////////////////////// -// IAIProfileFactory // -////////////////////////////////////////////////////////////////////////////// - -class IAIProfileFactory -: public NLMISC::CDbgRefCount -{ -public: - friend class CProfilePtr; - virtual ~IAIProfileFactory() { } - virtual NLMISC::CSmartPtr createAIProfile(CProfileOwner *owner) = 0; -}; - -#define RYAI_DECLARE_PROFILE_FACTORY(ProfileClass) RYAI_DECLARE_FACTORY(IAIProfileFactory, ProfileClass, std::string); -#define RYAI_REGISTER_PROFILE_FACTORY(ProfileClass, KeyValue) RYAI_REGISTER_FACTORY(IAIProfileFactory, ProfileClass, std::string, std::string(KeyValue)); - -////////////////////////////////////////////////////////////////////////////// -// CAIGenericProfileFactory // -////////////////////////////////////////////////////////////////////////////// - -template -class CAIGenericProfileFactory -: public IAIProfileFactory -{ -public: - NLMISC::CSmartPtr createAIProfile(CProfileOwner* owner) - { - return new TProfile(owner); - } -}; - -////////////////////////////////////////////////////////////////////////////// -// CAIBaseProfile // -////////////////////////////////////////////////////////////////////////////// - -class IAIProfile -: public NLMISC::CRefCount -{ -public: - virtual ~IAIProfile() { } - - /// @name Virtual interface - //@{ - // routine called when a profOwner starts to use a given profile - // note that bots have a data member called 'void *aiProfileData' reserved for the use of the profile code - // this data member should be setup here if it is to be used by the profile - virtual void beginProfile() = 0; - // routine called every time the profOwner is updated (frequency depends on player proximity, etc) - virtual void updateProfile(uint ticksSinceLastUpdate) = 0; - // routine called just before profOwner starts to use a new profile or when a profOwner dies - virtual void endProfile() = 0; - virtual AITYPES::TProfiles getAIProfileType() const = 0; - virtual std::string getOneLineInfoString() const = 0; - // routine called every time the profOwner's group changes state but profOwner maintains same ai profile - virtual void stateChangeProfile() = 0; - virtual void resumeProfile() = 0; - //@} -}; - -////////////////////////////////////////////////////////////////////////////// -// CAIBaseProfile // -////////////////////////////////////////////////////////////////////////////// - -class CAIBaseProfile -: public IAIProfile -{ -public: - virtual ~CAIBaseProfile() { } - - /// @name IAIProfile base implementation - //@{ - virtual void stateChangeProfile() { beginProfile(); } - virtual void resumeProfile() { } - //@} -}; - -////////////////////////////////////////////////////////////////////////////// -// CProfilePtr // -////////////////////////////////////////////////////////////////////////////// - -class CProfilePtr -{ -public: - enum TStartProfileType - { - START_BEGIN = 0, - START_RESUME - }; - -public: - CProfilePtr(); - - virtual ~CProfilePtr(); - -// std::string buildProfileDebugString() const; - virtual std::string getOneLineInfoString() const; - - AITYPES::TProfiles getAIProfileType() const; - - template - void setAIProfile(T* obj, IAIProfileFactory* profile, bool callStateChangedIfSame) const - { - if (profile) - { - setAIProfile(profile->createAIProfile(obj), callStateChangedIfSame); - } - } - - void setAIProfile(NLMISC::CSmartPtr profile, bool callStateChangedIfSame = false, TStartProfileType startType = START_BEGIN) const; - - void updateProfile(uint ticks) const; - - void mayUpdateProfile(uint ticks) const; - - IAIProfile* getAIProfile() const { return _AiProfile; } - NLMISC::CSmartPtr const& getAISpawnProfile() const { return _AiProfile; } - -private: - mutable NLMISC::CSmartPtr _AiProfile; - mutable NLMISC::CSmartPtr _NextAiProfile; - mutable bool _NextAiProfileCallStateChangedIfSame; - - mutable TStartProfileType _NextStartType; - mutable bool _IsUpdating; -}; - -////////////////////////////////////////////////////////////////////////////// -// Global functions // -////////////////////////////////////////////////////////////////////////////// - -/// the lookup routine that serves as a kind of repository interface -IAIProfileFactory* lookupAIGrpProfile(char const* name); - -/****************************************************************************/ -/* Inlined methods */ -/****************************************************************************/ - -////////////////////////////////////////////////////////////////////////////// -// CProfilePtr // -////////////////////////////////////////////////////////////////////////////// - -inline -CProfilePtr::CProfilePtr() -: _AiProfile(NULL) -, _NextAiProfile(NULL) -, _NextStartType(START_BEGIN) -, _IsUpdating(false) -{ -} - -inline -CProfilePtr::~CProfilePtr() -{ - _NextAiProfile = NULL; - _AiProfile = NULL; -} - -inline -std::string CProfilePtr::getOneLineInfoString() const -{ - if (_AiProfile.isNull()) - return std::string("No Profile"); - return _AiProfile->getOneLineInfoString(); -} - -inline -AITYPES::TProfiles CProfilePtr::getAIProfileType() const -{ - if (!_AiProfile.isNull()) - return _AiProfile->getAIProfileType(); - return AITYPES::BAD_TYPE; // unknown -} - -inline -void CProfilePtr::setAIProfile(NLMISC::CSmartPtr profile, bool callStateChangedIfSame, TStartProfileType startType) const -{ - // :NOTE: profile can be NULL - if (_IsUpdating) - { - _NextAiProfileCallStateChangedIfSame = callStateChangedIfSame; - _NextAiProfile = profile; - _NextStartType = startType; - return; - } - - if (!_AiProfile.isNull()) - { - // we may use the == operator because it doesn't take account of parameters (which is bad) :( - if (callStateChangedIfSame==true && _AiProfile->getAIProfileType ()==profile->getAIProfileType ()) // if we already have this profile, then call its stateChangeProfile method - { - _AiProfile->stateChangeProfile(); - return; - } - - _AiProfile->endProfile(); - _AiProfile = NULL; - } - - if (!profile.isNull()) - { - _AiProfile = profile; - if (startType==START_BEGIN) - _AiProfile->beginProfile(); - else - _AiProfile->resumeProfile(); - } -} - -inline -void CProfilePtr::updateProfile(uint ticks) const -{ - BOMB_IF(_AiProfile.isNull(),"Attempting updateProfile() with _AiProfile.isNull()",return); - - _IsUpdating = true; - _AiProfile->updateProfile(ticks); - _IsUpdating = false; - - if (!_NextAiProfile.isNull()) - { - setAIProfile(_NextAiProfile, _NextAiProfileCallStateChangedIfSame, _NextStartType); - _NextAiProfile = NULL; - } -} - -inline -void CProfilePtr::mayUpdateProfile(uint ticks) const -{ - if (_AiProfile) - updateProfile(ticks); -} - -#endif diff --git a/code/ryzom/server/src/ai_service/Backup 1 of stdpch.h b/code/ryzom/server/src/ai_service/Backup 1 of stdpch.h deleted file mode 100644 index c6b0cfc16..000000000 --- a/code/ryzom/server/src/ai_service/Backup 1 of stdpch.h +++ /dev/null @@ -1,184 +0,0 @@ -/** \file stdpch.h - * - * - * This is the ai_srevice executable's precopiled header controler file - * - * - * - * - * $Id: stdpch.h,v 1.41 2006/02/24 17:29:11 guignot Exp $ - */ -#ifndef STDPCH_H -#define STDPCH_H - - - -//---------------------------------------------------------------- -// external files -//---------------------------------------------------------------- - -// this is up top because it contains a certain number of #pragmas to -// control compiler warnings with stlport - -#include "nel/misc/types_nl.h" - - -//---------------------------------------------------------------- -// std libs - -#include -#include -#include - - -//---------------------------------------------------------------- -// stl - -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include - - -//---------------------------------------------------------------- -// nel - -#include "nel/misc/common.h" -#include "nel/misc/debug.h" -#include "nel/misc/command.h" -#include "nel/misc/variable.h" -#include "nel/misc/sheet_id.h" -#include "nel/misc/entity_id.h" -#include "nel/misc/file.h" -#include "nel/misc/path.h" -#include "nel/misc/time_nl.h" -#include "nel/misc/random.h" -#include "nel/misc/smart_ptr.h" - -#include "nel/misc/vector_2d.h" -#include "nel/misc/vectord.h" - -#include "nel/net/message.h" -#include "nel/net/unified_network.h" - -// NeL/ligo -#include "nel/ligo/ligo_config.h" -#include "nel/ligo/primitive.h" -#include "nel/ligo/primitive_configuration.h" - - -//---------------------------------------------------------------- -// nel net -#include "nel/net/service.h" -//---------------------------------------------------------------- -// service basics - -#define FOREACH(__itvar,__conttype,__contvar) \ -for (__conttype::iterator __itvar(__contvar.begin()),__itvar##end(__contvar.end()); __itvar!=__itvar##end; ++__itvar) - -#define FOREACH_NOINC(__itvar,__conttype,__contvar) \ -for (__conttype::iterator __itvar(__contvar.begin()),__itvar##end(__contvar.end()); __itvar!=__itvar##end;) - -#define FOREACHC(__itvar,__conttype,__contvar) \ -for (__conttype::const_iterator __itvar(__contvar.begin()),__itvar##end(__contvar.end()); __itvar!=__itvar##end; ++__itvar) - -#define FOREACHC_NOINC(__itvar,__conttype,__contvar) \ -for (__conttype::const_iterator __itvar(__contvar.begin()),__itvar##end(__contvar.end()); __itvar!=__itvar##end; ) - - -class CStringWriter - :public NLMISC::CRefCount -{ -public: - CStringWriter() - {} - virtual ~CStringWriter() - {} - virtual void append(const std::string &str) = 0; -}; - -class CTrashStringWriter -:public CStringWriter -{ -public: - CTrashStringWriter(NLMISC::CLog *log=NLMISC::InfoLog) - {} - virtual ~CTrashStringWriter() - {} - void append(const std::string &str) - {} -}; - -class CLogStringWriter - :public CStringWriter -{ -public: - CLogStringWriter(NLMISC::CLog *log=NLMISC::InfoLog) - :_Log(log) - {} - virtual ~CLogStringWriter() - {} - void append(const std::string &str) - { -#if !FINAL_VERSION - nlassert(_Log); -#endif - if (_Log) - _Log->displayNL(str.c_str()); - } - NLMISC::CLog *_Log; -}; - - -class CArrayStringWriter - :public CStringWriter -{ -public: - CArrayStringWriter(std::vector &stringVector) - :_StringVector(stringVector) - {} - virtual ~CArrayStringWriter() - {} - void append(const std::string &str) - { - _StringVector.push_back(str); - } - std::vector &_StringVector; -}; - - -namespace MULTI_LINE_FORMATER { - void pushTitle(std::vector& container, std::string const& text); - void pushEntry(std::vector& container, std::string const& text); - void pushFooter(std::vector& container); -} - -//---------------------------------------------------------------- -// game share - -#include "game_share/ryzom_entity_id.h" -#include "game_share/mode_and_behaviour.h" -#include "game_share/player_visual_properties.h" -#include "../ai_share/ai_event.h" -#include "../server_share/msg_ai_service.h" - -//---------------------------------------------------------------- -// ai share - - -#include "ai_share/ai_share.h" -#include "ai_share/ai_types.h" -#include "ai_share/ai_alias_description_node.h" -#include "ai_share/ai_event_description.h" -#include "ai_share/ai_coord.h" -#include "ai_share/ai_vector.h" -#include "ai_share/angle.h" -#include "ai_share/world_map.h" - -#endif /*STDPCH_H*/ diff --git a/code/ryzom/server/src/ai_service/CMakeLists.txt b/code/ryzom/server/src/ai_service/CMakeLists.txt index f684324ea..40fedc860 100644 --- a/code/ryzom/server/src/ai_service/CMakeLists.txt +++ b/code/ryzom/server/src/ai_service/CMakeLists.txt @@ -10,10 +10,7 @@ LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/ai_entity_id.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gpms_interface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gpms_interface.h ${CMAKE_CURRENT_SOURCE_DIR}/ios_interface.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ios_interface.h - ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ ai_profile_fauna.h - ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ profile.h - ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ stdpch.h) + ${CMAKE_CURRENT_SOURCE_DIR}/ios_interface.h) ADD_EXECUTABLE(ai_service ${SRC}) diff --git a/code/ryzom/server/src/gameplay_module_lib/CMakeLists.txt b/code/ryzom/server/src/gameplay_module_lib/CMakeLists.txt index 7843c0821..dd4824b2d 100644 --- a/code/ryzom/server/src/gameplay_module_lib/CMakeLists.txt +++ b/code/ryzom/server/src/gameplay_module_lib/CMakeLists.txt @@ -1,8 +1,5 @@ FILE(GLOB SRC *.cpp *.h) -# Filter out the source files not actually compiled. -#LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ admin_modules.cpp) - IF(WIN32) ADD_LIBRARY(gameplay_module_lib STATIC ${SRC}) ELSE(WIN32) diff --git a/code/ryzom/server/src/general_utilities_service/Backup 1 of stat_job_manager.h b/code/ryzom/server/src/general_utilities_service/Backup 1 of stat_job_manager.h deleted file mode 100644 index bd3bccd33..000000000 --- a/code/ryzom/server/src/general_utilities_service/Backup 1 of stat_job_manager.h +++ /dev/null @@ -1,98 +0,0 @@ -/** \file stats_job_manager.h - * - * Part of STAT Module for GUS (general utilities service) - * - * This file is the header for a singleton 'job manager'. The job manager manages a list of jobs to be - * executed one after another. Each job is assumed to require one or more calls to its update() method - * in order to perform its work. Each job's finished() method returns true when the job is done - * - * $Id: stat_job_manager.h,v 1.3 2005/03/29 09:25:53 miller Exp $ - */ - -#ifndef STAT_JOB_MANAGER_H -#define STAT_JOB_MANAGER_H - -#include "nel/misc/types_nl.h" -#include "nel/misc/debug.h" -#include "nel/misc/smart_ptr.h" -#include "game_share/singleton_registry.h" - -class CJobManager: public IServiceSingleton -{ -public: - static CJobManager* getInstance(); - -public: - class IJob: public NLMISC::CRefCount - { - public: - // virtual dtor - virtual ~IJob() {} - - // start a job running (one that isn't in progress) - virtual void start()=0; - - // return true if the job is finished -> the job object can be deleted - virtual bool finished()=0; - - // return a status string that can be displayed in an update variable - virtual std::string getShortStatus()=0; - - // get a detailed status string for display in a job list etc - virtual std::string getStatus()=0; - - // display the details of the job... eg the list of files being processed with related info - virtual void display(NLMISC::CLog* log=NLMISC::InfoLog)=0; - - // run the job's update to do a bit of work - virtual void update()=0; - }; - -public: - // add a job to the job vector and assign it a new id - uint32 addJob(NLMISC::CSmartPtr job); - - // move a job to the front of the queue - treat it as the active job - void promoteJob(uint32 idx); - - // the update method used to call job updates - void serviceUpdate(); - - // do nothing during the service updates until 'resume()' - void pause(); - - // resume after a 'pause()' - void resume(); - - // accessors for the number of job updates per call to serviceUpdate() - void setJobUpdatesPerUpdate(uint32 count); - uint32 getJobUpdatesPerUpdate(); - - // get the 'pause'/'resume' state, the number of jobsUpdatesPerUpdate and the status of the active job - std::string getStatus(); - - // list the status of all jobs that are not finished - void listJobs(NLMISC::CLog* log=NLMISC::InfoLog); - - // list the status of all jobs including those that are finished - void listJobHistory(NLMISC::CLog* log=NLMISC::InfoLog); - - // call the currently active job's 'display' method - void displayCurrentJob(NLMISC::CLog* log=NLMISC::InfoLog); - - // call the given job's 'display' method - void displayJob(uint32 jobId,NLMISC::CLog* log=NLMISC::InfoLog); - -private: - CJobManager(); - - typedef std::list TUnfinishedJobs; - typedef std::vector > TJobs; - - bool _Paused; - uint32 _JobUpdatesPerUpdate; - TJobs _Jobs; - TUnfinishedJobs _UnfinishedJobs; -}; - -#endif diff --git a/code/ryzom/server/src/general_utilities_service/CMakeLists.txt b/code/ryzom/server/src/general_utilities_service/CMakeLists.txt index 9b913f5e8..3db43b861 100644 --- a/code/ryzom/server/src/general_utilities_service/CMakeLists.txt +++ b/code/ryzom/server/src/general_utilities_service/CMakeLists.txt @@ -1,7 +1,6 @@ FILE(GLOB SRC *.cpp *.h) -LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ stat_job_manager.h - ${CMAKE_CURRENT_SOURCE_DIR}/ec_event_chat.cpp +LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/ec_event_chat.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gus_mfc_popups.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gus_mfc_popups.h ${CMAKE_CURRENT_SOURCE_DIR}/gus_mfc_select_with_text.cpp diff --git a/code/ryzom/server/src/patchman_service/Backup 1 of file_repository.h b/code/ryzom/server/src/patchman_service/Backup 1 of file_repository.h deleted file mode 100644 index 72527124c..000000000 --- a/code/ryzom/server/src/patchman_service/Backup 1 of file_repository.h +++ /dev/null @@ -1,173 +0,0 @@ -/** \file file_repository.h - * - * *********************************************************************** - * ****************************** IMPORTANT ****************************** - * *********************************************************************** - * - * The following set of routines all need to be called by the derived - * class for the repositry to function correctly: - * - init() - * - onModuleUp() - * - onModuleDown() - * - onModuleUpdate() - * - onDispatchMessage() - * - getModuleManifest() - * - * *********************************************************************** - * - */ - -#ifndef FILE_REPOSITORY_H -#define FILE_REPOSITORY_H - - -//----------------------------------------------------------------------------- -// includes -//----------------------------------------------------------------------------- - -// nel -#include "nel/misc/md5.h" -#include "nel/net/module_builder_parts.h" - -// game share -#include "game_share/deployment_configuration.h" - -// local -#include "module_admin_itf.h" -#include "administered_module.h" - - -//----------------------------------------------------------------------------- -// namespace PATCHMAN -//----------------------------------------------------------------------------- - -namespace PATCHMAN -{ - - //----------------------------------------------------------------------------- - // class CFileRepository - //----------------------------------------------------------------------------- - - class CFileRepository: - public CFileRepositorySkel, - public IFileRequestValidator, - public IFileInfoUpdateListener - { - public: - // get the module manifest component required for CFileReceiver modules to recognise us - std::string buildModuleManifest() const; - - public: - // ctor and init - CFileRepository(); - - // methods for use in derived classes - void init(NLNET::IModule* parent,const NLMISC::CSString& rootDirectory); - void onModuleUp(NLNET::IModuleProxy *module); - void onModuleDown(NLNET::IModuleProxy *module); - void onModuleUpdate(); - - // update methods - void rescanFull(); - void rescanPartial(); - void updateFile(const NLMISC::CSString& fileName); - - // overloadable method for getting the file list for subscribers - virtual void getFileInfo(const NLMISC::CSString& fileSpec,TFileInfoVector& result,const NLNET::IModuleProxy* sender) const; - - // query methods - TRepositoryDirectoryPtr getRepositoryDirectory(); - void getFile(const NLMISC::CSString& fileName,NLMISC::CSString& resultData,const NLNET::IModuleProxy* sender) const; - void dump(NLMISC::CLog& log); - - // stats system accessors - void setMaxHistorySize(uint32 maxHistorySize); - uint32 getMaxHistorySize() const; - - protected: - // treatment of incoming file requests - void requestFileInfo(NLNET::IModuleProxy *sender,const NLMISC::CSString& fileSpec); - void requestFileData(NLNET::IModuleProxy *sender, const NLMISC::CSString &fileName, uint32 startOffset, uint32 numBytes); - - // treatment of subscriptions and unsubscriptions - void subscribe(NLNET::IModuleProxy *sender, const NLMISC::CSString &fileSpec); - void unsubscribe(NLNET::IModuleProxy *sender, const NLMISC::CSString &fileSpec); - void unsubscribeAll(NLNET::IModuleProxy *sender); - void getInfo(NLNET::IModuleProxy *sender, const NLMISC::CSString &fileSpec); - - // IFileInfoUpdateListener specialisation implementation - void cbFileInfoUpdate(const SFileInfo& fileInfo); - void cbFileInfoErased(const NLMISC::CSString& fileName); - - // broadcast a set of file info changes to all subscribers - void _broadcastFileInfoChanges(const TFileInfoVector& fileInfoChanges); - - // overloadable method for treating my module down - virtual void onFileRepositoryModuleDown(NLNET::IModuleProxy *module); - - private: - // private data - - typedef NLNET::CInterceptorForwarder TInterceptor; - /// module interceptor forwarder - TInterceptor _Interceptor; - - friend class NLNET::CInterceptorForwarder; - - // the module object that this object is part of - NLNET::IModule* _Parent; - - // a wrapper round '_Parent' to allow us to log to the parent's CAdministeredModuleBase interface - CAdministeredModuleWrapper _AdministeredModuleWrapper; - - // the set of subscribers - typedef std::map TSubscribers; - TSubscribers _Subscribers; - - // the recent info changes that the subscribers may be interested in - TFileInfoVector _FileInfoChanges; - - // system for history of recent info requests and data requests - uint32 _MaxHistorySize; - typedef std::list THistory; - - // the history for info requests - THistory _FileInfoHistory; - uint32 _FileInfoHistorySize; - uint32 _FileInfoCount; - - // the history for file data requests - THistory _FileRequestHistory; - uint32 _FileRequestHistorySize; - uint32 _FileRequestCount; - - protected: - // data that may be accessed directlry by derived objects - - // a smart pointers to our repository directory - TRepositoryDirectoryPtr _Directory; - - - protected: - // declaration of NLMISC_COMMANDS implemented by this class - NLMISC_CLASS_COMMAND_DECL(dump); - NLMISC_CLASS_COMMAND_DECL(incRescan); - NLMISC_CLASS_COMMAND_DECL(fullRescan); - NLMISC_CLASS_COMMAND_DECL(getFile); - NLMISC_CLASS_COMMAND_DECL(getFileInfo); - NLMISC_CLASS_COMMAND_DECL(updateFile); - NLMISC_CLASS_COMMAND_DECL(MaxHistorySize); - - // macro for adding the NLMISC_COMMANDS provided here to the derived class's command table - #define NLMISC_COMMAND_HANDLER_ADDS_FOR_FILE_REPOSITORY(className) \ - NLMISC_COMMAND_HANDLER_ADD(className, incRescan, "Perform next increment of incremental rescan", "no args")\ - NLMISC_COMMAND_HANDLER_ADD(className, fullRescan, "Perform a full rescan", "no args")\ - NLMISC_COMMAND_HANDLER_ADD(className, getFile, "get a file", "")\ - NLMISC_COMMAND_HANDLER_ADD(className, getFileInfo, "get info on a set of files", "")\ - NLMISC_COMMAND_HANDLER_ADD(className, updateFile, "force a rescan of a given file", "")\ - NLMISC_COMMAND_HANDLER_ADD(className, MaxHistorySize, "the maximum size allowed for the history buffers", "[]") - }; - -} // end of namespace - -#endif diff --git a/code/ryzom/server/src/patchman_service/CMakeLists.txt b/code/ryzom/server/src/patchman_service/CMakeLists.txt index 5f388e833..c7913f53d 100644 --- a/code/ryzom/server/src/patchman_service/CMakeLists.txt +++ b/code/ryzom/server/src/patchman_service/CMakeLists.txt @@ -1,7 +1,6 @@ FILE(GLOB SRC *.cpp *.h) -LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ file_repository.h - ${CMAKE_CURRENT_SOURCE_DIR}/rr_module_itf.cpp +LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/rr_module_itf.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rr_module_itf.h) ADD_EXECUTABLE(patchman_service ${SRC}) diff --git a/code/ryzom/server/src/server_share/CMakeLists.txt b/code/ryzom/server/src/server_share/CMakeLists.txt index e777d25d9..d4535389f 100644 --- a/code/ryzom/server/src/server_share/CMakeLists.txt +++ b/code/ryzom/server/src/server_share/CMakeLists.txt @@ -1,8 +1,5 @@ FILE(GLOB SRC *.cpp *.h) -# Filter out the source files not actually compiled. -#LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ admin_modules.cpp) - ADD_LIBRARY(server_share STATIC ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${NEL_INCLUDE_DIR}) diff --git a/code/ryzom/tools/assoc_mem/Backup 1 of record.cpp b/code/ryzom/tools/assoc_mem/Backup 1 of record.cpp deleted file mode 100644 index d7f5bf719..000000000 --- a/code/ryzom/tools/assoc_mem/Backup 1 of record.cpp +++ /dev/null @@ -1,56 +0,0 @@ - #include "record.h" - -CRecord::CRecord() -{ -} - -CRecord::CRecord(std::vector &) -{ -} - -CRecord::~CRecord() -{ -/* std::vector::iterator it_val = _Values.begin(); - while ( it_val != _Values.end() ) - { - IValue *val = *it_val; - it_val++; - delete val; - } -*/ -} - -void CRecord::addValue(IValue *value) -{ - _Values.push_back( value ); -} - -void CRecord::addValue(std::string &str) -{ - _Values.push_back( new CValue(str) ); -} - -void CRecord::addValue(bool b) -{ - _Values.push_back( new CValue(b) ); -} - -void CRecord::addValue(int val) -{ - _Values.push_back( new CValue(val) ); -} - -const std::vector &CRecord::getValues() -{ - return _Values; -} - -const IValue *CRecord::operator[](int index) -{ - return _Values[index]; -} - -int CRecord::size() -{ - return _Values.size(); -} \ No newline at end of file diff --git a/code/ryzom/tools/assoc_mem/Backup 2 of record.cpp b/code/ryzom/tools/assoc_mem/Backup 2 of record.cpp deleted file mode 100644 index 657e3009b..000000000 --- a/code/ryzom/tools/assoc_mem/Backup 2 of record.cpp +++ /dev/null @@ -1,72 +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 . - - #include "record.h" - -CRecord::CRecord() -{ -} - -CRecord::CRecord(std::vector &) -{ -} - -CRecord::~CRecord() -{ -/* std::vector::iterator it_val = _Values.begin(); - while ( it_val != _Values.end() ) - { - IValue *val = *it_val; - it_val++; - delete val; - } -*/ -} - -void CRecord::addValue(IValue *value) -{ - _Values.push_back( value ); -} - -void CRecord::addValue(std::string &str) -{ - _Values.push_back( new CValue(str) ); -} - -void CRecord::addValue(bool b) -{ - _Values.push_back( new CValue(b) ); -} - -void CRecord::addValue(int val) -{ - _Values.push_back( new CValue(val) ); -} - -const std::vector &CRecord::getValues() -{ - return _Values; -} - -const IValue *CRecord::operator[](int index) -{ - return _Values[index]; -} - -int CRecord::size() -{ - return _Values.size(); -} \ No newline at end of file diff --git a/code/ryzom/tools/assoc_mem/CMakeLists.txt b/code/ryzom/tools/assoc_mem/CMakeLists.txt index 2593f848f..61df5bf23 100644 --- a/code/ryzom/tools/assoc_mem/CMakeLists.txt +++ b/code/ryzom/tools/assoc_mem/CMakeLists.txt @@ -1,9 +1,5 @@ FILE(GLOB SRC *.cpp *.h) -LIST(REMOVE_ITEM SRC - ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ record.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 2\ of\ record.cpp) - ADD_EXECUTABLE(assoc_mem ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR}) diff --git a/code/ryzom/tools/leveldesign/named_items_2_csv/Backup 1 of named_items_2_csv.cpp b/code/ryzom/tools/leveldesign/named_items_2_csv/Backup 1 of named_items_2_csv.cpp deleted file mode 100644 index ba66279d1..000000000 --- a/code/ryzom/tools/leveldesign/named_items_2_csv/Backup 1 of named_items_2_csv.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/* - author : Fabien Houlmann - houlmann@nevrax.com - date : 13/10/2005 - - named2csv: convert named_items.txt to .csv format and convert it back - to named_items.txt after changes. - - use: named2csv.exe named_items.txt filter.script (to generate a .csv based on filter) - named2csv.exe named_items.txt named_items.csv (to modify .txt with .csv) - - */ - -#include "nel\misc\common.h" -#include "nel\misc\debug.h" -#include "nel\misc\sstring.h" -#include "nel\misc\path.h" -#include "nel\misc\file.h" -#include - -using namespace NLMISC; -using namespace std; - -// function declaration -int verifItemsFile (const char *filename); -int verifCsvFile (const char *filename); -void processItemLine (const string &s); -int getItemsFromFile (const char *filename); -int getFieldsFromFile(const char *filename); -int getNbItemFromFile(const char *filename); -int exportCsv (const char *filename); -int importCsv (const char *filename); -void getItemBounds (const CVectorSString &lines, uint num, uint &a, uint &b); -void updateItemField (CVectorSString &lines, uint itemIndex, uint fieldIndex, uint &a, uint &b); -void addNewItem (CVectorSString &lines, uint itemIndex); -int updateItems (const char *filename); - -// global access -CVectorSString fields; -vector items; - -// check the items file (locSlot and item number coherence) -int verifItemsFile (const char *filename) -{ - FILE *f = fopen(filename, "r"); - if (f == NULL) - nlerror("Can't open file : %s", filename); - - char buffer[1024]; - while (fgets(buffer, 1024, f)) - { - string s(buffer); - - // null or comment - if (s == "" || s.find("//") == 0) - continue; - - if (s.find("_LocSlot") == string::npos) - continue; - - // get item numbers - int n1, n2; - sscanf(buffer, "_Items#%d._LocSlot=%d", &n1, &n2); - - // check - if (n1 != n2) - nlerror("item number (%d) and _LocSlot(%d) don't match !", n1, n2); - } - - fclose(f); - return 0; -} - -// check csv file (locSlot and item number coherence) -int verifCsvFile (const char *filename) -{ - FILE *f = fopen(filename, "r"); - if (f == NULL) - nlerror("Can't open file : %s", filename); - - uint prevId = -1; - char buffer[1024]; - // skip first line - fgets(buffer, 1024, f); - while (fgets(buffer, 1024, f)) - { - uint id = atoi(buffer); - if (id-1 != prevId) - nlerror("item number (%d) and previous item (%d) don't match !", id, prevId); - prevId = id; - } - - fclose(f); - return 0; -} - -// parse a line from source file -void processItemLine(const string &s) -{ - // null or comment - if (s == "" || s.find("//") == 0) - return; - - // other stuff - if (s.find("_Items#") == string::npos) - return; - - // get item number - int n; - sscanf(s.c_str(), "_Items#%d", &n); - - // check fields - for (uint i=0 ; i max) - max = n; - } - - fclose(f); - return max; -} - -// generate .csv file based on actual filled structure -int exportCsv(const char *filename) -{ - nlassert(fields.size() != 0); - - uint i, j; - FILE *f = fopen(filename, "w"); - if (f == NULL) - nlerror("Can't open file : %s", filename); - - // print fields name - for (i=0 ; i items.size()) - items.resize(n+1); - - // add item id - items[n].push_back(val); - - // add others - do - { - val = s.splitTo(';', true); - items[n].push_back(val); - } while (s != ""); - } - - fclose(f); - return 0; -} - -// compute item boundary in the file (min and max lines) -void getItemBounds(const CVectorSString &lines, uint num, uint &a, uint &b) -{ - a = b = 0; - uint i = -1; - bool ok = false; - - while (++i < lines.size() && !ok) - { - if (lines[i] == "" || lines[i].find("//") != string::npos) - continue; - - // get item number - uint n; - if (sscanf(lines[i].c_str(), "_Items#%d", &n) == 0) - continue; - - // find it - if (n == num) - { - // frist line - if (a == 0) - a = b = i+1; - // more line - else - b++; - } - else - { - // end - if (a != 0) - ok = true; - } - } - - // found it ? - if (a != 0) - { - ok = true; - b++; - } -} - -// update an item field with a new value -void updateItemField(CVectorSString &lines, uint itemIndex, uint fieldIndex, uint &a, uint &b) -{ - string field = fields[fieldIndex]; - string val = items[itemIndex][fieldIndex]; - string s = "_Items#"; - s += toString(itemIndex); - s += "."; - s += field; - - // remove jump - val = CSString(val).strtok("\n"); - - uint craftLine = 0; - bool found = false; - uint i = a-1; - - // first pass to check if param have changed - for (i=a ; i= items[itemIndex].size()); - cout << "Updating item " << itemIndex << endl; - - uint a, b; - getItemBounds(lines, itemIndex, a, b); - - // no bound found, it's a new item - if (b == 0) - { - addNewItem(lines, itemIndex); - getItemBounds(lines, itemIndex, a, b); - } - - for (uint fieldIndex=0 ; fieldIndex - - - - - - - - - -5) World_Editor_Service utilise un cache pour stocker les déplacements des joueurs, afin de n'envoyer que ce qui bouge - -6) World_Editor_Plugin utilise aussi un cache avec un pointeur sur les Primitives, afin de ne modifier dans WE que ce qui bouge - -*/ -#include "stdafx.h" -#include "plugin.h" -#include "resource.h" -#include "nel/misc/path.h" -#include "LoadDialog.h" -#include "nel/sound/u_listener.h" - -using namespace NLMISC; -using namespace NLLIGO; -using namespace NLSOUND; -using namespace NLNET; -using namespace std; - - -class Player -{ -public: - string _name; - float _x, _y; - const IPrimitive *primitive; - // Constructor - Player::Player() - { - primitive = NULL; - } - - Player::Player(string name, float x, float y) - { - primitive = NULL; - _name = name; - _x = x; - _y = y; - } - /// Destructor - Player::~Player() - { - } -}; - -vector StackPlayers; - -map StoredPlayers; - - -extern "C" -{ - void *createPlugin() - { - return new CPlugin(); - } -} - -CPlugin::CPlugin() - : _PluginAccess(0) -{ - m_Initialized = false; - _Client = NULL; - StackPlayers.clear(); -} - -CPlugin::~CPlugin() -{ - delete _Client; - - if (m_Initialized) - { - _PluginAccess->deleteRootPluginPrimitive(); - m_Initialized = false; - } -} - -void CPlugin::progress (float progressValue) -{ - /*char tmp[1024]; - sprintf(tmp, "Initializing mixer : %i%%", int(progressValue * 100)); - LoadDlg->Message = tmp; - LoadDlg->UpdateData(FALSE); - LoadDlg->RedrawWindow();*/ -} - -// *************************************************************************** -void serverSentPos (CMessage &msgin, TSockId from, CCallbackNetBase &netbase) -{ - // Called when the server sent a POS message - uint32 count; - - msgin.serial(count); - for (uint i = 0;i < count;++i) - { - string name; - msgin.serial(name); - - float x, y; - msgin.serial(x); - msgin.serial(y); - // we received name, x, y, we save it in the stack - StackPlayers.push_back (Player(name, x, y)); - } -} - -// *************************************************************************** -void serverSentInfo (CMessage &msgin, TSockId from, CCallbackNetBase &netbase) -{ - // Called when the server sent a INFO message - string text; - msgin.serial(text); - printf("%s\n", text.c_str()); -} - -// *************************************************************************** -// All messages handled by this server -#define NB_CB 2 -TCallbackItem CallbackArray[NB_CB] = -{ - { "POS", serverSentPos }, - { "INFO", serverSentInfo }, -}; - -void CPlugin::init(IPluginAccess *pluginAccess) -{ - CLoadDialog *LoadDlg; - - AFX_MANAGE_STATE(AfxGetStaticModuleState()); - AfxEnableControlContainer(); - _PluginAccess = pluginAccess; -//#undef new - LoadDlg = new CLoadDialog; -//#define new NL_NEW - LoadDlg->Create(IDD_DIALOG_LOAD); - LoadDlg->Message = "Connecting..."; - LoadDlg->UpdateData(FALSE); - //LoadDlg->Invalidate(); - LoadDlg->ShowWindow(SW_SHOW); - //LoadDlg->RedrawWindow(); - - // connect to the server here... - - // Read the host where to connect in the client.cfg file - CConfigFile ConfigFile; - ConfigFile.load ("client.cfg"); - string LSHost(ConfigFile.getVar("LSHost").asString()); - - // Init and Connect the client to the server located on port 3333 - _Client = new CCallbackClient(); - _Client->addCallbackArray (CallbackArray, NB_CB); - - //printf("Please wait connecting...\n"); - try - { - CInetAddress addr(LSHost+":48888"); - _Client->connect(addr); - } - catch(ESocket &e) - { - MessageBox (NULL, e.what(), "Error", MB_ICONERROR|MB_OK); - delete LoadDlg; - LoadDlg = 0; - return; - } - delete LoadDlg; - LoadDlg = 0; - - if (!_Client->connected()) - { - MessageBox (NULL, "The connection failed", "Error", MB_ICONERROR|MB_OK); - return; - } - -//#undef new - _DialogFlag = new CDialogFlags(/*_Mixer*/); -//#define new NL_NEW - // open the dialog flag window - _DialogFlag->Create(IDD_DIALOG_FLAGS, CWnd::FromHandle(_PluginAccess->getMainWindow()->m_hWnd)); - _DialogFlag->init(this); - _DialogFlag->ShowWindow(TRUE); - - // - { - CMessage msg; - msg.setType("WINDOW"); - float xmin = 0; - float xmax = 10000; - float ymin = 0; - float ymax = 10000; - msg.serial (xmin); - msg.serial (ymin); - msg.serial (xmax); - msg.serial (ymax); - _Client->send(msg); - } -} - -/// The current region has changed. -void CPlugin::primitiveChanged(const NLLIGO::IPrimitive *root) -{ -} - -/// The listener has been moved on the map. -void CPlugin::positionMoved(const NLMISC::CVector &position) -{ -} - -void CPlugin::lostPositionControl() -{ -} - -void CPlugin::onIdle() -{ - if (_Client && _Client->connected()) - { - // during the first call, we create a Root primitive to store all players - if (!m_Initialized) - { - m_Initialized = true; - _PluginAccess->createRootPluginPrimitive(); - } - else - { - // first, we receive the stack of messages, which is composed of players informations - _Client->update(); - // now, we insert the players into the GUI - for (uint i = 0; i < StackPlayers.size(); ++i) - { - map::const_iterator ite; - ite = StoredPlayers.find(StackPlayers[i]._name); - if (ite == StoredPlayers.end()) - { - // if the player doesn't exist in the static list, we add it - //StoredPlayers.insert(map::value_type(StackPlayers[i]._name, StackPlayers[i])); - StoredPlayers[StackPlayers[i]._name] = StackPlayers[i]; - std::vector Parameters; - - Parameters.push_back (CPrimitiveClass::CInitParameters ()); - CPrimitiveClass::CInitParameters ¶m1 = Parameters.back (); - param1.DefaultValue.resize (1); - param1.Name = "x"; - param1.DefaultValue[0].GenID = false; - param1.DefaultValue[0].Name = toString(StackPlayers[i]._x); - - Parameters.push_back (CPrimitiveClass::CInitParameters ()); - CPrimitiveClass::CInitParameters ¶m2 = Parameters.back (); - param2.DefaultValue.resize (1); - param2 = Parameters.back (); - param2.Name = "y"; - param2.DefaultValue[0].GenID = false; - param2.DefaultValue[0].Name = toString(StackPlayers[i]._y); - - // create a player in WorldEditor - StoredPlayers[StackPlayers[i]._name].primitive = _PluginAccess->createPluginPrimitive("player",StackPlayers[i]._name.c_str(),NLMISC::CVector(StackPlayers[i]._x,StackPlayers[i]._y,0),0,Parameters); - } - else - { - // the player has moved, we need to change its coordinates - _PluginAccess->movePluginPrimitive(StoredPlayers[StackPlayers[i]._name].primitive, CVector(StackPlayers[i]._x, StackPlayers[i]._y, 0)); - } - } - // we clear the stack - StackPlayers.clear(); - } - } -} diff --git a/code/ryzom/tools/server/build_world_packed_col/Backup 1 of test_col_world.cpp b/code/ryzom/tools/server/build_world_packed_col/Backup 1 of test_col_world.cpp deleted file mode 100644 index 8ec4ddab4..000000000 --- a/code/ryzom/tools/server/build_world_packed_col/Backup 1 of test_col_world.cpp +++ /dev/null @@ -1,1084 +0,0 @@ -/*#include "std_header.h" -// -// test_col_world.cpp : Defines the entry point for the console application. -// -#include "zone_util.h" -#include "village.h" -// -#include "nel/misc/array_2d.h" -#include "nel/misc/config_file.h" -#include "nel/misc/path.h" -#include "nel/misc/file.h" -#include "nel/misc/vector_2f.h" -#include "nel/misc/triangle.h" -#include "nel/misc/polygon.h" -#include "nel/misc/smart_ptr.h" -#include "nel/misc/quad.h" -// -#include "nel/3d/frustum.h" -#include "nel/3d/viewport.h" -#include "nel/3d/scissor.h" -#include "nel/misc/aabbox.h" -#include "nel/misc/stream.h" -// -#include "3d/landscape.h" -#include "3d/zone.h" -#include "3d/quad_grid.h" -#include "3d/event_mouse_listener.h" -#include "3d/vertex_buffer.h" -#include "3d/material.h" -#include "3d/register_3d.h" -#include "3d/nelu.h" -#include "3d/scene_group.h" -#include "3d/shape_info.h" -#include "3d/packed_zone.h" -#include "3d/packed_world.h" -// -#include -// - -#include "nel/georges/u_form.h" -#include "nel/georges/u_form_elm.h" -#include "nel/georges/u_form_loader.h" - - -using namespace NLMISC; -using namespace NL3D; - - - -static inline void pushVBQuad(NLMISC::CVector *&dest, const NLMISC::CQuad &quad) -{ - *dest++ = quad.V0; - *dest++ = quad.V1; - *dest++ = quad.V2; - *dest++ = quad.V3; -} - - -class CZoneRefCount : public CRefCount -{ -public: - CZone Zone; - bool Loaded; - std::string Path; - std::string IGPath; - sint X; - sint Y; -public: - CZoneRefCount() : Loaded(false) {} -}; - - -static void viewportToScissor(const CViewport &vp, CScissor &scissor) -{ - scissor.X = vp.getX(); - scissor.Y = vp.getY(); - scissor.Width = vp.getWidth(); - scissor.Height = vp.getHeight(); -} - - - - -// load list of continent from the .world sheet -static bool loadContinentList(const std::string &worldSheet, std::vector &continentList) -{ - NLGEORGES::UFormLoader *loader = NLGEORGES::UFormLoader::createLoader(); - // - std::string path = CPath::lookup(worldSheet, false, false); - if (path.empty()) - { - NLGEORGES::UFormLoader::releaseLoader(loader); - nlwarning("Path not found for %s.", worldSheet.c_str()); - return false; - } - NLGEORGES::UForm *worldForm; - worldForm = loader->loadForm(path.c_str()); - if (worldForm == NULL) - { - NLGEORGES::UFormLoader::releaseLoader(loader); - return false; - } - - uint size; - NLGEORGES::UFormElm *pElt; - nlverify (worldForm->getRootNode().getNodeByName (&pElt, "continents list")); - if(!pElt) - { - nlwarning("node 'continents list' not found in a .world"); - NLGEORGES::UFormLoader::releaseLoader(loader); - return false; - } - else - { - nlverify (pElt->getArraySize (size)); - for (uint32 i = 0; i getArrayNode (&pEltOfList, i) && pEltOfList) - { - std::string continentName; - pEltOfList->getValueByName (continentName, "continent_name"); - if (CFile::getExtension(continentName).empty()) - { - continentName += ".continent"; - } - continentList.push_back(continentName); - } - } - } - NLGEORGES::UFormLoader::releaseLoader(loader); - return true; -} - - -class CRemoveBorderLeavePred -{ -public: - CRemoveBorderLeavePred(uint16 zoneId) : ZoneId(zoneId) {} - bool operator()(const CTessFace *tf) const - { - return tf->Patch->getZone()->getZoneId() != ZoneId; - } - uint16 ZoneId; -}; - - -static bool parseCamPos(CConfigFile &cf, CVector &camPos) -{ - CConfigFile::CVar *camPosVar = cf.getVarPtr("CamPos"); - if (camPosVar) - { - if (camPosVar->size() == 3) - { - camPos.x = camPosVar->asFloat(0); - camPos.y = camPosVar->asFloat(1); - camPos.z = camPosVar->asFloat(2); - return true; - } - else - { - // it is a zone name - sint zoneX, zoneY; - if (getZonePos(camPosVar->asString(), zoneX, zoneY)) - { - camPos.x = 160.f * zoneX + 80.f; - camPos.y = 160.f * zoneY + 80.f; - camPos.z = 0.f; - return true; - } - } - } - return false; -} - -static bool parseCamSpeed(CConfigFile &cf, float &camSpeed) -{ - CConfigFile::CVar *camSpeedVar = cf.getVarPtr("CamSpeed"); - if (camSpeedVar) - { - camSpeed = camSpeedVar->asFloat(); - return true; - } - return false; -} - -static bool newCamSpeedWanted = false; -static float newCamSpeed = FLT_MIN; -static bool newCamPosWanted = false; - -static CVector newCamPos(FLT_MAX, FLT_MAX, FLT_MAX); - -static void configFileChanged(const std::string &filename) -{ - CConfigFile cf; - try - { - cf.load(filename); - CVector camPos; - if (parseCamPos(cf, camPos)) - { - if (camPos!= newCamPos) - { - newCamPos = camPos; - newCamPosWanted = true; - } - } - float camSpeed; - if (parseCamSpeed(cf, camSpeed)) - { - if (camSpeed != newCamSpeed) - { - newCamSpeed= camSpeed; - newCamSpeedWanted = true; - } - } - } - catch(EStream &) - { - printf("Error while reading config file\n"); - } -} - -int main(int argc, char* argv[]) -{ - registerSerial3d(); - - if (argc != 2) - { - printf("usage : %s config_file_name.cfg\n", CFile::getFilename(argv[0]).c_str()); - return -1; - } - // - std::string worldSheetName; - // - std::string cachePath; - // load all landscape zones - std::vector zoneNames; - CConfigFile cf; - CVector camPos(18927.f, -24382.f, 0.f); - - bool addLandscapeIG = false; - - float camSpeed = 35.f; - try - { - cf.load(argv[1]); - parseCamPos(cf, camPos); - newCamPos = camPos; - parseCamSpeed(cf, camSpeed); - newCamSpeed = camSpeed; - CConfigFile::CVar &paths = cf.getVar("ZonesPaths"); - for(uint k = 0; k < (uint) paths.size(); ++k) - { - std::vector files; - CPath::getPathContent(paths.asString(k), true, false, true, files); - for(uint l = 0; l < files.size(); ++l) - { - std::string ext = CFile::getExtension(files[l]); - if (nlstricmp(ext, "zonel") == 0) - { - zoneNames.push_back(files[l]); - } - } - } - cachePath = cf.getVar("CachePath").asString(); - CConfigFile::CVar *searchPaths = cf.getVarPtr("SearchPaths"); - for(uint k = 0; k < (uint) searchPaths->size(); ++k) - { - CPath::addSearchPath(searchPaths->asString(k), true, false); - } - CConfigFile::CVar *addLandscapeIGVarPtr = cf.getVarPtr("AddLandscapeIG"); - if (addLandscapeIGVarPtr) - { - addLandscapeIG = addLandscapeIGVarPtr->asInt() != 0; - } - } - catch(EStream &) - { - printf("Error while reading config file\n"); - return -1; - } - catch(EConfigFile &e) - { - printf(e.what()); - return -1; - } - // - CFile::addFileChangeCallback(argv[1], configFileChanged); - // - std::vector > zones; - zones.reserve(zoneNames.size()); - sint zoneMinX, zoneMaxX; - sint zoneMinY, zoneMaxY; - bool firstZoneCorner = true; - for(uint k = 0; k < zoneNames.size(); ++k) - { - CSmartPtr zoneRef = new CZoneRefCount; - zoneRef->Path = zoneNames[k]; - if (addLandscapeIG) - { - std::string igFileName = CFile::getFilenameWithoutExtension(zoneRef->Path) + ".ig"; - zoneRef->IGPath = CPath::lookup(igFileName, false, false); - if (zoneRef->IGPath.empty()) - { - nlwarning("Couldn't find ig %s. Maybe there's no ig for that zone.", igFileName.c_str()); - } - } - //printf("Loading zone %d / %d \n", (int) k + 1, (int) zoneNames.size()); - CVector2f zoneCornerMin, zoneCornerMax; - if (getZonePos(zoneNames[k], zoneRef->X, zoneRef->Y)) - { - if (firstZoneCorner) - { - zoneMinX = zoneMaxX = zoneRef->X; - zoneMinY = zoneMaxY = zoneRef->Y; - firstZoneCorner = false; - } - else - { - zoneMinX = std::min(zoneMinX, zoneRef->X); - zoneMaxX = std::max(zoneMaxX, zoneRef->X); - zoneMinY = std::min(zoneMinY, zoneRef->Y); - zoneMaxY = std::max(zoneMaxY, zoneRef->Y); - } - zones.push_back(zoneRef); - } - } - if (zones.empty()) - { - printf("No zones loaded \n"); - return -1; - } - uint gridWidth = zoneMaxX - zoneMinX + 1; - uint gridHeight = zoneMaxY - zoneMinY + 1; - // build a grid of zones - CArray2D zoneGrid; - CArray2D packedZoneGrid; - zoneGrid.init(gridWidth, gridHeight, NULL); - packedZoneGrid.init(gridWidth, gridHeight); - for(uint k = 0; k < zones.size(); ++k) - { - sint x = zones[k]->X - zoneMinX; - sint y = zones[k]->Y - zoneMinY; - zoneGrid(x, y) = zones[k]; - } - // build grid for tris - CVector2f cornerMin, cornerMax; - cornerMin.set(zoneMinX * 160.f, zoneMinY * 160.f); - cornerMax.set((zoneMaxX + 1) * 160.f, (zoneMaxY + 1) * 160.f); - const float CELL_SIZE = 4.f; // resolution of tri grid - - CVillageGrid vg; - vg.init(gridWidth, gridHeight, zoneMinX, zoneMinY); - - - std::vector continentList; - CConfigFile::CVar *worldSheetPtr = cf.getVarPtr("WorldSheet"); - if (!(worldSheetPtr && loadContinentList(worldSheetPtr->asString(), continentList))) - { - CConfigFile::CVar *continentSheetNames = cf.getVarPtr("ContinentSheetNames"); - std::vector > igs; - if (!continentSheetNames) - { - nlwarning("No villages added to collisions"); - } - else - { - for(uint k = 0; k < (uint) continentSheetNames->size(); ++k) - { - continentList.push_back(continentSheetNames->asString(k)); - } - } - } - - bool addVillages = true; - CConfigFile::CVar *addVillagesVar = cf.getVarPtr("AddVillages"); - if (addVillagesVar) - { - addVillages = addVillagesVar->asBool(); - } - if (addVillages) - { - for(uint k = 0; k < (uint) continentList.size(); ++k) - { - vg.addVillagesFromContinent(continentList[k]); - } - } - - TShapeCache shapeCache; - - - - // build each zone separatly - static std::vector leaves; - uint currZoneIndex = 0; - for (sint y = 0; y < (sint) zoneGrid.getHeight(); ++y) - { - for (sint x = 0; x < (sint) zoneGrid.getWidth(); ++x) - { - if (zoneGrid(x, y)) - { - std::string cacheFilename = CPath::standardizePath(cachePath) + CFile::getFilenameWithoutExtension(zoneGrid(x, y)->Path) + ".packed_zone"; - bool mustRebuild = false; - - // if there's any village on this zone that is more recent than the zone, then must rebuild the zone - { - const std::list &villageList = vg.VillageGrid(x, y); - for(std::list::const_iterator it = villageList.begin(); it != villageList.end(); ++it) - { - uint32 modifDate = vg.Villages[*it].FileModificationDate; - uint32 cacheDate = CFile::getFileModificationDate(cacheFilename); - if (modifDate > cacheDate) - { - mustRebuild = true; - break; - } - } - } - - // if landscape ig is reclaimed, see if it is more recent - if (!zoneGrid(x, y)->IGPath.empty()) - { - if (CFile::getFileModificationDate(zoneGrid(x, y)->IGPath) >= CFile::getFileModificationDate(cacheFilename)) - { - mustRebuild = true; - } - } - - if (!mustRebuild) - { - mustRebuild = true; - // see if zone is present in cache and is valid - if (CFile::getFileModificationDate(cacheFilename) >= CFile::getFileModificationDate(zoneGrid(x, y)->Path)) - { - // try to retrieve file from cache - try - { - CIFile f; - f.open(cacheFilename); - CPackedZoneBase *pb; - f.serialPolyPtr(pb); - packedZoneGrid(x, y) = pb; - mustRebuild = false; - printf("Retrieving zone %d / %d from cache\n", (int) currZoneIndex + 1, (int) zones.size()); - } - catch(EStream &) - { - } - } - } - - if (mustRebuild) - { - printf("Rebuilding zone %d / %d \n", (int) currZoneIndex + 1, (int) zones.size()); - CLandscape *landscape = new CLandscape; - landscape->init(); - landscape->setThreshold (8.f / (1000.f * 1000.f)); - //landscape->setThreshold(0); - landscape->setTileMaxSubdivision (0); - // add wanted zone & all zones around for continuity - for (sint ly = y - 1; ly <= y + 1; ++ly) - { - if (ly < 0) continue; - if (ly >= (sint) gridHeight) break; - for (sint lx = x - 1; lx <= x + 1; ++lx) - { - if (lx < 0) continue; - if (lx >= (sint) gridWidth) break; - if (zoneGrid(lx, ly)) - { - if (!zoneGrid(lx, ly)->Loaded) - { - CIFile stream; - try - { - stream.open(zoneGrid(lx, ly)->Path); - zoneGrid(lx, ly)->Zone.serial(stream); - zoneGrid(lx, ly)->Loaded = true; - } - catch(EStream &) - { - printf("Error while loading zone %s : zone not loaded \n"); - } - } - if (zoneGrid(lx, ly)->Loaded) - { - landscape->addZone(zoneGrid(lx, ly)->Zone); - } - } - } - } - // - landscape->refineAll(CVector((x + zoneMinX) * 160.f + 80.f, (y + zoneMinY) * 160.f + 80.f, 1000.f)); - // - // Dump tesselated triangles - leaves.clear(); - landscape->getTessellationLeaves(leaves); - leaves.erase(std::remove_if(leaves.begin(), leaves.end(), CRemoveBorderLeavePred(zoneGrid(x, y)->Zone.getZoneId())), leaves.end()); - // gather and load list of villages ig - std::vector igs; - if (addVillages) - { - const std::list &villageList = vg.VillageGrid(x, y); - for(std::list::const_iterator it = villageList.begin(); it != villageList.end(); ++it) - { - CVillage &village = vg.Villages[*it]; - village.load(shapeCache); // load if needed - for(uint k = 0; k < village.IG.size(); ++k) - { - if (village.IG[k].IG) - { - igs.push_back(village.IG[k].IG); - } - } - } - } - // - CAABBox baseZoneBBox; - CVector zoneMinCorner((x + zoneMinX) * 160.f, (y + zoneMinY) * 160.f, 0.f); - baseZoneBBox.setMinMax(zoneMinCorner, zoneMinCorner + CVector(160.f, 160.f, 1.f)); - CSmartPtr pz32 = new CPackedZone32; - // - pz32->build(leaves, CELL_SIZE, igs, shapeCache, baseZoneBBox, (sint32) (x + zoneMinX), (sint32) (y + zoneMinY)); - // - // try to convert to 16 bit indices to save some place - CSmartPtr pz16 = pz32->buildPackedZone16(); - if (pz16) - { - packedZoneGrid(x, y) = pz16; - } - else - { - packedZoneGrid(x, y) = pz32; - } - // write result in cache - try - { - if (!CFile::isExists(cachePath)) - { - CFile::createDirectoryTree(cachePath); - } - COFile f; - f.open(cacheFilename); - CPackedZoneBase *pb = packedZoneGrid(x, y); - f.serialPolyPtr(pb); - } - catch(EStream &e) - { - printf("Error while writing packed zone to cache : \n %s \n", e.what()); - } - // - delete landscape; - } - ++ currZoneIndex; - } - } - } - zoneGrid.clear(); - shapeCache.clear(); - - - std::vector packedZonesArray; - for (sint y = 0; y < (sint) packedZoneGrid.getHeight(); ++y) - { - for (sint x = 0; x < (sint) packedZoneGrid.getWidth(); ++x) - { - if (packedZoneGrid(x, y)) - { - packedZonesArray.push_back(packedZoneGrid(x, y)); - } - } - } - - // build packed world - CPackedWorld pw; - pw.build(packedZonesArray); - - - bool fly = true; - CConfigFile::CVar *flyVar = cf.getVarPtr("Fly"); - if (flyVar) - { - fly = flyVar->asBool(); - } - - if (!fly) return 0; - - // fly into scene - try - { - CNELU::init(1024, 768, CViewport(), 32, true, NULL, false, true); - } - catch(const Exception &e) - { - puts(e.what()); - getchar(); - return -1; - } - // - CFrustum frust; - frust.init(-0.1f, 0.1f, -0.1f, 0.1f, 0.1f, 150.f, 1); - // - - CMatrix camMat; - camMat.identity(); - camMat.setPos(camPos); - // - IDriver *driver = CNELU::Driver; - CEvent3dMouseListener mouseListener; - mouseListener.setMatrix(camMat); - mouseListener.setMouseMode(U3dMouseListener::firstPerson); - mouseListener.setFrustrum(frust); - mouseListener.addToServer(CNELU::EventServer); - mouseListener.setSpeed(camSpeed); - CVertexBuffer vb; - vb.setVertexFormat(CVertexBuffer::PositionFlag); - vb.setPreferredMemory(CVertexBuffer::AGPVolatile, false); - // - CMaterial material; - material.initUnlit(); - material.setDoubleSided(true); - material.setZFunc(CMaterial::lessequal); - // - do - { - printf("zone = %s \n", posToZoneName(camMat.getPos().x, camMat.getPos().y).c_str()); - // - CFile::checkFileChange(); - if (newCamPosWanted) - { - camMat.setPos(newCamPos); - mouseListener.setMatrix(camMat); - newCamPosWanted = false; - } - if (newCamSpeedWanted) - { - mouseListener.setSpeed(newCamSpeed); - newCamSpeedWanted = false; - } - const CRGBA clearColor = CRGBA(0, 0, 127, 0); - driver->enableFog(true); - driver->setupFog(frust.Far * 0.8f, frust.Far, clearColor); - CViewport vp; - vp.init(0.f, 0.f, 1.f, 1.f); - driver->setupViewport(vp); - CScissor scissor; - viewportToScissor(vp, scissor); - driver->setupScissor(scissor); - - CNELU::EventServer.pump(); - camMat = mouseListener.getViewMatrix(); - // - driver->clear2D(clearColor); - driver->clearZBuffer(); - // - driver->setFrustum(frust.Left, frust.Right, frust.Bottom, frust.Top, frust.Near, frust.Far, frust.Perspective); - driver->setupViewMatrix(camMat.inverted()); - driver->setupModelMatrix(CMatrix::Identity); - // - // - const CVector localFrustCorners[8] = - { - CVector(frust.Left, frust.Near, frust.Top), - CVector(frust.Right, frust.Near, frust.Top), - CVector(frust.Right, frust.Near, frust.Bottom), - CVector(frust.Left, frust.Near, frust.Bottom), - CVector(frust.Left * frust.Far / frust.Near, frust.Far, frust.Top * frust.Far / frust.Near), - CVector(frust.Right * frust.Far / frust.Near, frust.Far, frust.Top * frust.Far / frust.Near), - CVector(frust.Right * frust.Far / frust.Near, frust.Far, frust.Bottom * frust.Far / frust.Near), - CVector(frust.Left * frust.Far / frust.Near, frust.Far, frust.Bottom * frust.Far / frust.Near) - }; - // roughly compute covered zones - // - sint frustZoneMinX = INT_MAX; - sint frustZoneMaxX = INT_MIN; - sint frustZoneMinY = INT_MAX; - sint frustZoneMaxY = INT_MIN; - for(uint k = 0; k < sizeofarray(localFrustCorners); ++k) - { - CVector corner = camMat * localFrustCorners[k]; - sint zoneX = (sint) (corner.x / 160.f) - zoneMinX; - sint zoneY = (sint) floorf(corner.y / 160.f) - zoneMinY; - frustZoneMinX = std::min(frustZoneMinX, zoneX); - frustZoneMinY = std::min(frustZoneMinY, zoneY); - frustZoneMaxX = std::max(frustZoneMaxX, zoneX); - frustZoneMaxY = std::max(frustZoneMaxY, zoneY); - } - - const uint TRI_BATCH_SIZE = 10000; // batch size for rendering - - - //for (sint y = frustZoneMinY; y <= frustZoneMaxY; ++y) - //{ - //if (y < 0) continue; - //if (y >= (sint) gridHeight) break; - //for (sint x = frustZoneMinX; x <= frustZoneMaxX; ++x) - //{ - //if (x < 0) continue; - //if (x >= (sint) gridWidth) break; - //if (packedZoneGrid(x, y)) - //{ - //packedZoneGrid(x, y)->render(vb, *driver, material, camMat, TRI_BATCH_SIZE, localFrustCorners); - //} - //} - //} - - - for (sint y = 0; y <= (sint) gridHeight; ++y) - { - if (y < 0) continue; - if (y >= (sint) gridHeight) break; - for (sint x = 0; x <= (sint) gridWidth; ++x) - { - if (x < 0) continue; - if (x >= (sint) gridWidth) break; - if (packedZoneGrid(x, y)) - { - packedZoneGrid(x, y)->render(vb, *driver, material, camMat, TRI_BATCH_SIZE, localFrustCorners); - } - } - } - - driver->setPolygonMode(IDriver::Filled); - material.setColor(CRGBA::Green); - // compute intersection with landscape & display a dot at that position - CVector lookAtPos = camMat.getPos() + 1000.f * camMat.getJ(); - CVector inter; - static std::vector triList; - triList.clear(); - bool interFound = pw.raytrace(camMat.getPos(), lookAtPos, inter, &triList); - if (!triList.empty()) - { - vb.setNumVertices(3 * triList.size()); - CVertexBufferReadWrite vba; - vb.lock(vba); - CVector *dest = vba.getVertexCoordPointer(0); - memcpy(dest, &triList[0], sizeof(CTriangle) * triList.size()); - vba.unlock(); - driver->activeVertexBuffer(vb); - driver->renderRawTriangles(material, 0, triList.size()); - } - if (interFound) - { - material.setColor(CRGBA::Magenta); - CQuad q; - q.V0 = inter - camMat.getI() + camMat.getK(); - q.V1 = inter + camMat.getI() + camMat.getK(); - q.V2 = inter + camMat.getI() - camMat.getK(); - q.V3 = inter - camMat.getI() - camMat.getK(); - { - vb.setNumVertices(4); - CVertexBufferReadWrite vba; - vb.lock(vba); - CVector *dest = vba.getVertexCoordPointer(0); - pushVBQuad(dest, q); - vba.unlock(); - } - driver->activeVertexBuffer(vb); - driver->renderRawQuads(material, 0, 1); - } - // -// for(uint k = 0; k < sizeofarray(frustCorners); ++k) -// { -// frustCorners[k] = camMat * frustCorners[k]; -// frustCorners[k].x -= cornerMin.x; -// frustCorners[k].y -= cornerMin.y; -// } -// // project frustum on x/y plane to see where to test polys -// sint minY = INT_MAX; -// CPolygon2D::TRasterVect silhouette; -// addQuadToSilhouette(frustCorners[0], frustCorners[1], frustCorners[2], frustCorners[3], silhouette, minY, CELL_SIZE); -// addQuadToSilhouette(frustCorners[1], frustCorners[5], frustCorners[6], frustCorners[2], silhouette, minY, CELL_SIZE); -// addQuadToSilhouette(frustCorners[4], frustCorners[5], frustCorners[6], frustCorners[7], silhouette, minY, CELL_SIZE); -// addQuadToSilhouette(frustCorners[0], frustCorners[4], frustCorners[7], frustCorners[3], silhouette, minY, CELL_SIZE); -// addQuadToSilhouette(frustCorners[0], frustCorners[1], frustCorners[5], frustCorners[4], silhouette, minY, CELL_SIZE); -// addQuadToSilhouette(frustCorners[3], frustCorners[7], frustCorners[6], frustCorners[2], silhouette, minY, CELL_SIZE); -// // -// driver->setPolygonMode(IDriver::Line); -// // -// material.setColor(CRGBA::White); -// // -// vb.setNumVertices(TRI_BATCH_SIZE * 3); -// { -// CVertexBufferReadWrite vba; -// vb.lock(vba); -// CVector *dest = vba.getVertexCoordPointer(0); -// const CVector *endDest = dest + TRI_BATCH_SIZE * 3; -// for(sint y = 0; y < (sint) silhouette.size(); ++y) -// { -// sint gridY = y + minY; -// if (gridY < 0) continue; -// if (gridY >= triGridHeight) continue; -// sint minX = silhouette[y].first; -// sint maxX = silhouette[y].second; -// for (sint x = minX; x <= maxX; ++x) -// { -// if (x < 0) continue; -// if (x >= triGridWidth) break; -// sint triRefIndex = triGrid(x, gridY); -// while (triRefIndex != -1) -// { -// CTriangle tri = tris[triRefs[triRefIndex].TriIndex]; -// triRefIndex = triRefs[triRefIndex].NextTriRef; -// tri.V0.x += cornerMin.x; -// tri.V0.y += cornerMin.y; -// tri.V1.x += cornerMin.x; -// tri.V1.y += cornerMin.y; -// tri.V2.x += cornerMin.x; -// tri.V2.y += cornerMin.y; -// *dest++ = tri.V0; -// *dest++ = tri.V1; -// *dest++ = tri.V2; -// if (dest == endDest) -// { -// // flush batch -// vba.unlock(); -// material.setColor(CRGBA(100, 100, 100)); -// driver->setPolygonMode(IDriver::Filled); -// driver->renderRawTriangles(material, 0, TRI_BATCH_SIZE); -// material.setColor(CRGBA::White); -// driver->setPolygonMode(IDriver::Line); -// driver->renderRawTriangles(material, 0, TRI_BATCH_SIZE); -// // reclaim a new batch -// vb.lock(vba); -// dest = vba.getVertexCoordPointer(0); -// endDest = dest + TRI_BATCH_SIZE * 3; -// } -// } -// } -// } -// vba.unlock(); -// uint numRemainingTris = TRI_BATCH_SIZE - ((endDest - dest) / 3); -// if (numRemainingTris) -// { -// material.setColor(CRGBA(100, 100, 100)); -// driver->setPolygonMode(IDriver::Filled); -// driver->activeVertexBuffer(vb); -// driver->renderRawTriangles(material, 0, numRemainingTris); -// material.setColor(CRGBA::White); -// driver->setPolygonMode(IDriver::Line); -// driver->renderRawTriangles(material, 0, numRemainingTris); -// } -// } - - // prepare 2D view - -// const uint GRID_EXTENT = 20; -// sint currPosX = (sint) (camMat.getPos().x / CELL_SIZE); -// sint currPosY = (sint) (camMat.getPos().y / CELL_SIZE); -// driver->setFrustum( - (float) (GRID_EXTENT - 1) * CELL_SIZE, (float) (GRID_EXTENT - 1) * CELL_SIZE, -// - (float) (GRID_EXTENT - 1) * CELL_SIZE, (float) (GRID_EXTENT - 1) * CELL_SIZE, 0.f, 1.f, false); -// vp.init(0.1f, 0.1f, 0.4f ,0.4f); -// driver->setupViewport(vp); -// viewportToScissor(vp, scissor); -// driver->setupScissor(scissor); -// // -// driver->clear2D(CRGBA(0, 127, 0, 0)); -// driver->clearZBuffer(); -// CMatrix viewMatrix; -// viewMatrix.setRot(CVector::I, -CVector::K, CVector::J); -// viewMatrix.setPos(CVector(camMat.getPos().x, camMat.getPos().y, 0.f)); -// viewMatrix.invert(); -// driver->setupViewMatrix(viewMatrix); -// driver->setupModelMatrix(CMatrix::Identity); -// -// driver->setPolygonMode(IDriver::Filled); - -// // draw covered portion of the grid -// material.setColor(CRGBA(127, 0, 0)); -// { -// CVertexBufferReadWrite vba; -// vb.lock(vba); -// CVector *dest = vba.getVertexCoordPointer(0); -// sint numQuads = 0; -// for(sint y = 0; y < (sint) silhouette.size(); ++y) -// { -// if (silhouette[y].first > silhouette[y].second) continue; -// CQuad q; -// q.V0.x = silhouette[y].first * CELL_SIZE + cornerMin.x; -// q.V0.y = (y + minY) * CELL_SIZE + cornerMin.y; -// q.V1.x = (silhouette[y].second + 1) * CELL_SIZE + cornerMin.x; -// ++ numQuads; -// q.V1.y = q.V0.y; -// q.V2.x = q.V1.x; -// q.V2.y = q.V1.y + CELL_SIZE; -// q.V3.x = q.V0.x; -// q.V3.y = q.V2.y; -// pushVBQuad2D(dest, q); -// } -// nlassert(numQuads * 4 < TRI_BATCH_SIZE * 3); -// vba.unlock(); -// driver->renderRawQuads(material, 0, numQuads); -// } -// */ - // - /* -// driver->setPolygonMode(IDriver::Line); -// // draw grid around & frustum -// { -// // -// material.setColor(CRGBA(127, 127, 127)); -// { -// CVertexBufferReadWrite vba; -// vb.lock(vba); -// CVector *dest = vba.getVertexCoordPointer(0); -// for(sint x = currPosX - GRID_EXTENT; x <= currPosX + (sint) GRID_EXTENT; ++x) -// { -// pushVBLine2D(dest, CVector(x * CELL_SIZE, (currPosY + (sint) GRID_EXTENT) * CELL_SIZE, 0.f), -// CVector(x * CELL_SIZE, (currPosY - (sint) GRID_EXTENT) * CELL_SIZE, 0.f)); -// } -// for(sint y = currPosY - GRID_EXTENT; y <= currPosY + (sint) GRID_EXTENT; ++y) -// { -// pushVBLine2D(dest, CVector((currPosX - (sint) GRID_EXTENT) * CELL_SIZE, y * CELL_SIZE, 0.f), -// CVector((currPosX + (sint) GRID_EXTENT) * CELL_SIZE, y * CELL_SIZE, 0.f)); -// } -// vba.unlock(); -// uint numTri = 2 * (2 * GRID_EXTENT + 1); -// nlassert(numTri <= TRI_BATCH_SIZE); -// driver->renderRawTriangles(material, 0, numTri); -// } -// material.setColor(CRGBA::Red); -// { -// CVertexBufferReadWrite vba; -// vb.lock(vba); -// CVector *dest = vba.getVertexCoordPointer(0); -// for(uint k = 0; k < sizeofarray(localFrustCorners); ++k) -// { -// frustCorners[k].x += cornerMin.x; -// frustCorners[k].y += cornerMin.y; -// } -// pushVBLine2D(dest, frustCorners[1], frustCorners[5]); -// pushVBLine2D(dest, frustCorners[5], frustCorners[6]); -// pushVBLine2D(dest, frustCorners[6], frustCorners[2]); -// pushVBLine2D(dest, frustCorners[2], frustCorners[1]); -// // -// pushVBLine2D(dest, frustCorners[5], frustCorners[4]); -// pushVBLine2D(dest, frustCorners[4], frustCorners[7]); -// pushVBLine2D(dest, frustCorners[7], frustCorners[6]); -// // -// pushVBLine2D(dest, frustCorners[4], frustCorners[0]); -// pushVBLine2D(dest, frustCorners[0], frustCorners[3]); -// pushVBLine2D(dest, frustCorners[3], frustCorners[7]); -// // -// pushVBLine2D(dest, frustCorners[0], frustCorners[1]); -// pushVBLine2D(dest, frustCorners[3], frustCorners[2]); -// // -// nlassert(12 <= TRI_BATCH_SIZE); -// vba.unlock(); -// material.setColor(CRGBA::Red); -// driver->renderRawTriangles(material, 0, 12); -// } -// } -// - -// // draw underlying geometry -// material.setColor(CRGBA::White); -// { -// CVertexBufferReadWrite vba; -// vb.lock(vba); -// CVector *dest = vba.getVertexCoordPointer(0); -// const CVector *endDest = dest + TRI_BATCH_SIZE * 3; -// // compute cam pos in tri grid -// currPosX = (sint) ((camMat.getPos().x - cornerMin.x) / CELL_SIZE); -// currPosY = (sint) ((camMat.getPos().y - cornerMin.y) / CELL_SIZE); -// for(sint y = currPosY - GRID_EXTENT; y < currPosY + (sint) GRID_EXTENT; ++y) -// { -// for(sint x = currPosX - GRID_EXTENT; x < currPosX + (sint) GRID_EXTENT; ++x) -// { -// if (y < 0) continue; -// if (y >= triGridHeight) break; -// if (x < 0) continue; -// if (x >= triGridWidth) break; -// sint triRefIndex = triGrid(x, y); -// while (triRefIndex != -1) -// { -// CTriangle tri = tris[triRefs[triRefIndex].TriIndex]; -// tri.V0.x += cornerMin.x; -// tri.V0.y += cornerMin.y; -// tri.V1.x += cornerMin.x; -// tri.V1.y += cornerMin.y; -// tri.V2.x += cornerMin.x; -// tri.V2.y += cornerMin.y; -// -// triRefIndex = triRefs[triRefIndex].NextTriRef; -// pushVBTri2D(dest, tri); -// if (dest == endDest) -// { -// // flush batch -// vba.unlock(); -// driver->renderRawTriangles(material, 0, TRI_BATCH_SIZE); -// // reclaim a new batch -// vb.lock(vba); -// dest = vba.getVertexCoordPointer(0); -// endDest = dest + TRI_BATCH_SIZE * 3; -// } -// } -// } -// } -// vba.unlock(); -// uint numRemainingTris = TRI_BATCH_SIZE - ((endDest - dest) / 3); -// if (numRemainingTris) -// { -// driver->renderRawTriangles(material, 0, numRemainingTris); -// } -// } - - uint NUM_RAYS = 10000; - if (CNELU::AsyncListener.isKeyPushed(KeyT)) - { - printf("Starting raytracing test 1"); - uint numHits = 0; - NLMISC::TTime startTime = CTime::getLocalTime(); - for(uint k = 0; k < NUM_RAYS; ++k) - { - sint zone = rand() % packedZonesArray.size(); - CPackedZoneBase *zonePtr = packedZonesArray[zone]; - CVector cornerMin = zonePtr->Box.getMin(); - CVector cornerMax = zonePtr->Box.getMax(); - CVector start(frand(1.f) * (cornerMax.x - cornerMin.x) + cornerMin.x, - frand(1.f) * (cornerMax.y - cornerMin.y) + cornerMin.y, - frand(1.f) * (cornerMax.z - cornerMin.z) + cornerMin.z); - CVector end(frand(1.f) * (cornerMax.x - cornerMin.x) + cornerMin.x, - frand(1.f) * (cornerMax.y - cornerMin.y) + cornerMin.y, - frand(1.f) * (cornerMax.z - cornerMin.z) + cornerMin.z); - CVector inter; - bool result = pw.raytrace(start, end, inter); - if (result) - { - ++numHits; - } - } - NLMISC::TTime endTime = CTime::getLocalTime(); - - float dt = (float) (endTime - startTime) / 1000.f; - printf("Total time = %.2f s\n", dt); - printf("Num rays = %d\n", (int) NUM_RAYS); - printf("Num hits = %d\n", (int) numHits); - printf("Num test per seconds = %.2f\n", (float) NUM_RAYS / dt); - } - // - if (CNELU::AsyncListener.isKeyPushed(KeyU)) - { - printf("Starting raytracing test 2"); - uint numHits = 0; - NLMISC::TTime startTime = CTime::getLocalTime(); - for(uint k = 0; k < NUM_RAYS; ++k) - { - CVector start = camMat.getPos(); - CVector end(start.x + (frand(200.f) - 100.f), - start.y + (frand(200.f) - 100.f), - start.z + (frand(5.f) - 2.5f)); - CVector inter; - bool result = pw.raytrace(start, end, inter); - if (result) - { - ++numHits; - } - } - NLMISC::TTime endTime = CTime::getLocalTime(); - - float dt = (float) (endTime - startTime) / 1000.f; - printf("Total time = %.2f s\n", dt); - printf("Num rays = %d\n", (int) NUM_RAYS); - printf("Num hits = %d\n", (int) numHits); - printf("Num test per seconds = %.2f\n", (float) NUM_RAYS / dt); - } - // - driver->setPolygonMode(IDriver::Filled); - // - driver->swapBuffers(); - } - while(!CNELU::AsyncListener.isKeyPushed(KeyESCAPE)); - - - - return 0; -} - -*/ - - diff --git a/code/ryzom/tools/server/build_world_packed_col/Backup 1 of village.cpp b/code/ryzom/tools/server/build_world_packed_col/Backup 1 of village.cpp deleted file mode 100644 index 9096cf604..000000000 --- a/code/ryzom/tools/server/build_world_packed_col/Backup 1 of village.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/*#include "std_header.h" -// -#include "village.h" -#include "zone_util.h" -// -#include "nel/georges/u_form.h" -#include "nel/georges/u_form_elm.h" -#include "nel/georges/u_form_loader.h" -// -#include "nel/misc/path.h" -#include "nel/misc/file.h" -// -#include "3d/shape.h" - - -using namespace NLMISC; -using namespace NL3D; - -//********************************************************************************************** -CVillageGrid::CVillageGrid() -{ - _ZoneMinX = 0; - _ZoneMinY = 0; - -} - -//********************************************************************************************** -void CVillageGrid::init(uint gridWidth, uint gridHeight, sint zoneMinX, sint zoneMinY) -{ - reset(); - nlassert(gridWidth > 0); - nlassert(gridHeight > 0); - _ZoneMinX = zoneMinX; - _ZoneMinY = zoneMinY; - VillageGrid.init(gridWidth, gridHeight); -} - -//********************************************************************************************** -void CVillageGrid::reset() -{ - NLMISC::contReset(*this); -} - -//********************************************************************************************** -void CVillageGrid::addVillagesFromContinent(const std::string &continentSheetName) -{ - // Load the form - NLGEORGES::UFormLoader *loader = NLGEORGES::UFormLoader::createLoader(); - // - std::string path = CPath::lookup(continentSheetName, false, false); - if (path.empty()) - { - nlwarning("Path not found for %s.", continentSheetName.c_str()); - return; - } - NLGEORGES::UForm *villageForm; - villageForm = loader->loadForm(path.c_str()); - if(villageForm != NULL) - { - NLGEORGES::UFormElm &rootItem = villageForm->getRootNode(); - // try to get the village list - // Load the village list - NLGEORGES::UFormElm *villagesItem; - if(!(rootItem.getNodeByName (&villagesItem, "Villages") && villagesItem)) - { - nlwarning("No villages where found in %s", continentSheetName.c_str()); - return; - } - - // Get number of village - uint numVillage; - nlverify (villagesItem->getArraySize (numVillage)); - - // For each village - for(uint k = 0; k < numVillage; ++k) - { - NLGEORGES::UFormElm *currVillage; - if (!(villagesItem->getArrayNode (&currVillage, k) && currVillage)) - { - nlwarning("Couldn't get village %d in continent %s", continentSheetName.c_str(), k); - continue; - } - // check that this village is in the dependency zones - NLGEORGES::UFormElm *zoneNameItem; - if (!currVillage->getNodeByName (&zoneNameItem, "Zone") && zoneNameItem) - { - nlwarning("Couldn't get zone item of village %d in continent %s", continentSheetName.c_str(), k); - continue; - } - std::string zoneName; - if (!zoneNameItem->getValue(zoneName)) - { - nlwarning("Couldn't get zone name of village %d in continent %s", continentSheetName.c_str(), k); - continue; - } - sint zoneX, zoneY; - if (!getZonePos(zoneName, zoneX, zoneY)) - { - nlwarning("Zone name of village %d in continent %s is invalid", continentSheetName.c_str(), k); - continue; - } - sint villageMinX, villageMinY; - sint villageMaxX, villageMaxY; - - - // retrieve width & height of covered region - uint32 regionWidth; - uint32 regionHeight; - float centerX, centerY; - if (!currVillage->getValueByName(regionWidth, "Width") || - !currVillage->getValueByName(regionHeight, "Height") || - !currVillage->getValueByName(centerX, "CenterX") || - !currVillage->getValueByName(centerY, "CenterY")) - { - nlwarning("Can't retrieve region covered by village %d in continent %s", continentSheetName.c_str(), k); - continue; - } - // - villageMinX = villageMaxX = zoneX; - villageMinY = villageMaxY = zoneY; - // extends with bbox from center to min corner if leveldesigner forgot to enter good width & height - villageMaxX = std::max(villageMaxX, (sint) ((zoneX * 160.f + 2.f * centerX) / 160.f)); - villageMaxY = std::max(villageMaxY, (sint) ((zoneY * 160.f + 2.f * centerY) / 160.f)); - // - villageMinX -= _ZoneMinX; - villageMaxX -= _ZoneMinX; - villageMinY -= _ZoneMinY; - villageMaxY -= _ZoneMinY; - // - CVillage village; - if (loadVillageSheet(currVillage, continentSheetName, k, village)) - { - // - village.FileModificationDate = std::max(village.FileModificationDate, CFile::getFileModificationDate(path)); - // - Villages.push_back(CVillage()); - Villages.back().swap(village); - // - for (sint y = villageMinY; y <= (sint) villageMaxY; ++y) - { - if (y < 0) continue; - if (y >= (sint) VillageGrid.getHeight()) continue; - for (sint x = villageMinX; x <= (sint) villageMaxX; ++x) - { - if (x < 0) continue; - if (x >= (sint) VillageGrid.getWidth()) continue; - VillageGrid(x, y).push_back(Villages.size() - 1); - } - } - } - } - } - else - { - nlwarning("Can't load continent form : %s", continentSheetName.c_str()); - } -} - -//********************************************************************************************** -bool CVillageGrid::loadVillageSheet(const NLGEORGES::UFormElm *villageItem, const std::string &continentSheetName, uint villageIndex, CVillage &dest) -{ - dest.IG.clear(); - const NLGEORGES::UFormElm *igNamesItem; - if (! (villageItem->getNodeByName (&igNamesItem, "IgList") && igNamesItem) ) - { - nlwarning("No list of IGs was found in the continent form %s, village #%d", continentSheetName.c_str(), (int) villageIndex); - return false; - } - - // Get number of village - uint numIgs; - nlverify (igNamesItem->getArraySize (numIgs)); - const NLGEORGES::UFormElm *currIg; - uint32 mostRecentIGDate = 0; - for(uint l = 0; l < numIgs; ++l) - { - if (!(igNamesItem->getArrayNode (&currIg, l) && currIg)) - { - nlwarning("Couldn't get ig #%d in the continent form %s, in village #%d", l, continentSheetName.c_str(), (int) villageIndex); - continue; - } - const NLGEORGES::UFormElm *igNameItem; - currIg->getNodeByName (&igNameItem, "IgName"); - std::string igName; - if (!igNameItem->getValue (igName)) - { - nlwarning("Couldn't get ig name of ig #%d in the continent form %s, in village #%d", l, continentSheetName.c_str(), (int) villageIndex); - continue; - } - if (igName.empty()) - { - nlwarning("Ig name of ig #%d in the continent form %s, in village #%d is an empty string", l, continentSheetName.c_str(), (int) villageIndex); - continue; - } - // ensure .ig - igName = CFile::getFilenameWithoutExtension(igName) + ".ig"; - - - CIGInfo igInfo; - - // add this ig - std::string nameLookup = CPath::lookup (igName, false, true); - if (!nameLookup.empty()) - { - igInfo.Path = nameLookup; - dest.IG.push_back(igInfo); - mostRecentIGDate = std::max(mostRecentIGDate, CFile::getFileModificationDate(nameLookup)); - } - else - { - nlwarning("Couldn't find ig %s in continent form %s, in village %d", igName.c_str(), continentSheetName.c_str(), (int) villageIndex); - } - } - dest.FileModificationDate = mostRecentIGDate; - return true; -} - - -//********************************************************************************************** -void CVillage::load(TShapeCache &shapeCache) -{ - for(std::vector::iterator it = IG.begin(); it != IG.end(); ++it) - { - it->load(shapeCache); - } -} - -//********************************************************************************************** -void CIGInfo::load(TShapeCache &shapeCache) -{ - if (Loaded) return; - Loaded = true; // even if loading fails, don't try twice to load it - try - { - CIFile stream; - stream.open(Path); - printf(Path.c_str()); - CSmartPtr ig = new CInstanceGroup; - ig->serial(stream); - IG = ig; // commit - } - catch(EStream &e) - { - nlwarning(e.what()); - } - if (IG) - { - // complete cache - for(uint k = 0; k < IG->getNumInstance(); ++k) - { - std::string shapeName = standardizeShapeName(IG->getShapeName(k)); - if (NLMISC::strlwr(CFile::getExtension(shapeName)) == "pacs_prim") - { - continue; - } - TShapeCache::iterator it = shapeCache.find(shapeName); - CShapeInfo si; - bool buildOK = false; - if (it == shapeCache.end()) - { - CShapeStream ss; - try - { - - CIFile stream; - std::string path = CPath::lookup(shapeName, false, false); - if (!path.empty()) - { - stream.open(path); - ss.serial(stream); - CShapeInfo si; - si.build(*ss.getShapePointer()); - delete ss.getShapePointer(); - shapeCache[shapeName].swap(si); - } - } - catch (EStream &e) - { - // shape not loaded - nlwarning(e.what()); - } - } - } - } -} - - - -*/ \ No newline at end of file diff --git a/code/ryzom/tools/server/build_world_packed_col/Backup 1 of village.h b/code/ryzom/tools/server/build_world_packed_col/Backup 1 of village.h deleted file mode 100644 index 8294382a1..000000000 --- a/code/ryzom/tools/server/build_world_packed_col/Backup 1 of village.h +++ /dev/null @@ -1,72 +0,0 @@ -/*#ifndef _VILLAGE_H -#define _VILLAGE_H - -#include "nel/misc/array_2d.h" -#include "3d/shape_info.h" -// -#include "3d/scene_group.h" -// -#include "nel/misc/smart_ptr.h" -// -#include - - -namespace NLGEORGES -{ - class UFormElm; -} - -class CIGInfo -{ -public: - std::string Path; - NLMISC::CSmartPtr IG; // NULL if not loaded yet - bool Loaded; -public: - CIGInfo() : Loaded(false) {} - // load data & complete shape cache. no-op if datas where already loaded - void load(NL3D::TShapeCache &shapeCache); -}; - - -class CVillage -{ -public: - std::vector IG; - uint32 FileModificationDate; -public: - void swap(CVillage &other) - { - IG.swap(other.IG); - std::swap(other.FileModificationDate, FileModificationDate); - } - // load data & complete shape cache. no-op if datas where already loaded - void load(NL3D::TShapeCache &shapeCache); -}; - - - - -class CVillageGrid -{ -public: - std::vector Villages; - NLMISC::CArray2D > VillageGrid; // each grid cells gives the list of villages that overlap that cell (identified by their indices into 'Villages') -public: - CVillageGrid(); - // - void init(uint gridWidth, uint gridHright, sint zoneMinX, sint zoneMinY); - void reset(); - // Load & add all villages of a continent to the map - void addVillagesFromContinent(const std::string &continentSheetName); -private: - sint _ZoneMinX; - sint _ZoneMinY; -private: - bool loadVillageSheet(const NLGEORGES::UFormElm *villageItem, const std::string &continentSheetName, uint villageIndex, CVillage &dest); -}; - - - -#endif - */ \ No newline at end of file diff --git a/code/ryzom/tools/stats_scan/Backup 1 of char_commands.cpp b/code/ryzom/tools/stats_scan/Backup 1 of char_commands.cpp deleted file mode 100644 index 433b70dd6..000000000 --- a/code/ryzom/tools/stats_scan/Backup 1 of char_commands.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/** \file char_commands.cpp - * - * $id$ - * - * todo: - * - charScanScript commands - * * path for script files in cfg - * - charScanScriptNew - * - charScanScriptLoad - * - charScanScriptSave - * - charScanScriptListFiles - * - charScanScriptListLines - * - charScanScriptDeleteLine - * - charScanScriptAddInputFiles - * - charScanScriptAddInfoExtractor [] - * - charScanScriptAddFilter [] - * - charScanScriptAddPreInclude - * - charScanScriptAddPostInclude - * - charScanScriptSetOutputDirectory - * - charScanScriptSetDescription - * - charScanScriptRun [-s ] [-o ] - * - addJobCharScanScript [-s ] [-o ] - * - charScanScriptListOutputFiles [] - * - charScanScriptListOutputFileContents [] - * - charScanScriptTestFileList - * - charScanScriptTestOutput - * - charScanScriptHelp - * - path for generated files (from cfg + override) => managed incrementally with directory numbering - * - add incremental update systems - * - add tables with a column per day () - * - add tables with a column per week (limited number of weeks) - * - add tables with a column per month (limited number of months) - */ - -/* -bool CCharFilterFactory::beginScanJob(const std::vector& files, const std::vector& filters) -{ - bool noErrors= true; - - // create a new job - NLMISC::CSmartPtr job=new CCharacterScanJob; - - // look after the filters - for (uint32 i=0;igetName()) - break; - - // if none found then warn and skip passed - if(j>=_Filters.size()) - { - nlwarning("Unknown info extractor: %s",filters[i].c_str()); - noErrors=false; - continue; - } - - // add the info extractor to the new job - job->addFilter(_Filters[j]); - } - - // look after the files - job->addFiles(files); - - // add the job to the job manager - if (noErrors==true) - CJobManager::getInstance()->addJob(&*job); - - return noErrors; -} - -*/ -//----------------------------------------------------------------------------- -// includes -//----------------------------------------------------------------------------- - -#include "nel/misc/path.h" -#include "nel/misc/command.h" -#include "nel/misc/variable.h" -#include "nel/misc/algo.h" -#include "game_share/persistent_data.h" - -#include "character.h" -#include "job_manager.h" -#include "char_info_extractor_factory.h" - - -//----------------------------------------------------------------------------- -// Namespaces -//----------------------------------------------------------------------------- - -using namespace std; -using namespace NLMISC; - -//----------------------------------------------------------------------------- -// Variables -//----------------------------------------------------------------------------- - -CVariable SourceDirectory("variables", "SourceDirectory", "Directory we scan for files", string("."), 0, true); - - -//----------------------------------------------------------------------------- -// Commands - misc character related -//----------------------------------------------------------------------------- - -NLMISC_COMMAND(listCharNames,"display the names of the characters int he listed save files","") -{ - if (args.size()!=1 && args.size()!=0) - return false; - - std::string wildcard="pdr_account*"; - if (args.size()==1) - wildcard=args[0]; - - std::vector files; - NLMISC::CPath::getPathContent(SourceDirectory.get().c_str(),false,false,true,files); - for (uint32 i=files.size();i--;) - { - if (!NLMISC::testWildCard(NLMISC::CFile::getFilename(files[i]),wildcard)) - { - files[i]=files.back(); - files.pop_back(); - } - } - std::sort(files.begin(),files.end()); - for (uint32 i=0;idisplayInfoExtractorList(&log); - - return true; -} - -//----------------------------------------------------------------------------- -// Commands - jobsManager -//----------------------------------------------------------------------------- - -NLMISC_COMMAND(jobsPause,"pause execution of jobs","") -{ - if (args.size()!=0) - return false; - - CJobManager::getInstance()->pause(); - - return true; -} - -NLMISC_COMMAND(jobsResume,"resume execution of jobs","") -{ - if (args.size()!=0) - return false; - - CJobManager::getInstance()->resume(); - - return true; -} - -NLMISC_COMMAND(jobsPromote,"pause execution of jobs","") -{ - if (args.size()!=1) - return false; - - uint32 idx= atoi(args[0].c_str()); - if ( (idx==0 && args[0]!="0") ) - { - nlwarning("Argument is not a valid job id - should be a number"); - return false; - } - - CJobManager::getInstance()->promoteJob(idx); - CJobManager::getInstance()->listJobs(&log); - - return true; -} - -NLMISC_COMMAND(JobUpdatesPerUpdate,"set or display the number of job updates per service update","[]") -{ - if (args.size()>1) - return false; - - if (args.size()==1) - { - uint32 count= atoi(args[0].c_str()); - if ( (count==0 && args[0]!="0") ) - { - nlwarning("Argument is not a valid number"); - return false; - } - CJobManager::getInstance()->setJobUpdatesPerUpdate(count); - } - - nlinfo("JobUpdatesPerUpdate %d",CJobManager::getInstance()->getJobUpdatesPerUpdate()); - - return true; -} - -NLMISC_COMMAND(jobsStatus,"display the status of the job manager","") -{ - if (args.size()!=0) - return false; - - log.displayNL("%s",CJobManager::getInstance()->getStatus().c_str()); - - return true; -} - -NLMISC_COMMAND(jobsList,"display the list of unfinished jobs","") -{ - if (args.size()!=0) - return false; - - CJobManager::getInstance()->listJobs(&log); - - return true; -} - -NLMISC_COMMAND(jobsListAll,"display the list of all jobs (unfinished jobs are marked with a '*')","") -{ - if (args.size()!=0) - return false; - - CJobManager::getInstance()->listJobHistory(&log); - - return true; -} - -NLMISC_COMMAND(jobsDisplayDetails,"display detailed info for the current job (or a given job)","[]") -{ - switch (args.size()) - { - case 0: - CJobManager::getInstance()->displayCurrentJob(&log); - break; - - case 1: - { - uint32 idx= atoi(args[0].c_str()); - if ( (idx==0 && args[0]!="0") ) - { - nlwarning("Argument is not a valid job id - should be a number"); - return false; - } - CJobManager::getInstance()->displayJob(idx,&log); - } - break; - - - default: - return false; - } - - return true; -} - -//----------------------------------------------------------------------------- -// Commands - charScanScript -//----------------------------------------------------------------------------- - - -//----------------------------------------------------------------------------- diff --git a/code/ryzom/tools/stats_scan/CMakeLists.txt b/code/ryzom/tools/stats_scan/CMakeLists.txt index 69f19c88d..301531819 100644 --- a/code/ryzom/tools/stats_scan/CMakeLists.txt +++ b/code/ryzom/tools/stats_scan/CMakeLists.txt @@ -1,7 +1,5 @@ FILE(GLOB SRC *.cpp *.h) -LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ char_commands.cpp) - ADD_EXECUTABLE(stats_scan ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR})