Merge branch 'master' into NetherFortGen
This commit is contained in:
commit
18dad36189
@ -128,6 +128,8 @@ public: // tolua_export
|
||||
class cCommandEnumCallback
|
||||
{
|
||||
public:
|
||||
virtual ~cCommandEnumCallback() {}
|
||||
|
||||
/** Called for each command; return true to abort enumeration
|
||||
For console commands, a_Permission is not used (set to empty string)
|
||||
*/
|
||||
|
@ -4,6 +4,7 @@
|
||||
class cBroadcastInterface
|
||||
{
|
||||
public:
|
||||
virtual ~cBroadcastInterface() {}
|
||||
|
||||
virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0;
|
||||
virtual void BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL) = 0;
|
||||
|
@ -9,6 +9,7 @@ class cItems;
|
||||
class cWorldInterface
|
||||
{
|
||||
public:
|
||||
virtual ~cWorldInterface() {}
|
||||
|
||||
virtual Int64 GetTimeOfDay(void) const = 0;
|
||||
virtual Int64 GetWorldAge(void) const = 0;
|
||||
|
@ -24,6 +24,8 @@ class cBlockArea;
|
||||
class cForEachChunkProvider
|
||||
{
|
||||
public:
|
||||
virtual ~cForEachChunkProvider() {}
|
||||
|
||||
/** Calls the callback for each chunk in the specified range. */
|
||||
virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) = 0;
|
||||
|
||||
|
@ -264,11 +264,17 @@ template class SizeChecker<UInt16, 2>;
|
||||
#define assert_test(x) ( !!(x) || (assert(!#x), exit(1), 0))
|
||||
#endif
|
||||
|
||||
/// A generic interface used mainly in ForEach() functions
|
||||
|
||||
|
||||
|
||||
|
||||
/** A generic interface used mainly in ForEach() functions */
|
||||
template <typename Type> class cItemCallback
|
||||
{
|
||||
public:
|
||||
/// Called for each item in the internal list; return true to stop the loop, or false to continue enumerating
|
||||
virtual ~cItemCallback() {}
|
||||
|
||||
/** Called for each item in the internal list; return true to stop the loop, or false to continue enumerating */
|
||||
virtual bool Item(Type * a_Type) = 0;
|
||||
} ;
|
||||
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
class cCallbacks
|
||||
{
|
||||
public:
|
||||
virtual ~cCallbacks() {}
|
||||
|
||||
/** Called when a new request arrives over a connection and its headers have been parsed.
|
||||
The request body needn't have arrived yet.
|
||||
*/
|
||||
@ -50,7 +52,7 @@ public:
|
||||
} ;
|
||||
|
||||
cHTTPServer(void);
|
||||
~cHTTPServer();
|
||||
virtual ~cHTTPServer();
|
||||
|
||||
/// Initializes the server on the specified ports
|
||||
bool Initialize(const AString & a_PortsIPv4, const AString & a_PortsIPv6);
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
|
||||
cInventory(cPlayer & a_Owner);
|
||||
|
||||
virtual ~cInventory() {}
|
||||
|
||||
// tolua_begin
|
||||
|
||||
/// Removes all items from the entire inventory
|
||||
|
@ -20,11 +20,13 @@ class cItemGrid
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
/// This class is used as a callback for when a slot changes
|
||||
/** This class is used as a callback for when a slot changes */
|
||||
class cListener
|
||||
{
|
||||
public:
|
||||
/// Called whenever a slot changes
|
||||
virtual ~cListener() {}
|
||||
|
||||
/** Called whenever a slot changes */
|
||||
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) = 0;
|
||||
} ;
|
||||
typedef std::vector<cListener *> cListeners;
|
||||
@ -38,12 +40,12 @@ public:
|
||||
int GetHeight (void) const { return m_Height; }
|
||||
int GetNumSlots(void) const { return m_NumSlots; }
|
||||
|
||||
/// Converts XY coords into slot number; returns -1 on invalid coords
|
||||
/** Converts XY coords into slot number; returns -1 on invalid coords */
|
||||
int GetSlotNum(int a_X, int a_Y) const;
|
||||
|
||||
// tolua_end
|
||||
|
||||
/// Converts slot number into XY coords; sets coords to -1 on invalid slot number. Exported in ManualBindings.cpp
|
||||
/** Converts slot number into XY coords; sets coords to -1 on invalid slot number. Exported in ManualBindings.cpp */
|
||||
void GetSlotCoords(int a_SlotNum, int & a_X, int & a_Y) const;
|
||||
|
||||
// tolua_begin
|
||||
@ -62,16 +64,16 @@ public:
|
||||
void EmptySlot(int a_X, int a_Y);
|
||||
void EmptySlot(int a_SlotNum);
|
||||
|
||||
/// Returns true if the specified slot is empty or the slot doesn't exist
|
||||
/** Returns true if the specified slot is empty or the slot doesn't exist */
|
||||
bool IsSlotEmpty(int a_SlotNum) const;
|
||||
|
||||
/// Returns true if the specified slot is empty or the slot doesn't exist
|
||||
/** Returns true if the specified slot is empty or the slot doesn't exist */
|
||||
bool IsSlotEmpty(int a_X, int a_Y) const;
|
||||
|
||||
/// Sets all items as empty
|
||||
/** Sets all items as empty */
|
||||
void Clear(void);
|
||||
|
||||
/// Returns number of items out of a_ItemStack that can fit in the storage
|
||||
/** Returns number of items out of a_ItemStack that can fit in the storage */
|
||||
int HowManyCanFit(const cItem & a_ItemStack, bool a_AllowNewStacks = true);
|
||||
|
||||
/** Adds as many items out of a_ItemStack as can fit.
|
||||
@ -117,37 +119,37 @@ public:
|
||||
*/
|
||||
cItem RemoveOneItem(int a_X, int a_Y);
|
||||
|
||||
/// Returns the number of items of type a_Item that are stored
|
||||
/** Returns the number of items of type a_Item that are stored */
|
||||
int HowManyItems(const cItem & a_Item);
|
||||
|
||||
/// Returns true if there are at least as many items of type a_ItemStack as in a_ItemStack
|
||||
/** Returns true if there are at least as many items of type a_ItemStack as in a_ItemStack */
|
||||
bool HasItems(const cItem & a_ItemStack);
|
||||
|
||||
/// Returns the index of the first empty slot; -1 if all full
|
||||
/** Returns the index of the first empty slot; -1 if all full */
|
||||
int GetFirstEmptySlot(void) const;
|
||||
|
||||
/// Returns the index of the first non-empty slot; -1 if all empty
|
||||
/** Returns the index of the first non-empty slot; -1 if all empty */
|
||||
int GetFirstUsedSlot(void) const;
|
||||
|
||||
/// Returns the index of the last empty slot; -1 if all full
|
||||
/** Returns the index of the last empty slot; -1 if all full */
|
||||
int GetLastEmptySlot(void) const;
|
||||
|
||||
/// Returns the index of the last used slot; -1 if all empty
|
||||
/** Returns the index of the last used slot; -1 if all empty */
|
||||
int GetLastUsedSlot(void) const;
|
||||
|
||||
/// Returns the index of the first empty slot following a_StartFrom (a_StartFrom is not checked)
|
||||
/** Returns the index of the first empty slot following a_StartFrom (a_StartFrom is not checked) */
|
||||
int GetNextEmptySlot(int a_StartFrom) const;
|
||||
|
||||
/// Returns the index of the first used slot following a_StartFrom (a_StartFrom is not checked)
|
||||
/** Returns the index of the first used slot following a_StartFrom (a_StartFrom is not checked) */
|
||||
int GetNextUsedSlot(int a_StartFrom) const;
|
||||
|
||||
/// Copies the contents into a cItems object; preserves the original a_Items contents
|
||||
/** Copies the contents into a cItems object; preserves the original a_Items contents */
|
||||
void CopyToItems(cItems & a_Items) const;
|
||||
|
||||
/// Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact)
|
||||
/** Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact) */
|
||||
bool DamageItem(int a_SlotNum, short a_Amount);
|
||||
|
||||
/// Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact)
|
||||
/** Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact) */
|
||||
bool DamageItem(int a_X, int a_Y, short a_Amount);
|
||||
|
||||
// tolua_end
|
||||
@ -159,10 +161,10 @@ public:
|
||||
*/
|
||||
void GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, size_t a_CountLootProbabs, int a_NumSlots, int a_Seed);
|
||||
|
||||
/// Adds a callback that gets called whenever a slot changes. Must not be called from within the listener callback!
|
||||
/** Adds a callback that gets called whenever a slot changes. Must not be called from within the listener callback! */
|
||||
void AddListener(cListener & a_Listener);
|
||||
|
||||
/// Removes a slot-change-callback. Must not be called from within the listener callback!
|
||||
/** Removes a slot-change-callback. Must not be called from within the listener callback! */
|
||||
void RemoveListener(cListener & a_Listener);
|
||||
|
||||
// tolua_begin
|
||||
@ -177,7 +179,7 @@ protected:
|
||||
cCriticalSection m_CSListeners; ///< CS that guards the m_Listeners against multi-thread access
|
||||
bool m_IsInTriggerListeners; ///< Set to true while TriggerListeners is running, to detect attempts to manipulate listener list while triggerring
|
||||
|
||||
/// Calls all m_Listeners for the specified slot number
|
||||
/** Calls all m_Listeners for the specified slot number */
|
||||
void TriggerListeners(int a_SlotNum);
|
||||
|
||||
/** Adds up to a_Num items out of a_ItemStack, as many as can fit, in specified slot
|
||||
|
@ -29,43 +29,45 @@ class cListenThread :
|
||||
typedef cIsThread super;
|
||||
|
||||
public:
|
||||
/// Used as the callback for connection events
|
||||
/** Used as the callback for connection events */
|
||||
class cCallback
|
||||
{
|
||||
public:
|
||||
/// This callback is called whenever a socket connection is accepted
|
||||
virtual ~cCallback() {}
|
||||
|
||||
/** This callback is called whenever a socket connection is accepted */
|
||||
virtual void OnConnectionAccepted(cSocket & a_Socket) = 0;
|
||||
} ;
|
||||
|
||||
cListenThread(cCallback & a_Callback, cSocket::eFamily a_Family, const AString & a_ServiceName = "");
|
||||
~cListenThread();
|
||||
|
||||
/// Creates all the sockets, returns trus if successful, false if not.
|
||||
/** Creates all the sockets, returns trus if successful, false if not. */
|
||||
bool Initialize(const AString & a_PortsString);
|
||||
|
||||
bool Start(void);
|
||||
|
||||
void Stop(void);
|
||||
|
||||
/// Call before Initialize() to set the "reuse" flag on the sockets
|
||||
/** Call before Initialize() to set the "reuse" flag on the sockets */
|
||||
void SetReuseAddr(bool a_Reuse = true);
|
||||
|
||||
protected:
|
||||
typedef std::vector<cSocket> cSockets;
|
||||
|
||||
/// The callback which to notify of incoming connections
|
||||
/** The callback which to notify of incoming connections */
|
||||
cCallback & m_Callback;
|
||||
|
||||
/// Socket address family to use
|
||||
/** Socket address family to use */
|
||||
cSocket::eFamily m_Family;
|
||||
|
||||
/// Sockets that are being monitored
|
||||
/** Sockets that are being monitored */
|
||||
cSockets m_Sockets;
|
||||
|
||||
/// If set to true, the SO_REUSEADDR socket option is set to true
|
||||
/** If set to true, the SO_REUSEADDR socket option is set to true */
|
||||
bool m_ShouldReuseAddr;
|
||||
|
||||
/// Name of the service that's listening on the ports; for logging purposes only
|
||||
/** Name of the service that's listening on the ports; for logging purposes only */
|
||||
AString m_ServiceName;
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ class cRCONServer :
|
||||
{
|
||||
public:
|
||||
cRCONServer(cServer & a_Server);
|
||||
~cRCONServer();
|
||||
virtual ~cRCONServer();
|
||||
|
||||
void Initialize(cIniFile & a_IniFile);
|
||||
|
||||
|
@ -33,6 +33,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~cWindowOwner()
|
||||
{
|
||||
}
|
||||
|
||||
void CloseWindow(void)
|
||||
{
|
||||
m_Window = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user