From f8e1df2476074a86e4dc25204c2250a6111245de Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 6 Jul 2016 12:39:56 +0200 Subject: Updated API documentation. --- src/BlockEntities/DispenserEntity.h | 6 +++--- src/BlockEntities/MobHeadEntity.h | 2 +- src/Chunk.h | 4 ++-- src/ChunkMap.cpp | 4 ++-- src/ChunkMap.h | 2 +- src/Enchantments.h | 2 +- src/Entities/Entity.h | 10 +++++++--- src/Entities/Pawn.h | 18 ++++++------------ src/IniFile.h | 3 ++- src/Inventory.h | 4 ++-- src/ItemGrid.h | 14 ++++++-------- src/UI/Window.h | 8 ++++++-- src/World.cpp | 4 ++-- src/World.h | 2 +- 14 files changed, 42 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 03ce3ad69..4e81b455a 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -25,11 +25,11 @@ public: // tolua_begin /** Spawns a projectile of the given kind in front of the dispenser with the specified speed. - Returns the UniqueID of the spawned projectile, or 0 on failure. */ + Returns the UniqueID of the spawned projectile, or cEntity::INVALID_ID on failure. */ UInt32 SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d & a_Speed, const cItem * a_Item = nullptr); - /** Returns a unit vector in the cardinal direction of where the dispenser is facing. */ - Vector3d GetShootVector(NIBBLETYPE a_Meta); + /** Returns a unit vector in the cardinal direction of where the dispenser with the specified meta would be facing. */ + static Vector3d GetShootVector(NIBBLETYPE a_BlockMeta); // tolua_end diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h index 0aac95536..eef88a201 100644 --- a/src/BlockEntities/MobHeadEntity.h +++ b/src/BlockEntities/MobHeadEntity.h @@ -42,7 +42,7 @@ public: /** Set the player for mob heads with player type */ void SetOwner(const cPlayer & a_Owner); - /** Sets the player components for the mob heads with player type */ + /** Sets the player components for the mob heads with player type. */ void SetOwner(const AString & a_OwnerUUID, const AString & a_OwnerName, const AString & a_OwnerTexture, const AString & a_OwnerTextureSignature); /** Returns the type of the mob head */ diff --git a/src/Chunk.h b/src/Chunk.h index 162c8de96..925680fdd 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -397,7 +397,7 @@ public: /** Set a meta value, with the option of not informing the client and / or not marking dirty. Used for setting metas that are of little value for saving to disk and / or for sending to the client, such as leaf decay flags. */ - inline void SetMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta, bool a_ShouldMarkDirty = true, bool a_ShouldInformClient = true) + inline void SetMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta, bool a_ShouldMarkDirty = true, bool a_ShouldInformClients = true) { bool hasChanged = m_ChunkData.SetMeta(a_RelX, a_RelY, a_RelZ, a_Meta); if (hasChanged) @@ -406,7 +406,7 @@ public: { MarkDirty(); } - if (a_ShouldInformClient) + if (a_ShouldInformClients) { m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(a_RelX, a_RelY, a_RelZ), a_Meta)); } diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 55cabaa67..cb60b4841 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1228,7 +1228,7 @@ NIBBLETYPE cChunkMap::GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_Block -void cChunkMap::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta, bool a_ShouldMarkDirty, bool a_ShouldInformClient) +void cChunkMap::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta, bool a_ShouldMarkDirty, bool a_ShouldInformClients) { int ChunkX, ChunkZ; cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); @@ -1238,7 +1238,7 @@ void cChunkMap::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYP cChunkPtr Chunk = GetChunk(ChunkX, ChunkZ); if ((Chunk != nullptr) && Chunk->IsValid()) { - Chunk->SetMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta, a_ShouldMarkDirty, a_ShouldInformClient); + Chunk->SetMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta, a_ShouldMarkDirty, a_ShouldInformClients); } } diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 8a604ac09..70d9954eb 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -158,7 +158,7 @@ public: NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ); NIBBLETYPE GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ); NIBBLETYPE GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ); - void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta, bool a_ShouldMarkDirty, bool a_ShouldInformClient); + void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta, bool a_ShouldMarkDirty, bool a_ShouldInformClients); void SetBlock (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_SendToClients = true); bool GetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta); bool GetBlockInfo (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight); diff --git a/src/Enchantments.h b/src/Enchantments.h index e2f10be63..acc15dc7e 100644 --- a/src/Enchantments.h +++ b/src/Enchantments.h @@ -79,7 +79,7 @@ public: cEnchantments(const AString & a_StringSpec); /** Adds the enchantments contained in a_Other into this object. - Existing enchantments are preserved, unless a_Other specifies a different level, in which case the level is changed. */ + Existing enchantments are preserved, unless a_Other specifies a different level, in which case the level is changed to the a_Other's one. */ void Add(const cEnchantments & a_Other); /** Adds enchantments in the stringspec; if a specified enchantment already exists, overwrites it */ diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 6923795db..c543fd9c1 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -305,7 +305,7 @@ public: /** Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items */ virtual int GetRawDamageAgainst(const cEntity & a_Receiver); - /** Returns whether armor will protect against the passed damage type */ + /** Returns whether armor will protect against the specified damage type */ virtual bool ArmorCoversAgainst(eDamageType a_DamageType); /** Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover */ @@ -329,9 +329,13 @@ public: /** Returns the currently equipped boots; empty item if none */ virtual cItem GetEquippedBoots(void) const { return cItem(); } - /** Called when the health drops below zero. a_Killer may be nullptr (environmental damage) */ + // tolua_end + + /** Called when the health drops below zero. a_TDI's Attacker may be nullptr (environmental damage) */ virtual void KilledBy(TakeDamageInfo & a_TDI); + // tolua_begin + /** Called when the entity kills another entity */ virtual void Killed(cEntity * a_Victim) {} @@ -404,7 +408,7 @@ public: virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ); /** Schedules a MoveToWorld call to occur on the next Tick of the entity */ - void ScheduleMoveToWorld(cWorld * a_World, Vector3d a_NewPosition, bool a_SetPortalCooldown = false); + void ScheduleMoveToWorld(cWorld * a_World, Vector3d a_NewPosition, bool a_ShouldSetPortalCooldown = false); bool MoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition); diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 05bc09e88..6a7035ee6 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -39,23 +39,17 @@ public: // tolua_begin - /** Applies an entity effect + /** Applies an entity effect. Checks with plugins if they allow the addition. - @param a_EffectType The entity effect to apply - @param a_EffectDurationTicks The duration of the effect - @param a_EffectIntensity The level of the effect (0 = Potion I, 1 = Potion II, etc) - @param a_DistanceModifier The scalar multiplied to the potion duration, only applies to splash potions) + a_EffectIntensity is the level of the effect (0 = Potion I, 1 = Potion II, etc). + a_DistanceModifier is the scalar multiplied to the potion duration (only applies to splash potions). */ void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier = 1); - /** Removes a currently applied entity effect - @param a_EffectType The entity effect to remove - */ + /** Removes a currently applied entity effect. */ void RemoveEntityEffect(cEntityEffect::eType a_EffectType); - /** Returns true, if the entity effect is currently applied - @param a_EffectType The entity effect to check - */ + /** Returns true, if the entity effect is currently applied. */ bool HasEntityEffect(cEntityEffect::eType a_EffectType) const; /** Removes all currently applied entity effects (used when drinking milk) */ @@ -63,7 +57,7 @@ public: // tolua_end - /** remove the monster from the list of monsters targeting this pawn. */ + /** Remove the monster from the list of monsters targeting this pawn. */ void NoLongerTargetingMe(cMonster * a_Monster); /** Add the monster to the list of monsters targeting this pawn. (Does not check if already in list!) */ diff --git a/src/IniFile.h b/src/IniFile.h index 2eb81c879..37bf451d7 100644 --- a/src/IniFile.h +++ b/src/IniFile.h @@ -79,7 +79,8 @@ public: Returns true if successful, false otherwise. */ bool ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect = true); - /** Writes data stored in class to the specified ini file */ + /** Writes data stored in class to the specified ini file. + Returns true on success, false on failure. */ bool WriteFile(const AString & a_FileName) const; virtual bool Flush() override { return WriteFile(m_Filename); } diff --git a/src/Inventory.h b/src/Inventory.h index adad2fcbb..2bcc66ec1 100644 --- a/src/Inventory.h +++ b/src/Inventory.h @@ -62,10 +62,10 @@ public: void Clear(void); /** Returns number of items out of a_ItemStack that can fit in the storage */ - int HowManyCanFit(const cItem & a_ItemStack, bool a_ConsiderEmptySlots); + int HowManyCanFit(const cItem & a_ItemStack, bool a_ConsiderEmptySlots = true); /** Returns how many items of the specified type would fit into the slot range specified */ - int HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int a_EndSlotNum, bool a_ConsiderEmptySlots); + int HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int a_EndSlotNum, bool a_ConsiderEmptySlots = true); /** Adds as many items out of a_ItemStack as can fit. If a_AllowNewStacks is set to false, only existing stacks can be topped up; diff --git a/src/ItemGrid.h b/src/ItemGrid.h index 090649c44..46e200b9c 100644 --- a/src/ItemGrid.h +++ b/src/ItemGrid.h @@ -78,10 +78,9 @@ public: /** Adds as many items out of a_ItemStack as can fit. If a_AllowNewStacks is set to false, only existing stacks can be topped up; - if a_AllowNewStacks is set to true, empty slots can be used for the rest. - If a_PrioritarySlot is set to a positive value, then the corresponding slot will be used in - first (if empty or compatible with added items) - if a_PrioritarySlot is set to -1, regular order apply + If a_AllowNewStacks is set to true, empty slots can be used for the rest. + If a_PrioritarySlot is set to a positive value, then the corresponding slot will be used first (if empty or compatible with added items). + If a_PrioritarySlot is set to -1, regular order applies. Returns the number of items that fit. */ int AddItem(cItem & a_ItemStack, bool a_AllowNewStacks = true, int a_PrioritarySlot = -1); @@ -89,10 +88,9 @@ public: /** Same as AddItem, but works on an entire list of item stacks. The a_ItemStackList is modified to reflect the leftover items. If a_AllowNewStacks is set to false, only existing stacks can be topped up; - if a_AllowNewStacks is set to true, empty slots can be used for the rest. - If a_PrioritarySlot is set to a positive value, then the corresponding slot will be used in - first (if empty or compatible with added items) - if a_PrioritarySlot is set to -1, regular order apply + If a_AllowNewStacks is set to true, empty slots can be used for the rest. + If a_PrioritarySlot is set to a positive value, then the corresponding slot will be used first (if empty or compatible with added items). + If a_PrioritarySlot is set to -1, regular order applies. Returns the total number of items that fit. */ int AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks = true, int a_PrioritarySlot = -1); diff --git a/src/UI/Window.h b/src/UI/Window.h index 8a70b5855..e1b91ccc7 100644 --- a/src/UI/Window.h +++ b/src/UI/Window.h @@ -77,6 +77,8 @@ public: char GetWindowID(void) const { return m_WindowID; } // tolua_export int GetWindowType(void) const { return m_WindowType; } // tolua_export + + /** Returns the textual representation of the window's type, such as "minecraft:chest". */ const AString GetWindowTypeName(void) const; // tolua_export cWindowOwner * GetOwner(void) { return m_Owner; } @@ -136,10 +138,12 @@ public: const AString & GetWindowTitle() const { return m_WindowTitle; } void SetWindowTitle(const AString & a_WindowTitle) { m_WindowTitle = a_WindowTitle; } - /** Sends the UpdateWindowProperty (0x69) packet to all clients of the window */ + /** Updates a numerical property associated with the window. Typically used for furnace progressbars. + Sends the UpdateWindowProperty packet to all clients of the window */ virtual void SetProperty(short a_Property, short a_Value); - /** Sends the UpdateWindowPropert(0x69) packet to the specified player */ + /** Updates a numerical property associated with the window. Typically used for furnace progressbars. + Sends the UpdateWindowProperty packet only to the specified player */ virtual void SetProperty(short a_Property, short a_Value, cPlayer & a_Player); // tolua_end diff --git a/src/World.cpp b/src/World.cpp index a8225693f..557e110d7 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2082,9 +2082,9 @@ void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_Bloc -void cWorld::SetBlockMeta(int a_X, int a_Y, int a_Z, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty, bool a_ShouldInformClient) +void cWorld::SetBlockMeta(int a_X, int a_Y, int a_Z, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty, bool a_ShouldInformClients) { - m_ChunkMap->SetBlockMeta(a_X, a_Y, a_Z, a_MetaData, a_ShouldMarkDirty, a_ShouldInformClient); + m_ChunkMap->SetBlockMeta(a_X, a_Y, a_Z, a_MetaData, a_ShouldMarkDirty, a_ShouldInformClients); } diff --git a/src/World.h b/src/World.h index 368828225..fbe1f4a6d 100644 --- a/src/World.h +++ b/src/World.h @@ -402,7 +402,7 @@ public: return m_ChunkMap->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); } - void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty = true, bool a_ShouldInformClient = true); + void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty = true, bool a_ShouldInformClients = true); NIBBLETYPE GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ); NIBBLETYPE GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ); -- cgit v1.2.3