Compare commits

..
Author SHA1 Message Date
admin 8eaa748c4d Use direct roll vector declarations 2026-06-23 12:50:28 -07:00
5 changed files with 35 additions and 35 deletions
@@ -49,7 +49,7 @@ class ArcheryCommandFactoryTest : public ::testing::Test {
auto def1Offset = AddGenericUnit(1, 1, def1pos);
auto def2Offset = AddGenericUnit(1, 2, def2pos);
vector<Unit> vec{attackerUnit, def1Offset, def2Offset};
auto vec = vector<Unit>{attackerUnit, def1Offset, def2Offset};
auto u = fbb.CreateVectorOfSortedStructs(&vec);
fbb.Finish(u);
@@ -22,7 +22,7 @@ class MeleeCommandFactoryTests : public ::testing::Test {
auto actorOff = AddGenericUnit(5, 0, position);
auto defenderOff = AddGenericUnit(3, 1, defenderPosition);
std::vector<Unit> unitsVec{actorOff, defenderOff};
auto unitsVec = std::vector<Unit>{actorOff, defenderOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
auto mapOff = AddBasicMap(fbb);
@@ -60,7 +60,7 @@ protected:
TEST_F(ArcheryCommandTests, Execute_givesAgilityXp) {
attacker->mutable_attached_hero().mutate_agility_xp(88);
auto rolls = vector<double>{0.0, 0.50};
vector<double> rolls{0.0, 0.50};
auto generator = SequenceRandomGenerator::WithSequence(rolls);
auto action = ArcheryCommand(
@@ -85,7 +85,7 @@ TEST_F(ArcheryCommandTests, ExecuteWithAmbush_givesExtraAgilityXp) {
attacker->mutable_attached_hero().mutate_agility_xp(88);
attacker->mutate_hidden(true);
auto rolls = vector<double>{0.0, 0.50};
vector<double> rolls{0.0, 0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
auto action = ArcheryCommand(
@@ -110,7 +110,7 @@ TEST_F(ArcheryCommandTests, Execute_hiddenAttacker_unhides) {
attacker->mutate_hidden(true);
attacker->mutable_attached_hero().mutate_agility_xp(88);
auto rolls = vector<double>{0.0, 0.50};
vector<double> rolls{0.0, 0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
auto action = ArcheryCommand(
@@ -133,7 +133,7 @@ TEST_F(ArcheryCommandTests, Execute_hiddenAttacker_unhides) {
TEST_F(ArcheryCommandTests, Execute_hiddenAttackerLowRoll_ambushes) {
attacker->mutate_hidden(true);
auto rolls = vector<double>{0.25, 0.50};
vector<double> rolls{0.25, 0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
auto action = ArcheryCommand(
@@ -157,7 +157,7 @@ TEST_F(ArcheryCommandTests, Execute_hiddenAttackerLowRoll_attackerInCastle_noAmb
terrainWithCastle.mutable_modifier().mutable_castle().mutate_present(true);
terrainWithCastle.mutable_modifier().mutable_castle().mutate_integrity(100.0);
auto rolls = vector<double>{0.25, 0.50};
vector<double> rolls{0.25, 0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
auto action = ArcheryCommand(
@@ -177,7 +177,7 @@ TEST_F(ArcheryCommandTests, Execute_hiddenAttackerLowRoll_attackerInCastle_noAmb
TEST_F(ArcheryCommandTests, Execute_hiddenAttackerHighRoll_noAmbush) {
attacker->mutate_hidden(true);
auto rolls = vector<double>{0.75, 0.50};
vector<double> rolls{0.75, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
const auto results = ArcheryCommand(
@@ -199,7 +199,7 @@ TEST_F(ArcheryCommandTests, Execute_hiddenAttackerHighRoll_noAmbush) {
TEST_F(ArcheryCommandTests, Execute_onStunnedDefender_doesMoreDamage) {
GetGameSettingsSetter().SetDouble(kSettingsKeys.damageReceivedMultiplierFromStun, 1.25);
auto rolls = vector<double>{0.75, 0.50};
vector<double> rolls{0.75, 0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
auto results = ArcheryCommand(
@@ -81,7 +81,7 @@ protected:
};
TEST_F(ChargeCommandTests, Execute_givesAttackerStrengthAndAgilityXp) {
auto rolls = vector<double>{0.50, 0.50};
vector<double> rolls{0.50, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
attacker->mutable_attached_hero().mutate_strength_xp(57);
@@ -107,7 +107,7 @@ TEST_F(ChargeCommandTests, Execute_givesAttackerStrengthAndAgilityXp) {
}
TEST_F(ChargeCommandTests, Execute_givesDefenderStrengthXp) {
auto rolls = vector<double>{0.50, 0.50};
vector<double> rolls{0.50, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
defender->mutable_attached_hero().mutate_strength_xp(57);
@@ -131,7 +131,7 @@ TEST_F(ChargeCommandTests, Execute_givesDefenderStrengthXp) {
}
TEST_F(ChargeCommandTests, Execute_hiddenAttacker_unhides) {
auto rolls = vector<double>{0.50, 0.50};
vector<double> rolls{0.50, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
attacker->mutate_hidden(true);
@@ -154,7 +154,7 @@ TEST_F(ChargeCommandTests, Execute_hiddenAttacker_unhides) {
}
TEST_F(ChargeCommandTests, Execute_highRoll_stunsDefender) {
auto rolls = vector<double>{1.00, 0.50};
vector<double> rolls{1.00, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
const auto action = ChargeCommand(
@@ -172,7 +172,7 @@ TEST_F(ChargeCommandTests, Execute_highRoll_stunsDefender) {
}
TEST_F(ChargeCommandTests, Execute_rollUnderOdds_doesNotStun) {
auto rolls = vector<double>{0.0, 0.50};
vector<double> rolls{0.0, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
const auto action = ChargeCommand(
@@ -190,7 +190,7 @@ TEST_F(ChargeCommandTests, Execute_rollUnderOdds_doesNotStun) {
}
TEST_F(ChargeCommandTests, Execute_usesAllWhenSet) {
auto rolls = vector<double>{0.0, 0.50};
vector<double> rolls{0.0, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
const auto action = ChargeCommand(
@@ -208,7 +208,7 @@ TEST_F(ChargeCommandTests, Execute_usesAllWhenSet) {
}
TEST_F(ChargeCommandTests, Execute_leavesPointsWhenNotSet) {
auto rolls = vector<double>{0.0, 0.50};
vector<double> rolls{0.0, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
const auto action = ChargeCommand(
@@ -226,7 +226,7 @@ TEST_F(ChargeCommandTests, Execute_leavesPointsWhenNotSet) {
}
TEST_F(ChargeCommandTests, Execute_resetsMovedIntoZoc) {
auto rolls = vector<double>{0.0, 0.50};
vector<double> rolls{0.0, 0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
attacker->mutate_has_moved_in_zoc(true);
@@ -83,7 +83,7 @@ public:
};
TEST_F(ReduceCommandTests, BasicResult) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
auto cmd = ReduceCommand(
@@ -110,7 +110,7 @@ TEST_F(ReduceCommandTests, BasicResult) {
}
TEST_F(ReduceCommandTests, SpendsActionPoints) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
const auto cmd = ReduceCommand(
@@ -135,7 +135,7 @@ TEST_F(ReduceCommandTests, SpendsActionPoints) {
}
TEST_F(ReduceCommandTests, GivesXp) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
const auto cmd = ReduceCommand(
@@ -161,7 +161,7 @@ TEST_F(ReduceCommandTests, GivesXp) {
}
TEST_F(ReduceCommandTests, IncreasesKnowledgeToMinimum) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
actor->mutable_opponent_knowledge()->Mutate(3, 6);
@@ -191,7 +191,7 @@ TEST_F(ReduceCommandTests, IncreasesKnowledgeToMinimum) {
}
TEST_F(ReduceCommandTests, NoStructure_damagesOccupant) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
targetTerrain->mutable_modifier().mutable_castle().mutate_present(false);
@@ -220,7 +220,7 @@ TEST_F(ReduceCommandTests, NoStructure_damagesOccupant) {
}
TEST_F(ReduceCommandTests, Fortified_removesOccupantFortification) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
targetUnit->mutate_fortified(true);
@@ -249,7 +249,7 @@ TEST_F(ReduceCommandTests, Fortified_removesOccupantFortification) {
}
TEST_F(ReduceCommandTests, AlreadyDestroyedCastle_damagesOccupant) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
const auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
targetTerrain->mutable_modifier().mutable_castle().mutate_integrity(0.0);
@@ -278,7 +278,7 @@ TEST_F(ReduceCommandTests, AlreadyDestroyedCastle_damagesOccupant) {
}
TEST_F(ReduceCommandTests, DamagesBridge) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
targetTerrain->mutable_modifier().mutable_castle().mutate_present(false);
@@ -310,7 +310,7 @@ TEST_F(ReduceCommandTests, DamagesBridge) {
}
TEST_F(ReduceCommandTests, DamagesCastle) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
auto cmd = ReduceCommand(
@@ -338,7 +338,7 @@ TEST_F(ReduceCommandTests, DamagesCastle) {
}
TEST_F(ReduceCommandTests, DamagesCastle_alsoDamagesOccupant) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
auto cmd = ReduceCommand(
@@ -367,7 +367,7 @@ TEST_F(ReduceCommandTests, DamagesCastle_alsoDamagesOccupant) {
}
TEST_F(ReduceCommandTests, AverageHero_doesAverageDamage) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
actor->mutable_attached_hero().mutate_agility(50.0);
@@ -399,7 +399,7 @@ TEST_F(ReduceCommandTests, AverageHero_doesAverageDamage) {
}
TEST_F(ReduceCommandTests, CastleDamage_IntelligenceHelps) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
actor->mutable_attached_hero().mutate_agility(50.0);
@@ -431,7 +431,7 @@ TEST_F(ReduceCommandTests, CastleDamage_IntelligenceHelps) {
}
TEST_F(ReduceCommandTests, CastleDamage_AgilityHelps) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
actor->mutable_attached_hero().mutate_agility(90.0);
@@ -463,7 +463,7 @@ TEST_F(ReduceCommandTests, CastleDamage_AgilityHelps) {
}
TEST_F(ReduceCommandTests, CastleDamage_StrengthHelps) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
actor->mutable_attached_hero().mutate_agility(50.0);
@@ -495,7 +495,7 @@ TEST_F(ReduceCommandTests, CastleDamage_StrengthHelps) {
}
TEST_F(ReduceCommandTests, CastleDamage_RollHelps) {
auto rolls = vector<double>{0.80};
vector<double> rolls{0.80};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
actor->mutable_attached_hero().mutate_agility(50.0);
@@ -527,7 +527,7 @@ TEST_F(ReduceCommandTests, CastleDamage_RollHelps) {
}
TEST_F(ReduceCommandTests, CastleDamage_ForestAccessHelps) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
actor->mutable_attached_hero().mutate_agility(50.0);
@@ -562,7 +562,7 @@ TEST_F(ReduceCommandTests, CastleDamage_ForestAccessHelps) {
}
TEST_F(ReduceCommandTests, AlmostDeadBridge_destroysBridge) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
targetTerrain->mutable_modifier().mutable_castle().mutate_present(false);
@@ -594,7 +594,7 @@ TEST_F(ReduceCommandTests, AlmostDeadBridge_destroysBridge) {
}
TEST_F(ReduceCommandTests, AlmostDeadCastle_reducesTo0) {
auto rolls = vector<double>{0.50};
vector<double> rolls{0.50};
auto generator = std::make_shared<SequenceRandomGenerator>(rolls);
targetTerrain->mutable_modifier().mutable_castle().mutate_present(true);