uox3/source/cServerDefinitions.h
Xoduz 15da92aca2 Last batch of fixes for this PR
Fixes for updated wholist/spawnadmin menu crashing under certain circumstances using regular UO client
Updated logging of CPCharAndStartLoc packet to account for both old and new version of packet
Reloading Spawn Regions via 'reloadspawnregions JS command will now do a full reload from the DFN files (previously needed manual DFN reload before spawn region reload)
Reloading DFNs via 'reloaddfns JS command will now also reload creatures.dfn, titles.dfn, location.dfn
Reloading ALL via 'reloadall JS command will now also reload teleport.scp, creatures.dfn, titles.dfn, location.dfn
2025-04-29 09:34:51 +08:00

92 lines
2.8 KiB
C++

#ifndef __CSERVERDEFINITIONS__
#define __CSERVERDEFINITIONS__
#include <stack>
typedef std::vector<Script *> VECSCRIPTLIST;
typedef std::vector<Script *>::iterator VECSCRIPTLIST_ITERATOR;
typedef std::vector<Script *>::const_iterator VECSCRIPTLIST_CITERATOR;
typedef std::stack<std::string> dirList;
class CDirectoryListing
{
private:
typedef std::vector<CDirectoryListing> DIRLIST;
typedef std::vector<CDirectoryListing>::iterator DIRLIST_ITERATOR;
auto PushDir( DEFINITIONCATEGORIES toMove ) -> bool;
auto PushDir( std::string toMove ) -> bool;
auto PopDir() -> void;
std::vector<std::string> filenameList, shortList;
std::vector<std::string> flattenedShort, flattenedFull;
dirList dirs;
std::string extension;
std::string currentDir;
std::string shortCurrentDir;
DIRLIST subdirectories;
bool doRecursion;
void InternalRetrieve();
public:
CDirectoryListing( bool recurse = true );
CDirectoryListing( const std::string &dir, const std::string &extent, bool recurse = true );
CDirectoryListing( DEFINITIONCATEGORIES dir, const std::string &extent, bool recurse = true );
~CDirectoryListing();
auto Extension( const std::string &extent ) -> void;
auto Retrieve( const std::string &dir ) -> void;
auto Retrieve( DEFINITIONCATEGORIES dir ) -> void;
auto Flatten( bool isParent) -> void;
auto ClearFlatten() -> void;
auto List() -> std::vector<std::string>*;
auto ShortList() -> std::vector<std::string>*;
auto FlattenedList() -> std::vector<std::string>*;
auto FlattenedShortList() -> std::vector<std::string>*;
};
class CServerDefinitions
{
private:
VECSCRIPTLIST_ITERATOR slIter;
std::map<std::string, SI16> priorityMap;
SI16 defaultPriority;
auto LoadDFNCategory( DEFINITIONCATEGORIES toLoad ) -> void;
auto ReloadScriptObjects() -> void;
auto BuildPriorityMap( DEFINITIONCATEGORIES category, UI08 &wasPrioritized ) -> void;
auto CleanPriorityMap() -> void;
auto GetPriority( const char *file ) -> SI16;
auto Cleanup() -> void;
public:
std::vector<VECSCRIPTLIST> ScriptListings;
CServerDefinitions();
~CServerDefinitions();
auto Startup() -> void;
auto Reload() -> bool;
auto Reload( DEFINITIONCATEGORIES toReload ) -> bool;
auto Dispose(DEFINITIONCATEGORIES toDispose ) -> bool;
auto FindEntry( const std::string &toFind, DEFINITIONCATEGORIES typeToFind ) -> CScriptSection*;
auto FindEntrySubStr( const std::string &toFind, DEFINITIONCATEGORIES typeToFind ) -> CScriptSection*;
auto CountOfEntries( DEFINITIONCATEGORIES typeToFind ) -> size_t;
auto CountOfFiles( DEFINITIONCATEGORIES typeToFind ) -> size_t;
auto DisplayPriorityMap() -> void;
auto FirstScript( DEFINITIONCATEGORIES typeToFind ) -> Script*;
auto NextScript( DEFINITIONCATEGORIES typeToFind ) -> Script*;
auto FinishedScripts( DEFINITIONCATEGORIES typeToFind ) -> bool;
};
extern CServerDefinitions *FileLookup;
#endif