[Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.72,1.73
Max Horn
fingolfin at users.sourceforge.net
Fri Mar 7 13:50:02 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.44,2.45 resource_v2.cpp,1.10,1.11 resource_v3.cpp,1.7,1.8 script_v6.cpp,1.71,1.72 scumm.h,1.156,1.157 sound.cpp,1.94,1.95
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.73,1.74
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv1768
Modified Files:
script_v6.cpp
Log Message:
replaced shuffleArray with a meaningful implementation, even if it differes from assembly
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- script_v6.cpp 7 Mar 2003 21:38:45 -0000 1.72
+++ script_v6.cpp 7 Mar 2003 21:49:06 -0000 1.73
@@ -2812,16 +2812,17 @@
int range = maxIdx - minIdx;
int count = range * 2;
+ // Shuffle the array 'num'
while (count--) {
+ // Determine two random elements...
int rand1 = _rnd.getRandomNumber(range) + minIdx;
int rand2 = _rnd.getRandomNumber(range) + minIdx;
- _vars[VAR_V6_RANDOM_NR] = rand2;
- // FIXME - uhm this seems wrong. It replaces item rand1 with itself
- // It would seem more logical if we first read elements rand1 and rand2,
- // then swapped them. Assembler analysis, anybody?
- writeArray(num, 0, rand1, readArray(num, 0, rand1));
- writeArray(num, 0, rand2, readArray(num, 0, rand2));
+ // ...and swap them
+ int val1 = readArray(num, 0, rand1);
+ int val2 = readArray(num, 0, rand2);
+ writeArray(num, 0, rand1, val2);
+ writeArray(num, 0, rand2, val1));
}
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.44,2.45 resource_v2.cpp,1.10,1.11 resource_v3.cpp,1.7,1.8 script_v6.cpp,1.71,1.72 scumm.h,1.156,1.157 sound.cpp,1.94,1.95
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.73,1.74
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list