add phase to delete arrows in to protocol (#6159)

* protocol changes

* servatrice changes

* add new setting

* implement client side with static 4 phases

* reading the code explains the code

* add subphases to phase.cpp

* use new subphase definition
This commit is contained in:
ebbit1q 2025-11-26 15:16:10 +01:00 committed by GitHub
parent adee67115c
commit a21e45ed36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 133 additions and 39 deletions

View file

@ -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::phases[Phases::phaseTypesCount] = {
{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", "Second Main"), "blue", "main_2"},
{QT_TRANSLATE_NOOP("Phase", "End/Cleanup"), "green", "end_step"}};
const QVector<int> Phases::subPhasesEnd = getSubPhasesEnd();