added objection handler and started on set_scene
This commit is contained in:
		
							parent
							
								
									ab4de962e0
								
							
						
					
					
						commit
						6e7fd9c522
					
				@ -89,6 +89,7 @@ public:
 | 
				
			|||||||
  QVector<server_type> read_serverlist_txt();
 | 
					  QVector<server_type> read_serverlist_txt();
 | 
				
			||||||
  pos_size_type get_pos_and_size(QString p_identifier, QString p_design_path);
 | 
					  pos_size_type get_pos_and_size(QString p_identifier, QString p_design_path);
 | 
				
			||||||
  QString get_char_side(QString p_char);
 | 
					  QString get_char_side(QString p_char);
 | 
				
			||||||
 | 
					  QString get_showname(QString p_char);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  const int RELEASE = 2;
 | 
					  const int RELEASE = 2;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								aomovie.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								aomovie.cpp
									
									
									
									
									
								
							@ -15,12 +15,18 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
 | 
				
			|||||||
  connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
 | 
					  connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AOMovie::play(QString p_gif)
 | 
					void AOMovie::play(QString p_gif, QString p_char)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_movie->stop();
 | 
					  m_movie->stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QString gif_path = ao_app->get_theme_path() + p_gif + ".gif";
 | 
					 | 
				
			||||||
  QString default_path = ao_app->get_default_theme_path() + p_gif + ".gif";
 | 
					  QString default_path = ao_app->get_default_theme_path() + p_gif + ".gif";
 | 
				
			||||||
 | 
					  QString gif_path;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (p_gif == "custom")
 | 
				
			||||||
 | 
					    gif_path = ao_app->get_character_path(p_char) + "custom.gif";
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    gif_path = ao_app->get_theme_path() + p_gif + ".gif";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (file_exists(gif_path))
 | 
					  if (file_exists(gif_path))
 | 
				
			||||||
    m_movie->setFileName(gif_path);
 | 
					    m_movie->setFileName(gif_path);
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,7 @@ class AOMovie : public QLabel
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
  AOMovie(QWidget *p_parent, AOApplication *p_ao_app);
 | 
					  AOMovie(QWidget *p_parent, AOApplication *p_ao_app);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void play(QString p_gif);
 | 
					  void play(QString p_gif, QString p_char = "null");
 | 
				
			||||||
  void combo_resize(int w, int h);
 | 
					  void combo_resize(int w, int h);
 | 
				
			||||||
  void stop();
 | 
					  void stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,9 +20,13 @@ void AOScene::set_image(QString p_image)
 | 
				
			|||||||
  int w = this->width();
 | 
					  int w = this->width();
 | 
				
			||||||
  int h = this->height();
 | 
					  int h = this->height();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (file_exists(background_path))
 | 
					  if (file_exists(background_path))
 | 
				
			||||||
    this->setPixmap(background.scaled(w, h));
 | 
					    this->setPixmap(background.scaled(w, h));
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    this->setPixmap(default_bg.scaled(w, h));
 | 
					    this->setPixmap(default_bg.scaled(w, h));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOScene::set_legacy_desk(QString p_image)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,7 @@ public:
 | 
				
			|||||||
  explicit AOScene(Courtroom *parent);
 | 
					  explicit AOScene(Courtroom *parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void set_image(QString p_image);
 | 
					  void set_image(QString p_image);
 | 
				
			||||||
 | 
					  void set_legacy_desk(QString p_image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  Courtroom *m_courtroom;
 | 
					  Courtroom *m_courtroom;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										115
									
								
								courtroom.cpp
									
									
									
									
									
								
							
							
						
						
									
										115
									
								
								courtroom.cpp
									
									
									
									
									
								
							@ -14,6 +14,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  ao_app = p_ao_app;
 | 
					  ao_app = p_ao_app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  chat_tick_timer = new QTimer(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  text_delay = new QTimer(this);
 | 
				
			||||||
 | 
					  text_delay->setSingleShot(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  sfx_delay = new QTimer(this);
 | 
				
			||||||
 | 
					  sfx_delay->setSingleShot(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  char_button_mapper = new QSignalMapper(this);
 | 
					  char_button_mapper = new QSignalMapper(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  sfx_player = new QSoundEffect(this);
 | 
					  sfx_player = new QSoundEffect(this);
 | 
				
			||||||
@ -25,8 +33,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			|||||||
  ui_vp_desk = new AOScene(this);
 | 
					  ui_vp_desk = new AOScene(this);
 | 
				
			||||||
  ui_vp_legacy_desk = new AOScene(this);
 | 
					  ui_vp_legacy_desk = new AOScene(this);
 | 
				
			||||||
  ui_vp_chatbox = new AOImage(this, ao_app);
 | 
					  ui_vp_chatbox = new AOImage(this, ao_app);
 | 
				
			||||||
  ui_vp_showname = new QLabel(this);
 | 
					  ui_vp_showname = new QLabel(ui_vp_chatbox);
 | 
				
			||||||
  ui_vp_message = new QPlainTextEdit(this);
 | 
					  ui_vp_message = new QPlainTextEdit(ui_vp_chatbox);
 | 
				
			||||||
  ui_vp_testimony = new AOImage(this, ao_app);
 | 
					  ui_vp_testimony = new AOImage(this, ao_app);
 | 
				
			||||||
  ui_vp_realization = new AOImage(this, ao_app);
 | 
					  ui_vp_realization = new AOImage(this, ao_app);
 | 
				
			||||||
  ui_vp_wtce = new AOMovie(this, ao_app);
 | 
					  ui_vp_wtce = new AOMovie(this, ao_app);
 | 
				
			||||||
@ -502,6 +510,16 @@ void Courtroom::set_char_select_page()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Courtroom::set_background(QString p_background)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  current_background = p_background;
 | 
				
			||||||
 | 
					  QString bg_path = get_background_path();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  is_ao2_bg = file_exists(bg_path + "defensedesk.png") &&
 | 
				
			||||||
 | 
					              file_exists(bg_path + "prosecutiondesk.png") &&
 | 
				
			||||||
 | 
					              file_exists(bg_path + "stand.png");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Courtroom::enter_courtroom(int p_cid)
 | 
					void Courtroom::enter_courtroom(int p_cid)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_cid = p_cid;
 | 
					  m_cid = p_cid;
 | 
				
			||||||
@ -583,7 +601,14 @@ void Courtroom::append_server_chatmessage(QString f_message)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Courtroom::handle_chatmessage(QStringList *p_contents)
 | 
					void Courtroom::handle_chatmessage(QStringList *p_contents)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  QString f_message = p_contents->at(CHAR_NAME) + ": " + p_contents->at(MESSAGE) + '\n';
 | 
					  text_state = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    m_chatmessage[n_string] = p_contents->at(n_string);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QString f_message = m_chatmessage[CHAR_NAME] + ": " + m_chatmessage[MESSAGE] + '\n';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const QTextCursor old_cursor = ui_ic_chatlog->textCursor();
 | 
					  const QTextCursor old_cursor = ui_ic_chatlog->textCursor();
 | 
				
			||||||
  const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value();
 | 
					  const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value();
 | 
				
			||||||
@ -606,8 +631,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
 | 
				
			|||||||
      ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum());
 | 
					      ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int objection_mod = p_contents->at(OBJECTION_MOD);
 | 
					  int objection_mod = m_chatmessage[OBJECTION_MOD].toInt();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //if an objection is used
 | 
				
			||||||
 | 
					  if (objection_mod <= 4 && objection_mod >= 1)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    switch (objection_mod)
 | 
					    switch (objection_mod)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    case 1:
 | 
					    case 1:
 | 
				
			||||||
@ -619,27 +647,86 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
 | 
				
			|||||||
    case 3:
 | 
					    case 3:
 | 
				
			||||||
      ui_vp_objection->play("takethat");
 | 
					      ui_vp_objection->play("takethat");
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
  //AO2 only
 | 
					    //case 4 is AO2 only
 | 
				
			||||||
    case 4:
 | 
					    case 4:
 | 
				
			||||||
    //T0D0: add custom.gif here
 | 
					      ui_vp_objection->play("custom", m_chatmessage[CHAR_NAME]);
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
    //T0D0: continue program flow
 | 
					      qDebug() << "W: Logic error in objection switch statement!";
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //D3BUG START
 | 
					    //means we are in a state of objecting
 | 
				
			||||||
 | 
					    anim_state = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_vp_background->set_image("defenseempty.png");
 | 
					    int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_vp_player_char->set(p_contents->at(CHAR_NAME), p_contents->at(EMOTE), p_contents->at(PRE_EMOTE));
 | 
					    switch (emote_mod)
 | 
				
			||||||
  ui_vp_player_char->play_talking();
 | 
					    {
 | 
				
			||||||
 | 
					    //we change the chatmessage from no preanim to preanim, see documentation
 | 
				
			||||||
 | 
					    case 0: case 2:
 | 
				
			||||||
 | 
					      m_chatmessage[EMOTE_MOD] = QString::number(++emote_mod);
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    case 5:
 | 
				
			||||||
 | 
					      m_chatmessage[EMOTE_MOD] = QString::number(--emote_mod);
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //D3BUG END
 | 
					
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    handle_chatmessage_2();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Courtroom::objection_done()
 | 
					void Courtroom::objection_done()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //T0D0: play preanim, advance to step 2 in chat message handling
 | 
					  handle_chatmessage_2();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Courtroom::handle_chatmessage_2()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  ui_vp_player_char->stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QString remote_name = m_chatmessage[CHAR_NAME];
 | 
				
			||||||
 | 
					  QString local_showname = ao_app->get_showname(remote_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //empty string means we couldnt find showname in char ini
 | 
				
			||||||
 | 
					  if (local_showname == "")
 | 
				
			||||||
 | 
					    ui_vp_showname->remote_name;
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    ui_vp_showname->local_showname;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui_vp_message->clear();
 | 
				
			||||||
 | 
					  ui_vp_chatbox->hide();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  set_scene();
 | 
				
			||||||
 | 
					  set_text_color();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //ui_vp_player_char->set(m_chatmessage[CHAR_NAME], m_chatmessage[PRE_EMOTE], m_chatmessage[EMOTE]);
 | 
				
			||||||
 | 
					  //ui_vp_player_char->play_pre();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Courtroom::set_scene()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  //witness is default if pos is invalid
 | 
				
			||||||
 | 
					  QString f_image = "witnessempty.png";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QString f_side = m_chatmessage[SIDE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (f_side == "def")
 | 
				
			||||||
 | 
					    f_image = "defenseempty.png";
 | 
				
			||||||
 | 
					  else if (f_side == "pro")
 | 
				
			||||||
 | 
					    f_image = "prosecutionempty.png";
 | 
				
			||||||
 | 
					  else if (f_side == "jud")
 | 
				
			||||||
 | 
					    f_image = "judgestand.png";
 | 
				
			||||||
 | 
					  else if (f_side == "hld")
 | 
				
			||||||
 | 
					    f_image = "helperstand.png";
 | 
				
			||||||
 | 
					  else if (f_side == "hlp")
 | 
				
			||||||
 | 
					    f_image = "prohelperstand.png";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui_vp_background->set_image(f_image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //now for the hard part: desks
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Courtroom::handle_wtce(QString p_wtce)
 | 
					void Courtroom::handle_wtce(QString p_wtce)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										37
									
								
								courtroom.h
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								courtroom.h
									
									
									
									
									
								
							@ -39,18 +39,28 @@ public:
 | 
				
			|||||||
  void set_size_and_pos(QWidget *p_widget, QString p_identifier);
 | 
					  void set_size_and_pos(QWidget *p_widget, QString p_identifier);
 | 
				
			||||||
  void set_taken(int n_char, bool p_taken);
 | 
					  void set_taken(int n_char, bool p_taken);
 | 
				
			||||||
  void set_char_select_page();
 | 
					  void set_char_select_page();
 | 
				
			||||||
  void set_background(QString p_background){current_background = p_background;}
 | 
					  void set_background(QString p_background);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //sets desk and bg based on pos in chatmessage
 | 
				
			||||||
 | 
					  void set_scene();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //sets text color based on text color in chatmessage
 | 
				
			||||||
 | 
					  void set_text_color();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //implementations in path_functions.cpp
 | 
					  //implementations in path_functions.cpp
 | 
				
			||||||
  QString get_background_path();
 | 
					  QString get_background_path();
 | 
				
			||||||
  QString get_default_background_path();
 | 
					  QString get_default_background_path();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  int get_cid() {return m_cid;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void enter_courtroom(int p_cid);
 | 
					  void enter_courtroom(int p_cid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void append_ms_chatmessage(QString f_message);
 | 
					  void append_ms_chatmessage(QString f_message);
 | 
				
			||||||
  void append_server_chatmessage(QString f_message);
 | 
					  void append_server_chatmessage(QString f_message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void handle_chatmessage(QStringList *p_contents);
 | 
					  void handle_chatmessage(QStringList *p_contents);
 | 
				
			||||||
 | 
					  void handle_chatmessage_2();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void handle_wtce(QString p_wtce);
 | 
					  void handle_wtce(QString p_wtce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ~Courtroom();
 | 
					  ~Courtroom();
 | 
				
			||||||
@ -73,6 +83,28 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  QSignalMapper *char_button_mapper;
 | 
					  QSignalMapper *char_button_mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //determines how fast messages tick onto screen
 | 
				
			||||||
 | 
					  QTimer *chat_tick_timer;
 | 
				
			||||||
 | 
					  int chat_tick_interval = 60;
 | 
				
			||||||
 | 
					  //which tick position(character in chat message) we are at
 | 
				
			||||||
 | 
					  int tick_pos = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //delay before chat messages starts ticking
 | 
				
			||||||
 | 
					  QTimer *text_delay;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //delay before sfx plays
 | 
				
			||||||
 | 
					  QTimer *sfx_delay;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static const int chatmessage_size = 15;
 | 
				
			||||||
 | 
					  QString m_chatmessage[chatmessage_size];
 | 
				
			||||||
 | 
					  bool chatmessage_is_empty = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle
 | 
				
			||||||
 | 
					  int anim_state = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = ticking done
 | 
				
			||||||
 | 
					  int text_state = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //0 is the first page, 1 second etc.
 | 
					  //0 is the first page, 1 second etc.
 | 
				
			||||||
  //makes char arithmetic easier
 | 
					  //makes char arithmetic easier
 | 
				
			||||||
  int current_char_page = 0;
 | 
					  int current_char_page = 0;
 | 
				
			||||||
@ -80,6 +112,9 @@ private:
 | 
				
			|||||||
  //character id, which index of the char_list the player is
 | 
					  //character id, which index of the char_list the player is
 | 
				
			||||||
  int m_cid = 0;
 | 
					  int m_cid = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //is set to true if the bg folder contains defensedesk.png, prosecutiondesk.png and stand.png
 | 
				
			||||||
 | 
					  bool is_ao2_bg = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //wether the ooc chat is server or master chat, true is server
 | 
					  //wether the ooc chat is server or master chat, true is server
 | 
				
			||||||
  bool server_ooc = true;
 | 
					  bool server_ooc = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -311,6 +311,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    w_courtroom->handle_wtce(f_contents.at(0));
 | 
					    w_courtroom->handle_wtce(f_contents.at(0));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  else if (header == "checkconnection")
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    send_server_packet(new AOPacket("CH#" + QString::number(w_courtroom->get_cid()) + "#%"));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end:
 | 
					  end:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -174,3 +174,37 @@ QString AOApplication::get_char_side(QString p_char)
 | 
				
			|||||||
  return "wit";
 | 
					  return "wit";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QString AOApplication::get_showname(QString p_char)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  QString char_ini_path = get_character_path(p_char) + "char.ini";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QFile char_ini;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  char_ini.setFileName(char_ini_path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!char_ini.open(QIODevice::ReadOnly))
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    //default to empty string
 | 
				
			||||||
 | 
					    return "";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QTextStream in(&char_ini);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  while(!in.atEnd())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    QString line = in.readLine();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!line.startsWith("showname"))
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QStringList line_elements = line.split("=");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (line_elements.size() < 2)
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return line_elements.at(1).trimmed().toLower();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return "";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user