mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 21:04:07 -07:00
add subphases to phase.cpp
This commit is contained in:
parent
e37745ed9c
commit
37ab8433e5
2 changed files with 25 additions and 0 deletions
|
|
@ -22,6 +22,28 @@ Phase Phases::getPhase(int phase)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Phases::getLastSubphase(int phase)
|
||||||
|
{
|
||||||
|
if (0 <= phase && phase < Phases::phaseTypesCount) {
|
||||||
|
return subPhasesEnd[phase];
|
||||||
|
} else {
|
||||||
|
return phase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<int> getSubPhasesEnd()
|
||||||
|
{
|
||||||
|
QVector<int> array(Phases::phaseTypesCount);
|
||||||
|
for (int phaseEnd = Phases::phaseTypesCount - 1; phaseEnd >= 0;) {
|
||||||
|
int subPhase = phaseEnd;
|
||||||
|
for (; subPhase >= 0 && Phases::phases[phaseEnd].color == Phases::phases[subPhase].color; --subPhase) {
|
||||||
|
array[subPhase] = phaseEnd;
|
||||||
|
}
|
||||||
|
phaseEnd = subPhase;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
const Phase Phases::unknownPhase(QT_TRANSLATE_NOOP("Phase", "Unknown Phase"), "black", "unknown_phase");
|
const Phase Phases::unknownPhase(QT_TRANSLATE_NOOP("Phase", "Unknown Phase"), "black", "unknown_phase");
|
||||||
const Phase Phases::phases[Phases::phaseTypesCount] = {
|
const Phase Phases::phases[Phases::phaseTypesCount] = {
|
||||||
{QT_TRANSLATE_NOOP("Phase", "Untap"), "green", "untap_step"},
|
{QT_TRANSLATE_NOOP("Phase", "Untap"), "green", "untap_step"},
|
||||||
|
|
@ -35,3 +57,4 @@ const Phase Phases::phases[Phases::phaseTypesCount] = {
|
||||||
{QT_TRANSLATE_NOOP("Phase", "End of Combat"), "red", "end_combat"},
|
{QT_TRANSLATE_NOOP("Phase", "End of Combat"), "red", "end_combat"},
|
||||||
{QT_TRANSLATE_NOOP("Phase", "Second Main"), "blue", "main_2"},
|
{QT_TRANSLATE_NOOP("Phase", "Second Main"), "blue", "main_2"},
|
||||||
{QT_TRANSLATE_NOOP("Phase", "End/Cleanup"), "green", "end_step"}};
|
{QT_TRANSLATE_NOOP("Phase", "End/Cleanup"), "green", "end_step"}};
|
||||||
|
const QVector<int> Phases::subPhasesEnd = getSubPhasesEnd();
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,10 @@ struct Phases
|
||||||
const static int phaseTypesCount = 11;
|
const static int phaseTypesCount = 11;
|
||||||
const static Phase unknownPhase;
|
const static Phase unknownPhase;
|
||||||
const static Phase phases[phaseTypesCount];
|
const static Phase phases[phaseTypesCount];
|
||||||
|
const static QVector<int> subPhasesEnd;
|
||||||
|
|
||||||
static Phase getPhase(int);
|
static Phase getPhase(int);
|
||||||
|
static int getLastSubphase(int phase);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PHASE_H
|
#endif // PHASE_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue