=== modified file 'libsiedler2/src/ArchivItem_Ini.h'
--- libsiedler2/src/ArchivItem_Ini.h 2009-07-13 22:00:41 +0000
+++ libsiedler2/src/ArchivItem_Ini.h 2009-07-23 09:27:09 +0000
@@ -83,7 +83,7 @@
}
}
- inline void setValue(const char *name, unsigned int value)
+ inline void setValue(const char *name, int value)
{
char temp[512];
snprintf(temp, 256, "%d", value);
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2009-07-19 22:00:41 +0000
+++ src/CMakeLists.txt 2009-07-21 22:21:02 +0000
@@ -45,6 +45,7 @@
ctrlProgress.cpp ctrlProgress.h
ctrlRectangle.cpp ctrlRectangle.h
ctrlScrollBar.cpp ctrlScrollBar.h
+ ctrlSpinbox.cpp ctrlSpinbox.h
ctrlTab.cpp ctrlTab.h
ctrlTable.cpp ctrlTable.h
ctrlText.cpp ctrlText.h
@@ -83,6 +84,7 @@
iwDirectIPCreate.cpp iwDirectIPCreate.h
iwDistribution.cpp iwDistribution.h
iwEndgame.cpp iwEndgame.h
+ iwEnhancements.cpp iwEnhancements.h
iwHelp.cpp iwHelp.h
iwHQ.cpp iwHQ.h
iwInventory.cpp iwInventory.h
@@ -122,11 +124,14 @@
CollisionDetection.cpp CollisionDetection.h
ClientInterface.cpp ClientInterface.h
colors.h
+ const_enhancements.cpp const_enhancements.h
const_gui_ids.h
controls.h
customborderbuilder.h customborderbuilder.cpp
Desktop.cpp Desktop.h
DoorConsts.h
+ enhOptions.cpp enhOptions.h
+ Enhancements.cpp Enhancements.h
EventManager.cpp EventManager.h
ExtensionList.cpp ExtensionList.h
FileChecksum.cpp FileChecksum.h
=== added file 'src/Enhancements.cpp'
--- src/Enhancements.cpp 1970-01-01 00:00:00 +0000
+++ src/Enhancements.cpp 2009-07-22 12:41:17 +0000
@@ -0,0 +1,82 @@
+// $Id: Enhancements.cpp 5171 2009-07-02 20:21:42Z Divan $
+//
+// Copyright (c) 2005-2009 Settlers Freaks (sf-team at siedler25.org)
+//
+// This file is part of Siedler II.5 RTTR.
+//
+// Siedler II.5 RTTR is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Siedler II.5 RTTR is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Siedler II.5 RTTR. If not, see .
+
+#include
+
+#include "Enhancements.h"
+
+// Destructor
+Enhancements::~Enhancements()
+{
+ enh_by_id.clear();
+ if (enh_by_order.size() > 0)
+ for(unsigned int i = 0; i > enh_by_order.size(); ++i)
+ delete enh_by_order[i];
+}
+
+const std::string Enhancements::GetValueAsString(const unsigned int &id, const int &value) const
+{
+ std::string s = "";
+ enhOption enh = by_id(id);
+ switch(enh.type)
+ {
+ case ENH_OPT_BOOL:
+ {
+ s = (value == 1 ? _("Enabled") : _("Disabled"));
+ } break;
+ case ENH_OPT_SELECT:
+ {
+ int max = enh.selections.size() - 1;
+ assert(value <= max && value >= 0);
+ s = enh.selections[value];
+ } break;
+ case ENH_OPT_INT:
+ {
+ std::stringstream ss;
+ ss << value;
+ s = ss.str();
+ } break;
+ }
+ return s;
+}
+
+void Enhancements::Add(const enhOption &enh)
+{
+ enhOption *enh2 = new enhOption;
+ *enh2 = enh;
+ // Autoset min/max
+ switch(enh2->type)
+ {
+ case ENH_OPT_BOOL:
+ {
+ enh2->min = 0;
+ enh2->max = 1;
+ } break;
+ case ENH_OPT_SELECT:
+ {
+ enh2->min = 0;
+ enh2->max = enh2->selections.size()-1;
+ } break;
+ default: {}
+ }
+ // Add to stack
+ enh_by_order.push_back(enh2);
+ enh_by_id.insert(std::make_pair(enh2->id, enh2));
+}
+
=== added file 'src/Enhancements.h'
--- src/Enhancements.h 1970-01-01 00:00:00 +0000
+++ src/Enhancements.h 2009-07-23 09:27:09 +0000
@@ -0,0 +1,83 @@
+// $Id: Enhancements.h 5171 2009-07-02 20:21:42Z Divan $
+//
+// Copyright (c) 2005-2009 Settlers Freaks (sf-team at siedler25.org)
+//
+// This file is part of Siedler II.5 RTTR.
+//
+// Siedler II.5 RTTR is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Siedler II.5 RTTR is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Siedler II.5 RTTR. If not, see .
+#ifndef ENHANCEMENTS_H_INCLUDED
+#define ENHANCEMENTS_H_INCLUDED
+
+#pragma once
+
+///////////////////////////////////////////////////////////////////////////////
+// Header
+#include
+#include