46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
// Copyright (c) 2022 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "PokerGameEvent.hpp"
|
|
#include "poker/PokerPot.hpp"
|
|
|
|
namespace Dawn {
|
|
class PokerWinnerEvent : public PokerGameEvent {
|
|
protected:
|
|
void onStart(IVisualNovelEvent *previous) override {
|
|
PokerGameEvent::onStart(previous);
|
|
std::cout << "Poker Winning" << std::endl;
|
|
|
|
// Calculate
|
|
auto it = this->pokerGame->pots.begin();
|
|
while(it != this->pokerGame->pots.end()) {
|
|
auto pot = &(*it);
|
|
this->winnings[pot] = pot->getWinners(this->pokerGame);
|
|
++it;
|
|
}
|
|
|
|
// Award
|
|
auto it2 = this->winnings.begin();
|
|
while(it2 != this->winnings.end()) {
|
|
it2->second.award();
|
|
it2++;
|
|
}
|
|
}
|
|
|
|
bool_t onUpdate() override {
|
|
return false;
|
|
}
|
|
|
|
void onEnd() override {
|
|
}
|
|
|
|
public:
|
|
std::map<struct PokerPot*, struct PokerPotWinning> winnings;
|
|
|
|
PokerWinnerEvent(VisualNovelManager *manager) : PokerGameEvent(manager) {
|
|
}
|
|
};
|
|
} |