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.
This commit is contained in:
WrinklyNinja
2013-05-17 16:51:34 +01:00
parent 06523d2f8f
commit 8dd73adc82
2 changed files with 32 additions and 17 deletions
+11 -1
View File
@@ -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
+21 -16
View File
@@ -22,7 +22,7 @@
*/
#include "editor.h"
#include "../parsers.h"
#include "../generators.h"
#include <algorithm>
#include <boost/algorithm/string.hpp>
@@ -258,9 +258,9 @@ void Editor::OnPluginSelect(wxListEvent& event) {
i=0;
for (list<boss::Message>::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) {