mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 10:15:43 +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;
|
||||
|
||||
@@ -23,7 +23,7 @@ class DismissUnitCommandTest : public ::testing::Test {
|
||||
auto actorOff = AddGenericUnit(5, 0, Coords(1, 1));
|
||||
auto undeadOff = AddGenericUndead(5, 1, Coords(3, 3));
|
||||
|
||||
vector<Unit> unitsVec{actorOff, undeadOff};
|
||||
auto unitsVec = vector<Unit>{actorOff, undeadOff};
|
||||
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
|
||||
|
||||
GameStateBuilder gsb(fbb);
|
||||
|
||||
@@ -29,7 +29,7 @@ class EndTurnCommandTest : public ::testing::Test {
|
||||
|
||||
auto otherOffset = AddGenericUnit(1, 1, Coords(1, 1));
|
||||
|
||||
std::vector<Unit> unitsVec{casterOffset, otherOffset};
|
||||
auto unitsVec = std::vector<Unit>{casterOffset, otherOffset};
|
||||
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
|
||||
|
||||
auto hexMap = AddHexMap(fbb, BASIC_MAP_FB);
|
||||
@@ -44,10 +44,10 @@ class EndTurnCommandTest : public ::testing::Test {
|
||||
statusB.add_state(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
|
||||
auto statusOffset = statusB.Finish();
|
||||
|
||||
std::vector<UnitId> chargeesVec(6, -1);
|
||||
auto chargeesVec = std::vector<UnitId>(6, -1);
|
||||
auto chargeesOffset = fbb.CreateVector(chargeesVec);
|
||||
|
||||
vector<flatbuffers::Offset<PlayerInfo>> pisVec{
|
||||
auto pisVec = vector<flatbuffers::Offset<PlayerInfo>>{
|
||||
AddPlayerInfo(fbb, 0, false, 1000),
|
||||
AddPlayerInfo(fbb, 1, true, 1000)};
|
||||
auto pisOffset = fbb.CreateVector(pisVec);
|
||||
|
||||
@@ -21,7 +21,7 @@ class EvacuatePrisonersCommandTest : public ::testing::Test {
|
||||
fbb.ForceDefaults(true);
|
||||
auto actorOff = AddGenericUnit(0, 0, Coords(3, 3));
|
||||
auto captiveOff = AddGenericUnit(1, 1, Coords(4, 4));
|
||||
std::vector<Unit> unitsVec{actorOff, captiveOff};
|
||||
auto unitsVec = std::vector<Unit>{actorOff, captiveOff};
|
||||
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
|
||||
|
||||
GameStateBuilder gsb(fbb);
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ class ChallengeDuelCommandTests : public ::testing::Test {
|
||||
auto defenderOff = AddGenericUnit(1, 0, Coords(0, 1));
|
||||
auto challengerOff = AddGenericUnit(0, 1, Coords(0, 0));
|
||||
|
||||
std::vector<Unit> units{defenderOff, challengerOff};
|
||||
auto units = std::vector<Unit>{defenderOff, challengerOff};
|
||||
auto unitsOff = fbb.CreateVectorOfSortedStructs(&units);
|
||||
|
||||
auto mapOffset = AddBasicMap(fbb);
|
||||
|
||||
Reference in New Issue
Block a user