summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-12-29 12:06:26 -0500
committerBen Boeckel <MathStuf@gmail.com>2008-12-29 12:06:26 -0500
commitcb83f5255b360d64c32c7e45d11d242e104e62f5 (patch)
treec6611bf95729c4539f53d514d24847d2945408b9
parent02d571db3ef9fa2cb73203ef3dc46827ee6960cf (diff)
downloadsigen-sigmod-checks.tar.gz
sigen-sigmod-checks.tar.xz
sigen-sigmod-checks.zip
Added macos for overriding values in sigscriptsigmod-checks
-rw-r--r--sigscript/AbilityWrapper.cpp3
-rw-r--r--sigscript/CoinListItemWrapper.cpp3
-rw-r--r--sigscript/Global.h11
-rw-r--r--sigscript/ItemTypeWrapper.cpp3
-rw-r--r--sigscript/ItemWrapper.cpp6
-rw-r--r--sigscript/MapEffectWrapper.cpp6
-rw-r--r--sigscript/MapTileWrapper.cpp6
-rw-r--r--sigscript/MapTrainerTeamMemberWrapper.cpp3
-rw-r--r--sigscript/MapWarpWrapper.cpp3
-rw-r--r--sigscript/MapWildListEncounterWrapper.cpp6
-rw-r--r--sigscript/MoveWrapper.cpp9
-rw-r--r--sigscript/RulesWrapper.cpp45
-rw-r--r--sigscript/SpeciesItemWrapper.cpp3
-rw-r--r--sigscript/SpeciesWrapper.cpp12
-rw-r--r--sigscript/TileWrapper.cpp3
-rw-r--r--sigscript/TrainerWrapper.cpp6
16 files changed, 50 insertions, 78 deletions
diff --git a/sigscript/AbilityWrapper.cpp b/sigscript/AbilityWrapper.cpp
index a08a8e4e..6627f5f7 100644
--- a/sigscript/AbilityWrapper.cpp
+++ b/sigscript/AbilityWrapper.cpp
@@ -42,8 +42,7 @@ QString Sigscript::AbilityWrapper::name() const
int Sigscript::AbilityWrapper::priority() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("priority"))
- return valueOfType<int>("priority");
+ ALLOW_OVERRIDE_SO(ability, int, priority);
return m_ability->priority();
}
diff --git a/sigscript/CoinListItemWrapper.cpp b/sigscript/CoinListItemWrapper.cpp
index 01bf3094..fd154efe 100644
--- a/sigscript/CoinListItemWrapper.cpp
+++ b/sigscript/CoinListItemWrapper.cpp
@@ -66,7 +66,6 @@ Sigscript::SpeciesWrapper* Sigscript::CoinListItemWrapper::speciesObject()
int Sigscript::CoinListItemWrapper::cost() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("cost"))
- return valueOfType<int>("cost");
+ ALLOW_OVERRIDE_SO(object, int, cost);
return m_object->cost();
}
diff --git a/sigscript/Global.h b/sigscript/Global.h
index c8ab9c93..9c60b170 100644
--- a/sigscript/Global.h
+++ b/sigscript/Global.h
@@ -34,4 +34,15 @@
# define SIGSCRIPT_EXPORT_DEPRECATED KDE_DEPRECATED SIGSCRIPT_EXPORT
#endif
+#ifdef MAKE_SIGSCRIPT_LIB
+
+#define ALLOW_OVERRIDE_SO(class, type, variable) \
+ if (sigmod()->singlePlayer()) \
+ ALLOW_OVERRIDE(class, type, variable)
+#define ALLOW_OVERRIDE(class, type, variable) \
+ if (hasValueOfType<type>(#variable) && m_##class->variable##Check(valueOfType<type>(#variable))) \
+ return valueOfType<type>(#variable)
+
+#endif
+
#endif
diff --git a/sigscript/ItemTypeWrapper.cpp b/sigscript/ItemTypeWrapper.cpp
index 8201a33b..42008c7a 100644
--- a/sigscript/ItemTypeWrapper.cpp
+++ b/sigscript/ItemTypeWrapper.cpp
@@ -61,8 +61,7 @@ int Sigscript::ItemTypeWrapper::player() const
int Sigscript::ItemTypeWrapper::maxWeight() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxWeight"))
- return valueOfType<int>("maxWeight");
+ ALLOW_OVERRIDE_SO(itemType, int, maxWeight);
return m_itemType->maxWeight();
}
diff --git a/sigscript/ItemWrapper.cpp b/sigscript/ItemWrapper.cpp
index 1e341144..22706474 100644
--- a/sigscript/ItemWrapper.cpp
+++ b/sigscript/ItemWrapper.cpp
@@ -52,15 +52,13 @@ Sigscript::ItemTypeWrapper* Sigscript::ItemWrapper::type()
int Sigscript::ItemWrapper::price() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("price"))
- return valueOfType<int>("price");
+ ALLOW_OVERRIDE_SO(item, int, price);
return m_item->price();
}
int Sigscript::ItemWrapper::sellPrice() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("sellPrice"))
- return valueOfType<int>("sellPrice");
+ ALLOW_OVERRIDE_SO(item, int, sellPrice);
return m_item->sellPrice();
}
diff --git a/sigscript/MapEffectWrapper.cpp b/sigscript/MapEffectWrapper.cpp
index 0302c89d..d51cdca0 100644
--- a/sigscript/MapEffectWrapper.cpp
+++ b/sigscript/MapEffectWrapper.cpp
@@ -43,8 +43,7 @@ QString Sigscript::MapEffectWrapper::name() const
QPoint Sigscript::MapEffectWrapper::coordinate() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<QPoint>("coordinate"))
- return valueOfType<QPoint>("coordinate");
+ ALLOW_OVERRIDE_SO(effect, QPoint, coordinate);
return m_effect->coordinate();
}
@@ -55,8 +54,7 @@ Sigscript::SkinWrapper* Sigscript::MapEffectWrapper::skin()
bool Sigscript::MapEffectWrapper::isGhost() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<bool>("ghost"))
- return valueOfType<bool>("ghost");
+ ALLOW_OVERRIDE_SO(effect, bool, isGhost);
return m_effect->isGhost();
}
diff --git a/sigscript/MapTileWrapper.cpp b/sigscript/MapTileWrapper.cpp
index 2ca2abbe..2faef412 100644
--- a/sigscript/MapTileWrapper.cpp
+++ b/sigscript/MapTileWrapper.cpp
@@ -43,14 +43,12 @@ Sigscript::TileWrapper* Sigscript::MapTileWrapper::tile()
QPoint Sigscript::MapTileWrapper::position() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<QPoint>("position"))
- return valueOfType<QPoint>("position");
+ ALLOW_OVERRIDE_SO(tile, QPoint, position);
return m_tile->position();
}
int Sigscript::MapTileWrapper::zIndex() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("zIndex"))
- return valueOfType<int>("zIndex");
+ ALLOW_OVERRIDE_SO(tile, int, zIndex);
return m_tile->zIndex();
}
diff --git a/sigscript/MapTrainerTeamMemberWrapper.cpp b/sigscript/MapTrainerTeamMemberWrapper.cpp
index 41d47ea9..6309c1d7 100644
--- a/sigscript/MapTrainerTeamMemberWrapper.cpp
+++ b/sigscript/MapTrainerTeamMemberWrapper.cpp
@@ -43,8 +43,7 @@ Sigscript::SpeciesWrapper* Sigscript::MapTrainerTeamMemberWrapper::species()
int Sigscript::MapTrainerTeamMemberWrapper::level() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("level"))
- return valueOfType<int>("level");
+ ALLOW_OVERRIDE_SO(teamMember, int, level);
return m_teamMember->level();
}
diff --git a/sigscript/MapWarpWrapper.cpp b/sigscript/MapWarpWrapper.cpp
index 4af106a9..70547608 100644
--- a/sigscript/MapWarpWrapper.cpp
+++ b/sigscript/MapWarpWrapper.cpp
@@ -56,8 +56,7 @@ QString Sigscript::MapWarpWrapper::name() const
QRect Sigscript::MapWarpWrapper::area() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<QRect>("area"))
- return valueOfType<QRect>("area");
+ ALLOW_OVERRIDE_SO(warp, QRect, area);
return m_warp->area();
}
diff --git a/sigscript/MapWildListEncounterWrapper.cpp b/sigscript/MapWildListEncounterWrapper.cpp
index 1d2b7904..b6d6daf4 100644
--- a/sigscript/MapWildListEncounterWrapper.cpp
+++ b/sigscript/MapWildListEncounterWrapper.cpp
@@ -43,14 +43,12 @@ Sigscript::SpeciesWrapper* Sigscript::MapWildListEncounterWrapper::species()
int Sigscript::MapWildListEncounterWrapper::level() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("level"))
- return valueOfType<int>("level");
+ ALLOW_OVERRIDE_SO(encounter, int, level);
return m_encounter->level();
}
int Sigscript::MapWildListEncounterWrapper::weight() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("weight"))
- return valueOfType<int>("weight");
+ ALLOW_OVERRIDE_SO(encounter, int, weight);
return m_encounter->weight();
}
diff --git a/sigscript/MoveWrapper.cpp b/sigscript/MoveWrapper.cpp
index 8242e88f..17c3b4f2 100644
--- a/sigscript/MoveWrapper.cpp
+++ b/sigscript/MoveWrapper.cpp
@@ -42,15 +42,13 @@ QString Sigscript::MoveWrapper::name() const
Sigcore::Fraction Sigscript::MoveWrapper::accuracy() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<Sigcore::Fraction>("accuracy"))
- return valueOfType<Sigcore::Fraction>("accuracy");
+ ALLOW_OVERRIDE_SO(move, Sigcore::Fraction, accuracy);
return m_move->accuracy();
}
int Sigscript::MoveWrapper::power() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("power"))
- return valueOfType<int>("power");
+ ALLOW_OVERRIDE_SO(move, int, power);
return m_move->power();
}
@@ -71,8 +69,7 @@ int Sigscript::MoveWrapper::powerPoints() const
int Sigscript::MoveWrapper::priority() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("priority"))
- return valueOfType<int>("priority");
+ ALLOW_OVERRIDE_SO(move, int, priority);
return m_move->priority();
}
diff --git a/sigscript/RulesWrapper.cpp b/sigscript/RulesWrapper.cpp
index 39efd685..a5f78592 100644
--- a/sigscript/RulesWrapper.cpp
+++ b/sigscript/RulesWrapper.cpp
@@ -57,50 +57,43 @@ bool Sigscript::RulesWrapper::useTurns() const
bool Sigscript::RulesWrapper::pausedATB() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<bool>("pausedATB"))
- return valueOfType<bool>("pausedATB");
+ ALLOW_OVERRIDE_SO(rules, bool, pausedATB);
return m_rules->pausedATB();
}
int Sigscript::RulesWrapper::numBoxes() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("numBoxes"))
- return valueOfType<int>("numBoxes");
+ ALLOW_OVERRIDE_SO(rules, int, numBoxes);
return m_rules->numBoxes();
}
int Sigscript::RulesWrapper::boxSize() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("boxSize"))
- return valueOfType<int>("boxSize");
+ ALLOW_OVERRIDE_SO(rules, int, boxSize);
return m_rules->boxSize();
}
int Sigscript::RulesWrapper::maxParty() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxParty"))
- return valueOfType<int>("maxParty");
+ ALLOW_OVERRIDE_SO(rules, int, maxParty);
return m_rules->maxParty();
}
int Sigscript::RulesWrapper::maxFight() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxFight"))
- return valueOfType<int>("maxFight");
+ ALLOW_OVERRIDE_SO(rules, int, maxFight);
return m_rules->maxFight();
}
int Sigscript::RulesWrapper::maxPlayers() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxFight"))
- return valueOfType<int>("maxFight");
+ ALLOW_OVERRIDE_SO(rules, int, maxFight);
return m_rules->maxPlayers();
}
int Sigscript::RulesWrapper::maxHeldItems() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxHeldItems"))
- return valueOfType<int>("maxHeldItems");
+ ALLOW_OVERRIDE_SO(rules, int, maxHeldItems);
return m_rules->maxHeldItems();
}
@@ -116,43 +109,37 @@ int Sigscript::RulesWrapper::maxNatures() const
int Sigscript::RulesWrapper::maxMoves() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxMoves"))
- return valueOfType<int>("maxMoves");
+ ALLOW_OVERRIDE_SO(rules, int, maxMoves);
return m_rules->maxMoves();
}
int Sigscript::RulesWrapper::maxLevel() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxLevel"))
- return valueOfType<int>("maxLevel");
+ ALLOW_OVERRIDE_SO(rules, int, maxLevel);
return m_rules->maxLevel();
}
int Sigscript::RulesWrapper::maxStages() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxStages"))
- return valueOfType<int>("maxStages");
+ ALLOW_OVERRIDE_SO(rules, int, maxStages);
return m_rules->maxStages();
}
int Sigscript::RulesWrapper::maxMoney() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxMoney"))
- return valueOfType<int>("maxMoney");
+ ALLOW_OVERRIDE_SO(rules, int, maxMoney);
return m_rules->maxMoney();
}
int Sigscript::RulesWrapper::maxTotalWeight() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxTotalWeight"))
- return valueOfType<int>("maxTotalWeight");
+ ALLOW_OVERRIDE_SO(rules, int, maxTotalWeight);
return m_rules->maxTotalWeight();
}
bool Sigscript::RulesWrapper::allowSwitchStyle() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<bool>("allowSwitchStyle"))
- return valueOfType<bool>("allowSwitchStyle");
+ ALLOW_OVERRIDE_SO(rules, bool, allowSwitchStyle);
return m_rules->allowSwitchStyle();
}
@@ -173,14 +160,12 @@ bool Sigscript::RulesWrapper::effortValuesAllowed() const
int Sigscript::RulesWrapper::maxTotalEV() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxTotalEV"))
- return valueOfType<int>("maxTotalEV");
+ ALLOW_OVERRIDE_SO(rules, int, maxTotalEV);
return m_rules->maxTotalEV();
}
int Sigscript::RulesWrapper::maxEVPerStat() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("maxEVPerStat"))
- return valueOfType<int>("maxEVPerStat");
+ ALLOW_OVERRIDE_SO(rules, int, maxEVPerStat);
return m_rules->maxEVPerStat();
}
diff --git a/sigscript/SpeciesItemWrapper.cpp b/sigscript/SpeciesItemWrapper.cpp
index a41f8dc5..a734c978 100644
--- a/sigscript/SpeciesItemWrapper.cpp
+++ b/sigscript/SpeciesItemWrapper.cpp
@@ -43,7 +43,6 @@ Sigscript::ItemWrapper* Sigscript::SpeciesItemWrapper::item()
int Sigscript::SpeciesItemWrapper::weight() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("weight"))
- return valueOfType<int>("weight");
+ ALLOW_OVERRIDE_SO(item, int, weight);
return m_item->weight();
}
diff --git a/sigscript/SpeciesWrapper.cpp b/sigscript/SpeciesWrapper.cpp
index c1ea6da0..08c59b68 100644
--- a/sigscript/SpeciesWrapper.cpp
+++ b/sigscript/SpeciesWrapper.cpp
@@ -108,22 +108,19 @@ int Sigscript::SpeciesWrapper::maxHoldWeight() const
Sigcore::Fraction Sigscript::SpeciesWrapper::runChance() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<Sigcore::Fraction>("runChance"))
- return valueOfType<Sigcore::Fraction>("runChance");
+ ALLOW_OVERRIDE_SO(species, Sigcore::Fraction, runChance);
return m_species->runChance();
}
Sigcore::Fraction Sigscript::SpeciesWrapper::fleeChance() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<Sigcore::Fraction>("fleeChance"))
- return valueOfType<Sigcore::Fraction>("fleeChance");
+ ALLOW_OVERRIDE_SO(species, Sigcore::Fraction, fleeChance);
return m_species->fleeChance();
}
Sigcore::Fraction Sigscript::SpeciesWrapper::itemChance() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<Sigcore::Fraction>("itemChance"))
- return valueOfType<Sigcore::Fraction>("itemChance");
+ ALLOW_OVERRIDE_SO(species, Sigcore::Fraction, itemChance);
return m_species->itemChance();
}
@@ -179,8 +176,7 @@ Sigcore::Fraction Sigscript::SpeciesWrapper::genderFactor() const
int Sigscript::SpeciesWrapper::eggSpecies() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("eggSpecies"))
- return valueOfType<int>("eggSpecies");
+ ALLOW_OVERRIDE_SO(species, int, eggSpecies);
return m_species->eggSpecies();
}
diff --git a/sigscript/TileWrapper.cpp b/sigscript/TileWrapper.cpp
index 2674caa8..5d7b5a55 100644
--- a/sigscript/TileWrapper.cpp
+++ b/sigscript/TileWrapper.cpp
@@ -42,8 +42,7 @@ QString Sigscript::TileWrapper::name() const
bool Sigscript::TileWrapper::walkable() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<bool>("walkable"))
- return valueOfType<bool>("walkable");
+ ALLOW_OVERRIDE_SO(tile, bool, walkable);
return m_tile->walkable();
}
diff --git a/sigscript/TrainerWrapper.cpp b/sigscript/TrainerWrapper.cpp
index 34751aa7..52a8f99b 100644
--- a/sigscript/TrainerWrapper.cpp
+++ b/sigscript/TrainerWrapper.cpp
@@ -55,8 +55,7 @@ QString Sigscript::TrainerWrapper::TrainerWrapper::name() const
int Sigscript::TrainerWrapper::TrainerWrapper::moneyFactor() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("moneyFactor"))
- return valueOfType<int>("moneyFactor");
+ ALLOW_OVERRIDE_SO(trainer, int, moneyFactor);
return m_trainer->moneyFactor();
}
@@ -67,8 +66,7 @@ Sigscript::SkinWrapper* Sigscript::TrainerWrapper::TrainerWrapper::skin()
int Sigscript::TrainerWrapper::TrainerWrapper::depth() const
{
- if (sigmod()->singlePlayer() && hasValueOfType<int>("depth"))
- return valueOfType<int>("depth");
+ ALLOW_OVERRIDE_SO(trainer, int, depth);
return m_trainer->depth();
}