improved DC handling and added case insensitivity to char.ini checks
This commit is contained in:
		
							parent
							
								
									f769741c1d
								
							
						
					
					
						commit
						23262512ac
					
				@ -19,6 +19,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
			
		||||
 | 
			
		||||
  keepalive_timer = new QTimer(this);
 | 
			
		||||
  keepalive_timer->start(60000);
 | 
			
		||||
  disconnect_timer = new QTimer(this);
 | 
			
		||||
  disconnect_timer->setSingleShot(true);
 | 
			
		||||
 | 
			
		||||
  chat_tick_timer = new QTimer(this);
 | 
			
		||||
 | 
			
		||||
@ -300,6 +302,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
			
		||||
 | 
			
		||||
  connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked()));
 | 
			
		||||
 | 
			
		||||
  connect(disconnect_timer, SIGNAL(timeout()), this, SLOT(connection_timeout()));
 | 
			
		||||
 | 
			
		||||
  set_widgets();
 | 
			
		||||
 | 
			
		||||
  construct_evidence();
 | 
			
		||||
@ -1323,7 +1327,7 @@ void Courtroom::chat_tick()
 | 
			
		||||
 | 
			
		||||
    QScrollBar *scroll = ui_vp_message->verticalScrollBar();
 | 
			
		||||
    scroll->setValue(scroll->maximum());
 | 
			
		||||
    scroll->hide();
 | 
			
		||||
    //scroll->hide();
 | 
			
		||||
 | 
			
		||||
    if (f_message.at(tick_pos) != ' ')
 | 
			
		||||
    {
 | 
			
		||||
@ -1985,6 +1989,19 @@ void Courtroom::char_clicked(int n_char)
 | 
			
		||||
void Courtroom::ping_server()
 | 
			
		||||
{
 | 
			
		||||
  ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%"));
 | 
			
		||||
  disconnect_timer->start(10000);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::check_connection_received()
 | 
			
		||||
{
 | 
			
		||||
  disconnect_timer->stop();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::connection_timeout()
 | 
			
		||||
{
 | 
			
		||||
  call_notice("Disconnected from server.");
 | 
			
		||||
  ao_app->construct_lobby();
 | 
			
		||||
  ao_app->destruct_courtroom();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Courtroom::~Courtroom()
 | 
			
		||||
 | 
			
		||||
@ -92,6 +92,8 @@ public:
 | 
			
		||||
  void handle_wtce(QString p_wtce);
 | 
			
		||||
  void set_hp_bar(int p_bar, int p_state);
 | 
			
		||||
 | 
			
		||||
  void check_connection_received();
 | 
			
		||||
 | 
			
		||||
  ~Courtroom();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
@ -115,6 +117,9 @@ private:
 | 
			
		||||
  //triggers ping_server() every 60 seconds
 | 
			
		||||
  QTimer *keepalive_timer;
 | 
			
		||||
 | 
			
		||||
  //how long we wait for the server to respond on a ping
 | 
			
		||||
  QTimer *disconnect_timer;
 | 
			
		||||
 | 
			
		||||
  //determines how fast messages tick onto screen
 | 
			
		||||
  QTimer *chat_tick_timer;
 | 
			
		||||
  int chat_tick_interval = 60;
 | 
			
		||||
@ -317,6 +322,8 @@ private:
 | 
			
		||||
  void construct_evidence();
 | 
			
		||||
  void set_evidence_page();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
  void objection_done();
 | 
			
		||||
  void preanim_done();
 | 
			
		||||
@ -406,6 +413,7 @@ private slots:
 | 
			
		||||
  void char_clicked(int n_char);
 | 
			
		||||
 | 
			
		||||
  void ping_server();
 | 
			
		||||
  void connection_timeout();
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -520,9 +520,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
			
		||||
    if (courtroom_constructed && f_contents.size() > 0)
 | 
			
		||||
      w_courtroom->mod_called(f_contents.at(0));
 | 
			
		||||
  }
 | 
			
		||||
  else if (header == "checkconnection")
 | 
			
		||||
  else if (header == "checkconnection" || header == "CHECK")
 | 
			
		||||
  {
 | 
			
		||||
    send_server_packet(new AOPacket("CH#" + QString::number(w_courtroom->get_cid()) + "#%"));
 | 
			
		||||
    if (courtroom_constructed)
 | 
			
		||||
      w_courtroom->check_connection_received();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  end:
 | 
			
		||||
 | 
			
		||||
@ -224,30 +224,27 @@ QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QStr
 | 
			
		||||
 | 
			
		||||
  QTextStream in(&char_ini);
 | 
			
		||||
 | 
			
		||||
  //because there are char inis that look like [eMoTIonS] for whatever reason
 | 
			
		||||
  target_tag = target_tag.toLower();
 | 
			
		||||
  terminator_tag = terminator_tag.toLower();
 | 
			
		||||
  bool tag_found = false;
 | 
			
		||||
 | 
			
		||||
  while(!in.atEnd())
 | 
			
		||||
  {
 | 
			
		||||
    QString line = in.readLine();
 | 
			
		||||
 | 
			
		||||
    if (line.toLower().startsWith(terminator_tag))
 | 
			
		||||
    if (QString::compare(line, terminator_tag, Qt::CaseInsensitive) == 0)
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    if (line.toLower().startsWith(target_tag))
 | 
			
		||||
    if (line.startsWith(target_tag, Qt::CaseInsensitive))
 | 
			
		||||
    {
 | 
			
		||||
      tag_found = true;
 | 
			
		||||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!line.startsWith(p_search_line))
 | 
			
		||||
    if (!line.startsWith(p_search_line, Qt::CaseInsensitive))
 | 
			
		||||
      continue;
 | 
			
		||||
 | 
			
		||||
    QStringList line_elements = line.split("=");
 | 
			
		||||
 | 
			
		||||
    if (line_elements.at(0).trimmed() != p_search_line)
 | 
			
		||||
    if (QString::compare(line_elements.at(0).trimmed(), p_search_line, Qt::CaseInsensitive) != 0)
 | 
			
		||||
      continue;
 | 
			
		||||
 | 
			
		||||
    if (line_elements.size() < 2)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user