From 727c39a1df42a5aba8a9c863ee2f05169d204ffa Mon Sep 17 00:00:00 2001 From: David Skoland Date: Fri, 16 Nov 2018 02:26:47 +0100 Subject: [PATCH] small fixes and removing compiler warnings --- aocharmovie.cpp | 6 ++++++ courtroom.cpp | 27 ++++++++++++--------------- path_functions.cpp | 35 ++++++++++++----------------------- 3 files changed, 30 insertions(+), 38 deletions(-) diff --git a/aocharmovie.cpp b/aocharmovie.cpp index 180052a..c3490ce 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -75,8 +75,11 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) real_duration += m_movie->nextFrameDelay(); m_movie->jumpToFrame(n_frame + 1); } + +#ifdef DEBUG_GIF qDebug() << "full_duration: " << full_duration; qDebug() << "real_duration: " << real_duration; +#endif double percentage_modifier = 100.0; @@ -88,7 +91,10 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) if (percentage_modifier > 100.0) percentage_modifier = 100.0; } + +#ifdef DEBUG_GIF qDebug() << "% mod: " << percentage_modifier; +#endif if (full_duration == 0 || full_duration >= real_duration) { diff --git a/courtroom.cpp b/courtroom.cpp index 372d4b9..e180817 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1034,11 +1034,11 @@ void Courtroom::handle_chatmessage_2() case 1: case 2: case 6: play_preanim(); break; - default: - qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); - //intentional fallthru case 0: case 5: handle_chatmessage_3(); + break; + default: + qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); } } @@ -1094,15 +1094,11 @@ void Courtroom::handle_chatmessage_3() QString f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; - switch (f_anim_state) - { - case 2: + if (f_anim_state == 2) { ui_vp_player_char->play_talking(f_char, f_emote); anim_state = 2; - break; - default: - qDebug() << "W: invalid anim_state: " << f_anim_state; - case 3: + } + else { ui_vp_player_char->play_idle(f_char, f_emote); anim_state = 3; } @@ -1194,12 +1190,11 @@ void Courtroom::play_preanim() sfx_delay_timer->start(sfx_delay); - if (!file_exists(ao_app->get_character_path(f_char, f_preanim.toLower() + ".gif")) || + if (!file_exists(ao_app->get_character_path(f_char, f_preanim + ".gif")) || preanim_duration < 0) { anim_state = 1; preanim_done(); - qDebug() << "could not find " + ao_app->get_character_path(f_char, f_preanim.toLower() + ".gif"); return; } @@ -1462,12 +1457,14 @@ void Courtroom::set_text_color() ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: yellow"); break; - default: - qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; case WHITE: ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white"); - + break; + default: + ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: white"); + qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; } } diff --git a/path_functions.cpp b/path_functions.cpp index 83e4752..f066102 100644 --- a/path_functions.cpp +++ b/path_functions.cpp @@ -18,27 +18,23 @@ #define CASE_SENSITIVE_FILESYSTEM #endif -QString base_path = ""; - QString AOApplication::get_base_path() { - if (base_path == "") - { -#ifdef BASE_OVERRIDE - base_path = base_override; -#elif defined(ANDROID) - QString sdcard_storage = getenv("SECONDARY_STORAGE"); - if (dir_exists(sdcard_storage + "/AO2/")){ - base_path = sdcard_storage + "/AO2/"; - }else{ - QString external_storage = getenv("EXTERNAL_STORAGE"); - base_path = external_storage + "/AO2/"; - } + QString base_path = ""; +#ifdef ANDROID + QString sdcard_storage = getenv("SECONDARY_STORAGE"); + if (dir_exists(sdcard_storage + "/AO2/")){ + base_path = sdcard_storage + "/AO2/"; + } + else { + QString external_storage = getenv("EXTERNAL_STORAGE"); + base_path = external_storage + "/AO2/"; + } #else base_path = QDir::currentPath() + "/base/"; #endif -} - return base_path; + + return base_path; } QString AOApplication::get_data_path() @@ -146,21 +142,14 @@ QString AOApplication::get_evidence_path(QString p_file) } QString AOApplication::get_case_sensitive_path(QString p_file) { - qDebug() << "calling get_case_sensitive_path: " << p_file; - QFileInfo file(p_file); //quick check to see if it's actually there first if (file.exists()) return p_file; QString file_name = file.fileName(); - - qDebug() << "file_name: " << file_name; - QString file_path = file.absolutePath(); - qDebug() << "file_path: " << file_path; - QRegExp file_rx = QRegExp(file_name, Qt::CaseInsensitive); QStringList files = QDir(file_path).entryList(); int result = files.indexOf(file_rx);