summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Blocks/BlockSapling.h13
-rw-r--r--src/Mobs/PassiveMonster.cpp36
-rw-r--r--src/Mobs/PathFinder.h2
-rw-r--r--src/Root.cpp2
-rw-r--r--src/World.cpp2
5 files changed, 40 insertions, 15 deletions
diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h
index 1770cc4aa..ea10d5c20 100644
--- a/src/Blocks/BlockSapling.h
+++ b/src/Blocks/BlockSapling.h
@@ -92,7 +92,18 @@ public:
}
break;
}
- // Dark Oaks only grow in a 2x2 area
+ // Acacias don't need horizontal clearance
+ case E_META_SAPLING_ACACIA:
+ {
+ if (!IsLargeTree(a_Chunk, a_RelX, a_RelY, a_RelZ, a_Meta))
+ {
+ return false;
+ }
+ CheckHeight = 7;
+ LargeTree = true;
+ break;
+ }
+ // Dark Oaks don't need horizontal clearance
case E_META_SAPLING_DARK_OAK:
{
if (!IsLargeTree(a_Chunk, a_RelX, a_RelY, a_RelZ, a_Meta))
diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp
index 30b46500d..53288a54c 100644
--- a/src/Mobs/PassiveMonster.cpp
+++ b/src/Mobs/PassiveMonster.cpp
@@ -157,19 +157,33 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
virtual bool Item(cEntity * a_Entity) override
{
- // if we're the same species as someone around and they don't have a partner, start mating with them
- if ((a_Entity->GetEntityType() == m_Me->GetEntityType()) && (a_Entity != m_Me))
+ // If the entity is not a monster, don't breed with it
+ // Also, do not self-breed
+ if ((a_Entity->GetEntityType() != etMonster) || (a_Entity == m_Me))
{
- cPassiveMonster * Me = static_cast<cPassiveMonster*>(m_Me);
- cPassiveMonster * Partner = static_cast<cPassiveMonster*>(a_Entity);
- if (Partner->IsInLove() && (Partner->GetPartner() == nullptr))
- {
- Partner->EngageLoveMode(Me);
- Me->EngageLoveMode(Partner);
- return true;
- }
+ return false;
}
- return false;
+
+ cPassiveMonster * Me = static_cast<cPassiveMonster*>(m_Me);
+ cPassiveMonster * PotentialPartner = static_cast<cPassiveMonster*>(a_Entity);
+
+ // If the potential partner is not of the same species, don't breed with it
+ if (PotentialPartner->GetMobType() != Me->GetMobType())
+ {
+ return false;
+ }
+
+ // If the potential partner is not in love
+ // Or they already have a mate, do not breed with them
+ if ((!PotentialPartner->IsInLove()) || (PotentialPartner->GetPartner() != nullptr))
+ {
+ return false;
+ }
+
+ // All conditions met, let's breed!
+ PotentialPartner->EngageLoveMode(Me);
+ Me->EngageLoveMode(PotentialPartner);
+ return true;
}
} Callback(this);
diff --git a/src/Mobs/PathFinder.h b/src/Mobs/PathFinder.h
index 1bdc13a32..213530b11 100644
--- a/src/Mobs/PathFinder.h
+++ b/src/Mobs/PathFinder.h
@@ -14,7 +14,7 @@ class cPathFinder
public:
/** Creates a cPathFinder instance. Each mob should have one cPathFinder throughout its lifetime.
@param a_MobWidth The mob width.
- @param a_MobWidth The mob height.
+ @param a_MobHeight The mob height.
*/
cPathFinder(double a_MobWidth, double a_MobHeight);
diff --git a/src/Root.cpp b/src/Root.cpp
index aa532f88c..737d350ff 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -358,7 +358,7 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn
// Fix servers that have default world configs created prior to #2815. See #2810.
// This can probably be removed several years after 2016
// We start by inspecting the world linkage and determining if it's the default one
- if (DefaultWorldName == "world")
+ if ((DefaultWorldName == "world") && (Worlds.size() == 1))
{
auto DefaultWorldIniFile= cpp14::make_unique<cIniFile>();
if (DefaultWorldIniFile->ReadFile("world/world.ini"))
diff --git a/src/World.cpp b/src/World.cpp
index 5b6a215d8..127621069 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -3583,7 +3583,7 @@ void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Resul
PlayerName = (*itr)->GetCustomName();
}
- AString::size_type Found = PlayerName.find(LastWord); // Try to find last word in playername
+ AString::size_type Found = StrToLower(PlayerName).find(StrToLower(LastWord)); // Try to find last word in playername
if (Found == AString::npos)
{
continue; // No match