mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 06:35:41 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea3252db90 |
@@ -46,12 +46,12 @@ auto ConvertVictoryCondition(const net::eagle0::shardok::common::VictoryConditio
|
||||
|
||||
auto FromPlayerInfoProto(flatbuffers::FlatBufferBuilder& fbb, const PlayerInfoProto& piProto)
|
||||
-> flatbuffers::Offset<net::eagle0::shardok::storage::fb::PlayerInfo> {
|
||||
auto alliesVec = std::vector<AlliedPlayer>();
|
||||
std::vector<AlliedPlayer> alliesVec;
|
||||
alliesVec.reserve(piProto.allies_size());
|
||||
for (const auto& apProto : piProto.allies()) { alliesVec.emplace_back(apProto.player_id()); }
|
||||
const auto alliesOffset = fbb.CreateVectorOfStructs(alliesVec);
|
||||
|
||||
auto vcVec = std::vector<int8_t>();
|
||||
std::vector<int8_t> vcVec;
|
||||
const int victoryConditionCount = piProto.victory_conditions_size();
|
||||
vcVec.reserve(victoryConditionCount);
|
||||
for (int i = 0; i < victoryConditionCount; i++) {
|
||||
@@ -142,7 +142,7 @@ auto SetupInitialGameState(
|
||||
&endGameCondition);
|
||||
auto gameIdOffset = fbb.CreateString(gameId);
|
||||
|
||||
auto playerInfoVec = std::vector<Offset<PlayerInfo>>();
|
||||
std::vector<Offset<PlayerInfo>> playerInfoVec;
|
||||
playerInfoVec.reserve(playerInfoProtos.size());
|
||||
for (const auto& piProto : playerInfoProtos) {
|
||||
playerInfoVec.push_back(FromPlayerInfoProto(fbb, piProto));
|
||||
@@ -162,7 +162,7 @@ auto SetupInitialGameState(
|
||||
// Add slack units: 3 per necromancer, minimum 5 for general use
|
||||
const int slackUnits = std::max(5, necromancerCount * 3);
|
||||
|
||||
auto unitsVec = std::vector<Unit>();
|
||||
std::vector<Unit> unitsVec;
|
||||
unitsVec.reserve(units.size() + slackUnits);
|
||||
for (const auto& unit : units) {
|
||||
Unit modifiedUnit = unit;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ class EvacuatePrisonersCommandFactoryTest : public ::testing::Test {
|
||||
auto actorOff = AddGenericUnit(0, 0, position);
|
||||
auto enemyCaptiveOff = AddGenericUnit(1, 1, Coords(4, 4));
|
||||
auto alliedCaptiveOff = AddGenericUnit(2, 2, Coords(5, 5));
|
||||
std::vector<Unit> unitsVec{actorOff, enemyCaptiveOff, alliedCaptiveOff};
|
||||
auto unitsVec = std::vector<Unit>{actorOff, enemyCaptiveOff, alliedCaptiveOff};
|
||||
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
|
||||
|
||||
GameStateBuilder gsb(fbb);
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ class MoveCommandFactoryTest : public ::testing::Test {
|
||||
auto actorOff = AddGenericUnit(1, 3, position);
|
||||
auto enemyOff = AddGenericUnit(0, 2, Coords(3, 2));
|
||||
|
||||
vector<Unit> vec{actorOff, enemyOff};
|
||||
auto vec = vector<Unit>{actorOff, enemyOff};
|
||||
auto u = fbb.CreateVectorOfSortedStructs(&vec);
|
||||
|
||||
fbb.Finish(u);
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ class ReinforceCommandFactoryTest : public ::testing::Test {
|
||||
auto defenderOffset = AddGenericUnit(1, 2, Coords(2, 5));
|
||||
auto anotherReserveOffset = AddGenericUnit(2, 3, Coords(-1, -1));
|
||||
|
||||
std::vector<Unit> unitsVec{
|
||||
auto unitsVec = std::vector<Unit>{
|
||||
attacker1Offset,
|
||||
reserveAttackerOffset,
|
||||
defenderOffset,
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ class ScoutCommandFactoryTests : public ::testing::Test {
|
||||
fbb.ForceDefaults(true);
|
||||
|
||||
auto rangerOff = AddGenericUnit(5, 0, position);
|
||||
std::vector<Unit> unitsVec{rangerOff};
|
||||
auto unitsVec = std::vector<Unit>{rangerOff};
|
||||
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
|
||||
|
||||
auto mapOff = AddBasicMap(fbb);
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ class StartFireCommandFactoryTest : public ::testing::Test {
|
||||
auto friendlyOffset = AddGenericUnit(0, 1, Coords(5, 5));
|
||||
auto defenderOffset = AddGenericUnit(1, 2, Coords(2, 0));
|
||||
|
||||
vector<Unit> unitsVec{attackerOffset, friendlyOffset, defenderOffset};
|
||||
auto unitsVec = vector<Unit>{attackerOffset, friendlyOffset, defenderOffset};
|
||||
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
|
||||
|
||||
weather = WeatherFb();
|
||||
|
||||
Reference in New Issue
Block a user