mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Remove dividing .cw spawn by 32 when spawn is outside map backwards compatibility patch
This means if your position is outside the map and you save the map, when you load the map, you appear at this position again, instead of the position divided by 32. This was a workaround for ClassicalSharp maps saved before 0.98.6. Considering that was relased on Feb 2016, I think it's an acceptable loss that a few maps from waayyy back then have the wrong spawn when loaded.
This commit is contained in:
parent
2016b4ef7f
commit
54c32e29e8
@ -684,28 +684,17 @@ static void Cw_Callback(struct NbtTag* tag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cc_result Cw_Load(struct Stream* stream) {
|
cc_result Cw_Load(struct Stream* stream) {
|
||||||
cc_uint8 tag;
|
|
||||||
struct Stream compStream;
|
struct Stream compStream;
|
||||||
struct InflateState state;
|
struct InflateState state;
|
||||||
Vec3* spawn; IVec3 pos;
|
|
||||||
cc_result res;
|
cc_result res;
|
||||||
|
cc_uint8 tag;
|
||||||
|
|
||||||
Inflate_MakeStream2(&compStream, &state, stream);
|
Inflate_MakeStream2(&compStream, &state, stream);
|
||||||
if ((res = Map_SkipGZipHeader(stream))) return res;
|
if ((res = Map_SkipGZipHeader(stream))) return res;
|
||||||
if ((res = compStream.ReadU8(&compStream, &tag))) return res;
|
if ((res = compStream.ReadU8(&compStream, &tag))) return res;
|
||||||
|
|
||||||
if (tag != NBT_DICT) return CW_ERR_ROOT_TAG;
|
if (tag != NBT_DICT) return CW_ERR_ROOT_TAG;
|
||||||
res = Nbt_ReadTag(NBT_DICT, true, &compStream, NULL, Cw_Callback);
|
return Nbt_ReadTag(NBT_DICT, true, &compStream, NULL, Cw_Callback);
|
||||||
if (res) return res;
|
|
||||||
|
|
||||||
/* Older versions incorrectly multiplied spawn coords by * 32, so we check for that */
|
|
||||||
spawn = &LocalPlayer_Instance.Spawn;
|
|
||||||
IVec3_Floor(&pos, spawn);
|
|
||||||
|
|
||||||
if (!World_Contains(pos.X, pos.Y, pos.Z)) {
|
|
||||||
spawn->X /= 32.0f; spawn->Y /= 32.0f; spawn->Z /= 32.0f;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user