feat: started resource management & dice
This commit is contained in:
parent
3a5b55cc06
commit
451c71254c
6 changed files with 141 additions and 4 deletions
46
src/dice_data.h
Normal file
46
src/dice_data.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
enum Die {
|
||||
D_COIN = 2,
|
||||
D4 = 4,
|
||||
D6 = 6,
|
||||
D8 = 8,
|
||||
D10 = 10,
|
||||
D12 = 12,
|
||||
D20 = 20,
|
||||
D100 = 100,
|
||||
};
|
||||
|
||||
constexpr Die diceIndex[]{D_COIN, D4, D6, D8, D10, D12, D20, D100};
|
||||
|
||||
static inline size_t DieToIndex(Die die) {
|
||||
switch(die) {
|
||||
default:
|
||||
case D_COIN:
|
||||
return 0;
|
||||
case D4:
|
||||
return 1;
|
||||
case D6:
|
||||
return 2;
|
||||
case D8:
|
||||
return 3;
|
||||
case D10:
|
||||
return 4;
|
||||
case D12:
|
||||
return 5;
|
||||
case D20:
|
||||
return 6;
|
||||
case D100:
|
||||
return 7;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace active_dice {
|
||||
void Add(Die die);
|
||||
void Remove(size_t at);
|
||||
Die Get(size_t at);
|
||||
size_t Count();
|
||||
} // namespace active_dice
|
||||
Loading…
Add table
Add a link
Reference in a new issue