Commit 41f5fcf4 authored by coppro's avatar coppro

Fixed a bunch of linker errors preventing optimized compile on Linux.

parent 5cb0f740
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <util/prec.hpp> #include <util/prec.hpp>
#include <data/field/choice.hpp> #include <data/field/choice.hpp>
#include <util/io/package.hpp> #include <util/io/package.hpp>
#include <util/defaultable.hpp>
#include <wx/imaglist.h> #include <wx/imaglist.h>
DECLARE_TYPEOF_COLLECTION(ChoiceField::ChoiceP); DECLARE_TYPEOF_COLLECTION(ChoiceField::ChoiceP);
...@@ -303,3 +304,5 @@ bool ChoiceValue::update(Context& ctx) { ...@@ -303,3 +304,5 @@ bool ChoiceValue::update(Context& ctx) {
IMPLEMENT_REFLECTION_NAMELESS(ChoiceValue) { IMPLEMENT_REFLECTION_NAMELESS(ChoiceValue) {
if (fieldP->save_value || tag.scripting() || tag.reading()) REFLECT_NAMELESS(value); if (fieldP->save_value || tag.scripting() || tag.reading()) REFLECT_NAMELESS(value);
} }
INSTANTIATE_REFLECTION_NAMELESS(ChoiceValue)
...@@ -419,7 +419,7 @@ void PackInstance::generate(vector<CardP>* out) { ...@@ -419,7 +419,7 @@ void PackInstance::generate(vector<CardP>* out) {
if (pack_type.select == SELECT_EQUAL_PROPORTIONAL) { if (pack_type.select == SELECT_EQUAL_PROPORTIONAL) {
wi.weight = item->weight * parent.get(item->name).total_weight; wi.weight = item->weight * parent.get(item->name).total_weight;
} else if (pack_type.select == SELECT_EQUAL_NONEMPTY) { } else if (pack_type.select == SELECT_EQUAL_NONEMPTY) {
wi.weight = parent.get(item->name).total_weight > 0 ? item->weight : 0; wi.weight = parent.get(item->name).total_weight > 0 ? static_cast<int>(item->weight) : 0;
} else { } else {
wi.weight = item->weight; wi.weight = item->weight;
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <data/field/information.hpp> #include <data/field/information.hpp>
#include <util/tagged_string.hpp> // for 0.2.7 fix #include <util/tagged_string.hpp> // for 0.2.7 fix
#include <util/order_cache.hpp> #include <util/order_cache.hpp>
#include <util/delayed_index_maps.hpp>
#include <script/script_manager.hpp> #include <script/script_manager.hpp>
#include <script/profiler.hpp> #include <script/profiler.hpp>
#include <wx/sstream.h> #include <wx/sstream.h>
......
...@@ -63,7 +63,7 @@ String format_input(const String& format, const ScriptValue& input) { ...@@ -63,7 +63,7 @@ String format_input(const String& format, const ScriptValue& input) {
// determine type of input // determine type of input
ScriptType type = input.type(); ScriptType type = input.type();
if (type == SCRIPT_DATETIME) { if (type == SCRIPT_DATETIME) {
return static_cast<wxDateTime>(input).Format(format.c_str()); input.toDateTime().Format(format.c_str());
} else { } else {
// determine type expected by format string // determine type expected by format string
String fmt = _("%") + replace_all(format, _("%"), _("")); String fmt = _("%") + replace_all(format, _("%"), _(""));
......
...@@ -78,6 +78,9 @@ class ScriptValue : public IntrusivePtrBaseWithDelete { ...@@ -78,6 +78,9 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
/** This is sometimes necessary, because wxString has an int constructor, /** This is sometimes necessary, because wxString has an int constructor,
* which confuses gcc. */ * which confuses gcc. */
inline String toString() const { return *this; } inline String toString() const { return *this; }
/// Explicit overload to convert to a wxDateTime
/** Overload resolution is sometimes confused by other conversions */
inline wxDateTime toDateTime() const { return *this; }
/// Convert this value to an image /// Convert this value to an image
virtual GeneratedImageP toImage(const ScriptValueP& thisP) const; virtual GeneratedImageP toImage(const ScriptValueP& thisP) const;
......
...@@ -149,6 +149,17 @@ ...@@ -149,6 +149,17 @@
/// Reflect a variable under the given name /// Reflect a variable under the given name
#define REFLECT_NO_SCRIPT_N(name, var) tag.handleNoScript(_(name), var) #define REFLECT_NO_SCRIPT_N(name, var) tag.handleNoScript(_(name), var)
/// Explicitly instantiate reflection; this is occasionally required.
#define INSTANTIATE_REFLECTION(Class) \
template void Class::reflect_impl<Reader> (Reader&); \
template void Class::reflect_impl<Writer> (Writer&); \
template void Class::reflect_impl<GetMember> (GetMember&);
#define INSTANTIATE_REFLECTION_NAMELESS(Class) \
template void Class::reflect_impl<Reader> (Reader&); \
template void Class::reflect_impl<Writer> (Writer&); \
template void Class::reflect_impl<GetDefaultMember> (GetDefaultMember&);
// ----------------------------------------------------------------------------- : Reflecting enums // ----------------------------------------------------------------------------- : Reflecting enums
/// Implement the refelection of a enumeration type Enum /// Implement the refelection of a enumeration type Enum
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment