summaryrefslogtreecommitdiff
path: root/src/device_allocation.cc
blob: f97de2ec5c18b8f83b8423d646e95202c2f75bf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "device_allocation.h"

int compare_device_allocation(device_allocation *a, device_allocation *b)
{
	return SGLIB_NUMERIC_COMPARATOR(a->tval, b->tval);
}

SGLIB_DEFINE_LIST_FUNCTIONS(device_allocation, compare_device_allocation, next);

void device_allocation_init(device_allocation *device_allocation, byte tval)
{
	assert(device_allocation != NULL);

	device_allocation->tval = tval;
	device_allocation->rarity = 0;
	range_init(&device_allocation->base_level, 0, 0);
	range_init(&device_allocation->max_level, 0, 0);
	device_allocation->next = NULL;
}

device_allocation *device_allocation_new(byte tval)
{
	device_allocation *d = new device_allocation;
	device_allocation_init(d, tval);
	return d;
}