diff options
author | Bardur Arantsson <bardur@scientician.net> | 2013-03-26 17:10:10 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2013-09-27 14:46:42 +0200 |
commit | cbef37bd5bfb938a2303ee3887520c08be85d8e8 (patch) | |
tree | b604e49323e46af4ea582f9a9e1977b3daa90611 /src/device_allocation.cc | |
parent | b9f824effb037a53556e02955cace6c09ff646c3 (diff) |
Switch almost everything over to C++
Diffstat (limited to 'src/device_allocation.cc')
-rw-r--r-- | src/device_allocation.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/device_allocation.cc b/src/device_allocation.cc new file mode 100644 index 00000000..f97de2ec --- /dev/null +++ b/src/device_allocation.cc @@ -0,0 +1,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; +} |