15.07.2013, 11:21
pawn Код:
decode_doors(src, &bonnet, &boot, &driver_door, &passenger_door)
{
new int[1];
int[0] = src;
bonnet = int{3};
boot = int{2};
driver_door = int{1};
passenger_door = int{0};
return 1;
}
EXAMPLE:
pawn Код:
encode_doors(bonnet, boot, driver_door, passenger_door, behind_driver_door, behind_passenger_door)
{
#pragma unused behind_driver_door
#pragma unused behind_passenger_door
return bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24);
}
decode_doors(src, &bonnet, &boot, &driver_door, &passenger_door)
{
new int[1];
int[0] = src;
bonnet = int{3};
boot = int{2};
driver_door = int{1};
passenger_door = int{0};
return 1;
}
main()
{
new bonnet, boot, driver_door, passenger_door;
decode_doors(encode_doors(1, 2, 3, 4, 0, 0), bonnet, boot, driver_door, passenger_door);
printf("%d | %d | %d | %d", bonnet, boot, driver_door, passenger_door); // Result: "1 | 2 | 3 | 4"
}