[openjk] 13/130: Revise method open
Simon McVittie
smcv at debian.org
Fri Oct 28 11:09:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository openjk.
commit 4f9f1ceda1b23c9b0ddd3668ee165436e89fbd8e
Author: bibendovsky <bibendovsky at NOSTROMO>
Date: Sun Jul 3 22:21:55 2016 +0300
Revise method open
---
shared/qcommon/ojk_sg_archive.cpp | 34 ++++++++++++++++++++++++----------
shared/qcommon/ojk_sg_archive_fwd.h | 1 +
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/shared/qcommon/ojk_sg_archive.cpp b/shared/qcommon/ojk_sg_archive.cpp
index 24c3267..b266490 100644
--- a/shared/qcommon/ojk_sg_archive.cpp
+++ b/shared/qcommon/ojk_sg_archive.cpp
@@ -43,6 +43,7 @@ bool Archive::open(
is_succeed = false;
auto error_message = get_failed_to_open_message(
+ archive_mode,
file_path,
true);
@@ -167,21 +168,34 @@ std::string Archive::generate_path(
}
std::string Archive::get_failed_to_open_message(
+ ArchiveMode archive_mode,
const std::string& file_name,
bool is_open)
{
constexpr int max_length = 256;
- auto message_id =
- is_open ?
-#ifdef JK2_MODE
- "MENUS3_FAILED_TO_OPEN_SAVEGAME" :
- "MENUS3_FAILED_TO_CREATE_SAVEGAME"
-#else
- "MENUS_FAILED_TO_OPEN_SAVEGAME" :
- "MENUS3_FAILED_TO_CREATE_SAVEGAME"
-#endif
- ;
+ const char* message_id = nullptr;
+
+ switch (archive_mode) {
+ case ArchiveMode::jedi_outcast:
+ if (is_open) {
+ message_id = "MENUS3_FAILED_TO_OPEN_SAVEGAME";
+ } else {
+ message_id = "MENUS3_FAILED_TO_CREATE_SAVEGAME";
+ }
+ break;
+
+ case ArchiveMode::jedi_academy:
+ if (is_open) {
+ message_id = "MENUS_FAILED_TO_OPEN_SAVEGAME";
+ } else {
+ message_id = "MENUS3_FAILED_TO_CREATE_SAVEGAME";
+ }
+ break;
+
+ default:
+ break;
+ }
std::string result(
S_COLOR_RED);
diff --git a/shared/qcommon/ojk_sg_archive_fwd.h b/shared/qcommon/ojk_sg_archive_fwd.h
index cf7b11d..e23e553 100644
--- a/shared/qcommon/ojk_sg_archive_fwd.h
+++ b/shared/qcommon/ojk_sg_archive_fwd.h
@@ -169,6 +169,7 @@ private:
const std::string& base_file_name);
static std::string get_failed_to_open_message(
+ ArchiveMode archive_mode,
const std::string& file_name,
bool is_open);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list