2002-04-07 20:53:41 +00:00
|
|
|
|
2022-10-24 18:39:33 +08:00
|
|
|
//o------------------------------------------------------------------------------------------------o
|
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
|
|
|
//| File - PageVector.h
|
2022-10-24 18:39:33 +08:00
|
|
|
//o------------------------------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - CHelpRequest and PageVector classes. For use in the GM and Couselor queues
|
|
|
|
|
//o------------------------------------------------------------------------------------------------o
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
#ifndef __PAGEVECTOR_H__
|
|
|
|
|
#define __PAGEVECTOR_H__
|
|
|
|
|
|
2022-10-24 18:39:33 +08:00
|
|
|
class CHelpRequest
|
2002-04-07 20:53:41 +00:00
|
|
|
{
|
|
|
|
|
private:
|
2022-10-24 18:39:33 +08:00
|
|
|
SERIAL helpReqId;
|
2002-04-07 20:53:41 +00:00
|
|
|
SERIAL playerPaging; // player who is paging
|
|
|
|
|
SERIAL playerHandling; // player who is handling it
|
|
|
|
|
SI08 priority; // priority of the page
|
|
|
|
|
bool handled; // has it been handled?
|
|
|
|
|
time_t timeOfPage; // when was the page reported?
|
2012-11-03 18:11:04 +00:00
|
|
|
std::string reason; // reason for the page
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
public:
|
2022-10-24 18:39:33 +08:00
|
|
|
CHelpRequest() : helpReqId( INVALIDSERIAL ), playerPaging( INVALIDSERIAL ), playerHandling( INVALIDSERIAL ), priority( 0 ), handled( false ), timeOfPage( 0 )
|
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
|
|
|
{
|
2022-10-24 18:39:33 +08:00
|
|
|
reason = "";
|
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
|
|
|
}
|
2022-10-24 18:39:33 +08:00
|
|
|
~CHelpRequest();
|
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
|
|
|
|
2002-04-07 20:53:41 +00:00
|
|
|
SERIAL WhoPaging( void ) const;
|
|
|
|
|
SERIAL WhoHandling( void ) const;
|
|
|
|
|
SI08 Priority( void ) const;
|
|
|
|
|
bool IsHandled( void ) const;
|
|
|
|
|
time_t TimeOfPage( void ) const;
|
2012-11-03 18:11:04 +00:00
|
|
|
std::string Reason( void ) const;
|
2022-10-24 18:39:33 +08:00
|
|
|
SERIAL RequestId( void ) const;
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
void WhoPaging( SERIAL pPaging );
|
|
|
|
|
void WhoHandling( SERIAL pHandling );
|
|
|
|
|
void Priority( SI08 pPriority );
|
|
|
|
|
void IsHandled( bool pHandled );
|
|
|
|
|
void TimeOfPage( time_t pTime );
|
2018-09-20 09:31:55 +08:00
|
|
|
void Reason( const std::string &pReason );
|
2022-10-24 18:39:33 +08:00
|
|
|
void RequestId( SERIAL hrid );
|
2002-04-07 20:53:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PageVector
|
|
|
|
|
{
|
|
|
|
|
private:
|
2022-10-24 18:39:33 +08:00
|
|
|
std::vector<CHelpRequest *> requestQueue;
|
|
|
|
|
std::vector<CHelpRequest *>::iterator currentPos;
|
2012-11-03 18:11:04 +00:00
|
|
|
std::string title; // GM/Counselor Queue
|
2002-04-07 20:53:41 +00:00
|
|
|
|
2022-11-21 21:11:34 -05:00
|
|
|
[[maybe_unused]] R32 avgEntryTime;
|
|
|
|
|
[[maybe_unused]] R32 maxEntryTime;
|
|
|
|
|
[[maybe_unused]] R32 minEntryTime;
|
2022-10-24 18:39:33 +08:00
|
|
|
SERIAL maxId;
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
void KillQueue( void );
|
|
|
|
|
public:
|
2022-10-24 18:39:33 +08:00
|
|
|
SERIAL Add( CHelpRequest *toAdd );
|
2002-04-07 20:53:41 +00:00
|
|
|
bool Remove( void );
|
2022-10-24 18:39:33 +08:00
|
|
|
CHelpRequest * First( void );
|
|
|
|
|
CHelpRequest * Next( void );
|
|
|
|
|
CHelpRequest * Current( void );
|
2002-04-07 20:53:41 +00:00
|
|
|
bool AtEnd( void ) const;
|
2012-11-03 18:11:04 +00:00
|
|
|
size_t NumEntries( void ) const;
|
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
|
|
|
PageVector();
|
|
|
|
|
PageVector( const std::string &newTitle );
|
|
|
|
|
~PageVector();
|
2012-11-03 18:11:04 +00:00
|
|
|
void SendAsGump( CSocket *toSendTo );
|
2018-09-20 09:31:55 +08:00
|
|
|
void SetTitle( const std::string &newTitle );
|
2002-04-07 20:53:41 +00:00
|
|
|
bool GotoPos( SI32 pos );
|
|
|
|
|
SI32 CurrentPos( void ) const;
|
|
|
|
|
SERIAL GetCallNum( void ) const;
|
|
|
|
|
SI32 FindCallNum( SERIAL callNum );
|
2012-11-03 18:11:04 +00:00
|
|
|
bool AnswerNextCall( CSocket *mSock, CChar *mChar );
|
2002-04-07 20:53:41 +00:00
|
|
|
};
|
|
|
|
|
|
2012-11-03 18:11:04 +00:00
|
|
|
extern PageVector *GMQueue;
|
|
|
|
|
extern PageVector *CounselorQueue;
|
|
|
|
|
|
2002-04-07 20:53:41 +00:00
|
|
|
#endif
|
|
|
|
|
|