Allow -1 charid messages to be sent (system/server messages) UNTESTED
This commit is contained in:
parent
ec02078b4d
commit
990f653e4a
@ -1561,14 +1561,14 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
|
|||||||
|
|
||||||
int f_char_id = m_chatmessage[CHAR_ID].toInt();
|
int f_char_id = m_chatmessage[CHAR_ID].toInt();
|
||||||
|
|
||||||
if (f_char_id < 0 || f_char_id >= char_list.size())
|
if (f_char_id >= 0 && f_char_id >= char_list.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mute_map.value(m_chatmessage[CHAR_ID].toInt()))
|
if (mute_map.value(m_chatmessage[CHAR_ID].toInt()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString f_showname;
|
QString f_showname;
|
||||||
if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
|
if (f_char_id > 0 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()))
|
||||||
{
|
{
|
||||||
f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
|
f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
|
||||||
}
|
}
|
||||||
@ -1583,9 +1583,14 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
|
|||||||
|
|
||||||
QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n';
|
QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n';
|
||||||
|
|
||||||
if (f_message == previous_ic_message)
|
if (f_char_id >= 0 && f_message == previous_ic_message) //Not a system message
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (f_char_id <= -1)
|
||||||
|
previous_ic_message = ""; //System messages don't care about repeating themselves
|
||||||
|
else
|
||||||
|
previous_ic_message = f_message;
|
||||||
|
|
||||||
//Stop the chat arrow from animating
|
//Stop the chat arrow from animating
|
||||||
ui_vp_chat_arrow->stop();
|
ui_vp_chat_arrow->stop();
|
||||||
|
|
||||||
@ -1597,8 +1602,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
|
|||||||
|
|
||||||
//Remove undesired newline chars
|
//Remove undesired newline chars
|
||||||
m_chatmessage[MESSAGE].remove("\n");
|
m_chatmessage[MESSAGE].remove("\n");
|
||||||
//Replace all trailing whitespace with a single space and remove all whitespace at the end of the string.
|
|
||||||
//m_chatmessage[MESSAGE] = m_chatmessage[MESSAGE].replace(QRegularExpression("^\\s+(?=\\s)|\\s+$|\\s+(?=\\s)"), "");
|
|
||||||
|
|
||||||
chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
|
chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
|
||||||
|
|
||||||
@ -1625,7 +1628,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
|
|||||||
//Let the server handle actually checking if they're allowed to do this.
|
//Let the server handle actually checking if they're allowed to do this.
|
||||||
is_additive = m_chatmessage[ADDITIVE].toInt() == 1;
|
is_additive = m_chatmessage[ADDITIVE].toInt() == 1;
|
||||||
|
|
||||||
chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, m_chatmessage[MESSAGE], false);
|
QString f_charname = "";
|
||||||
|
if (f_char_id >= 0)
|
||||||
|
f_charname = ao_app->get_showname(char_list.at(f_char_id).name);
|
||||||
|
|
||||||
|
chatlogpiece* temp = new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false);
|
||||||
ic_chatlog_history.append(*temp);
|
ic_chatlog_history.append(*temp);
|
||||||
ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true);
|
ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true);
|
||||||
|
|
||||||
@ -1636,8 +1643,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
|
|||||||
|
|
||||||
append_ic_text(m_chatmessage[MESSAGE], f_showname);
|
append_ic_text(m_chatmessage[MESSAGE], f_showname);
|
||||||
|
|
||||||
previous_ic_message = f_message;
|
|
||||||
|
|
||||||
int objection_mod = m_chatmessage[OBJECTION_MOD].toInt();
|
int objection_mod = m_chatmessage[OBJECTION_MOD].toInt();
|
||||||
QString f_char = m_chatmessage[CHAR_NAME];
|
QString f_char = m_chatmessage[CHAR_NAME];
|
||||||
QString f_custom_theme = ao_app->get_char_shouts(f_char);
|
QString f_custom_theme = ao_app->get_char_shouts(f_char);
|
||||||
@ -1701,9 +1706,10 @@ void Courtroom::handle_chatmessage_2()
|
|||||||
else
|
else
|
||||||
ui_vp_player_char->network_strings.clear();
|
ui_vp_player_char->network_strings.clear();
|
||||||
|
|
||||||
if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
|
int f_charid = m_chatmessage[CHAR_ID].toInt();
|
||||||
|
if (f_charid >= 0 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()))
|
||||||
{
|
{
|
||||||
QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name;
|
QString real_name = char_list.at(f_charid).name;
|
||||||
|
|
||||||
QString f_showname = ao_app->get_showname(real_name);
|
QString f_showname = ao_app->get_showname(real_name);
|
||||||
|
|
||||||
@ -1845,7 +1851,6 @@ void Courtroom::handle_chatmessage_2()
|
|||||||
else
|
else
|
||||||
ui_vp_player_char->move(0, 0);
|
ui_vp_player_char->move(0, 0);
|
||||||
|
|
||||||
qDebug() << "offset OK" << ok << "offset value" << self_offset;
|
|
||||||
switch (emote_mod)
|
switch (emote_mod)
|
||||||
{
|
{
|
||||||
case 1: case 2: case 6:
|
case 1: case 2: case 6:
|
||||||
|
Loading…
Reference in New Issue
Block a user