Skip to content

Commit

Permalink
Category from ini to server (#18)
Browse files Browse the repository at this point in the history
Right now character categories are stored in ini file, my idea was to
send category with character list. So it is not related to ini file but
it is related to the server.

Example of the packet: ["SC", Char1&Category1, Char2&Category2.......]
  • Loading branch information
EstatoDeviato authored Jul 29, 2024
1 parent 21e47ee commit 1d35dc8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
3 changes: 0 additions & 3 deletions include/aoapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,6 @@ class AOApplication : public QApplication {
// Returns the showname from the ini of p_char
QString get_showname(QString p_char);

// Returns the category of this character
QString get_category(QString p_char);

// Returns the value of chat image from the specific p_char's ini file
QString get_chat(QString p_char);

Expand Down
1 change: 1 addition & 0 deletions include/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct emote_type {

struct char_type {
QString name;
QString category;
// QString description;
// QString evidence_string;
bool taken;
Expand Down
4 changes: 2 additions & 2 deletions src/charselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void Courtroom::character_loading_finished()
char_button->set_image(char_list.at(n).name);
char_button->setToolTip(char_list.at(n).name);
ui_char_button_list.append(char_button);
QString char_category = ao_app->get_category(char_list.at(n).name);
QString char_category = char_list.at(n).category;
QList<QTreeWidgetItem*> matching_list = ui_char_list->findItems(char_category, Qt::MatchFixedString, 0);
// create the character tree item
QTreeWidgetItem *treeItem = new QTreeWidgetItem();
Expand Down Expand Up @@ -393,7 +393,7 @@ void Courtroom::filter_character_list()
continue;
}

if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive) && !ao_app->get_category(char_list.at(i).name).contains(ui_char_search->text(), Qt::CaseInsensitive)) {
if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive) && !char_list.at(i).category.contains(ui_char_search->text(), Qt::CaseInsensitive)) {
current_char_list_item->setHidden(true);
continue;
}
Expand Down
7 changes: 4 additions & 3 deletions src/packet_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)

char_type f_char;
f_char.name = sub_elements.at(0);
// if (sub_elements.size() >= 2) If this breaks anything,
// f_char.description = sub_elements.at(1); I blame Symphony

// temporary. the CharsCheck packet sets this properly
f_char.category = "";
if (sub_elements.size() >= 2) {
f_char.category = sub_elements.at(1);
}
f_char.taken = false;

w_courtroom->append_char(f_char);
Expand Down
6 changes: 0 additions & 6 deletions src/text_file_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,6 @@ Qt::TransformationMode AOApplication::get_misc_scaling(QString p_miscname)
return Qt::FastTransformation;
}

QString AOApplication::get_category(QString p_char)
{
QString f_result = read_char_ini(p_char, "category", "Options");
return f_result;
}

QString AOApplication::get_chat(QString p_char)
{
if (p_char == "default")
Expand Down

0 comments on commit 1d35dc8

Please sign in to comment.