summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-04 17:54:56 +0000
committertruelight <truelight@openttd.org>2004-12-04 17:54:56 +0000
commitb8f6d41418982163965dd5beb0b39dbdce1fbe8f (patch)
tree68d3e795694a875138c369707ed74b5b4b022d49 /vehicle.c
parent0434287ef826a4ed72cd8528a52a86ae8b70a948 (diff)
downloadopenttd-b8f6d41418982163965dd5beb0b39dbdce1fbe8f.tar.xz
(svn r942) -Merged branch/network back into the trunk
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/vehicle.c b/vehicle.c
index 9c46bb13b..4a895fe9b 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1069,6 +1069,12 @@ static const byte * const _effecttick9_data[6] = {
static void EffectTick_9(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)
+ */
int et;
const byte *b;
@@ -1086,7 +1092,7 @@ static void EffectTick_9(Vehicle *v)
return;
}
if (v->u.special.unk2 != 0) {
- v->spritenum = (byte)((Random()&3)+1);
+ v->spritenum = (byte)((InteractiveRandom()&3)+1);
} else {
v->spritenum = 6;
}
@@ -1104,7 +1110,7 @@ again:
}
if (*b == 0x81) {
- if (v->z_pos > 180 || CHANCE16(1,96)) {
+ if (v->z_pos > 180 || CHANCE16I(1,96, InteractiveRandom())) {
v->spritenum = 5;
SndPlayVehicleFx(SND_2F_POP, v);
}
@@ -1399,7 +1405,7 @@ int32 CmdNameVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!CheckOwnership(v->owner))
return CMD_ERROR;
- str = AllocateName((byte*)_decode_parameters, 2);
+ str = AllocateNameUnique((byte*)_decode_parameters, 2);
if (str == 0)
return CMD_ERROR;