d2waypoints.c
740 Bytes
#include "d2waypoints.h"
#include "d2char.h"
int isWaypointActivated(D2WaypointsData* d, D2S_WAYPOINT waypoint, D2S_DIFFICULTY difficulty) {
if(waypoint > D2S_WAYPOINTSDATA_NUMWAYPOINTS) {
return -1;
}
unsigned int byte = waypoint / 8;
unsigned int offset = waypoint % 8;
return (d->waypoints[difficulty].waypointData[byte] & (1 << offset)) >> offset;
}
// TODO: Return success
void setWaypointActivated(D2WaypointsData* d, D2S_WAYPOINT waypoint, D2S_DIFFICULTY difficulty, int activated) {
if(waypoint > D2S_WAYPOINTSDATA_NUMWAYPOINTS) {
return;
}
unsigned int byte = waypoint / 8;
unsigned int offset = waypoint % 8;
d->waypoints[difficulty].waypointData[byte] |= (1 << offset);
}