uox3/source/ConfigOS.h

90 lines
2.6 KiB
C
Raw Permalink Normal View History

#ifndef __ConfigOS_H_
#define __ConfigOS_H_
// Initial platform/compiler-related stuff to set.
#define WINDOWS 1
#define LINUX 2
#define MACOS 3
// Finds the compiler type and version.
#if defined( _MSC_VER )
#define XP_WIN // JS API Requires we define OS we compile with
#define XP_PC
//o------------------------------------------------------------------------------------------------o
// These should be defined on the compilier line, in case windows.h gets defined ahead (resources.h?)
#define NOMINMAX // Dont want min/max macros, use <algorithm>
#define WIN32_LEAN_AND_MEAN // We NEVER want Winsock1, and the extra windows stuff
//o------------------------------------------------------------------------------------------------o
//o------------------------------------------------------------------------------------------------o
// Ok, windows sets _ITERATOR_DEBUG_LEVEL based on debug/release.
// Check: https://docs.microsoft.com/en-us/cpp/standard-library/iterator-debug-level?view=msvc-170
// In theory, we shouldn't need these, if we have issues, we want to fix the iterator problem
// If we continue to need them, then ideally, they should be on the compile line in the project
// Got rid of _HAS_ITERATOR_DEBUGGING/_SECURE_SCL as _ITERATOR_DEBUG_LEVEL supersedes them.
#ifdef _DEBUG
#define _ITERATOR_DEBUG_LEVEL 2 // THis is the default, why do we need this?
#else
#define _HAS_ITERATOR_DEBUGGING 0 // This is the default for non debug, why do we need?
#endif // endif to _DEBUG
//o------------------------------------------------------------------------------------------------o
Misc small fixes Fixed an issue with books where server could get stuck in an infinite loop if number of lines per page was higher than 8. Now capped at 8 lines per page. Renamed item type enum IT_READABLEBOOK to IT_BOOK, since it's the item type used by both readable and writeable books. Changed ANIMALATTACKCHANCE to use a scale of 1 to 1000 instead of 1 to 100, for additional granularity in setting the chance for animals to get attacked by monsters. An INI value of 15 now translates as 1.5% chance (per NPC AI cycle!) instead of the previous 15% Removed new GetEnvironment() function and expanded on the use of the existing OS_STR define in Config.h Updated fireworks wand (IT_FIREWORKSWAND) so effects no longer play permanently in ClassicUO client Fixed an issue with converting a house from public to private while there were player vendors in the house Ported player vendor deeds and placement of player vendors to JS (UOX3/js/server/house/playerVendorDeed.js) and added checks to make sure player is in a house they own, that can hold more player vendors, and that they are trying to add the vendor in a location that's not blocking any doors. Partially ported guildstone deed functionality to JS (UOX3/js/item/guildstone.js) and added various additional checks to make sure player is in a house they own, they're not already in a guild, no other guildstones exist in the house and they're not trying to place it in a location that blocks any doors. Main guild creation code is still hardcoded, though. Removed some unused item types that have been marked as candidates for deletion for over 15 years (IT_CHAOSGATEOPENER, IT_CHAOSGATE, IT_GUILLOTINEANIM, IT_TRAININGDUMMYANIM)! Updated UOX3 documentation with complete list of item types, and item layers, in addition to other small additions. Fixed an issue with advanced pathfinding where NPCs in some cases would stop 1 tile before reaching the target location Fixed an issue where no crafting resources would ever be lost if failing to craft an item that only required 1 of a given crafting resource Fixed an issue with pathfinding that could cause NPCs to queue up in long rows when attempting to reach the same target in combat when advanced pathfinding was disabled Added functionality to allow guild masters to move guildstones by transforming these into portable stones that can be used to place the guildstones in new locations Updated timestamp for packet logs to include milliseconds for greater granularity
2020-11-08 05:53:01 +08:00
#ifdef _WIN32 // Includes both 32 bit and 64 bit
Misc small fixes Fixed an issue with books where server could get stuck in an infinite loop if number of lines per page was higher than 8. Now capped at 8 lines per page. Renamed item type enum IT_READABLEBOOK to IT_BOOK, since it's the item type used by both readable and writeable books. Changed ANIMALATTACKCHANCE to use a scale of 1 to 1000 instead of 1 to 100, for additional granularity in setting the chance for animals to get attacked by monsters. An INI value of 15 now translates as 1.5% chance (per NPC AI cycle!) instead of the previous 15% Removed new GetEnvironment() function and expanded on the use of the existing OS_STR define in Config.h Updated fireworks wand (IT_FIREWORKSWAND) so effects no longer play permanently in ClassicUO client Fixed an issue with converting a house from public to private while there were player vendors in the house Ported player vendor deeds and placement of player vendors to JS (UOX3/js/server/house/playerVendorDeed.js) and added checks to make sure player is in a house they own, that can hold more player vendors, and that they are trying to add the vendor in a location that's not blocking any doors. Partially ported guildstone deed functionality to JS (UOX3/js/item/guildstone.js) and added various additional checks to make sure player is in a house they own, they're not already in a guild, no other guildstones exist in the house and they're not trying to place it in a location that blocks any doors. Main guild creation code is still hardcoded, though. Removed some unused item types that have been marked as candidates for deletion for over 15 years (IT_CHAOSGATEOPENER, IT_CHAOSGATE, IT_GUILLOTINEANIM, IT_TRAININGDUMMYANIM)! Updated UOX3 documentation with complete list of item types, and item layers, in addition to other small additions. Fixed an issue with advanced pathfinding where NPCs in some cases would stop 1 tile before reaching the target location Fixed an issue where no crafting resources would ever be lost if failing to craft an item that only required 1 of a given crafting resource Fixed an issue with pathfinding that could cause NPCs to queue up in long rows when attempting to reach the same target in combat when advanced pathfinding was disabled Added functionality to allow guild masters to move guildstones by transforming these into portable stones that can be used to place the guildstones in new locations Updated timestamp for packet logs to include milliseconds for greater granularity
2020-11-08 05:53:01 +08:00
#ifdef _WIN64
#define OS_STR "Win64"
#else
#define OS_STR "Win32"
#endif //_WIN64
#endif //_WIN32
#define PLATFORM WINDOWS
#else // A unix type system
#define XP_UNIX // JS API Requires we define OS we compile with
#define ioctlsocket( s, b, c ) ioctl( s, b, c )
#define closesocket( s ) close( s )
#ifdef __linux__
#define PLATFORM LINUX
#define SOCKET int
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
Misc small fixes Fixed an issue with books where server could get stuck in an infinite loop if number of lines per page was higher than 8. Now capped at 8 lines per page. Renamed item type enum IT_READABLEBOOK to IT_BOOK, since it's the item type used by both readable and writeable books. Changed ANIMALATTACKCHANCE to use a scale of 1 to 1000 instead of 1 to 100, for additional granularity in setting the chance for animals to get attacked by monsters. An INI value of 15 now translates as 1.5% chance (per NPC AI cycle!) instead of the previous 15% Removed new GetEnvironment() function and expanded on the use of the existing OS_STR define in Config.h Updated fireworks wand (IT_FIREWORKSWAND) so effects no longer play permanently in ClassicUO client Fixed an issue with converting a house from public to private while there were player vendors in the house Ported player vendor deeds and placement of player vendors to JS (UOX3/js/server/house/playerVendorDeed.js) and added checks to make sure player is in a house they own, that can hold more player vendors, and that they are trying to add the vendor in a location that's not blocking any doors. Partially ported guildstone deed functionality to JS (UOX3/js/item/guildstone.js) and added various additional checks to make sure player is in a house they own, they're not already in a guild, no other guildstones exist in the house and they're not trying to place it in a location that blocks any doors. Main guild creation code is still hardcoded, though. Removed some unused item types that have been marked as candidates for deletion for over 15 years (IT_CHAOSGATEOPENER, IT_CHAOSGATE, IT_GUILLOTINEANIM, IT_TRAININGDUMMYANIM)! Updated UOX3 documentation with complete list of item types, and item layers, in addition to other small additions. Fixed an issue with advanced pathfinding where NPCs in some cases would stop 1 tile before reaching the target location Fixed an issue where no crafting resources would ever be lost if failing to craft an item that only required 1 of a given crafting resource Fixed an issue with pathfinding that could cause NPCs to queue up in long rows when attempting to reach the same target in combat when advanced pathfinding was disabled Added functionality to allow guild masters to move guildstones by transforming these into portable stones that can be used to place the guildstones in new locations Updated timestamp for packet logs to include milliseconds for greater granularity
2020-11-08 05:53:01 +08:00
#if INTPTR_MAX == INT64_MAX
#define OS_STR "Linux64"
#elif INTPTR_MAX == INT32_MAX
#define OS_STR "Linux32"
#endif // INTPTR_MAX
#elif defined(__APPLE__)
#define PLATFORM MACOS
#define SOCKET int
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
Misc small fixes Fixed an issue with books where server could get stuck in an infinite loop if number of lines per page was higher than 8. Now capped at 8 lines per page. Renamed item type enum IT_READABLEBOOK to IT_BOOK, since it's the item type used by both readable and writeable books. Changed ANIMALATTACKCHANCE to use a scale of 1 to 1000 instead of 1 to 100, for additional granularity in setting the chance for animals to get attacked by monsters. An INI value of 15 now translates as 1.5% chance (per NPC AI cycle!) instead of the previous 15% Removed new GetEnvironment() function and expanded on the use of the existing OS_STR define in Config.h Updated fireworks wand (IT_FIREWORKSWAND) so effects no longer play permanently in ClassicUO client Fixed an issue with converting a house from public to private while there were player vendors in the house Ported player vendor deeds and placement of player vendors to JS (UOX3/js/server/house/playerVendorDeed.js) and added checks to make sure player is in a house they own, that can hold more player vendors, and that they are trying to add the vendor in a location that's not blocking any doors. Partially ported guildstone deed functionality to JS (UOX3/js/item/guildstone.js) and added various additional checks to make sure player is in a house they own, they're not already in a guild, no other guildstones exist in the house and they're not trying to place it in a location that blocks any doors. Main guild creation code is still hardcoded, though. Removed some unused item types that have been marked as candidates for deletion for over 15 years (IT_CHAOSGATEOPENER, IT_CHAOSGATE, IT_GUILLOTINEANIM, IT_TRAININGDUMMYANIM)! Updated UOX3 documentation with complete list of item types, and item layers, in addition to other small additions. Fixed an issue with advanced pathfinding where NPCs in some cases would stop 1 tile before reaching the target location Fixed an issue where no crafting resources would ever be lost if failing to craft an item that only required 1 of a given crafting resource Fixed an issue with pathfinding that could cause NPCs to queue up in long rows when attempting to reach the same target in combat when advanced pathfinding was disabled Added functionality to allow guild masters to move guildstones by transforming these into portable stones that can be used to place the guildstones in new locations Updated timestamp for packet logs to include milliseconds for greater granularity
2020-11-08 05:53:01 +08:00
#if INTPTR_MAX == INT64_MAX
#define OS_STR "MacOS64"
#elif INTPTR_MAX == INT32_MAX
#define OS_STR "MacOS32"
#endif //INPTR_MAX
Misc small fixes Fixed an issue with books where server could get stuck in an infinite loop if number of lines per page was higher than 8. Now capped at 8 lines per page. Renamed item type enum IT_READABLEBOOK to IT_BOOK, since it's the item type used by both readable and writeable books. Changed ANIMALATTACKCHANCE to use a scale of 1 to 1000 instead of 1 to 100, for additional granularity in setting the chance for animals to get attacked by monsters. An INI value of 15 now translates as 1.5% chance (per NPC AI cycle!) instead of the previous 15% Removed new GetEnvironment() function and expanded on the use of the existing OS_STR define in Config.h Updated fireworks wand (IT_FIREWORKSWAND) so effects no longer play permanently in ClassicUO client Fixed an issue with converting a house from public to private while there were player vendors in the house Ported player vendor deeds and placement of player vendors to JS (UOX3/js/server/house/playerVendorDeed.js) and added checks to make sure player is in a house they own, that can hold more player vendors, and that they are trying to add the vendor in a location that's not blocking any doors. Partially ported guildstone deed functionality to JS (UOX3/js/item/guildstone.js) and added various additional checks to make sure player is in a house they own, they're not already in a guild, no other guildstones exist in the house and they're not trying to place it in a location that blocks any doors. Main guild creation code is still hardcoded, though. Removed some unused item types that have been marked as candidates for deletion for over 15 years (IT_CHAOSGATEOPENER, IT_CHAOSGATE, IT_GUILLOTINEANIM, IT_TRAININGDUMMYANIM)! Updated UOX3 documentation with complete list of item types, and item layers, in addition to other small additions. Fixed an issue with advanced pathfinding where NPCs in some cases would stop 1 tile before reaching the target location Fixed an issue where no crafting resources would ever be lost if failing to craft an item that only required 1 of a given crafting resource Fixed an issue with pathfinding that could cause NPCs to queue up in long rows when attempting to reach the same target in combat when advanced pathfinding was disabled Added functionality to allow guild masters to move guildstones by transforming these into portable stones that can be used to place the guildstones in new locations Updated timestamp for packet logs to include milliseconds for greater granularity
2020-11-08 05:53:01 +08:00
#else
Misc small fixes Fixed an issue with books where server could get stuck in an infinite loop if number of lines per page was higher than 8. Now capped at 8 lines per page. Renamed item type enum IT_READABLEBOOK to IT_BOOK, since it's the item type used by both readable and writeable books. Changed ANIMALATTACKCHANCE to use a scale of 1 to 1000 instead of 1 to 100, for additional granularity in setting the chance for animals to get attacked by monsters. An INI value of 15 now translates as 1.5% chance (per NPC AI cycle!) instead of the previous 15% Removed new GetEnvironment() function and expanded on the use of the existing OS_STR define in Config.h Updated fireworks wand (IT_FIREWORKSWAND) so effects no longer play permanently in ClassicUO client Fixed an issue with converting a house from public to private while there were player vendors in the house Ported player vendor deeds and placement of player vendors to JS (UOX3/js/server/house/playerVendorDeed.js) and added checks to make sure player is in a house they own, that can hold more player vendors, and that they are trying to add the vendor in a location that's not blocking any doors. Partially ported guildstone deed functionality to JS (UOX3/js/item/guildstone.js) and added various additional checks to make sure player is in a house they own, they're not already in a guild, no other guildstones exist in the house and they're not trying to place it in a location that blocks any doors. Main guild creation code is still hardcoded, though. Removed some unused item types that have been marked as candidates for deletion for over 15 years (IT_CHAOSGATEOPENER, IT_CHAOSGATE, IT_GUILLOTINEANIM, IT_TRAININGDUMMYANIM)! Updated UOX3 documentation with complete list of item types, and item layers, in addition to other small additions. Fixed an issue with advanced pathfinding where NPCs in some cases would stop 1 tile before reaching the target location Fixed an issue where no crafting resources would ever be lost if failing to craft an item that only required 1 of a given crafting resource Fixed an issue with pathfinding that could cause NPCs to queue up in long rows when attempting to reach the same target in combat when advanced pathfinding was disabled Added functionality to allow guild masters to move guildstones by transforming these into portable stones that can be used to place the guildstones in new locations Updated timestamp for packet logs to include milliseconds for greater granularity
2020-11-08 05:53:01 +08:00
#define OS_STR "Unknown"
#endif //__linux__
#define FALSE 0L
#define TRUE 1L
#endif // End to the compiler type/version
#endif //__ConfigOS_H_