aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mapblock.cpp2
-rw-r--r--src/mapblock.h2
-rw-r--r--src/network/serverpackethandler.cpp4
-rw-r--r--src/nodetimer.cpp16
-rw-r--r--src/serialization.h12
5 files changed, 18 insertions, 18 deletions
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index 346f01a0b..11c4c125b 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -564,7 +564,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
throw SerializationError("ERROR: Not writing dummy block.");
}
- FATAL_ERROR_IF(version < SER_FMT_CLIENT_VER_LOWEST, "Serialize version error");
+ FATAL_ERROR_IF(version < SER_FMT_VER_LOWEST_WRITE, "Serialisation version error");
// First byte
u8 flags = 0;
diff --git a/src/mapblock.h b/src/mapblock.h
index 334136b92..197d58ec7 100644
--- a/src/mapblock.h
+++ b/src/mapblock.h
@@ -504,7 +504,7 @@ public:
// These don't write or read version by itself
// Set disk to true for on-disk format, false for over-the-network format
- // Precondition: version >= SER_FMT_CLIENT_VER_LOWEST
+ // Precondition: version >= SER_FMT_VER_LOWEST_WRITE
void serialize(std::ostream &os, u8 version, bool disk);
// If disk == true: In addition to doing other things, will add
// unknown blocks from id-name mapping to wndef
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index f756d80ef..d89e30c8d 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -103,7 +103,7 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
// Use the highest version supported by both
u8 depl_serial_v = std::min(client_max, our_max);
// If it's lower than the lowest supported, give up.
- if (depl_serial_v < SER_FMT_VER_LOWEST)
+ if (depl_serial_v < SER_FMT_VER_LOWEST_READ)
depl_serial_v = SER_FMT_VER_INVALID;
if (depl_serial_v == SER_FMT_VER_INVALID) {
@@ -347,7 +347,7 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt)
// Use the highest version supported by both
int deployed = std::min(client_max, our_max);
// If it's lower than the lowest supported, give up.
- if (deployed < SER_FMT_VER_LOWEST)
+ if (deployed < SER_FMT_VER_LOWEST_READ)
deployed = SER_FMT_VER_INVALID;
if (deployed == SER_FMT_VER_INVALID) {
diff --git a/src/nodetimer.cpp b/src/nodetimer.cpp
index a5b48a5af..1feefa203 100644
--- a/src/nodetimer.cpp
+++ b/src/nodetimer.cpp
@@ -45,9 +45,9 @@ void NodeTimer::deSerialize(std::istream &is)
void NodeTimerList::serialize(std::ostream &os, u8 map_format_version) const
{
- if(map_format_version == 24){
+ if (map_format_version == 24) {
// Version 0 is a placeholder for "nothing to see here; go away."
- if(m_data.empty()){
+ if (m_data.empty()) {
writeU8(os, 0); // version
return;
}
@@ -55,18 +55,18 @@ void NodeTimerList::serialize(std::ostream &os, u8 map_format_version) const
writeU16(os, m_data.size());
}
- if(map_format_version >= 25){
- writeU8(os, 2+4+4);
+ if (map_format_version >= 25) {
+ writeU8(os, 2 + 4 + 4); // length of the data for a single timer
writeU16(os, m_data.size());
}
- for(std::map<v3s16, NodeTimer>::const_iterator
+ for (std::map<v3s16, NodeTimer>::const_iterator
i = m_data.begin();
- i != m_data.end(); ++i){
+ i != m_data.end(); ++i) {
v3s16 p = i->first;
NodeTimer t = i->second;
- u16 p16 = p.Z*MAP_BLOCKSIZE*MAP_BLOCKSIZE + p.Y*MAP_BLOCKSIZE + p.X;
+ u16 p16 = p.Z * MAP_BLOCKSIZE * MAP_BLOCKSIZE + p.Y * MAP_BLOCKSIZE + p.X;
writeU16(os, p16);
t.serialize(os);
}
@@ -75,7 +75,7 @@ void NodeTimerList::serialize(std::ostream &os, u8 map_format_version) const
void NodeTimerList::deSerialize(std::istream &is, u8 map_format_version)
{
m_data.clear();
-
+
if(map_format_version == 24){
u8 timer_version = readU8(is);
if(timer_version == 0)
diff --git a/src/serialization.h b/src/serialization.h
index ab6fe0f79..01d37d363 100644
--- a/src/serialization.h
+++ b/src/serialization.h
@@ -30,11 +30,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
--------------------------------
For map data (blocks, nodes, sectors).
-
+
NOTE: The goal is to increment this so that saved maps will be
loadable by any version. Other compatibility is not
maintained.
-
+
0: original networked test with 1-byte nodes
1: update with 2-byte nodes
2: lighting is transmitted in param
@@ -70,14 +70,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// Saved on disk version
#define SER_FMT_VER_HIGHEST_WRITE 25
// Lowest supported serialization version
-#define SER_FMT_VER_LOWEST 0
-// Lowest client supported serialization version
+#define SER_FMT_VER_LOWEST_READ 0
+// Lowest serialization version for writing
// Can't do < 24 anymore; we have 16-bit dynamically allocated node IDs
// in memory; conversion just won't work in this direction.
-#define SER_FMT_CLIENT_VER_LOWEST 24
+#define SER_FMT_VER_LOWEST_WRITE 24
inline bool ser_ver_supported(s32 v) {
- return v >= SER_FMT_VER_LOWEST && v <= SER_FMT_VER_HIGHEST_READ;
+ return v >= SER_FMT_VER_LOWEST_READ && v <= SER_FMT_VER_HIGHEST_READ;
}
/*