Blame view

d2waypoints.c 740 Bytes
1
#include "d2waypoints.h"
2
#include "d2char.h"
3
4
int isWaypointActivated(D2WaypointsData* d, D2S_WAYPOINT waypoint, D2S_DIFFICULTY difficulty) {
5
6
7
8
9
10
11
12
13
    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
14
void setWaypointActivated(D2WaypointsData* d, D2S_WAYPOINT waypoint, D2S_DIFFICULTY difficulty, int activated) {
15
16
17
18
19
20
21
    if(waypoint > D2S_WAYPOINTSDATA_NUMWAYPOINTS) {
        return;
    }
    unsigned int byte = waypoint / 8;
    unsigned int offset = waypoint % 8;
    d->waypoints[difficulty].waypointData[byte] |= (1 << offset);
}