mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Fixed a bunch of linker errors preventing optimized compile on Linux.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1352 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -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) {
|
|||||||
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)
|
||||||
|
|||||||
+5
-5
@@ -376,7 +376,7 @@ void PackInstance::generate(vector<CardP>* out) {
|
|||||||
if (pack_type.select == SELECT_ALL) {
|
if (pack_type.select == SELECT_ALL) {
|
||||||
// add all cards
|
// add all cards
|
||||||
generate_all(out, requested_copies);
|
generate_all(out, requested_copies);
|
||||||
|
|
||||||
} else if (pack_type.select == SELECT_REPLACE
|
} else if (pack_type.select == SELECT_REPLACE
|
||||||
|| pack_type.select == SELECT_PROPORTIONAL
|
|| pack_type.select == SELECT_PROPORTIONAL
|
||||||
|| pack_type.select == SELECT_NONEMPTY) {
|
|| pack_type.select == SELECT_NONEMPTY) {
|
||||||
@@ -384,7 +384,7 @@ void PackInstance::generate(vector<CardP>* out) {
|
|||||||
for (size_t i = 0 ; i < requested_copies ; ++i) {
|
for (size_t i = 0 ; i < requested_copies ; ++i) {
|
||||||
generate_one_random(out);
|
generate_one_random(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (pack_type.select == SELECT_NO_REPLACE) {
|
} else if (pack_type.select == SELECT_NO_REPLACE) {
|
||||||
if (!pack_type.items.empty()) {
|
if (!pack_type.items.empty()) {
|
||||||
throw Error(_("'select:no replace' is not yet supported in combination with 'items', only with 'filter'."));
|
throw Error(_("'select:no replace' is not yet supported in combination with 'items', only with 'filter'."));
|
||||||
@@ -402,7 +402,7 @@ void PackInstance::generate(vector<CardP>* out) {
|
|||||||
rem -= max_per_batch;
|
rem -= max_per_batch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (pack_type.select == SELECT_EQUAL
|
} else if (pack_type.select == SELECT_EQUAL
|
||||||
|| pack_type.select == SELECT_EQUAL_PROPORTIONAL
|
|| pack_type.select == SELECT_EQUAL_PROPORTIONAL
|
||||||
|| pack_type.select == SELECT_EQUAL_NONEMPTY) {
|
|| pack_type.select == SELECT_EQUAL_NONEMPTY) {
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -452,7 +452,7 @@ void PackInstance::generate(vector<CardP>* out) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (pack_type.select == SELECT_FIRST) {
|
} else if (pack_type.select == SELECT_FIRST) {
|
||||||
if (!cards.empty()) {
|
if (!cards.empty()) {
|
||||||
// there is a card, pick it
|
// there is a card, pick it
|
||||||
|
|||||||
+2
-1
@@ -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>
|
||||||
@@ -145,7 +146,7 @@ void Set::validate(Version file_app_version) {
|
|||||||
if (stylesheet->game != game) {
|
if (stylesheet->game != game) {
|
||||||
throw Error(_ERROR_("stylesheet and set refer to different game"));
|
throw Error(_ERROR_("stylesheet and set refer to different game"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is our chance to fix version incompatabilities
|
// This is our chance to fix version incompatabilities
|
||||||
if (file_app_version < 207) {
|
if (file_app_version < 207) {
|
||||||
// Since 0.2.7 we use </tag> style close tags, in older versions it was </>
|
// Since 0.2.7 we use </tag> style close tags, in older versions it was </>
|
||||||
|
|||||||
@@ -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, _("%"), _(""));
|
||||||
|
|||||||
+11
-8
@@ -49,7 +49,7 @@ enum CompareWhat
|
|||||||
class ScriptValue : public IntrusivePtrBaseWithDelete {
|
class ScriptValue : public IntrusivePtrBaseWithDelete {
|
||||||
public:
|
public:
|
||||||
virtual ~ScriptValue() {}
|
virtual ~ScriptValue() {}
|
||||||
|
|
||||||
/// Information on the type of this value
|
/// Information on the type of this value
|
||||||
virtual ScriptType type() const = 0;
|
virtual ScriptType type() const = 0;
|
||||||
/// Name of the type of value
|
/// Name of the type of value
|
||||||
@@ -57,7 +57,7 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
|
|||||||
/// How to compare this object?
|
/// How to compare this object?
|
||||||
/** Returns 1 if the pointer should be used, 0 otherwise */
|
/** Returns 1 if the pointer should be used, 0 otherwise */
|
||||||
virtual CompareWhat compareAs(String& compare_str, void const*& compare_ptr) const;
|
virtual CompareWhat compareAs(String& compare_str, void const*& compare_ptr) const;
|
||||||
|
|
||||||
/// Convert this value to a string
|
/// Convert this value to a string
|
||||||
virtual operator String() const;
|
virtual operator String() const;
|
||||||
/// Convert this value to a double
|
/// Convert this value to a double
|
||||||
@@ -70,20 +70,23 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
|
|||||||
virtual operator AColor() const;
|
virtual operator AColor() const;
|
||||||
/// Convert this value to a wxDateTime
|
/// Convert this value to a wxDateTime
|
||||||
virtual operator wxDateTime() const;
|
virtual operator wxDateTime() const;
|
||||||
|
|
||||||
/// Script code to generate this value
|
/// Script code to generate this value
|
||||||
virtual String toCode() const;
|
virtual String toCode() const;
|
||||||
|
|
||||||
/// Explicit overload to convert to a string
|
/// Explicit overload to convert to a string
|
||||||
/** 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;
|
||||||
|
|
||||||
/// Get a member variable from this value
|
/// Get a member variable from this value
|
||||||
virtual ScriptValueP getMember(const String& name) const;
|
virtual ScriptValueP getMember(const String& name) const;
|
||||||
|
|
||||||
/// Signal that a script depends on this value itself
|
/// Signal that a script depends on this value itself
|
||||||
virtual void dependencyThis(const Dependency& dep);
|
virtual void dependencyThis(const Dependency& dep);
|
||||||
/// Signal that a script depends on a member of this value
|
/// Signal that a script depends on a member of this value
|
||||||
@@ -92,7 +95,7 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
|
|||||||
/// Signal that a script depends on a member of container, with the name of this
|
/// Signal that a script depends on a member of container, with the name of this
|
||||||
/** This function allows for a kind of visitor pattern over dependencyMember */
|
/** This function allows for a kind of visitor pattern over dependencyMember */
|
||||||
virtual ScriptValueP dependencyName(const ScriptValue& container, const Dependency&) const;
|
virtual ScriptValueP dependencyName(const ScriptValue& container, const Dependency&) const;
|
||||||
|
|
||||||
/// Evaluate this value (if it is a function)
|
/// Evaluate this value (if it is a function)
|
||||||
virtual ScriptValueP eval(Context&) const;
|
virtual ScriptValueP eval(Context&) const;
|
||||||
/// Mark the scripts that this function depends on
|
/// Mark the scripts that this function depends on
|
||||||
@@ -103,7 +106,7 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
|
|||||||
* Alternatively, the closure may be modified in place.
|
* Alternatively, the closure may be modified in place.
|
||||||
*/
|
*/
|
||||||
virtual ScriptValueP simplifyClosure(ScriptClosure&) const;
|
virtual ScriptValueP simplifyClosure(ScriptClosure&) const;
|
||||||
|
|
||||||
/// Return an iterator for the current collection, an iterator is a value that has next()
|
/// Return an iterator for the current collection, an iterator is a value that has next()
|
||||||
/** thisP can be used to prevent destruction of the collection */
|
/** thisP can be used to prevent destruction of the collection */
|
||||||
virtual ScriptValueP makeIterator(const ScriptValueP& thisP) const;
|
virtual ScriptValueP makeIterator(const ScriptValueP& thisP) const;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user