summaryrefslogtreecommitdiff
path: root/src/toBeSorted/counters/rupee_counter.cpp
blob: 8d02a9e5e9a40234c43eb4b4c5a5b64a07ea2312 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "d/a/d_a_item.h"
#include "d/flag/itemflag_manager.h"
#include "toBeSorted/counters/counter.h"

static u16 getBaseCapacity();
static u16 getExtraWalletCapacity();

class RupeeCounter : public Counter {
public:
    RupeeCounter();
    ~RupeeCounter() {}
    virtual u16 getMax() const override {
        return (getBaseCapacity() + getExtraWalletCapacity());
    }
};

struct WalletStruct {
    u32 flag;
    u16 capacity;
};

static u16 getBaseCapacity() {
    int i = 0;
    WalletStruct wallet_definitions[4] = {
        {ITEM_MEDIUM_WALLET,  500},
        {   ITEM_BIG_WALLET, 1000},
        { ITEM_GIANT_WALLET, 5000},
        {ITEM_TYCOON_WALLET, 9000},
    };
    const WalletStruct *wallet = &wallet_definitions[3];
    for (; i < 4; i++, wallet--) {
        if (ItemflagManager::sInstance->getFlagDirect(wallet->flag)) {
            return wallet->capacity;
        }
    }
    return 300;
}

static u16 getExtraWalletCapacity() {
    return 300 * getCounterByIndex(0x27); // Maybe 0x27 corresponds to item 27 -> small wallet?
}

RupeeCounter RUPEE_COUNTER;

RupeeCounter::RupeeCounter() : Counter(0x1f5) {}