From 8dd73adc828dc56ac5f13e787f933fc8273acca2 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Fri, 17 May 2013 16:51:34 +0100 Subject: [PATCH] Changed some metadata member types, constructors. Message types, languages are now given by int constants for simpler comparison. Tag constructor now explicitly takes addition/removal flag. Removed unused metadata member functions. Also removed CRC/isActive calc from Plugin constructor, and implemented YAML emitter for Game objects. --- src/globals.h | 12 +++++++++++- src/gui/editor.cpp | 37 +++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/globals.h b/src/globals.h index 4e6f2ad4..cb933dca 100644 --- a/src/globals.h +++ b/src/globals.h @@ -34,6 +34,16 @@ namespace boss { const unsigned int GAME_FO3 = 3; const unsigned int GAME_FONV = 4; + //Message types. + const unsigned int MESSAGE_SAY = 0; + const unsigned int MESSAGE_WARN = 1; + const unsigned int MESSAGE_ERROR = 2; + const unsigned int MESSAGE_TAG = 3; + + //Languages + const unsigned int LANG_AUTO = 0; + const unsigned int LANG_ENG = 1; + //Version numbers. const unsigned int VERSION_MAJOR = 3; const unsigned int VERSION_MINOR = 0; @@ -43,7 +53,7 @@ namespace boss { const boost::filesystem::path settings_path = "resources/settings.yaml"; const boost::filesystem::path log_path = "BOSSDebugLog.txt"; const boost::filesystem::path readme_path = boost::filesystem::path("Docs") / "BOSS Readme.html"; - const char * const libespm_options_path = "resources/libespm.yaml"; + const char * const libespm_options_path = "resources/libespm.yaml"; } #endif diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index 4657bb4e..a4bfea53 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -22,7 +22,7 @@ */ #include "editor.h" -#include "../parsers.h" +#include "../generators.h" #include #include @@ -258,9 +258,9 @@ void Editor::OnPluginSelect(wxListEvent& event) { i=0; for (list::const_iterator it=messages.begin(), endit=messages.end(); it != endit; ++it) { - if (boost::iequals(it->Type(),"say")) + if (it->Type() == boss::MESSAGE_SAY) messageList->InsertItem(i, Type[0]); - else if (boost::iequals(it->Type(), "warn")) + else if (it->Type() == boss::MESSAGE_WARN) messageList->InsertItem(i, Type[1]); else messageList->InsertItem(i, Type[2]); @@ -268,7 +268,7 @@ void Editor::OnPluginSelect(wxListEvent& event) { messageList->SetItem(i, 1, FromUTF8(it->Content())); messageList->SetItem(i, 2, FromUTF8(it->Condition())); - if (it->Language().empty()) + if (it->Language() == boss::LANG_AUTO) messageList->SetItem(i, 3, Language[0]); else messageList->SetItem(i, 3, Language[1]); @@ -727,17 +727,17 @@ boss::File Editor::RowToFile(wxListView * list, long row) const { } boss::Message Editor::RowToMessage(wxListView * list, long row) const { - string type,language; + unsigned int type,language; if (list->GetItemText(row, 0) == Type[0]) - type = "say"; + type = boss::MESSAGE_SAY; else if (list->GetItemText(row, 0) == Type[1]) - type = "warn"; + type = boss::MESSAGE_WARN; else - type = "error"; + type = boss::MESSAGE_ERROR; if (list->GetItemText(row, 3) == Language[0]) - language = ""; + language = boss::LANG_AUTO; else - language = "eng"; + language = boss::LANG_ENG; return boss::Message( type, @@ -751,12 +751,17 @@ boss::Tag Editor::RowToTag(wxListView * list, long row) const { string name = string(list->GetItemText(row, 1).ToUTF8()); if (list->GetItemText(row, 0) == State[1]) - name = "-" + name; - - return boss::Tag( - name, - string(list->GetItemText(row, 2).ToUTF8()) - ); + return boss::Tag( + name, + false, + string(list->GetItemText(row, 2).ToUTF8()) + ); + else + return boss::Tag( + name, + true, + string(list->GetItemText(row, 2).ToUTF8()) + ); } FileEditDialog::FileEditDialog(wxWindow *parent, const wxString& title) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) {