Make pos dropdown more abstract and actually useful by letting servers send only pos you can actually access.
Pos dropdown system also reads the actual bg folder of the current BG to see all the created pos.
This commit is contained in:
parent
9df7b9648a
commit
a4e448576b
@ -159,6 +159,9 @@ public:
|
|||||||
//sets the local character pos/side to use.
|
//sets the local character pos/side to use.
|
||||||
void set_side(QString p_side);
|
void set_side(QString p_side);
|
||||||
|
|
||||||
|
//sets the pos dropdown
|
||||||
|
void set_pos_dropdown(QStringList pos_dropdowns);
|
||||||
|
|
||||||
//sets the evidence list member variable to argument
|
//sets the evidence list member variable to argument
|
||||||
void set_evidence_list(QVector<evi_type> &p_evi_list);
|
void set_evidence_list(QVector<evi_type> &p_evi_list);
|
||||||
|
|
||||||
@ -394,6 +397,9 @@ private:
|
|||||||
QVector<bool> color_markdown_talking_list;
|
QVector<bool> color_markdown_talking_list;
|
||||||
//Text Color-related optimization END
|
//Text Color-related optimization END
|
||||||
|
|
||||||
|
//List of all currently available pos
|
||||||
|
QStringList pos_dropdown_list;
|
||||||
|
|
||||||
bool is_presenting_evidence = false;
|
bool is_presenting_evidence = false;
|
||||||
|
|
||||||
QString effect = "";
|
QString effect = "";
|
||||||
|
@ -180,14 +180,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
initialize_emotes();
|
initialize_emotes();
|
||||||
|
|
||||||
ui_pos_dropdown = new QComboBox(this);
|
ui_pos_dropdown = new QComboBox(this);
|
||||||
ui_pos_dropdown->addItem("wit");
|
|
||||||
ui_pos_dropdown->addItem("def");
|
|
||||||
ui_pos_dropdown->addItem("pro");
|
|
||||||
ui_pos_dropdown->addItem("jud");
|
|
||||||
ui_pos_dropdown->addItem("hld");
|
|
||||||
ui_pos_dropdown->addItem("hlp");
|
|
||||||
ui_pos_dropdown->addItem("jur");
|
|
||||||
ui_pos_dropdown->addItem("sea");
|
|
||||||
|
|
||||||
ui_iniswap_dropdown = new QComboBox(this);
|
ui_iniswap_dropdown = new QComboBox(this);
|
||||||
ui_iniswap_dropdown->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui_iniswap_dropdown->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
@ -1005,10 +997,32 @@ void Courtroom::set_background(QString p_background, bool display)
|
|||||||
ui_vp_testimony->stop();
|
ui_vp_testimony->stop();
|
||||||
current_background = p_background;
|
current_background = p_background;
|
||||||
|
|
||||||
|
//welcome to hardcode central may I take your order of regularly scheduled CBT
|
||||||
|
QMap<QString, QString> default_pos;
|
||||||
|
default_pos["defenseempty"] = "def";
|
||||||
|
default_pos["helperstand"] = "hld";
|
||||||
|
default_pos["prosecutorempty"] = "pro";
|
||||||
|
default_pos["prohelperstand"] = "hlp";
|
||||||
|
default_pos["witnessempty"] = "wit";
|
||||||
|
default_pos["judgestand"] = "jud";
|
||||||
|
default_pos["jurystand"] = "jur";
|
||||||
|
default_pos["seancestand"] = "sea";
|
||||||
|
|
||||||
|
//Populate the dropdown list with all pos that exist on this bg
|
||||||
|
QStringList pos_list = {};
|
||||||
|
for (QString key : default_pos.keys())
|
||||||
|
{
|
||||||
|
if (file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path(key))))
|
||||||
|
{
|
||||||
|
pos_list.append(default_pos[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: search through extra/custom pos and add them to the pos dropdown as well
|
||||||
|
|
||||||
|
set_pos_dropdown(pos_list);
|
||||||
|
|
||||||
is_ao2_bg = true;
|
is_ao2_bg = true;
|
||||||
// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("defensedesk"))) &&
|
|
||||||
// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("prosecutiondesk"))) &&
|
|
||||||
// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("stand")));
|
|
||||||
|
|
||||||
if (is_ao2_bg)
|
if (is_ao2_bg)
|
||||||
{
|
{
|
||||||
@ -1070,6 +1084,13 @@ void Courtroom::set_side(QString p_side)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Courtroom::set_pos_dropdown(QStringList pos_dropdowns)
|
||||||
|
{
|
||||||
|
pos_dropdown_list = pos_dropdowns;
|
||||||
|
ui_pos_dropdown->clear();
|
||||||
|
ui_pos_dropdown->addItems(pos_dropdown_list);
|
||||||
|
qDebug() << pos_dropdown_list;
|
||||||
|
}
|
||||||
|
|
||||||
void Courtroom::update_character(int p_cid)
|
void Courtroom::update_character(int p_cid)
|
||||||
{
|
{
|
||||||
@ -3336,42 +3357,14 @@ void Courtroom::on_pos_dropdown_changed(int p_index)
|
|||||||
|
|
||||||
toggle_judge_buttons(false);
|
toggle_judge_buttons(false);
|
||||||
|
|
||||||
QString f_pos;
|
QString f_pos = ui_pos_dropdown->itemText(p_index);
|
||||||
|
|
||||||
switch (p_index)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
f_pos = "wit";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
f_pos = "def";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
f_pos = "pro";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
f_pos = "jud";
|
|
||||||
toggle_judge_buttons(true);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
f_pos = "hld";
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
f_pos = "hlp";
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
f_pos = "jur";
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
f_pos = "sea";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
f_pos = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f_pos == "")
|
if (f_pos == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (f_pos == "jud")
|
||||||
|
toggle_judge_buttons(true);
|
||||||
|
|
||||||
//YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA
|
//YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA
|
||||||
//how about this instead
|
//how about this instead
|
||||||
set_side(f_pos);
|
set_side(f_pos);
|
||||||
|
@ -595,7 +595,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (courtroom_constructed) //We were sent a "set position" packet
|
if (courtroom_constructed) //We were sent a "set position" packet
|
||||||
|
{
|
||||||
w_courtroom->set_side(f_contents.at(0));
|
w_courtroom->set_side(f_contents.at(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (header == "SD") //Send pos dropdown
|
||||||
|
{
|
||||||
|
if (f_contents.size() < 1)
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
w_courtroom->set_pos_dropdown(f_contents.at(0).split("*"));
|
||||||
}
|
}
|
||||||
//server accepting char request(CC) packet
|
//server accepting char request(CC) packet
|
||||||
else if (header == "PV")
|
else if (header == "PV")
|
||||||
|
Loading…
Reference in New Issue
Block a user