summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-18 16:58:27 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-18 16:58:27 +0200
commitfb32c28f8097db8a8d200888f40b1fca8ee71024 (patch)
treef9c3243c1260eb5fa30dceb20e1451a399573b21 /source/World.cpp
parentMade cPiston code more readable and configurable. (diff)
parentAdded checks to bail out if block entities are being pushed by a piston (diff)
downloadcuberite-fb32c28f8097db8a8d200888f40b1fca8ee71024.tar
cuberite-fb32c28f8097db8a8d200888f40b1fca8ee71024.tar.gz
cuberite-fb32c28f8097db8a8d200888f40b1fca8ee71024.tar.bz2
cuberite-fb32c28f8097db8a8d200888f40b1fca8ee71024.tar.lz
cuberite-fb32c28f8097db8a8d200888f40b1fca8ee71024.tar.xz
cuberite-fb32c28f8097db8a8d200888f40b1fca8ee71024.tar.zst
cuberite-fb32c28f8097db8a8d200888f40b1fca8ee71024.zip
Diffstat (limited to 'source/World.cpp')
-rw-r--r--source/World.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/source/World.cpp b/source/World.cpp
index 702e94b56..97186fa24 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -1385,6 +1385,21 @@ void cWorld::FastSetBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBB
+void cWorld::SetServerBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
+{
+ if (a_BlockType == E_BLOCK_AIR)
+ {
+ BlockHandler(GetBlock(a_X, a_Y, a_Z))->OnDestroyed(this, a_X, a_Y, a_Z);
+ }
+ m_ChunkMap->SetServerBlock(a_X, a_Y, a_Z, a_BlockType, a_BlockMeta);
+
+ BlockHandler(a_BlockType)->OnPlaced(this, a_X, a_Y, a_Z, a_BlockType, a_BlockMeta);
+}
+
+
+
+
+
BLOCKTYPE cWorld::GetBlock(int a_X, int a_Y, int a_Z)
{
// First check if it isn't queued in the m_FastSetBlockQueue:
@@ -2635,12 +2650,18 @@ void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Resul
cCSLock Lock(m_CSPlayers);
for (cPlayerList::iterator itr = m_Players.begin(), end = m_Players.end(); itr != end; ++itr)
{
- if (NoCaseCompare((*itr)->GetName().substr(0, a_Text.length()), a_Text) != 0)
+ size_t LastSpace = a_Text.find_last_of(" "); //Find the position of the last space
+
+ std::string LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); //Find the last word
+ std::string PlayerName ((*itr)->GetName());
+ std::size_t Found = PlayerName.find(LastWord); //Try to find last word in playername
+
+ if (Found!=0)
{
- // Player name doesn't match
- continue;
+ continue; //No match
}
- a_Results.push_back((*itr)->GetName());
+
+ a_Results.push_back((*itr)->GetName()); //Match!
}
}