# HG changeset patch # User glx # Date 2008-08-20 16:51:08 # Node ID 31fb21ef4806d8560a111334bced2f016a07f78c # Parent e7ebdcbb29a25c58035b9c5d35e22f2d101fdc3a (svn r14110) -Fix: desyncs due to bubbles in toyland diff --git a/src/effectvehicle.cpp b/src/effectvehicle.cpp --- a/src/effectvehicle.cpp +++ b/src/effectvehicle.cpp @@ -515,12 +515,6 @@ static const BubbleMovement * const _bub static void BubbleTick(Vehicle *v) { - /* - * Warning: those effects can NOT use Random(), and have to use - * InteractiveRandom(), because somehow someone forgot to save - * spritenum to the savegame, and so it will cause desyncs in - * multiplayer!! (that is: in ToyLand) - */ uint et; v->progress++; @@ -536,7 +530,7 @@ static void BubbleTick(Vehicle *v) return; } if (v->u.effect.animation_substate != 0) { - v->spritenum = GB(InteractiveRandom(), 0, 2) + 1; + v->spritenum = GB(Random(), 0, 2) + 1; } else { v->spritenum = 6; } @@ -554,7 +548,7 @@ static void BubbleTick(Vehicle *v) } if (b->y == 4 && b->x == 1) { - if (v->z_pos > 180 || Chance16I(1, 96, InteractiveRandom())) { + if (v->z_pos > 180 || Chance16I(1, 96, Random())) { v->spritenum = 5; SndPlayVehicleFx(SND_2F_POP, v); } diff --git a/src/vehicle.cpp b/src/vehicle.cpp --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2270,8 +2270,10 @@ static const SaveLoad _special_desc[] = SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleEffect, animation_state), SLE_UINT16), SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleEffect, animation_substate), SLE_UINT8), - /* reserve extra space in savegame here. (currently 16 bytes) */ - SLE_CONDNULL(16, 2, SL_MAX_VERSION), + SLE_CONDVAR(Vehicle, spritenum, SLE_UINT8, 2, SL_MAX_VERSION), + + /* reserve extra space in savegame here. (currently 15 bytes) */ + SLE_CONDNULL(15, 2, SL_MAX_VERSION), SLE_END() };