09.11.2014, 19:24
The code does work
pawn Код:
// global
enum eRaceData {
Float: rX,
Float: rY,
Float: rA,
rRowSize,
rStartPos
}
new gRaceData[eRaceData];
// command to init a race, lets say we init the default race
switch(strval(params)) {
case 0: {}
default: {
gRaceData[rStartPos] = 0; // needs to be 0
gRaceData[rRowSize] = 3; // Vehicles / row
gRaceData[rX] = 0.0; // Start X
gRaceData[rY] = 0.0; // Start Y
gRaceData[rA] = 0.0; // Angle
}
}
// command to join the race
GetXYForRacer(gRaceData[rX], gRaceData[rY], gRaceData[rA], gRaceData[rRowSize], gRaceData[rStartPos]);
printf("%d. %f %f", gRaceData[rStartPos], gRaceData[rX], gRaceData[rY]);
/* should output
1. -3.000000 0.000000
2. 0.000000 0.000000
3. 3.000000 0.000000
4. -3.000000 -5.000000
5. 0.000000 -5.000000
6. 3.000000 -5.000000
7. -3.000000 -10.000000
8. 0.000000 -10.000000
9. 3.000000 -10.000000
*/