Add rule for 0.3.1
This commit is contained in:
parent
cdff1a98f3
commit
6d606fe90f
1
rules.d/000-0.3.1/tag
Normal file
1
rules.d/000-0.3.1/tag
Normal file
@ -0,0 +1 @@
|
||||
0.3.1
|
12
rules.d/000-0.3.1/unistd.patch
Normal file
12
rules.d/000-0.3.1/unistd.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff --git a/src/filesys.cpp b/src/filesys.cpp
|
||||
index ab950d4..bd82a4c 100644
|
||||
--- a/src/filesys.cpp
|
||||
+++ b/src/filesys.cpp
|
||||
@@ -214,6 +214,7 @@ bool DeleteSingleFileOrEmptyDirectory(std::string path)
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
std::vector<DirListNode> GetDirListing(std::string pathstring)
|
||||
{
|
160
rules.d/000-0.3.1/worldtest_load_check_set_0.3.patch
Normal file
160
rules.d/000-0.3.1/worldtest_load_check_set_0.3.patch
Normal file
@ -0,0 +1,160 @@
|
||||
diff --git a/src/server.cpp b/src/server.cpp
|
||||
index 52e9dc8..1e98a56 100644
|
||||
--- a/src/server.cpp
|
||||
+++ b/src/server.cpp
|
||||
@@ -165,6 +165,10 @@ void * EmergeThread::Thread()
|
||||
*/
|
||||
|
||||
bool only_from_disk = true;
|
||||
+ // <worldtest hack>
|
||||
+ // This doesn't seem to really work in our case
|
||||
+ only_from_disk = false;
|
||||
+ // </worldtest hack>
|
||||
|
||||
{
|
||||
core::map<u16, u8>::Iterator i;
|
||||
@@ -987,6 +991,20 @@ u32 PIChecksum(core::list<PlayerInfo> &l)
|
||||
// Load players
|
||||
infostream<<"Server: Loading players"<<std::endl;
|
||||
m_env.deSerializePlayers(m_mapsavedir);
|
||||
+
|
||||
+ // <worldtest hack>
|
||||
+ // Load or generate blocks near origin
|
||||
+ dstream<<DTIME<<"Worldtest hack server started."<<std::endl;
|
||||
+ dstream<<DTIME<<"Will load or generate origin and quit."<<std::endl;
|
||||
+ m_emerge_queue.addBlock(PEER_ID_INEXISTENT, v3s16(0,0,0), 0);
|
||||
+ m_emerge_queue.addBlock(PEER_ID_INEXISTENT, v3s16(0,0,-1), 0);
|
||||
+ m_emerge_queue.addBlock(PEER_ID_INEXISTENT, v3s16(0,-1,0), 0);
|
||||
+ m_emerge_queue.addBlock(PEER_ID_INEXISTENT, v3s16(0,-1,-1), 0);
|
||||
+ m_emerge_queue.addBlock(PEER_ID_INEXISTENT, v3s16(-1,0,0), 0);
|
||||
+ m_emerge_queue.addBlock(PEER_ID_INEXISTENT, v3s16(-1,0,-1), 0);
|
||||
+ m_emerge_queue.addBlock(PEER_ID_INEXISTENT, v3s16(-1,-1,0), 0);
|
||||
+ m_emerge_queue.addBlock(PEER_ID_INEXISTENT, v3s16(-1,-1,-1), 0);
|
||||
+ // </worldtest hack>
|
||||
}
|
||||
|
||||
Server::~Server()
|
||||
@@ -1204,6 +1222,123 @@ void Server::AsyncRunStep()
|
||||
}
|
||||
}
|
||||
|
||||
+ // <worldtest hack>
|
||||
+ // Quit when blocks near origin have been loaded or generated
|
||||
+ {
|
||||
+ JMutexAutoLock envlock(m_env_mutex);
|
||||
+ // Make sure EmergeThread runs
|
||||
+ m_emergethread.trigger();
|
||||
+ // Check area near origin
|
||||
+ Map *map = &m_env.getMap();
|
||||
+ if(
|
||||
+ !m_shutdown_requested &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(0,0,0)) &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(0,0,0))->isGenerated() &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(0,0,-1)) &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(0,0,-1))->isGenerated() &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(0,-1,0)) &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(0,-1,0))->isGenerated() &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(0,-1,-1)) &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(0,-1,-1))->isGenerated() &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(-1,0,0)) &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(-1,0,0))->isGenerated() &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(-1,0,-1)) &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(-1,0,-1))->isGenerated() &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(-1,-1,0)) &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(-1,-1,0))->isGenerated() &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(-1,-1,-1)) &&
|
||||
+ map->getBlockNoCreateNoEx(v3s16(-1,-1,-1))->isGenerated()
|
||||
+ ){
|
||||
+ dstream<<DTIME<<"Worldtest server: Loaded all blocks."<<std::endl;
|
||||
+
|
||||
+ /*
|
||||
+ Check contents of nodes
|
||||
+ */
|
||||
+
|
||||
+ dstream<<DTIME<<"Worldtest server: Checking nodes"<<std::endl;
|
||||
+ std::ofstream resultfile("worldtest_result.txt");
|
||||
+ int errors = 0;
|
||||
+#define NODECHECK(x){\
|
||||
+ if(!(x)){\
|
||||
+ dstream<<"BAD: Check failed: "<<(#x)<<std::endl;\
|
||||
+ resultfile<<"BAD: Check failed: "<<(#x)<<std::endl;\
|
||||
+ errors++;\
|
||||
+ } else {\
|
||||
+ dstream<<"GOOD: Check succeeded: "<<(#x)<<std::endl;\
|
||||
+ resultfile<<"GOOD: Check succeeded: "<<(#x)<<std::endl;\
|
||||
+ }\
|
||||
+}
|
||||
+ {
|
||||
+ MapNode n = map->getNodeNoEx(v3s16(-1,-1,-1));
|
||||
+ NODECHECK(n.getContent() == CONTENT_NC);
|
||||
+ }
|
||||
+ {
|
||||
+ MapNode n = map->getNodeNoEx(v3s16(0,3,0));
|
||||
+ NODECHECK(n.getContent() == CONTENT_NC);
|
||||
+ }
|
||||
+ {
|
||||
+ MapNode n = map->getNodeNoEx(v3s16(0,2,0));
|
||||
+ NODECHECK(n.getContent() == CONTENT_TORCH);
|
||||
+ NODECHECK(n.getLight(LIGHTBANK_DAY) == 13);
|
||||
+ NODECHECK(n.getLight(LIGHTBANK_NIGHT) == 13);
|
||||
+ }
|
||||
+ {
|
||||
+ MapNode n = map->getNodeNoEx(v3s16(0,1,0));
|
||||
+ NODECHECK(n.getContent() == CONTENT_GLASS);
|
||||
+ NODECHECK(n.getLight(LIGHTBANK_DAY) == 12);
|
||||
+ NODECHECK(n.getLight(LIGHTBANK_NIGHT) == 12);
|
||||
+ }
|
||||
+ {
|
||||
+ MapNode n = map->getNodeNoEx(v3s16(0,0,0));
|
||||
+ NODECHECK(n.getContent() == CONTENT_AIR);
|
||||
+ NODECHECK(n.getLight(LIGHTBANK_DAY) == 11);
|
||||
+ NODECHECK(n.getLight(LIGHTBANK_NIGHT) == 11);
|
||||
+ }
|
||||
+ dstream<<"ERRORS: "<<errors<<std::endl;
|
||||
+ resultfile<<"ERRORS: "<<errors<<std::endl;
|
||||
+ resultfile.close();
|
||||
+
|
||||
+ /*
|
||||
+ Set contents of nodes
|
||||
+ */
|
||||
+
|
||||
+ dstream<<DTIME<<"Worldtest server: Setting nodes"<<std::endl;
|
||||
+ for(int x=-1; x<=1; x++)
|
||||
+ for(int y=-1; y<=3; y++)
|
||||
+ for(int z=-1; z<=1; z++)
|
||||
+ {
|
||||
+ MapNode n(CONTENT_NC);
|
||||
+ map->setNode(v3s16(x,y,z), n);
|
||||
+ }
|
||||
+ {
|
||||
+ MapNode n(CONTENT_TORCH);
|
||||
+ n.setLight(LIGHTBANK_DAY, 13);
|
||||
+ n.setLight(LIGHTBANK_NIGHT, 13);
|
||||
+ map->setNode(v3s16(0,2,0), n);
|
||||
+ }
|
||||
+ {
|
||||
+ MapNode n(CONTENT_GLASS);
|
||||
+ n.setLight(LIGHTBANK_DAY, 12);
|
||||
+ n.setLight(LIGHTBANK_NIGHT, 12);
|
||||
+ map->setNode(v3s16(0,1,0), n);
|
||||
+ }
|
||||
+ {
|
||||
+ MapNode n(CONTENT_AIR);
|
||||
+ n.setLight(LIGHTBANK_DAY, 11);
|
||||
+ n.setLight(LIGHTBANK_NIGHT, 11);
|
||||
+ map->setNode(v3s16(0,0,0), n);
|
||||
+ }
|
||||
+ {
|
||||
+ MapNode n(CONTENT_SIGN_WALL);
|
||||
+ map->setNode(v3s16(0,0,2), n);
|
||||
+ map->setNodeMetadata(v3s16(0,0,2), new SignNodeMetadata("Foo Bar"));
|
||||
+ }
|
||||
+ dstream<<DTIME<<"Worldtest server: Quitting."<<std::endl;
|
||||
+ m_shutdown_requested = true;
|
||||
+ }
|
||||
+ }
|
||||
+ // </worldtest hack>
|
||||
+
|
||||
{
|
||||
JMutexAutoLock lock(m_env_mutex);
|
||||
// Step environment
|
Loading…
x
Reference in New Issue
Block a user