aboutsummaryrefslogtreecommitdiff
path: root/include/courtroom.h
diff options
context:
space:
mode:
authorRosemary Witchaven <32779090+in1tiate@users.noreply.github.com>2022-03-29 09:37:02 -0500
committerGitHub <noreply@github.com>2022-03-29 17:37:02 +0300
commit68d0b838cf5abf01c4956a9f079fa76fef340a2e (patch)
tree46f51c1cce650270d273f4013a0f480ce0e391d8 /include/courtroom.h
parent18412cc9303b1c11c8e35818d57b39aee72a5ec2 (diff)
Add two ways of controlling judge buttons that aren't hardcoded nonsense (networked and local) (#537)
* add both network and local ways to show judge buttons on pos other than jud * hide judge buttons when pos_removing to a non-judge position * alter packet header * Only use pos jud hardcoding if no design.ini if design.ini does not define judges= then we fall back to pos jud garbage * Fix judge buttons being disabled if default_side pos is judge (logic poopy) Fix positions.isEmpty() returning False cuz a split of an empty string returns the list with an empty string by default * Expand JD packet to be able to send -1, 0 and 1. If -1 is received, fall back on client-sided judge button behavior. If 0 or 1 is received, treat it as "absolute override" and adhere to that packet. * alter check for empty qstringlist to support old qt versions * heehoo * trigger client side behavior when jd -1 is sent * less confusing variable names * remove useless code, trim some fat Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com> * use an enum dammit! & warn on malformed auth * use an enum dammit! pt. 2 * appease clang, rewrite ugly judge controls function * please squash this its so bad Co-authored-by: Crystalwarrior <Varsash@Gmail.com> Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Diffstat (limited to 'include/courtroom.h')
-rw-r--r--include/courtroom.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/courtroom.h b/include/courtroom.h
index bf688b50..55e8b4e8 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -304,7 +304,7 @@ public:
void set_hp_bar(int p_bar, int p_state);
// Toggles the judge buttons, whether they should appear or not.
- void toggle_judge_buttons(bool is_on);
+ void show_judge_controls(bool visible);
void announce_case(QString title, bool def, bool pro, bool jud, bool jur,
bool steno);
@@ -325,6 +325,16 @@ public:
void on_authentication_state_received(int p_state);
+ enum JudgeState {
+ POS_DEPENDENT = -1,
+ HIDE_CONTROLS = 0,
+ SHOW_CONTROLS = 1
+ };
+
+ JudgeState get_judge_state() { return judge_state; }
+ void set_judge_state(JudgeState new_state) { judge_state = new_state; }
+ void set_judge_buttons() { show_judge_controls(ao_app->get_pos_is_judge(current_side)); }
+
~Courtroom();
private:
AOApplication *ao_app;
@@ -480,6 +490,8 @@ private:
bool is_muted = false;
+ JudgeState judge_state = POS_DEPENDENT;
+
// state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 =
// noniterrupting preanim, 5 = (c) animation
int anim_state = 3;