summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-07-31 19:26:33 +0200
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-07-31 19:26:33 +0200
commitd19cde93fa3344f318fb0d4ffbf5bb0397a51a75 (patch)
treeb5ee221d8a8e63c7d3b7868da1db19bf717a6ffd /src/Mobs
parentMerge pull request #2400 from cuberite/OffloadBadChunks (diff)
parentUnified the doxy-comment format. (diff)
downloadcuberite-d19cde93fa3344f318fb0d4ffbf5bb0397a51a75.tar
cuberite-d19cde93fa3344f318fb0d4ffbf5bb0397a51a75.tar.gz
cuberite-d19cde93fa3344f318fb0d4ffbf5bb0397a51a75.tar.bz2
cuberite-d19cde93fa3344f318fb0d4ffbf5bb0397a51a75.tar.lz
cuberite-d19cde93fa3344f318fb0d4ffbf5bb0397a51a75.tar.xz
cuberite-d19cde93fa3344f318fb0d4ffbf5bb0397a51a75.tar.zst
cuberite-d19cde93fa3344f318fb0d4ffbf5bb0397a51a75.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/MagmaCube.h4
-rw-r--r--src/Mobs/Monster.h14
-rw-r--r--src/Mobs/MonsterTypes.h5
-rw-r--r--src/Mobs/PassiveMonster.h3
-rw-r--r--src/Mobs/Path.cpp6
-rw-r--r--src/Mobs/Path.h13
-rw-r--r--src/Mobs/Villager.cpp18
-rw-r--r--src/Mobs/Villager.h8
8 files changed, 44 insertions, 27 deletions
diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h
index b914dc867..3cd77f3e3 100644
--- a/src/Mobs/MagmaCube.h
+++ b/src/Mobs/MagmaCube.h
@@ -12,7 +12,7 @@ class cMagmaCube :
typedef cAggressiveMonster super;
public:
- /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest
+ /** Creates a MagmaCube of the specified size; with 1 being the smallest */
cMagmaCube(int a_Size);
CLASS_PROTODEF(cMagmaCube)
@@ -26,7 +26,7 @@ public:
protected:
- /// Size of the MagmaCube, 1, 2 and 4, with 1 being the smallest
+ /** Size of the MagmaCube, with 1 being the smallest */
int m_Size;
} ;
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index d5de3b19e..5438bb7d9 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -73,7 +73,7 @@ public:
virtual void CheckEventSeePlayer(void);
virtual void EventSeePlayer(cEntity * a_Player);
- /// Reads the monster configuration for the specified monster name and assigns it to this object.
+ /** Reads the monster configuration for the specified monster name and assigns it to this object. */
void GetMonsterConfig(const AString & a_Name);
/** Returns whether this mob is undead (skeleton, zombie, etc.) */
@@ -105,7 +105,7 @@ public:
void SetDropChanceBoots(float a_DropChanceBoots) { m_DropChanceBoots = a_DropChanceBoots; }
void SetCanPickUpLoot(bool a_CanPickUpLoot) { m_CanPickUpLoot = a_CanPickUpLoot; }
- /// Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick
+ /** Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick */
void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; }
double GetRelativeWalkSpeed(void) const { return m_RelativeWalkSpeed; } // tolua_export
@@ -278,19 +278,19 @@ protected:
char m_Age;
- /** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/
+ /** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops */
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
- /** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops*/
+ /** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops */
void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
- /** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/
+ /** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops */
void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel);
- /** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
+ /** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if picked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop */
void AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
- /** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
+ /** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if picked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop */
void AddRandomWeaponDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
diff --git a/src/Mobs/MonsterTypes.h b/src/Mobs/MonsterTypes.h
index 02bec267b..c268b5ff6 100644
--- a/src/Mobs/MonsterTypes.h
+++ b/src/Mobs/MonsterTypes.h
@@ -1,9 +1,12 @@
#pragma once
-/// This identifies individual monster type, as well as their network type-ID
+
+
+
// tolua_begin
+/** Identifies individual monster type, as well as their network type-ID. */
enum eMonsterType
{
mtInvalidType = -1,
diff --git a/src/Mobs/PassiveMonster.h b/src/Mobs/PassiveMonster.h
index 2ed2cd21d..7f20c3092 100644
--- a/src/Mobs/PassiveMonster.h
+++ b/src/Mobs/PassiveMonster.h
@@ -17,8 +17,9 @@ public:
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
- /// When hit by someone, run away
+ /** When hit by someone, run away */
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
+
/** Returns the item that the animal of this class follows when a player holds it in hand
Return an empty item not to follow (default). */
virtual const cItem GetFollowedItem(void) const { return cItem(); }
diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp
index d6de8de00..dd908c86b 100644
--- a/src/Mobs/Path.cpp
+++ b/src/Mobs/Path.cpp
@@ -387,7 +387,8 @@ void cPath::ProcessIfWalkable(const Vector3i & a_Location, cPathCell * a_Parent,
}
}
- /*y =-1;
+ /*
+ y = -1;
for (x = 0; x < m_BoundingBoxWidth; ++x)
{
for (z = 0; z < m_BoundingBoxWidth; ++z)
@@ -398,7 +399,8 @@ void cPath::ProcessIfWalkable(const Vector3i & a_Location, cPathCell * a_Parent,
}
}
}
- ProcessCell(cell, a_Parent, a_Cost);*/
+ ProcessCell(cell, a_Parent, a_Cost);
+ */
// Make sure there's at least 1 piece of solid below us.
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h
index d4ad066e3..04841f2b4 100644
--- a/src/Mobs/Path.h
+++ b/src/Mobs/Path.h
@@ -79,7 +79,7 @@ public:
/** Performs part of the path calculation and returns the appropriate status.
If NEARBY_FOUND is returned, it means that the destination is not reachable, but a nearby destination
is reachable. If the user likes the alternative destination, they can call AcceptNearbyPath to treat the path as found,
- and to make consequent calls to step return PATH_FOUND*/
+ and to make consequent calls to step return PATH_FOUND */
ePathFinderStatus Step(cChunk & a_Chunk);
/** Called after the PathFinder's step returns NEARBY_FOUND.
@@ -87,7 +87,8 @@ public:
the PathFinder found a path to. */
Vector3i AcceptNearbyPath();
- /* Point retrieval functions, inlined for performance. */
+ // Point retrieval functions, inlined for performance:
+
/** Returns the next point in the path. */
inline Vector3d GetNextPoint()
{
@@ -95,17 +96,23 @@ public:
Vector3i Point = m_PathPoints[m_PathPoints.size() - 1 - (++m_CurrentPoint)];
return Vector3d(Point.x + m_HalfWidth, Point.y, Point.z + m_HalfWidth);
}
+
+
/** Checks whether this is the last point or not. Never call getnextPoint when this is true. */
inline bool IsLastPoint()
{
ASSERT(m_Status == ePathFinderStatus::PATH_FOUND);
return (m_CurrentPoint == m_PathPoints.size() - 1);
}
+
+
inline bool IsFirstPoint()
{
ASSERT(m_Status == ePathFinderStatus::PATH_FOUND);
return (m_CurrentPoint == 0);
}
+
+
/** Get the point at a_index. Remark: Internally, the indexes are reversed. */
inline Vector3d GetPoint(size_t a_index)
{
@@ -114,6 +121,8 @@ public:
Vector3i Point = m_PathPoints[m_PathPoints.size() - 1 - a_index];
return Vector3d(Point.x + m_HalfWidth, Point.y, Point.z + m_HalfWidth);
}
+
+
/** Returns the total number of points this path has. */
inline size_t GetPointCount()
{
diff --git a/src/Mobs/Villager.cpp b/src/Mobs/Villager.cpp
index 7a1a6e448..2dc753f52 100644
--- a/src/Mobs/Villager.cpp
+++ b/src/Mobs/Villager.cpp
@@ -103,7 +103,8 @@ void cVillager::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
////////////////////////////////////////////////////////////////////////////////
-// Farmer functions.
+// Farmer functions:
+
void cVillager::HandleFarmerPrepareFarmCrops()
{
if (!m_World->VillagersShouldHarvestCrops())
@@ -112,15 +113,16 @@ void cVillager::HandleFarmerPrepareFarmCrops()
}
cBlockArea Surrounding;
- /// Read a 11x7x11 area.
+
+ // Read a 11x7x11 area:
Surrounding.Read(
m_World,
- static_cast<int>(GetPosX()) - 5,
- static_cast<int>(GetPosX()) + 6,
- static_cast<int>(GetPosY()) - 3,
- static_cast<int>(GetPosY()) + 4,
- static_cast<int>(GetPosZ()) - 5,
- static_cast<int>(GetPosZ()) + 6
+ FloorC(GetPosX()) - 5,
+ FloorC(GetPosX()) + 6,
+ FloorC(GetPosY()) - 3,
+ FloorC(GetPosY()) + 4,
+ FloorC(GetPosZ()) - 5,
+ FloorC(GetPosZ()) + 6
);
for (int I = 0; I < 5; I++)
diff --git a/src/Mobs/Villager.h b/src/Mobs/Villager.h
index 2de79295c..dc356b4a6 100644
--- a/src/Mobs/Villager.h
+++ b/src/Mobs/Villager.h
@@ -34,17 +34,17 @@ public:
virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
// cVillager functions
- /** return true if the given blocktype are: crops, potatoes or carrots.*/
+ /** return true if the given blocktype are: crops, potatoes or carrots. */
bool IsBlockFarmable(BLOCKTYPE a_BlockType);
// Farmer functions
- /** Searches in a 11x7x11 area for crops. If it found some it will navigate to them.*/
+ /** Searches in a 11x7x11 area for crops. If it found some it will navigate to them. */
void HandleFarmerPrepareFarmCrops();
- /** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 2 blocks it will harvest them.*/
+ /** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 2 blocks it will harvest them. */
void HandleFarmerTryHarvestCrops();
- /** Replaces the crops he harvested.*/
+ /** Replaces the crops he harvested. */
void HandleFarmerPlaceCrops();
// Get and set functions.