mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57: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 <data/field/choice.hpp>
|
||||
#include <util/io/package.hpp>
|
||||
#include <util/defaultable.hpp>
|
||||
#include <wx/imaglist.h>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(ChoiceField::ChoiceP);
|
||||
@@ -303,3 +304,5 @@ bool ChoiceValue::update(Context& ctx) {
|
||||
IMPLEMENT_REFLECTION_NAMELESS(ChoiceValue) {
|
||||
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) {
|
||||
// add all cards
|
||||
generate_all(out, requested_copies);
|
||||
|
||||
|
||||
} else if (pack_type.select == SELECT_REPLACE
|
||||
|| pack_type.select == SELECT_PROPORTIONAL
|
||||
|| pack_type.select == SELECT_NONEMPTY) {
|
||||
@@ -384,7 +384,7 @@ void PackInstance::generate(vector<CardP>* out) {
|
||||
for (size_t i = 0 ; i < requested_copies ; ++i) {
|
||||
generate_one_random(out);
|
||||
}
|
||||
|
||||
|
||||
} else if (pack_type.select == SELECT_NO_REPLACE) {
|
||||
if (!pack_type.items.empty()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else if (pack_type.select == SELECT_EQUAL
|
||||
|| pack_type.select == SELECT_EQUAL_PROPORTIONAL
|
||||
|| pack_type.select == SELECT_EQUAL_NONEMPTY) {
|
||||
@@ -419,7 +419,7 @@ void PackInstance::generate(vector<CardP>* out) {
|
||||
if (pack_type.select == SELECT_EQUAL_PROPORTIONAL) {
|
||||
wi.weight = item->weight * parent.get(item->name).total_weight;
|
||||
} 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 {
|
||||
wi.weight = item->weight;
|
||||
}
|
||||
@@ -452,7 +452,7 @@ void PackInstance::generate(vector<CardP>* out) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else if (pack_type.select == SELECT_FIRST) {
|
||||
if (!cards.empty()) {
|
||||
// there is a card, pick it
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@
|
||||
#include <data/field/information.hpp>
|
||||
#include <util/tagged_string.hpp> // for 0.2.7 fix
|
||||
#include <util/order_cache.hpp>
|
||||
#include <util/delayed_index_maps.hpp>
|
||||
#include <script/script_manager.hpp>
|
||||
#include <script/profiler.hpp>
|
||||
#include <wx/sstream.h>
|
||||
@@ -145,7 +146,7 @@ void Set::validate(Version file_app_version) {
|
||||
if (stylesheet->game != game) {
|
||||
throw Error(_ERROR_("stylesheet and set refer to different game"));
|
||||
}
|
||||
|
||||
|
||||
// This is our chance to fix version incompatabilities
|
||||
if (file_app_version < 207) {
|
||||
// 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
|
||||
ScriptType type = input.type();
|
||||
if (type == SCRIPT_DATETIME) {
|
||||
return static_cast<wxDateTime>(input).Format(format.c_str());
|
||||
input.toDateTime().Format(format.c_str());
|
||||
} else {
|
||||
// determine type expected by format string
|
||||
String fmt = _("%") + replace_all(format, _("%"), _(""));
|
||||
|
||||
+11
-8
@@ -49,7 +49,7 @@ enum CompareWhat
|
||||
class ScriptValue : public IntrusivePtrBaseWithDelete {
|
||||
public:
|
||||
virtual ~ScriptValue() {}
|
||||
|
||||
|
||||
/// Information on the type of this value
|
||||
virtual ScriptType type() const = 0;
|
||||
/// Name of the type of value
|
||||
@@ -57,7 +57,7 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
|
||||
/// How to compare this object?
|
||||
/** Returns 1 if the pointer should be used, 0 otherwise */
|
||||
virtual CompareWhat compareAs(String& compare_str, void const*& compare_ptr) const;
|
||||
|
||||
|
||||
/// Convert this value to a string
|
||||
virtual operator String() const;
|
||||
/// Convert this value to a double
|
||||
@@ -70,20 +70,23 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
|
||||
virtual operator AColor() const;
|
||||
/// Convert this value to a wxDateTime
|
||||
virtual operator wxDateTime() const;
|
||||
|
||||
|
||||
/// Script code to generate this value
|
||||
virtual String toCode() const;
|
||||
|
||||
|
||||
/// Explicit overload to convert to a string
|
||||
/** This is sometimes necessary, because wxString has an int constructor,
|
||||
* which confuses gcc. */
|
||||
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
|
||||
virtual GeneratedImageP toImage(const ScriptValueP& thisP) const;
|
||||
|
||||
|
||||
/// Get a member variable from this value
|
||||
virtual ScriptValueP getMember(const String& name) const;
|
||||
|
||||
|
||||
/// Signal that a script depends on this value itself
|
||||
virtual void dependencyThis(const Dependency& dep);
|
||||
/// 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
|
||||
/** This function allows for a kind of visitor pattern over dependencyMember */
|
||||
virtual ScriptValueP dependencyName(const ScriptValue& container, const Dependency&) const;
|
||||
|
||||
|
||||
/// Evaluate this value (if it is a function)
|
||||
virtual ScriptValueP eval(Context&) const;
|
||||
/// Mark the scripts that this function depends on
|
||||
@@ -103,7 +106,7 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
|
||||
* Alternatively, the closure may be modified in place.
|
||||
*/
|
||||
virtual ScriptValueP simplifyClosure(ScriptClosure&) const;
|
||||
|
||||
|
||||
/// 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 */
|
||||
virtual ScriptValueP makeIterator(const ScriptValueP& thisP) const;
|
||||
|
||||
@@ -149,6 +149,17 @@
|
||||
/// Reflect a variable under the given name
|
||||
#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
|
||||
|
||||
/// Implement the refelection of a enumeration type Enum
|
||||
|
||||
Reference in New Issue
Block a user