mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 10:35:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe4259cfa7 | ||
|
|
57dae50cf7 | ||
|
|
4bce809fab | ||
|
|
2ff2cdab79 | ||
|
|
76839dcd59 | ||
|
|
effd5451b6 | ||
|
|
00ac74f944 | ||
|
|
728f1969ce | ||
|
|
fab757f9dd | ||
|
|
fa006ba947 | ||
|
|
2b61fb0fcf | ||
|
|
62bcd3b669 | ||
|
|
0fc394174c | ||
|
|
14015aebc7 | ||
|
|
5acdcea0b0 | ||
|
|
709d3b9219 | ||
|
|
0f028e73d3 | ||
|
|
f0fa1f1a1d | ||
|
|
0a52e41c3d | ||
|
|
9ef750956c | ||
|
|
b70d541224 | ||
|
|
a8299738d2 | ||
|
|
e789309827 | ||
|
|
f8066454a8 | ||
|
|
a80c8e6d1b | ||
|
|
3dc8541aee | ||
|
|
b7cd003b4c | ||
|
|
bae90633a5 | ||
|
|
56eff84f30 | ||
|
|
375ae7cecb | ||
|
|
ac8a9358ff | ||
|
|
8bc900eef9 | ||
|
|
845a85ed1f | ||
|
|
a1a7a8abf8 | ||
|
|
9cc4dca5b2 | ||
|
|
ea244506d3 | ||
|
|
9827414e92 |
@@ -37,7 +37,7 @@ int main(const int argc, char** argv) {
|
||||
|
||||
void ModifyMap(HexMapProto& map) {
|
||||
const int terrainCount = map.terrain_size();
|
||||
for (int i = 0; i < terrainCount; i++) {
|
||||
for (int i = 0; i < terrainCount; ++i) {
|
||||
const auto existingTerrainType = map.terrain(i).type();
|
||||
const auto newTerrain =
|
||||
static_cast<net::eagle0::shardok::common::Terrain_Type>(existingTerrainType + 2);
|
||||
|
||||
@@ -37,7 +37,7 @@ auto CalculateMap(
|
||||
.name = mapName,
|
||||
.positionsRequiringCrossing = {}};
|
||||
|
||||
for (std::size_t i = 0; i < hexMap->attacker_starting_positions()->size(); i++) {
|
||||
for (std::size_t i = 0; i < hexMap->attacker_starting_positions()->size(); ++i) {
|
||||
const auto* positionList = hexMap->attacker_starting_positions()->Get(i);
|
||||
const auto* positions = positionList->positions();
|
||||
if (positions->empty()) continue;
|
||||
|
||||
@@ -54,7 +54,7 @@ void runBattle(const std::vector<shardok::Unit>& units) {
|
||||
const auto p1UnitCount = randInt(1, static_cast<int>(maxP1UnitCount));
|
||||
std::vector<shardok::Unit> p1Units{};
|
||||
p1Units.reserve(p1UnitCount);
|
||||
for (int i = 0; i < p1UnitCount; i++) {
|
||||
for (int i = 0; i < p1UnitCount; ++i) {
|
||||
auto unit = units[i];
|
||||
unit.mutate_player_id(0);
|
||||
p1Units.push_back(std::move(unit));
|
||||
@@ -64,7 +64,7 @@ void runBattle(const std::vector<shardok::Unit>& units) {
|
||||
const auto p2UnitCount = randInt(1, static_cast<int>(maxP2UnitCount));
|
||||
std::vector<shardok::Unit> p2Units{};
|
||||
p2Units.reserve(p2UnitCount);
|
||||
for (int i = p1UnitCount; i < p1UnitCount + p2UnitCount; i++) {
|
||||
for (int i = p1UnitCount; i < p1UnitCount + p2UnitCount; ++i) {
|
||||
auto unit = units[i];
|
||||
unit.mutate_player_id(1);
|
||||
p2Units.push_back(std::move(unit));
|
||||
@@ -158,7 +158,7 @@ auto main(int /*argc*/, char** argv) -> int {
|
||||
|
||||
std::array<std::thread, THREAD_COUNT> threads;
|
||||
|
||||
for (int i = 0; i < THREAD_COUNT; i++) {
|
||||
for (int i = 0; i < THREAD_COUNT; ++i) {
|
||||
threads[i] = std::thread(runBattlesThread, randomUnits);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ AttackLocationsCache::AttackLocationsCache(const HexMap *hexMap, const SettingsG
|
||||
|
||||
auto emptySet = CoordsSet(columnCount, rowCount);
|
||||
|
||||
for (MapIndex r = 0; r < hexMap->row_count(); r++) {
|
||||
for (MapIndex c = 0; c < hexMap->column_count(); c++) {
|
||||
for (MapIndex r = 0; r < hexMap->row_count(); ++r) {
|
||||
for (MapIndex c = 0; c < hexMap->column_count(); ++c) {
|
||||
auto location = Coords(r, c);
|
||||
const auto terrain = GetTerrain(hexMap, location);
|
||||
|
||||
|
||||
@@ -21,16 +21,12 @@
|
||||
|
||||
namespace shardok {
|
||||
|
||||
// No need to forward declare internal functions - use the public interface instead
|
||||
|
||||
// Helper constants and static variables
|
||||
static const std::vector<double> kAverageSequence = {0.5};
|
||||
static const auto kAverageGenerator = std::make_shared<SequenceRandomGenerator>(kAverageSequence);
|
||||
|
||||
constexpr bool kMultithread = true;
|
||||
constexpr bool kLogging = false;
|
||||
|
||||
// Helper function to determine if a command type is deterministic
|
||||
static auto IsDeterministic(const CommandType type) -> bool {
|
||||
switch (type) {
|
||||
case net::eagle0::shardok::common::MOVE_COMMAND:
|
||||
@@ -63,7 +59,6 @@ static auto RandomnessSampleForRepeat(const int repeatIteration, const int maxRe
|
||||
return static_cast<double>(repeatIteration) / static_cast<double>(maxRepeatCount - 1);
|
||||
}
|
||||
|
||||
// Helper function to sort commands by score
|
||||
static auto CommandSorter(
|
||||
const AICommandEvaluator::IndexAndScore& l,
|
||||
const AICommandEvaluator::IndexAndScore& r) -> bool {
|
||||
@@ -83,7 +78,7 @@ AICommandEvaluator::AICommandEvaluator(
|
||||
BattalionTypeGetter battalionTypeGetter)
|
||||
: scorer_(scorer),
|
||||
apdCache_(apdCache),
|
||||
battalionTypeGetter_(std::move(battalionTypeGetter)) {} // Move the function object
|
||||
battalionTypeGetter_(std::move(battalionTypeGetter)) {}
|
||||
|
||||
auto AICommandEvaluator::PerformLookahead(
|
||||
const PlayerId pid,
|
||||
@@ -336,7 +331,7 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
|
||||
std::vector<CommandEvaluation> commandEvaluations(commandCount);
|
||||
|
||||
for (uint32_t index = 0; index < commandCount; index++) {
|
||||
for (uint32_t index = 0; index < commandCount; ++index) {
|
||||
const auto originalIndex = filteredIndices[index];
|
||||
const auto& guessedDescriptor = guessedDescriptors->at(originalIndex);
|
||||
const auto guessedCommandType = guessedDescriptor->GetCommandType();
|
||||
@@ -423,7 +418,7 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
ScoreValue sum = 0.0;
|
||||
const int sampleCount = std::max(1, maxRepeatCount);
|
||||
commandEvaluations[index].lookaheadFutures.reserve(sampleCount);
|
||||
for (int repeatIteration = 0; repeatIteration < sampleCount; repeatIteration++) {
|
||||
for (int repeatIteration = 0; repeatIteration < sampleCount; ++repeatIteration) {
|
||||
// In each iteration, use a double from [0, 1] as the random roll
|
||||
auto sequence =
|
||||
std::vector{RandomnessSampleForRepeat(repeatIteration, sampleCount)};
|
||||
@@ -587,7 +582,7 @@ auto AICommandEvaluator::EvaluateCommand(
|
||||
const int sampleCount = std::max(1, maxRepeatCount);
|
||||
lookaheadFutures.reserve(sampleCount);
|
||||
|
||||
for (int repeatIteration = 0; repeatIteration < sampleCount; repeatIteration++) {
|
||||
for (int repeatIteration = 0; repeatIteration < sampleCount; ++repeatIteration) {
|
||||
auto sequence = std::vector{RandomnessSampleForRepeat(repeatIteration, sampleCount)};
|
||||
auto evaluation = EvaluateWithRandomness(
|
||||
pid,
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
private:
|
||||
const AIScoreCalculator& scorer_;
|
||||
const APDCache& apdCache_;
|
||||
BattalionTypeGetter battalionTypeGetter_; // Store by value
|
||||
BattalionTypeGetter battalionTypeGetter_;
|
||||
|
||||
struct ImmediateAndLookaheadScore {
|
||||
ScoreValue immediateScore{};
|
||||
|
||||
@@ -114,7 +114,7 @@ auto DefenderDistanceBuf(
|
||||
|
||||
// experiment: add dummy values to the end with very high cost, so there's never an advantage
|
||||
// to leaving a defender unit alive in a castle.
|
||||
for (size_t i = attackerUnits.size(); i < 20; i++) { pointCosts.emplace_back(999, 999); }
|
||||
for (size_t i = attackerUnits.size(); i < 20; ++i) { pointCosts.emplace_back(999, 999); }
|
||||
|
||||
double sum = 0.0;
|
||||
double decr = kPerUnitDebufDecay;
|
||||
|
||||
@@ -18,7 +18,7 @@ auto UnitIdsRequiringWaterCrossing(
|
||||
const BattalionTypeGetter &battalionTypeGetter) -> vector<UnitId> {
|
||||
// Put out all the fires, except on bridges
|
||||
fb::HexMapW mapCopy = fb::CopyHexMap(gameState->hex_map());
|
||||
for (uint32_t index = 0; index < mapCopy->terrain()->size(); index++) {
|
||||
for (uint32_t index = 0; index < mapCopy->terrain()->size(); ++index) {
|
||||
if (IsWater(mapCopy->terrain()->Get(index)->type())) continue;
|
||||
// const_cast is safe because we own the mutable buffer (mapCopy)
|
||||
const_cast<net::eagle0::shardok::storage::fb::Terrain *>(
|
||||
@@ -155,7 +155,7 @@ auto WaterCrossingTiles(
|
||||
// 1) the tile is water
|
||||
// 2) the tile does not already have a bridge (that is not on fire)
|
||||
// 3) the tile is not already frozen
|
||||
for (int index = 0; index < mapSize; index++) {
|
||||
for (int index = 0; index < mapSize; ++index) {
|
||||
const auto startTerrain = *hexMap->terrain()->Get(index);
|
||||
|
||||
if (!IsWater(startTerrain.type())) continue;
|
||||
|
||||
@@ -51,7 +51,7 @@ IterativeDeepeningAI::IterativeDeepeningAI(
|
||||
castleCoords(castleCoords),
|
||||
scorer(scorer),
|
||||
apdCache(apdCache),
|
||||
battalionTypeGetter(std::move(battalionTypeGetter)) {} // Move the function object
|
||||
battalionTypeGetter(std::move(battalionTypeGetter)) {}
|
||||
|
||||
auto IterativeDeepeningAI::IterativeSearch(
|
||||
const GameSettingsSPtr& settings,
|
||||
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
CoordsSet castleCoords;
|
||||
const AIScoreCalculator& scorer;
|
||||
const APDCache& apdCache;
|
||||
BattalionTypeGetter battalionTypeGetter; // Store by value, not reference!
|
||||
BattalionTypeGetter battalionTypeGetter;
|
||||
|
||||
// Reusable vectors to reduce memory allocations
|
||||
mutable std::vector<std::vector<ScoreValue>> scoresByDepth;
|
||||
|
||||
@@ -182,7 +182,7 @@ auto ShardokAIClient::StandardChooseCommandIndex(
|
||||
<< " round=" << guessedState->current_round() << "\n";
|
||||
|
||||
const auto maxDump = std::max(commandCount, realAvailableCommands->size());
|
||||
for (size_t i = 0; i < maxDump; i++) {
|
||||
for (size_t i = 0; i < maxDump; ++i) {
|
||||
const auto realName = i < realAvailableCommands->size()
|
||||
? net::eagle0::shardok::common::CommandType_Name(
|
||||
(*realAvailableCommands)[i]->GetCommandType())
|
||||
@@ -214,13 +214,13 @@ auto ShardokAIClient::StandardChooseCommandIndex(
|
||||
// Group by unit to find the missing position per unit
|
||||
std::unordered_map<int, std::set<std::pair<int, int>>> realPositions;
|
||||
std::unordered_map<int, std::set<std::pair<int, int>>> guessedPositions;
|
||||
for (size_t i = 0; i < realAvailableCommands->size(); i++) {
|
||||
for (size_t i = 0; i < realAvailableCommands->size(); ++i) {
|
||||
const auto &cmd = (*realAvailableCommands)[i];
|
||||
realPositions[cmd->GetActorUnitId()].emplace(
|
||||
cmd->GetTargetRow(),
|
||||
cmd->GetTargetColumn());
|
||||
}
|
||||
for (size_t i = 0; i < commandCount; i++) {
|
||||
for (size_t i = 0; i < commandCount; ++i) {
|
||||
const auto &cmd = (*guessedCommands)[i];
|
||||
guessedPositions[cmd->GetActorUnitId()].emplace(
|
||||
cmd->GetTargetRow(),
|
||||
@@ -250,7 +250,7 @@ auto ShardokAIClient::StandardChooseCommandIndex(
|
||||
|
||||
// Dump all guessed state units for full picture
|
||||
std::cerr << " Guessed state units (" << guessedState->units()->size() << " total):\n";
|
||||
for (size_t i = 0; i < guessedState->units()->size(); i++) {
|
||||
for (size_t i = 0; i < guessedState->units()->size(); ++i) {
|
||||
const auto *u = guessedState->units()->Get(static_cast<unsigned int>(i));
|
||||
std::cerr << " unit_id=" << u->unit_id() << " player=" << u->player_id()
|
||||
<< " status=" << static_cast<int>(u->status()) << " loc=("
|
||||
@@ -263,7 +263,7 @@ auto ShardokAIClient::StandardChooseCommandIndex(
|
||||
"AI command count mismatch: guessed=" + std::to_string(commandCount) +
|
||||
" real=" + std::to_string(realAvailableCommands->size()));
|
||||
}
|
||||
for (size_t i = 0; i < commandCount; i++) {
|
||||
for (size_t i = 0; i < commandCount; ++i) {
|
||||
CheckCommand((*realAvailableCommands)[i], (*guessedCommands)[i]);
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ auto ShardokAIClient::ChooseCommandIndex(
|
||||
if (totalChoices % 1000 == 0) {
|
||||
std::cout << "TYPES CHOSEN:\n";
|
||||
vector<std::pair<int, CommandType>> choices{};
|
||||
for (int i = 0; i <= net::eagle0::shardok::common::CommandType_MAX; i++) {
|
||||
for (int i = 0; i <= net::eagle0::shardok::common::CommandType_MAX; ++i) {
|
||||
if (typeChosenCount[i] != 0) {
|
||||
choices.emplace_back(typeChosenCount[i], static_cast<CommandType>(i));
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ auto SortActionsByWeight(
|
||||
std::vector<size_t> sortedIndices(actions.size());
|
||||
std::iota(sortedIndices.begin(), sortedIndices.end(), 0);
|
||||
|
||||
std::sort(sortedIndices.begin(), sortedIndices.end(), [&weights](size_t a, size_t b) {
|
||||
std::ranges::sort(sortedIndices, [&weights](size_t a, size_t b) {
|
||||
return weights[a] > weights[b];
|
||||
});
|
||||
|
||||
@@ -398,9 +398,8 @@ std::vector<size_t> ShardokGameEngine::filterActions(
|
||||
const MCTSGameState& /*state*/) const {
|
||||
// All filtering is already done in getLegalActions() using AICommandFilter
|
||||
// This method is used by simulation policies and doesn't need additional filtering
|
||||
std::vector<size_t> indices;
|
||||
indices.reserve(actions.size());
|
||||
for (size_t i = 0; i < actions.size(); ++i) { indices.push_back(i); }
|
||||
std::vector<size_t> indices(actions.size());
|
||||
std::iota(indices.begin(), indices.end(), 0);
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ auto MakeMCTSOptimizedAIScoreCalculator(
|
||||
std::vector<BattalionTypeSPtr> battalionTypes(BattalionTypeId::BattalionTypeId_MAX + 1);
|
||||
for (int typeId = BattalionTypeId::BattalionTypeId_MIN;
|
||||
typeId <= BattalionTypeId::BattalionTypeId_MAX;
|
||||
typeId++) {
|
||||
++typeId) {
|
||||
auto battalionTypeId = static_cast<BattalionTypeId>(typeId);
|
||||
battalionTypes[battalionTypeId] = settingsGetter.GetBattalionType(battalionTypeId);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ auto MakeStandardAIScoreCalculatorWithExperiment(
|
||||
std::vector<BattalionTypeSPtr> battalionTypes(BattalionTypeId::BattalionTypeId_MAX + 1);
|
||||
for (int typeId = BattalionTypeId::BattalionTypeId_MIN;
|
||||
typeId <= BattalionTypeId::BattalionTypeId_MAX;
|
||||
typeId++) {
|
||||
++typeId) {
|
||||
auto battalionTypeId = static_cast<BattalionTypeId>(typeId);
|
||||
battalionTypes[battalionTypeId] = settingsGetter.GetBattalionType(battalionTypeId);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace shardok {
|
||||
namespace ai_battle_simulator {
|
||||
namespace shardok::ai_battle_simulator {
|
||||
|
||||
using net::eagle0::shardok::ai_battle_simulator::AIAlgorithmType;
|
||||
using net::eagle0::shardok::ai_battle_simulator::PlayerConfig;
|
||||
@@ -110,5 +109,4 @@ std::string AiBattleConfigLoader::ToJsonString(const BattleConfigProto& config)
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
} // namespace ai_battle_simulator
|
||||
} // namespace shardok
|
||||
} // namespace shardok::ai_battle_simulator
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
#include "src/main/protobuf/net/eagle0/shardok/ai_battle_simulator/ai_battle_config.pb.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
namespace shardok {
|
||||
namespace ai_battle_simulator {
|
||||
namespace shardok::ai_battle_simulator {
|
||||
|
||||
using BattleConfigProto = net::eagle0::shardok::ai_battle_simulator::BattleConfig;
|
||||
|
||||
@@ -41,7 +40,6 @@ public:
|
||||
[[nodiscard]] static std::string ToJsonString(const BattleConfigProto& config);
|
||||
};
|
||||
|
||||
} // namespace ai_battle_simulator
|
||||
} // namespace shardok
|
||||
} // namespace shardok::ai_battle_simulator
|
||||
|
||||
#endif // EAGLE0_SHARDOK_AI_BATTLE_SIMULATOR_AI_BATTLE_CONFIG_HPP
|
||||
|
||||
@@ -331,10 +331,6 @@ GameStateW AiBattleSimulator::CreateInitialGameState() const {
|
||||
// Load map
|
||||
auto hexMapProto = LoadMap(config_.map_name());
|
||||
|
||||
// Create player info protos
|
||||
std::vector<net::eagle0::shardok::common::PlayerInfo> playerInfoProtos;
|
||||
playerInfoProtos.reserve(2);
|
||||
|
||||
// Attacker info
|
||||
net::eagle0::shardok::common::PlayerInfo attackerInfo;
|
||||
attackerInfo.set_player_id(ATTACKER_ID);
|
||||
@@ -344,7 +340,6 @@ GameStateW AiBattleSimulator::CreateInitialGameState() const {
|
||||
net::eagle0::shardok::common::VICTORY_CONDITION_LAST_PLAYER_STANDING);
|
||||
attackerInfo.add_victory_conditions(
|
||||
net::eagle0::shardok::common::VICTORY_CONDITION_HOLDS_CRITICAL_TILES);
|
||||
playerInfoProtos.push_back(std::move(attackerInfo));
|
||||
|
||||
// Defender info
|
||||
net::eagle0::shardok::common::PlayerInfo defenderInfo;
|
||||
@@ -355,7 +350,10 @@ GameStateW AiBattleSimulator::CreateInitialGameState() const {
|
||||
net::eagle0::shardok::common::VICTORY_CONDITION_LAST_PLAYER_STANDING);
|
||||
defenderInfo.add_victory_conditions(
|
||||
net::eagle0::shardok::common::VICTORY_CONDITION_WIN_AFTER_MAX_ROUNDS);
|
||||
playerInfoProtos.push_back(std::move(defenderInfo));
|
||||
|
||||
std::vector<net::eagle0::shardok::common::PlayerInfo> playerInfoProtos{
|
||||
std::move(attackerInfo),
|
||||
std::move(defenderInfo)};
|
||||
|
||||
// Create units from config
|
||||
std::vector<net::eagle0::shardok::storage::fb::Unit> units;
|
||||
|
||||
+2
-1
@@ -191,7 +191,8 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
std::cout << "],\"has_game_status\":" << (hasGameStatus ? "true" : "false") << "}\n";
|
||||
return 0;
|
||||
} else if (!resultPath.empty()) {
|
||||
}
|
||||
if (!resultPath.empty()) {
|
||||
ActionResult result;
|
||||
if (!result.ParseFromString(ReadFile(resultPath))) {
|
||||
throw std::runtime_error("Failed to parse Shardok action result proto");
|
||||
|
||||
@@ -442,7 +442,7 @@ public:
|
||||
|
||||
[[nodiscard]] auto ToBuilder() const -> Builder {
|
||||
Builder builder = Builder();
|
||||
for (int i = 0; i < static_cast<int>(NUM_DAMAGE_TYPES); i++) {
|
||||
for (int i = 0; i < static_cast<int>(NUM_DAMAGE_TYPES); ++i) {
|
||||
const auto type = static_cast<DamageType>(i);
|
||||
builder.SetDamageByType(type, false, this->GetNormalDamageOfType(type));
|
||||
builder.SetDamageByType(type, true, this->GetPenetratingDamageOfType(type));
|
||||
|
||||
@@ -443,7 +443,7 @@ void ShardokEngine::PostPlacementCommands(
|
||||
reinforcementPositions);
|
||||
|
||||
// first make sure they're all valid and there are no duplicates
|
||||
for (size_t i = 0; i < placementInfos.size(); i++) {
|
||||
for (size_t i = 0; i < placementInfos.size(); ++i) {
|
||||
const UnitPlacementInfo &pi = placementInfos[i];
|
||||
|
||||
const auto it = std::ranges::find_if(*placementCommands, [pi](const CommandSPtr &cmd) {
|
||||
@@ -455,7 +455,7 @@ void ShardokEngine::PostPlacementCommands(
|
||||
}
|
||||
|
||||
// check that we're not double-filling any location or double-placing any unit
|
||||
for (size_t j = i + 1; j < placementInfos.size(); j++) {
|
||||
for (size_t j = i + 1; j < placementInfos.size(); ++j) {
|
||||
const UnitPlacementInfo &other = placementInfos[j];
|
||||
|
||||
if (pi.unitId == other.unitId)
|
||||
|
||||
+6
-6
@@ -31,7 +31,7 @@ auto ActionPointDistances::BraveWaterPossibleCoords(const HexMap* hexMap) const
|
||||
const int indexCount = hexMap->row_count() * hexMap->column_count();
|
||||
info->details.reserve(indexCount);
|
||||
const auto indexToCoords = CreateIndexToCoords(hexMap);
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
for (int i = 0; i < indexCount; ++i) {
|
||||
if (const Terrain* terrain = hexMap->terrain()->Get(i);
|
||||
IsWater(terrain->type()) && !terrain->modifier().bridge().present() &&
|
||||
!terrain->modifier().ice().present()) {
|
||||
@@ -71,7 +71,7 @@ auto ActionPointDistances::CreateIndexToCoords(const HexMap* hexMap) -> std::vec
|
||||
const int indexCount = hexMap->row_count() * columnCount;
|
||||
std::vector<Coords> indexToCoords;
|
||||
indexToCoords.reserve(indexCount);
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
for (int i = 0; i < indexCount; ++i) {
|
||||
indexToCoords.emplace_back(
|
||||
static_cast<int8_t>(i / columnCount),
|
||||
static_cast<int8_t>(i % columnCount));
|
||||
@@ -85,7 +85,7 @@ auto ActionPointDistances::CreateAdjacencyTable(const HexMap* hexMap)
|
||||
const int indexCount = hexMap->row_count() * columnCount;
|
||||
std::vector<std::array<int, 6>> adjacencyTable;
|
||||
adjacencyTable.reserve(indexCount);
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
for (int i = 0; i < indexCount; ++i) {
|
||||
const Coords coords(
|
||||
static_cast<int8_t>(i / columnCount),
|
||||
static_cast<int8_t>(i % columnCount));
|
||||
@@ -119,7 +119,7 @@ void ActionPointDistances::PopulateOne(
|
||||
|
||||
// Find starting index (the one with distance 0)
|
||||
const int distanceCount = static_cast<int>(ds.size());
|
||||
for (int i = 0; i < distanceCount; i++) {
|
||||
for (int i = 0; i < distanceCount; ++i) {
|
||||
if (ds[i] == 0) {
|
||||
pq.emplace(0, i);
|
||||
break;
|
||||
@@ -141,7 +141,7 @@ void ActionPointDistances::PopulateOne(
|
||||
|
||||
// Prefetch terrain data for all neighbors to reduce memory stalls
|
||||
const std::array<int, 6>& neighbors = adjacencyTable[currentIndex];
|
||||
for (int i = 0; i < 6 && neighbors[i] != -1; i++) {
|
||||
for (int i = 0; i < 6 && neighbors[i] != -1; ++i) {
|
||||
__builtin_prefetch(hexMap->terrain()->Get(neighbors[i]), 0, 3);
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ OnDemandActionPointDistances::OnDemandActionPointDistances(
|
||||
|
||||
auto braveWaterPossibleCoords = includeBravingWater ? BraveWaterPossibleCoords(map) : nullptr;
|
||||
|
||||
for (int fromIndex = 0; fromIndex < indexCount; fromIndex++) {
|
||||
for (int fromIndex = 0; fromIndex < indexCount; ++fromIndex) {
|
||||
distances[fromIndex] = std::async(
|
||||
std::launch::deferred,
|
||||
&OnDemandActionPointDistances::GenerateDistances,
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ static auto CreateIceClearedMap(const HexMap* map) -> fb::HexMapW {
|
||||
auto* mutableMap = mapCopy.Get();
|
||||
auto* terrainVec = mutableMap->mutable_terrain();
|
||||
|
||||
for (size_t i = 0; i < terrainVec->size(); i++) {
|
||||
for (size_t i = 0; i < terrainVec->size(); ++i) {
|
||||
// Only process tiles with ice
|
||||
// const_cast is safe here because we own the mutable buffer (mapCopy)
|
||||
if (auto* terrain = const_cast<Terrain*>(terrainVec->GetMutableObject(i));
|
||||
|
||||
+3
-3
@@ -42,13 +42,13 @@ auto FixedActionPointDistances::Create(
|
||||
|
||||
int chunkSize = (indexCount + ASYNC_COUNT - 1) / ASYNC_COUNT;
|
||||
// Break into chunks for async
|
||||
for (int chunkIdx = 0; chunkIdx < ASYNC_COUNT; chunkIdx++) {
|
||||
for (int chunkIdx = 0; chunkIdx < ASYNC_COUNT; ++chunkIdx) {
|
||||
futures[chunkIdx] = std::async(std::launch::async, [=]() -> vector<vector<DIST_T>> {
|
||||
vector<vector<DIST_T>> chunkVec;
|
||||
chunkVec.reserve(chunkSize);
|
||||
const int chunkStartIndex = chunkIdx * chunkSize;
|
||||
|
||||
for (int i = 0; i < chunkSize; i++) {
|
||||
for (int i = 0; i < chunkSize; ++i) {
|
||||
const auto fromIndex = chunkStartIndex + i;
|
||||
if (fromIndex >= indexCount) { continue; }
|
||||
chunkVec.push_back(ActionPointDistances::GenerateDistances(
|
||||
@@ -65,7 +65,7 @@ auto FixedActionPointDistances::Create(
|
||||
|
||||
apd->distances.reserve(indexCount);
|
||||
|
||||
for (int chunkIdx = 0; chunkIdx < ASYNC_COUNT; chunkIdx++) {
|
||||
for (int chunkIdx = 0; chunkIdx < ASYNC_COUNT; ++chunkIdx) {
|
||||
auto resultsVec = futures[chunkIdx].get();
|
||||
apd->distances.insert(apd->distances.end(), resultsVec.begin(), resultsVec.end());
|
||||
}
|
||||
|
||||
+5
-5
@@ -68,7 +68,7 @@ void ApplyResolvedUnit(
|
||||
// If a VIP was captured, alter the morale of all this player's units
|
||||
if (status == net::eagle0::shardok::storage::fb::UnitStatus_CAPTURED_UNIT &&
|
||||
unit.has_attached_hero() && unit.attached_hero().is_vip()) {
|
||||
for (uint32_t i = 0; i < inoutState->units()->size(); i++) {
|
||||
for (uint32_t i = 0; i < inoutState->units()->size(); ++i) {
|
||||
auto *playerUnit = GetMutableUnit(inoutState, i);
|
||||
if (playerUnit->player_id() != unit.player_id()) continue;
|
||||
if (playerUnit->unit_id() == unit.unit_id()) continue;
|
||||
@@ -248,12 +248,12 @@ void MutatingApplyResult(
|
||||
static_cast<net::eagle0::shardok::storage::fb::GameStatus_::State>(
|
||||
result.game_status().state())));
|
||||
const int winningShardokIdCount = result.game_status().winning_shardok_ids_size();
|
||||
for (int i = 0; i < winningShardokIdCount; i++) {
|
||||
for (int i = 0; i < winningShardokIdCount; ++i) {
|
||||
mutatingGameState->mutable_status()->mutable_winning_shardok_ids()->Mutate(
|
||||
i,
|
||||
result.game_status().winning_shardok_ids(i));
|
||||
}
|
||||
for (int i = winningShardokIdCount; i < 10; i++) {
|
||||
for (int i = winningShardokIdCount; i < 10; ++i) {
|
||||
mutatingGameState->mutable_status()->mutable_winning_shardok_ids()->Mutate(i, -1);
|
||||
}
|
||||
|
||||
@@ -385,10 +385,10 @@ void MutatingApplyResult(
|
||||
internalAssert(mutatingGameState->mutate_eligible_charger_id(-1));
|
||||
}
|
||||
const int possibleChargeeCount = result.possible_chargees_size();
|
||||
for (int i = 0; i < possibleChargeeCount; i++) {
|
||||
for (int i = 0; i < possibleChargeeCount; ++i) {
|
||||
mutatingGameState->mutable_possible_chargee_ids()->Mutate(i, result.possible_chargees(i));
|
||||
}
|
||||
for (int i = possibleChargeeCount; i < 6; i++) {
|
||||
for (int i = possibleChargeeCount; i < 6; ++i) {
|
||||
mutatingGameState->mutable_possible_chargee_ids()->Mutate(i, -1);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ auto CopyWithExtraUnits(const GameStateW& original, int additionalCount) -> Game
|
||||
|
||||
// Add the requested units plus some extra slack for future use
|
||||
int extraSlack = std::max(5, additionalCount * 2);
|
||||
for (int i = 0; i < additionalCount + extraSlack; i++) {
|
||||
for (int i = 0; i < additionalCount + extraSlack; ++i) {
|
||||
Unit unit;
|
||||
unit.mutate_unit_id(static_cast<int16_t>(endGST.units.size()));
|
||||
if (i < additionalCount) {
|
||||
|
||||
@@ -29,7 +29,7 @@ auto UpdateOpponentKnowledgeAction::InternalExecute(
|
||||
|
||||
auto unitAfter = *unit;
|
||||
|
||||
for (PlayerId pid = 0; pid < 10; pid++) {
|
||||
for (PlayerId pid = 0; pid < 10; ++pid) {
|
||||
if (pid == unitPid) continue;
|
||||
if (static_cast<unsigned int>(pid) >= playerCount) continue;
|
||||
int bump = PlayerIsDefender(currentState, pid) ? defenderKnowledgeGain
|
||||
|
||||
@@ -27,7 +27,7 @@ void FearCommandFactory::AddAvailableFearCommands(
|
||||
|
||||
if (costForFear.IsPossible(remainingActionPoints)) {
|
||||
const int range = settings.Backing().fear_range();
|
||||
for (int distance = 1; distance <= range; distance++) {
|
||||
for (int distance = 1; distance <= range; ++distance) {
|
||||
const auto coordsSet = TilesWithExactDistance(hexMap, position, distance);
|
||||
|
||||
for (const Coords &fearCoords : coordsSet) {
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ auto LightningBoltCommandFactory::AddAvailableLightningBoltCommands(
|
||||
ActionCost::UsesAllActionCost(settings.Backing().lightning_action_point_cost());
|
||||
const int lightningRange = settings.Backing().lightning_range();
|
||||
if (costForLightning.IsPossible(remainingActionPoints)) {
|
||||
for (int distance = 1; distance <= lightningRange; distance++) {
|
||||
for (int distance = 1; distance <= lightningRange; ++distance) {
|
||||
CoordsSet coords = TilesWithExactDistance(hexMap, position, distance);
|
||||
|
||||
for (const Coords &lightningCoords : coords) {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ void RaiseDeadCommandFactory::AddAvailableRaiseDeadCommands(
|
||||
const BattalionTypeSPtr &undeadType = settings.GetBattalionType(
|
||||
net::eagle0::shardok::storage::fb::BattalionTypeId_UNDEAD);
|
||||
|
||||
for (int distance = 1; distance <= range; distance++) {
|
||||
for (int distance = 1; distance <= range; ++distance) {
|
||||
const CoordsSet coordsSet = TilesWithExactDistance(hexMap, position, distance);
|
||||
|
||||
for (const Coords &raiseDeadCoords : coordsSet) {
|
||||
|
||||
@@ -34,7 +34,7 @@ void ScoutCommandFactory::AddAvailableScoutCommands(
|
||||
const Coords unitLocation = unit->location();
|
||||
|
||||
if (costForScout.IsPossible(remainingActionPoints)) {
|
||||
for (int distance = 1; distance <= scoutRange; distance++) {
|
||||
for (int distance = 1; distance <= scoutRange; ++distance) {
|
||||
CoordsSet coordsSet = TilesWithExactDistance(hexMap, unitLocation, distance);
|
||||
|
||||
for (const Coords& scoutCoords : coordsSet) {
|
||||
|
||||
@@ -75,7 +75,7 @@ auto EndTurnCommand::InternalExecute(
|
||||
// Any heroes in fire get burninated
|
||||
// Decrement stun counters, increment cast state
|
||||
const auto beforeFireUnitsCount = runningGameState->units()->size();
|
||||
for (size_t i = 0; i < beforeFireUnitsCount; i++) {
|
||||
for (size_t i = 0; i < beforeFireUnitsCount; ++i) {
|
||||
const auto *beforeUnit = runningGameState->units()->Get(static_cast<unsigned int>(i));
|
||||
if (beforeUnit->status() != net::eagle0::shardok::storage::fb::UnitStatus_NORMAL_UNIT)
|
||||
continue;
|
||||
@@ -114,7 +114,7 @@ auto EndTurnCommand::InternalExecute(
|
||||
endTurnResult.mutable_next_player()->set_value(NextPlayerId(currentState, GetPlayerId()));
|
||||
|
||||
const auto unitsAtEndOfRoundCount = runningGameState->units()->size();
|
||||
for (size_t i = 0; i < unitsAtEndOfRoundCount; i++) {
|
||||
for (size_t i = 0; i < unitsAtEndOfRoundCount; ++i) {
|
||||
// Grab the unit fresh because it might have been modified by a previous iteration of the
|
||||
// loop
|
||||
const auto *eorUnit = runningGameState->units()->Get(static_cast<unsigned int>(i));
|
||||
|
||||
@@ -85,7 +85,7 @@ auto FearCommand::GetFearOdds(
|
||||
double attackerWisdom,
|
||||
const double defenderCharisma) -> PercentileRollOdds {
|
||||
const std::array otherFactors = {
|
||||
MakeOtherFactor(int(50.0 - defenderCharisma), opponentCharismaString)};
|
||||
MakeOtherFactor(static_cast<int>(50.0 - defenderCharisma), opponentCharismaString)};
|
||||
return MakeOdds(
|
||||
fearBaseOdds,
|
||||
0,
|
||||
|
||||
@@ -143,8 +143,9 @@ auto HolyWaveInspireAction::InternalExecute(
|
||||
|
||||
resultProto.set_type(net::eagle0::shardok::common::INSPIRED_TROOPS);
|
||||
|
||||
float newMorale = moraleBefore + float(inspireBuf);
|
||||
float moraleCap = inspiredUnit->battalion().base_morale() + float(maxInspireOverBase);
|
||||
float newMorale = moraleBefore + static_cast<float>(inspireBuf);
|
||||
float moraleCap =
|
||||
inspiredUnit->battalion().base_morale() + static_cast<float>(maxInspireOverBase);
|
||||
if (moraleCap < newMorale) newMorale = moraleCap;
|
||||
if (newMorale > 100) newMorale = 100;
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ auto GetNewUnit(
|
||||
unit.mutate_player_id(playerId);
|
||||
unit.mutate_commanding_unit_id(commandingUnitId);
|
||||
|
||||
for (uint32_t i = 0; i < unit.opponent_knowledge()->size(); i++) {
|
||||
for (uint32_t i = 0; i < unit.opponent_knowledge()->size(); ++i) {
|
||||
unit.mutable_opponent_knowledge()->Mutate(i, 0);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ auto GetAcceptOdds(
|
||||
|
||||
double baseDeadliness = settings.Backing().base_deadliness();
|
||||
|
||||
for (int i = 0; i < NUM_RUNS; i++) {
|
||||
for (int i = 0; i < NUM_RUNS; ++i) {
|
||||
double defenderRoll;
|
||||
if (statsKnown) {
|
||||
defenderRoll = i * 100.0 / (NUM_RUNS - 1);
|
||||
@@ -114,7 +114,7 @@ auto GetAcceptOdds(
|
||||
|
||||
Hero defendingHero = defender->attached_hero();
|
||||
defenderWins = 0;
|
||||
for (int i = 0; i < NUM_RUNS; i++) {
|
||||
for (int i = 0; i < NUM_RUNS; ++i) {
|
||||
double defenderRoll;
|
||||
if (heroStatsKnown) {
|
||||
defenderRoll = i * 100.0 / (NUM_RUNS - 1);
|
||||
|
||||
@@ -46,15 +46,15 @@ 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++) {
|
||||
for (int i = 0; i < victoryConditionCount; ++i) {
|
||||
vcVec.push_back(ConvertVictoryCondition(piProto.victory_conditions(i)));
|
||||
}
|
||||
const auto vcOffset = fbb.CreateVector(vcVec);
|
||||
@@ -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;
|
||||
@@ -191,7 +191,7 @@ auto SetupInitialGameState(
|
||||
}
|
||||
|
||||
// Add slack units for future expansion (e.g., necromancer raise dead)
|
||||
for (int i = 0; i < slackUnits; i++) {
|
||||
for (int i = 0; i < slackUnits; ++i) {
|
||||
Unit slackUnit;
|
||||
slackUnit.mutate_unit_id(static_cast<int16_t>(units.size() + i));
|
||||
slackUnit.mutate_status(net::eagle0::shardok::storage::fb::UnitStatus_RESERVED_SLOT);
|
||||
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
}
|
||||
|
||||
void Filter(const std::function<bool(int, int)>& f) {
|
||||
for (uint32_t i = 0; i < indexCount; i++) {
|
||||
for (uint32_t i = 0; i < indexCount; ++i) {
|
||||
if (Contains(i) && !f(i / mapWidth, i % mapWidth)) { Remove(i); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ int32_t MutatingInternalTakeDamage(
|
||||
|
||||
double takenDamage = 0.0;
|
||||
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; i++) {
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; ++i) {
|
||||
const auto damageType = static_cast<DamageType>(i);
|
||||
const double armamentAdjustment =
|
||||
1.0 - ((type->baseResistanceByType[i] +
|
||||
|
||||
@@ -52,7 +52,7 @@ auto MutatingTakeDamage(
|
||||
const CombatDamage heroDamage = heroDamageRatio * damage;
|
||||
|
||||
double vigorHit = 0.0;
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; i++) {
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; ++i) {
|
||||
vigorHit += heroDamage.GetNormalDamageOfType(DamageType(i)) * kHeroMortalityFactor;
|
||||
vigorHit += heroDamage.GetPenetratingDamageOfType(DamageType(i)) * kHeroMortalityFactor;
|
||||
// TODO: hero should have adjustments for damage types too
|
||||
|
||||
@@ -45,7 +45,7 @@ auto OpponentKnowledge(const Unit &unit, const PlayerId toPlayer) -> int {
|
||||
if (toPlayer == -1) {
|
||||
// handle observer, with pid -1
|
||||
int8_t max = 0;
|
||||
for (uint32_t i = 0; i < unit.opponent_knowledge()->size(); i++) {
|
||||
for (uint32_t i = 0; i < unit.opponent_knowledge()->size(); ++i) {
|
||||
max = std::max(max, unit.opponent_knowledge()->Get(i));
|
||||
}
|
||||
return max;
|
||||
@@ -59,7 +59,7 @@ auto OpponentKnowledge(const Unit *unit, const PlayerId toPlayer) -> int {
|
||||
if (toPlayer == -1) {
|
||||
// handle observer, with pid -1
|
||||
int8_t max = 0;
|
||||
for (uint32_t i = 0; i < unit->opponent_knowledge()->size(); i++) {
|
||||
for (uint32_t i = 0; i < unit->opponent_knowledge()->size(); ++i) {
|
||||
max = std::max(max, unit->opponent_knowledge()->Get(i));
|
||||
}
|
||||
return max;
|
||||
@@ -190,7 +190,7 @@ void MutatingBumpOpponentKnowledge(Unit *unit, const PlayerId pid, const int bum
|
||||
|
||||
void MutatingBumpAllKnowledgeToMinimum(Unit *unit, const int minimum) {
|
||||
const auto current = unit->opponent_knowledge();
|
||||
for (uint32_t i = 0; i < current->size(); i++) {
|
||||
for (uint32_t i = 0; i < current->size(); ++i) {
|
||||
if (current->Get(i) < minimum) { unit->mutable_opponent_knowledge()->Mutate(i, minimum); }
|
||||
}
|
||||
}
|
||||
@@ -220,7 +220,7 @@ auto InternalTakeDamageFb(
|
||||
CombatDamage heroDamage = heroDamageRatio * totalDamage;
|
||||
|
||||
double vigorHit = 0.0;
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; i++) {
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; ++i) {
|
||||
const auto damageType = static_cast<DamageType>(i);
|
||||
vigorHit += heroDamage.GetNormalDamageOfType(damageType) * heroMortalityFactor;
|
||||
vigorHit += heroDamage.GetPenetratingDamageOfType(damageType) * heroMortalityFactor;
|
||||
@@ -237,7 +237,7 @@ auto InternalTakeDamageFb(
|
||||
double takenDamage = 0.0;
|
||||
double terrainAdjustment = battalionType->GetDamageTakenMultiplierForTerrain(&terrain);
|
||||
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; i++) {
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; ++i) {
|
||||
const auto damageType = static_cast<DamageType>(i);
|
||||
double armamentAdjustment = 1.0 - (battalionType->baseResistanceByType[i] +
|
||||
(battalion.armament() / 100.0) *
|
||||
|
||||
@@ -77,7 +77,7 @@ auto CombatUtils::CalculateBattalionDamageGiven(
|
||||
const double totalSwing =
|
||||
randomnessAdjustment * moraleAdjustment * charismaAdjustment * braveryAdjustment;
|
||||
|
||||
for (int i = 0; i < static_cast<int>(NUM_DAMAGE_TYPES); i++) {
|
||||
for (int i = 0; i < static_cast<int>(NUM_DAMAGE_TYPES); ++i) {
|
||||
double damagePerTroop =
|
||||
(type->baseMeleeDamageByType[i] +
|
||||
(battalion.training() / 100.0) * type->maxAugmentMeleeDamageByType[i]);
|
||||
@@ -148,7 +148,7 @@ auto CombatUtils::CalculateUnitArcheryDamageGiven(
|
||||
|
||||
const double totalSwing = randomnessAdjustment * moraleAdjustment * charismaAdjustment;
|
||||
|
||||
for (int i = 0; i < static_cast<int>(NUM_DAMAGE_TYPES); i++) {
|
||||
for (int i = 0; i < static_cast<int>(NUM_DAMAGE_TYPES); ++i) {
|
||||
double damagePerTroop =
|
||||
type->baseMissileDamageByType[i] +
|
||||
(battalion.training() / 100.0) * type->maxAugmentMissileDamageByType[i];
|
||||
|
||||
@@ -30,9 +30,9 @@ auto CubesWithinDistance(const Cube &c1, const int distance) -> std::vector<Cube
|
||||
std::vector<Cube> cubes{};
|
||||
cubes.reserve(1 + 3 * distance * (distance + 1));
|
||||
|
||||
for (int x = -distance; x <= distance; x++) {
|
||||
for (int x = -distance; x <= distance; ++x) {
|
||||
for (int y = std::max(-distance, -x - distance); y <= std::min(distance, -x + distance);
|
||||
y++) {
|
||||
++y) {
|
||||
const int z = -x - y;
|
||||
cubes.emplace_back(c1.x + x, c1.y + y, c1.z + z);
|
||||
}
|
||||
@@ -45,9 +45,9 @@ auto CubesWithExactDistance(const Cube &c1, const int distance) -> std::vector<C
|
||||
std::vector<Cube> cubes{};
|
||||
cubes.reserve(distance == 0 ? 1 : 6 * distance);
|
||||
|
||||
for (int x = -distance; x <= distance; x++) {
|
||||
for (int x = -distance; x <= distance; ++x) {
|
||||
for (int y = std::max(-distance, -x - distance); y <= std::min(distance, -x + distance);
|
||||
y++) {
|
||||
++y) {
|
||||
const int z = -x - y;
|
||||
if (abs(x) != distance && abs(y) != distance && abs(z) != distance) continue;
|
||||
cubes.emplace_back(c1.x + x, c1.y + y, c1.z + z);
|
||||
@@ -119,7 +119,7 @@ auto CubeLineInclusive(const Cube &c1, const Cube &c2) -> std::vector<Cube> {
|
||||
cubes.reserve(2 * (dist + 1));
|
||||
const double reciprocal = 1.0 / dist;
|
||||
|
||||
for (int i = 0; i <= dist; i++) {
|
||||
for (int i = 0; i <= dist; ++i) {
|
||||
for (const auto &c : CubeLerp(c1, c2, i * reciprocal)) { cubes.push_back(c); }
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ const std::array<Coords, 6> ADJACENT_TILE_MODS_ODD_ROW =
|
||||
|
||||
auto AllCastleCoords(const HexMap *hexMap) -> CoordsSet {
|
||||
CoordsSet castleCoords(hexMap);
|
||||
for (int16_t r = 0; r < hexMap->row_count(); r++) {
|
||||
for (int16_t c = 0; c < hexMap->column_count(); c++) {
|
||||
for (int16_t r = 0; r < hexMap->row_count(); ++r) {
|
||||
for (int16_t c = 0; c < hexMap->column_count(); ++c) {
|
||||
Coords coords(r, c);
|
||||
if (GetTerrain(hexMap, coords)->modifier().castle().present()) {
|
||||
castleCoords.Add(coords);
|
||||
@@ -106,7 +106,7 @@ auto HexMapUtils::ComputeAllStandardAdjacentCoords() -> std::vector<CoordsSet> {
|
||||
std::vector<CoordsSet> arr;
|
||||
arr.reserve(size_t(STANDARD_MAP_ROWS * STANDARD_MAP_COLUMNS));
|
||||
|
||||
for (int index = 0; index < STANDARD_MAP_ROWS * STANDARD_MAP_COLUMNS; index++) {
|
||||
for (int index = 0; index < STANDARD_MAP_ROWS * STANDARD_MAP_COLUMNS; ++index) {
|
||||
arr.push_back(ComputeAdjacentCoords(
|
||||
STANDARD_MAP_ROWS,
|
||||
STANDARD_MAP_COLUMNS,
|
||||
@@ -206,7 +206,7 @@ auto HexMapUtils::GetAdjacentTiles(const HexMap *map, const Coords &origin)
|
||||
if (IsWater(static_cast<net::eagle0::shardok::common::Terrain_Type>(terrain->type()))) {
|
||||
if (terrain->modifier().bridge().present()) continue;
|
||||
if (terrain->modifier().ice().present()) continue;
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int i = -1; i <= 1; ++i) {
|
||||
const auto nextDirection =
|
||||
static_cast<HexMapDirection>((adjacentTile.directionTo + i + 6) % 6);
|
||||
const auto &maybeNext =
|
||||
@@ -329,7 +329,7 @@ void MaybeAdd(const Cube &cube, CoordsSet &set, const HexMap *map) {
|
||||
const auto c2 = OffsetToCube(coords2);
|
||||
|
||||
auto line = CubeLineInclusive(c1, c2);
|
||||
return std::any_of(std::begin(line), std::end(line), [&map](const Cube &c) {
|
||||
return std::ranges::any_of(line, [&map](const Cube &c) {
|
||||
const auto betweenCoords = CubeToOffset(c);
|
||||
if (CoordsAreValid(map, betweenCoords) &&
|
||||
GetTerrain(map, betweenCoords)->type() ==
|
||||
@@ -534,8 +534,8 @@ auto MaybeOccupantInDirection(
|
||||
|
||||
auto GetAllCoords(const HexMap *hexMap) -> CoordsSet {
|
||||
CoordsSet cs(hexMap);
|
||||
for (int row = 0; row < hexMap->row_count(); row++) {
|
||||
for (int column = 0; column < hexMap->column_count(); column++) { cs.Add(row, column); }
|
||||
for (int row = 0; row < hexMap->row_count(); ++row) {
|
||||
for (int column = 0; column < hexMap->column_count(); ++column) { cs.Add(row, column); }
|
||||
}
|
||||
|
||||
return cs;
|
||||
|
||||
@@ -15,7 +15,7 @@ auto CoordsInMeteorRange(
|
||||
const int meteorRange = settings.Backing().meteor_range();
|
||||
CoordsSet coordsInRange(hexMap);
|
||||
|
||||
for (int distance = 1; distance <= meteorRange; distance++) {
|
||||
for (int distance = 1; distance <= meteorRange; ++distance) {
|
||||
coordsInRange += TilesWithExactDistance(hexMap, location, distance);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ auto GameStateGuesser::GuessedState(
|
||||
winningShardokIdsVec.end(),
|
||||
std::begin(gameStateView.status().winning_shardok_ids()),
|
||||
std::end(gameStateView.status().winning_shardok_ids()));
|
||||
for (int i = gameStateView.status().winning_shardok_ids_size(); i < 10; i++) {
|
||||
for (int i = gameStateView.status().winning_shardok_ids_size(); i < 10; ++i) {
|
||||
winningShardokIdsVec.push_back(-1);
|
||||
}
|
||||
auto winningShardokIdsOffset = fbb.CreateVector(winningShardokIdsVec);
|
||||
@@ -257,7 +257,7 @@ auto GameStateGuesser::GuessedState(
|
||||
foundUnits.push_back(uv.unit_id());
|
||||
}
|
||||
|
||||
for (int i = 0; i < maxId; i++) {
|
||||
for (int i = 0; i < maxId; ++i) {
|
||||
auto entry = std::find(std::begin(foundUnits), std::end(foundUnits), i);
|
||||
if (entry == std::end(foundUnits)) {
|
||||
net::eagle0::shardok::storage::fb::Unit newUnit;
|
||||
@@ -300,7 +300,7 @@ auto GameStateGuesser::GuessedState(
|
||||
|
||||
// Add 5 reserved slots for future expansion (e.g., necromancer raise dead)
|
||||
UnitId nextReservedId = maxId + 2; // Start after any guessed defender unit
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
Unit reservedSlot;
|
||||
reservedSlot.mutate_unit_id(nextReservedId + i);
|
||||
reservedSlot.mutate_status(net::eagle0::shardok::storage::fb::UnitStatus_RESERVED_SLOT);
|
||||
@@ -359,7 +359,7 @@ auto GameStateGuesser::GuessedState(
|
||||
chargeeIdsVec.end(),
|
||||
std::begin(gameStateView.possible_chargee_ids()),
|
||||
std::end(gameStateView.possible_chargee_ids()));
|
||||
for (int i = gameStateView.possible_chargee_ids_size(); i < 6; i++) {
|
||||
for (int i = gameStateView.possible_chargee_ids_size(); i < 6; ++i) {
|
||||
chargeeIdsVec.push_back(-1);
|
||||
}
|
||||
auto chargeeIdsOffset = fbb.CreateVector(chargeeIdsVec);
|
||||
@@ -406,7 +406,7 @@ auto GameStateGuesser::GuessedState(
|
||||
|
||||
GameStateW gsw(fbb);
|
||||
// Make sure that controlled unit/commanding unit IDs match up
|
||||
for (UnitId unitId = 0; static_cast<unsigned int>(unitId) < gsw->units()->size(); unitId++) {
|
||||
for (UnitId unitId = 0; static_cast<unsigned int>(unitId) < gsw->units()->size(); ++unitId) {
|
||||
const Unit *unit = gsw->units()->Get(unitId);
|
||||
|
||||
if (unit->has_attached_hero()) {
|
||||
@@ -490,7 +490,7 @@ auto GuessedUnit(
|
||||
|
||||
unit.mutate_has_moved_in_zoc(uv.has_moved_in_zoc());
|
||||
|
||||
for (uint32_t i = 0; i < unit.opponent_knowledge()->size(); i++) {
|
||||
for (uint32_t i = 0; i < unit.opponent_knowledge()->size(); ++i) {
|
||||
unit.mutable_opponent_knowledge()->Mutate(i, 0);
|
||||
}
|
||||
unit.mutable_opponent_knowledge()->Mutate(toPid, uv.my_knowledge());
|
||||
|
||||
@@ -20,10 +20,9 @@ void PopulateRepeatedUnitDiffs(
|
||||
::google::protobuf::RepeatedField<::google::protobuf::int32> *mutableRemovedIdsOut,
|
||||
bool &changed) {
|
||||
for (const auto &afterUnit : afterUnits) {
|
||||
const auto &beforeUnit = std::find_if(
|
||||
beforeUnits.begin(),
|
||||
beforeUnits.end(),
|
||||
[afterUnit](const UnitView &u) { return u.unit_id() == afterUnit.unit_id(); });
|
||||
const auto &beforeUnit = std::ranges::find_if(beforeUnits, [afterUnit](const UnitView &u) {
|
||||
return u.unit_id() == afterUnit.unit_id();
|
||||
});
|
||||
|
||||
// FIXME: this should really be a HeroViewDiff
|
||||
if (beforeUnit == beforeUnits.end() ||
|
||||
@@ -35,10 +34,9 @@ void PopulateRepeatedUnitDiffs(
|
||||
|
||||
// removed units
|
||||
for (const auto &beforeUnit : beforeUnits) {
|
||||
const auto &afterUnit =
|
||||
std::find_if(afterUnits.begin(), afterUnits.end(), [beforeUnit](const UnitView &u) {
|
||||
return u.unit_id() == beforeUnit.unit_id();
|
||||
});
|
||||
const auto &afterUnit = std::ranges::find_if(afterUnits, [beforeUnit](const UnitView &u) {
|
||||
return u.unit_id() == beforeUnit.unit_id();
|
||||
});
|
||||
|
||||
if (afterUnit == afterUnits.end()) {
|
||||
mutableRemovedIdsOut->Add(beforeUnit.unit_id());
|
||||
@@ -70,7 +68,7 @@ auto MakeGameStateViewDiff(const GameStateView &before, const GameStateView &aft
|
||||
const int afterColumnCount = after.hex_map().column_count();
|
||||
const int afterCount = afterRowCount * afterColumnCount;
|
||||
|
||||
for (int tileIndex = 0; tileIndex < afterCount; tileIndex++) {
|
||||
for (int tileIndex = 0; tileIndex < afterCount; ++tileIndex) {
|
||||
Coords coords =
|
||||
Coords(int8_t(tileIndex / afterColumnCount), int8_t(tileIndex % afterColumnCount));
|
||||
const auto afterModifier = after.hex_map().terrain(tileIndex).modifier();
|
||||
@@ -148,7 +146,7 @@ auto MakeGameStateViewDiff(const GameStateView &before, const GameStateView &aft
|
||||
|
||||
const int afterPlayerTotalCount = after.player_totals_size();
|
||||
const int beforePlayerTotalCount = before.player_totals_size();
|
||||
for (int i = 0; i < afterPlayerTotalCount; i++) {
|
||||
for (int i = 0; i < afterPlayerTotalCount; ++i) {
|
||||
const auto &afterTotal = after.player_totals(i);
|
||||
if (beforePlayerTotalCount <= i) {
|
||||
*diff.add_changed_player_totals() = afterTotal;
|
||||
|
||||
@@ -110,7 +110,7 @@ auto ConvertPlayerInfo(
|
||||
vector<PlayerId> allPids{};
|
||||
const int playerInfoCount = allPis.size();
|
||||
allPids.reserve(playerInfoCount);
|
||||
for (int i = 0; i < playerInfoCount; i++) { allPids.push_back(static_cast<PlayerId>(i)); }
|
||||
for (int i = 0; i < playerInfoCount; ++i) { allPids.push_back(static_cast<PlayerId>(i)); }
|
||||
|
||||
vector<Unit> shardokUnits;
|
||||
shardokUnits.reserve(pi.units().size());
|
||||
@@ -132,7 +132,7 @@ auto ConvertPlayerInfo(
|
||||
alliedPids.reserve(pi.allies_size());
|
||||
for (const auto &ally : pi.allies()) {
|
||||
const int32_t alliedFid = ally.eagle_faction_id();
|
||||
for (int i = 0; i < playerInfoCount; i++) {
|
||||
for (int i = 0; i < playerInfoCount; ++i) {
|
||||
if (allPis[i].eagle_faction_id() == alliedFid) {
|
||||
alliedPids.push_back(static_cast<PlayerId>(i));
|
||||
break;
|
||||
@@ -178,13 +178,13 @@ void EagleInterfaceImpl::StartGame(const NewGameRequest &request) {
|
||||
for (const auto &info : request.user_infos()) {
|
||||
for (const auto &unit : info.units()) { heroIds.push_back(unit.hero().eagle_hero_id()); }
|
||||
}
|
||||
std::sort(heroIds.begin(), heroIds.end());
|
||||
std::ranges::sort(heroIds);
|
||||
|
||||
// Convert each interface player struct into the Shardok storage equivalents
|
||||
vector<PlayerInfoWithUnits> playersInfo{};
|
||||
const int userInfoCount = request.user_infos_size();
|
||||
playersInfo.reserve(userInfoCount);
|
||||
for (int i = 0; i < userInfoCount; i++) {
|
||||
for (int i = 0; i < userInfoCount; ++i) {
|
||||
playersInfo.push_back(ConvertPlayerInfo(request.user_infos(), static_cast<PlayerId>(i)));
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ void EagleInterfaceImpl::StartGame(const NewGameRequest &request) {
|
||||
for (const int32_t watcherFid : request.watcher_eagle_faction_ids()) {
|
||||
std::vector<PlayerId> allyPids;
|
||||
allyPids.reserve(userInfoCount);
|
||||
for (int i = 0; i < userInfoCount; i++) {
|
||||
for (int i = 0; i < userInfoCount; ++i) {
|
||||
for (const auto &ally : request.user_infos(i).allies()) {
|
||||
if (ally.eagle_faction_id() == watcherFid) {
|
||||
allyPids.push_back(static_cast<PlayerId>(i));
|
||||
|
||||
@@ -172,7 +172,7 @@ auto SetUpController(
|
||||
const std::string &serializedRequest,
|
||||
const std::vector<std::pair<int32_t, std::vector<PlayerId>>> &watcherAllies)
|
||||
-> std::shared_ptr<ShardokGameController> {
|
||||
auto unplacedUnits = std::vector<Unit>();
|
||||
std::vector<Unit> unplacedUnits;
|
||||
unplacedUnits.reserve(units.size() + TutorialReinforcementUnitCount(tutorialConfig));
|
||||
|
||||
UnitId nextUnitId = 0;
|
||||
@@ -206,7 +206,7 @@ auto SetUpController(
|
||||
if (tutorialConfig.enabled()) {
|
||||
std::vector<PlayerId> allPlayerIds;
|
||||
allPlayerIds.reserve(playerInfos.size());
|
||||
for (size_t i = 0; i < playerInfos.size(); i++) {
|
||||
for (size_t i = 0; i < playerInfos.size(); ++i) {
|
||||
allPlayerIds.push_back(static_cast<PlayerId>(i));
|
||||
}
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ auto main(const int argc, char **argv) -> int {
|
||||
|
||||
FilesystemUtils::SetExecPath(argv[0]);
|
||||
|
||||
auto extraSettings = std::vector<std::string>();
|
||||
std::vector<std::string> extraSettings;
|
||||
extraSettings.reserve(argc - 1);
|
||||
for (int i = 1; i < argc; i++) { extraSettings.emplace_back(argv[i]); }
|
||||
for (int i = 1; i < argc; ++i) { extraSettings.emplace_back(argv[i]); }
|
||||
|
||||
const std::shared_ptr<ServerConfiguration> config = std::make_shared<ServerConfiguration>(
|
||||
FilesystemUtils::StaticEagle0FilesDirectory() + "/eagle0.conf");
|
||||
|
||||
+2
-2
@@ -466,7 +466,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 200
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 200
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
@@ -963,7 +963,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 50
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 50
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
|
||||
-5
@@ -38,11 +38,6 @@ public class AvailableGameItem : MonoBehaviour {
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchTargets(joinButton, dropButton);
|
||||
TouchTargetUtils.EnsureMinimumTouchHeight(heroDropdownController);
|
||||
}
|
||||
|
||||
public void JoinClicked() {
|
||||
// Track multiplayer status for tutorial system
|
||||
TutorialManager.IsMultiplayerGame = maxHumanPlayerCount > 1;
|
||||
|
||||
+29
-29
@@ -994,7 +994,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 240, y: -20}
|
||||
m_SizeDelta: {x: 300, y: 40}
|
||||
m_SizeDelta: {x: 300, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3027143629724913515
|
||||
CanvasRenderer:
|
||||
@@ -1103,10 +1103,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 300
|
||||
m_PreferredHeight: 45
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -2182,7 +2182,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 540, y: -20}
|
||||
m_SizeDelta: {x: 300, y: 40}
|
||||
m_SizeDelta: {x: 300, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4463988733060461493
|
||||
CanvasRenderer:
|
||||
@@ -2291,10 +2291,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 300
|
||||
m_PreferredHeight: 45
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -2364,7 +2364,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 240, y: -100}
|
||||
m_SizeDelta: {x: 300, y: 40}
|
||||
m_SizeDelta: {x: 300, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7758813704872912265
|
||||
CanvasRenderer:
|
||||
@@ -2473,10 +2473,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 300
|
||||
m_PreferredHeight: 45
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3293,7 +3293,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 495, y: -21.428572}
|
||||
m_SizeDelta: {x: 150, y: 42.857143}
|
||||
m_SizeDelta: {x: 150, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5402356299776843339
|
||||
CanvasRenderer:
|
||||
@@ -3390,8 +3390,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
@@ -3437,7 +3437,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 240, y: -60}
|
||||
m_SizeDelta: {x: 300, y: 40}
|
||||
m_SizeDelta: {x: 300, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7764947219300022713
|
||||
CanvasRenderer:
|
||||
@@ -3546,10 +3546,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 300
|
||||
m_PreferredHeight: 45
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3676,7 +3676,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 540, y: -100}
|
||||
m_SizeDelta: {x: 300, y: 40}
|
||||
m_SizeDelta: {x: 300, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5993515603083611706
|
||||
CanvasRenderer:
|
||||
@@ -3785,10 +3785,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 300
|
||||
m_PreferredHeight: 45
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -4308,7 +4308,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 310, y: -21.428572}
|
||||
m_SizeDelta: {x: 200, y: 42.857143}
|
||||
m_SizeDelta: {x: 200, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7995546684590395312
|
||||
CanvasRenderer:
|
||||
@@ -4438,7 +4438,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: 50
|
||||
m_FlexibleWidth: 1
|
||||
@@ -4753,7 +4753,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 540, y: -60}
|
||||
m_SizeDelta: {x: 300, y: 40}
|
||||
m_SizeDelta: {x: 300, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4530446958448000868
|
||||
CanvasRenderer:
|
||||
@@ -4862,10 +4862,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 300
|
||||
m_PreferredHeight: 45
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
-19
@@ -206,7 +206,6 @@ public class ConnectionHandler : MonoBehaviour, ILobbySubscriber, IDisposable {
|
||||
void Start() {
|
||||
MainQueue.EnsureExists();
|
||||
EnsureOAuthManager();
|
||||
EnsureConnectionTouchTargets();
|
||||
|
||||
var currentResolution = Screen.currentResolution;
|
||||
var resolutions = Screen.resolutions;
|
||||
@@ -240,24 +239,6 @@ public class ConnectionHandler : MonoBehaviour, ILobbySubscriber, IDisposable {
|
||||
TryRestoreSession();
|
||||
}
|
||||
|
||||
private void EnsureConnectionTouchTargets() {
|
||||
TouchTargetUtils.EnsureMinimumTouchHeight(resolutionDropdown);
|
||||
TouchTargetUtils.EnsureMinimumTouchTargets(
|
||||
discordLoginButton,
|
||||
googleLoginButton,
|
||||
githubLoginButton,
|
||||
appleLoginButton,
|
||||
steamLoginButton,
|
||||
twitchLoginButton,
|
||||
connectToQAButton,
|
||||
logoutButton,
|
||||
customBattleButton,
|
||||
cancelCustomBattleButton,
|
||||
lobbyConnectToQAButton,
|
||||
startTutorialButton);
|
||||
TouchTargetUtils.EnsureMinimumTouchHeight(tutorialPhaseDropdown);
|
||||
}
|
||||
|
||||
private static void EnsureOAuthManager() {
|
||||
if (OAuthManager.Instance != null) return;
|
||||
|
||||
|
||||
-6
@@ -22,12 +22,6 @@ public class CreateGameItem : MonoBehaviour {
|
||||
|
||||
private List<AvailableLeader> availableLeaders;
|
||||
|
||||
private void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchTarget(createButton);
|
||||
TouchTargetUtils.EnsureMinimumTouchHeight(heroDropdownController);
|
||||
TouchTargetUtils.EnsureMinimumTouchHeight(totalHumansDropdown);
|
||||
}
|
||||
|
||||
public string SelectedLeaderTextId {
|
||||
get {
|
||||
if (heroDropdownController.SelectedHeroId == 0) {
|
||||
|
||||
+64
-1
@@ -592,6 +592,7 @@ GameObject:
|
||||
- component: {fileID: 898597746203911659}
|
||||
- component: {fileID: 4434126794738073477}
|
||||
- component: {fileID: 7385850781428792638}
|
||||
- component: {fileID: 8800000000000005002}
|
||||
m_Layer: 5
|
||||
m_Name: Map Dropdown
|
||||
m_TagString: Untagged
|
||||
@@ -2171,6 +2172,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1501326297537489426}
|
||||
- component: {fileID: 2252783213297032447}
|
||||
- component: {fileID: 8800000000000005001}
|
||||
m_Layer: 5
|
||||
m_Name: Defender Toggle
|
||||
m_TagString: Untagged
|
||||
@@ -2197,7 +2199,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: -569, y: -35}
|
||||
m_SizeDelta: {x: 160, y: 20}
|
||||
m_SizeDelta: {x: 160, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2252783213297032447
|
||||
MonoBehaviour:
|
||||
@@ -3213,6 +3215,7 @@ GameObject:
|
||||
- component: {fileID: 7214163081024251216}
|
||||
- component: {fileID: 7405796262465680575}
|
||||
- component: {fileID: 423746629815688217}
|
||||
- component: {fileID: 8800000000000005003}
|
||||
m_Layer: 5
|
||||
m_Name: Month Dropdown
|
||||
m_TagString: Untagged
|
||||
@@ -6378,3 +6381,63 @@ MonoBehaviour:
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!114 &8800000000000005001
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3698460732655721751}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &8800000000000005002
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 881271985257327667}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &8800000000000005003
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4908952190814918517}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
-5
@@ -38,11 +38,6 @@ public class CustomBattleHandler : MonoBehaviour, IClientConnectionSubscriber {
|
||||
|
||||
private ShardokGameModel _shardokModel;
|
||||
|
||||
private void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchTarget(defenderToggle);
|
||||
TouchTargetUtils.EnsureMinimumTouchHeights(mapDropdown, monthDropdown);
|
||||
}
|
||||
|
||||
public void SetActive(
|
||||
EagleConnection conn,
|
||||
PersistentClientConnection persistentClientConnection) {
|
||||
|
||||
+16
-16
@@ -1593,7 +1593,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1256, y: -20}
|
||||
m_SizeDelta: {x: 150, y: 40}
|
||||
m_SizeDelta: {x: 150, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7949922150679434671
|
||||
CanvasRenderer:
|
||||
@@ -1690,8 +1690,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
@@ -3231,7 +3231,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1676, y: -20}
|
||||
m_SizeDelta: {x: 150, y: 40}
|
||||
m_SizeDelta: {x: 150, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7556415920075317943
|
||||
CanvasRenderer:
|
||||
@@ -3340,8 +3340,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
@@ -4862,7 +4862,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 514.9999}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_SizeDelta: {x: 160, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2955986525496909840
|
||||
CanvasRenderer:
|
||||
@@ -4980,7 +4980,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 200
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
@@ -5447,7 +5447,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1466, y: -20}
|
||||
m_SizeDelta: {x: 250, y: 40}
|
||||
m_SizeDelta: {x: 250, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &9022295474990888655
|
||||
CanvasRenderer:
|
||||
@@ -5556,8 +5556,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 250
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
@@ -5601,7 +5601,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 80, y: -20}
|
||||
m_SizeDelta: {x: 150, y: 40}
|
||||
m_SizeDelta: {x: 150, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2803292952421455886
|
||||
CanvasRenderer:
|
||||
@@ -5698,8 +5698,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
@@ -6963,7 +6963,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 200
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 200
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
@@ -7117,7 +7117,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 150
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
|
||||
+4
-4
@@ -783,10 +783,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 35
|
||||
m_MinHeight: 35
|
||||
m_PreferredWidth: 35
|
||||
m_PreferredHeight: 35
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 48
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
-2
@@ -20,8 +20,6 @@ public class RunningGameItem : MonoBehaviour {
|
||||
|
||||
private long gameId;
|
||||
|
||||
private void Awake() { TouchTargetUtils.EnsureMinimumTouchTarget(dropButton); }
|
||||
|
||||
public void GoClicked() { GoCallback(gameId); }
|
||||
|
||||
public void DropClicked() { DropCallback?.Invoke(gameId); }
|
||||
|
||||
-5
@@ -5,9 +5,4 @@ public class StoredAccountButton : MonoBehaviour {
|
||||
public TMP_Text label;
|
||||
public Image icon;
|
||||
public Button deleteButton;
|
||||
|
||||
private void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchTarget(this);
|
||||
TouchTargetUtils.EnsureMinimumTouchTarget(deleteButton);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -328,8 +328,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 400
|
||||
m_PreferredHeight: 60
|
||||
m_FlexibleWidth: -1
|
||||
@@ -757,10 +757,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: 40
|
||||
m_PreferredHeight: 40
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 48
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
-2
@@ -22,8 +22,6 @@ namespace eagle {
|
||||
|
||||
private bool _registeredAsFightButton;
|
||||
|
||||
private void Awake() { TouchTargetUtils.EnsureMinimumTouchTarget(actionButton); }
|
||||
|
||||
public void Populate(
|
||||
ShardokBattleView battle,
|
||||
IGameModel model,
|
||||
|
||||
@@ -785,6 +785,7 @@ GameObject:
|
||||
- component: {fileID: 6176764422977772710}
|
||||
- component: {fileID: 6176764422977772709}
|
||||
- component: {fileID: 6176764422977772708}
|
||||
- component: {fileID: 8800000000000006001}
|
||||
m_Layer: 0
|
||||
m_Name: Hero Dropdown
|
||||
m_TagString: Untagged
|
||||
@@ -1371,3 +1372,23 @@ MonoBehaviour:
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &8800000000000006001
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6176764422977772730}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+2
-2
@@ -546,8 +546,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 100
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: 0
|
||||
|
||||
+11
-11
@@ -1404,8 +1404,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 30
|
||||
m_MinHeight: 30
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
@@ -1665,7 +1665,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 150
|
||||
m_MinHeight: 30
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
@@ -3078,8 +3078,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 30
|
||||
m_MinHeight: 30
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
@@ -5514,8 +5514,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 30
|
||||
m_MinHeight: 30
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
@@ -14664,8 +14664,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 30
|
||||
m_MinHeight: 30
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
@@ -14822,8 +14822,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 30
|
||||
m_MinHeight: 30
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
|
||||
-13
@@ -27,19 +27,6 @@ namespace eagle {
|
||||
public Toggle canStartFire;
|
||||
public Button deleteButton;
|
||||
|
||||
private void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchHeights(
|
||||
professionDropdown,
|
||||
battalionTypeDropdown,
|
||||
startingPosition);
|
||||
TouchTargetUtils.EnsureMinimumTouchTargets(
|
||||
isVip,
|
||||
canFlee,
|
||||
canArchery,
|
||||
canStartFire,
|
||||
deleteButton);
|
||||
}
|
||||
|
||||
public CommonProfession SelectedProfession {
|
||||
get => professionDropdown.value == 0 ? CommonProfession.NoProfession
|
||||
: (CommonProfession)(professionDropdown.value);
|
||||
|
||||
@@ -85441,7 +85441,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -702}
|
||||
m_SizeDelta: {x: 0, y: 288}
|
||||
m_SizeDelta: {x: 0, y: 324}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!114 &604968800
|
||||
MonoBehaviour:
|
||||
|
||||
@@ -3873,7 +3873,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 75, y: -15}
|
||||
m_SizeDelta: {x: 150, y: 30}
|
||||
m_SizeDelta: {x: 150, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &292706908
|
||||
MonoBehaviour:
|
||||
@@ -3888,10 +3888,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -6505,7 +6505,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 70, y: -15}
|
||||
m_SizeDelta: {x: 140, y: 30}
|
||||
m_SizeDelta: {x: 140, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &502471670
|
||||
MonoBehaviour:
|
||||
@@ -6520,10 +6520,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 140
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -10095,7 +10095,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 730, y: -20}
|
||||
m_SizeDelta: {x: 120, y: 40}
|
||||
m_SizeDelta: {x: 120, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &865352379
|
||||
MonoBehaviour:
|
||||
@@ -10110,10 +10110,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 120
|
||||
m_PreferredHeight: 40
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
@@ -12797,7 +12797,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 200, y: -15}
|
||||
m_SizeDelta: {x: 100, y: 30}
|
||||
m_SizeDelta: {x: 100, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1121182313
|
||||
MonoBehaviour:
|
||||
@@ -12812,10 +12812,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 100
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -22454,7 +22454,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 730, y: -15}
|
||||
m_SizeDelta: {x: 100, y: 30}
|
||||
m_SizeDelta: {x: 100, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1873973024
|
||||
MonoBehaviour:
|
||||
@@ -22469,10 +22469,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 100
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -24191,7 +24191,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 60, y: -20}
|
||||
m_SizeDelta: {x: 120, y: 40}
|
||||
m_SizeDelta: {x: 120, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1984490470
|
||||
MonoBehaviour:
|
||||
@@ -24206,10 +24206,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 120
|
||||
m_PreferredHeight: 40
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
@@ -24603,7 +24603,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 730, y: -15}
|
||||
m_SizeDelta: {x: 100, y: 30}
|
||||
m_SizeDelta: {x: 100, y: 48}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2059354380
|
||||
MonoBehaviour:
|
||||
@@ -24618,10 +24618,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 100
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 48
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+20
-20
@@ -587,8 +587,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 80
|
||||
m_PreferredHeight: 80
|
||||
m_FlexibleWidth: -1
|
||||
@@ -4103,8 +4103,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 80
|
||||
m_PreferredHeight: 80
|
||||
m_FlexibleWidth: -1
|
||||
@@ -9828,8 +9828,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 80
|
||||
m_PreferredHeight: 80
|
||||
m_FlexibleWidth: -1
|
||||
@@ -10994,8 +10994,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: 50
|
||||
m_FlexibleWidth: 1
|
||||
@@ -11696,8 +11696,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 80
|
||||
m_PreferredHeight: 80
|
||||
m_FlexibleWidth: -1
|
||||
@@ -15539,8 +15539,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 80
|
||||
m_PreferredHeight: 80
|
||||
m_FlexibleWidth: -1
|
||||
@@ -16040,8 +16040,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 80
|
||||
m_PreferredHeight: 80
|
||||
m_FlexibleWidth: -1
|
||||
@@ -16409,8 +16409,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 80
|
||||
m_PreferredHeight: 80
|
||||
m_FlexibleWidth: -1
|
||||
@@ -16774,8 +16774,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 80
|
||||
m_PreferredHeight: 80
|
||||
m_FlexibleWidth: -1
|
||||
@@ -21389,8 +21389,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinWidth: 48
|
||||
m_MinHeight: 48
|
||||
m_PreferredWidth: 120
|
||||
m_PreferredHeight: 120
|
||||
m_FlexibleWidth: -1
|
||||
|
||||
+1
-14
@@ -263,20 +263,7 @@ namespace Shardok {
|
||||
private int _setupGameGeneration;
|
||||
private bool _gridRebuildHandlerAttached;
|
||||
|
||||
void Awake() {
|
||||
_randomNumberForCellIndex = Array.Empty<int>();
|
||||
TouchTargetUtils.EnsureMinimumTouchTargets(
|
||||
endTurnButton,
|
||||
button1,
|
||||
button2,
|
||||
button3,
|
||||
button4,
|
||||
button5,
|
||||
button6,
|
||||
button7,
|
||||
button8,
|
||||
button9);
|
||||
}
|
||||
void Awake() { _randomNumberForCellIndex = Array.Empty<int>(); }
|
||||
|
||||
void Start() {
|
||||
buttons = new List<Button> {
|
||||
|
||||
-5
@@ -45,11 +45,6 @@ namespace common.GUIUtils {
|
||||
private byte[] _capturedScreenshot;
|
||||
|
||||
void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchTargets(
|
||||
submitButton,
|
||||
cancelButton,
|
||||
screenshotButton);
|
||||
|
||||
panel.SetActive(false);
|
||||
if (modalBlocker != null) {
|
||||
modalBlocker.SetActive(false);
|
||||
|
||||
-2
@@ -22,8 +22,6 @@ namespace common.UpdateNotification {
|
||||
public Button laterButton;
|
||||
|
||||
void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchTargets(restartButton, laterButton);
|
||||
|
||||
if (panel != null) panel.SetActive(false);
|
||||
|
||||
if (restartButton != null) restartButton.onClick.AddListener(OnRestartClicked);
|
||||
|
||||
-2
@@ -23,8 +23,6 @@ namespace common.UpdateNotification {
|
||||
public Button restartButton;
|
||||
|
||||
void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchTarget(restartButton);
|
||||
|
||||
if (panel != null) panel.SetActive(false);
|
||||
if (modalBlocker != null) modalBlocker.SetActive(false);
|
||||
|
||||
|
||||
-2
@@ -40,8 +40,6 @@ namespace common.WhatsNew {
|
||||
private bool _showingOlder;
|
||||
|
||||
void Awake() {
|
||||
TouchTargetUtils.EnsureMinimumTouchTargets(gotItButton, showOlderButton);
|
||||
|
||||
if (panel != null) panel.SetActive(false);
|
||||
if (modalBlocker != null) {
|
||||
modalBlocker.SetActive(false);
|
||||
|
||||
@@ -83,14 +83,14 @@ object Main {
|
||||
|
||||
def main(args: Array[String]): Unit = {
|
||||
// Initialize Sentry for error tracking (if DSN is configured)
|
||||
Option(System.getenv("SENTRY_DSN")).filter(_.nonEmpty).foreach { dsn =>
|
||||
sys.env.get("SENTRY_DSN").filter(_.nonEmpty).foreach { dsn =>
|
||||
Sentry.init { options =>
|
||||
options.setDsn(dsn)
|
||||
options.setEnvironment(
|
||||
Option(System.getenv("SENTRY_ENVIRONMENT")).getOrElse("production")
|
||||
sys.env.get("SENTRY_ENVIRONMENT").getOrElse("production")
|
||||
)
|
||||
options.setRelease(
|
||||
Option(System.getenv("SENTRY_RELEASE")).getOrElse("unknown")
|
||||
sys.env.get("SENTRY_RELEASE").getOrElse("unknown")
|
||||
)
|
||||
}
|
||||
SimpleTimedLogger.printLogger.logLine("Sentry error tracking enabled")
|
||||
|
||||
@@ -501,7 +501,7 @@ object MidGameAIClient {
|
||||
def reconnedBattalionsFor(provinceId: ProvinceId): Vector[BattalionViewC] =
|
||||
reconnedFullInfoFor(provinceId)
|
||||
.map(_.battalions)
|
||||
.getOrElse(Vector())
|
||||
.getOrElse(Vector.empty)
|
||||
|
||||
AttackCommandChooser.chosenAttackCommand(
|
||||
actingFactionId,
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ object AvailableAttackDecisionCommandFactory extends ScalaAvailableCommandsFacto
|
||||
): Boolean =
|
||||
myDecidingHostileArmies(pid, fid, gs)
|
||||
.map(_.armies)
|
||||
.getOrElse(Vector())
|
||||
.getOrElse(Vector.empty)
|
||||
.map(_.army)
|
||||
.forall(_.fleeProvinceId.isDefined)
|
||||
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ object AvailableDefendCommandsFactory extends ScalaAvailableCommandsFactory {
|
||||
)
|
||||
.map(_.id)
|
||||
.forall(_ == from.id)
|
||||
then Vector()
|
||||
then Vector.empty
|
||||
else
|
||||
from.neighbors
|
||||
.map(_.provinceId)
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ object AvailableDiplomacyCommandsFactory extends ScalaAvailableCommandsFactory {
|
||||
)
|
||||
)
|
||||
}
|
||||
else Vector()
|
||||
else Vector.empty
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ object AvailableDivineCommandsFactory extends ScalaAvailableCommandsFactory {
|
||||
actingProvinceId = provinceId,
|
||||
costPerHero = effectiveCost(province),
|
||||
divinableHeroes = expandedHeroes,
|
||||
unavailableHeroes = Vector()
|
||||
unavailableHeroes = Vector.empty
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ object AvailableIssueOrdersCommandFactory extends ScalaAvailableCommandsFactory
|
||||
.sortBy(_.name)
|
||||
.map(p => ProvinceOrders(provinceId = p.id, orderType = toCommandOrderType(p.provinceOrders))),
|
||||
availableOrders = Vector(Develop, Mobilize, Expand, Entrust),
|
||||
availableFocusProvinces = Vector()
|
||||
availableFocusProvinces = Vector.empty
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -331,7 +331,7 @@ object ChronicleEventGenerator {
|
||||
)
|
||||
}
|
||||
|
||||
case _ => Vector()
|
||||
case _ => Vector.empty
|
||||
}
|
||||
|
||||
def eventTextEntries(
|
||||
|
||||
+6
-6
@@ -191,12 +191,12 @@ case class EndPlayerCommandsPhaseAction(
|
||||
case _: DeferredChange.EpidemicStarted =>
|
||||
province.activeEvents :+ EpidemicEvent(startDate = currentDate)
|
||||
|
||||
case _: DeferredChange.PrisonerMoved => Vector()
|
||||
case _: DeferredChange.PrisonerReturned => Vector()
|
||||
case _: DeferredChange.CapturedHeroImprisoned => Vector()
|
||||
case _: DeferredChange.CapturedHeroExecuted => Vector()
|
||||
case _: DeferredChange.CapturedHeroExiled => Vector()
|
||||
case _: DeferredChange.CapturedHeroReturned => Vector()
|
||||
case _: DeferredChange.PrisonerMoved => Vector.empty
|
||||
case _: DeferredChange.PrisonerReturned => Vector.empty
|
||||
case _: DeferredChange.CapturedHeroImprisoned => Vector.empty
|
||||
case _: DeferredChange.CapturedHeroExecuted => Vector.empty
|
||||
case _: DeferredChange.CapturedHeroExiled => Vector.empty
|
||||
case _: DeferredChange.CapturedHeroReturned => Vector.empty
|
||||
}
|
||||
),
|
||||
removedDeferredChangeIndex = Some(0)
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ case class EndProvinceMoveResolutionPhaseAction(
|
||||
factions = factions,
|
||||
provinces = provinces,
|
||||
heroes = heroes,
|
||||
killedHeroIds = Vector()
|
||||
killedHeroIds = Vector.empty
|
||||
).randomResults(functionalRandom)
|
||||
.map(
|
||||
_ :+
|
||||
|
||||
+8
-3
@@ -25,11 +25,16 @@ case class EndUnaffiliatedHeroActionsPhaseAction(
|
||||
heroes: Vector[HeroT],
|
||||
factions: Vector[FactionT]
|
||||
) extends ProtolessSequentialResultsAction {
|
||||
private lazy val factionsById: Map[FactionId, FactionT] =
|
||||
factions.map(faction => faction.id -> faction).toMap
|
||||
private lazy val heroesById: Map[HeroId, HeroT] =
|
||||
heroes.map(hero => hero.id -> hero).toMap
|
||||
|
||||
private def requiredFaction(fid: FactionId): FactionT =
|
||||
factions.find(_.id == fid).getOrElse(throw new IllegalArgumentException(s"No faction found for id $fid"))
|
||||
factionsById.getOrElse(fid, throw new IllegalArgumentException(s"No faction found for id $fid"))
|
||||
|
||||
private def requiredHero(hid: HeroId): HeroT =
|
||||
heroes.find(_.id == hid).getOrElse(throw new IllegalArgumentException(s"No hero found for id $hid"))
|
||||
heroesById.getOrElse(hid, throw new IllegalArgumentException(s"No hero found for id $hid"))
|
||||
|
||||
private def heroRejoinResults: Vector[ActionResultT] =
|
||||
(for {
|
||||
@@ -78,7 +83,7 @@ case class EndUnaffiliatedHeroActionsPhaseAction(
|
||||
)
|
||||
}
|
||||
}
|
||||
.getOrElse(Vector())
|
||||
.getOrElse(Vector.empty)
|
||||
|
||||
override def results: Vector[ActionResultT] = {
|
||||
val cpsAndLlmRequests = provinces.map { p =>
|
||||
|
||||
@@ -140,7 +140,7 @@ case class NewRoundAction(
|
||||
chronicler_style = chroniclerStyle
|
||||
)
|
||||
)
|
||||
else Vector()
|
||||
else Vector.empty
|
||||
|
||||
private def dateBefore(a: Date, b: Date): Boolean =
|
||||
a.year < b.year || (a.year == b.year && a.month.value < b.month.value)
|
||||
|
||||
+5
-5
@@ -267,7 +267,7 @@ case class PerformUnaffiliatedHeroesAction(
|
||||
toCheck = gs.provinces.keys,
|
||||
nextHid = gs.heroes.values.map(_.id).max + 1,
|
||||
currentGenerator = heroGenerator,
|
||||
acc = RandomState(Vector(), fr)
|
||||
acc = RandomState(Vector.empty, fr)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ case class PerformUnaffiliatedHeroesAction(
|
||||
toCheck = gs.provinces.keys,
|
||||
nextHid = gs.heroes.values.map(_.id).max + 1,
|
||||
currentGenerator = heroGenerator,
|
||||
acc = RandomState(Vector(), fr)
|
||||
acc = RandomState(Vector.empty, fr)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -528,17 +528,17 @@ case class PerformUnaffiliatedHeroesAction(
|
||||
gs.heroes
|
||||
)
|
||||
|
||||
if spawnChance <= 0 then RandomState((Vector(), nextHid), fr)
|
||||
if spawnChance <= 0 then RandomState((Vector.empty, nextHid), fr)
|
||||
else
|
||||
fr.nextDouble.continue {
|
||||
case (roll, nextFr) =>
|
||||
if roll >= spawnChance then RandomState((Vector(), nextHid), nextFr)
|
||||
if roll >= spawnChance then RandomState((Vector.empty, nextHid), nextFr)
|
||||
else {
|
||||
// Find provinces containing faction leaders (faction head or sworn brothers)
|
||||
val faction = gs.factions(factionId)
|
||||
val leaderProvinces = FactionUtils.provincesWithLeaders(gs.provinces.values, faction)
|
||||
|
||||
if leaderProvinces.isEmpty then RandomState((Vector(), nextHid), nextFr)
|
||||
if leaderProvinces.isEmpty then RandomState((Vector.empty, nextHid), nextFr)
|
||||
else
|
||||
nextFr.nextRandomElement(leaderProvinces.map(_.id)).continue {
|
||||
case (targetPid, fr2) =>
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ object PrisonerExchangeAction {
|
||||
case _ => acc
|
||||
}
|
||||
|
||||
go(Vector(), sortedExchangeableLeaders)
|
||||
go(Vector.empty, sortedExchangeableLeaders)
|
||||
}
|
||||
|
||||
def exchangeResults(
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ case class TruceTurnBackPhaseAction(
|
||||
)
|
||||
}
|
||||
}
|
||||
.getOrElse(Vector())
|
||||
.getOrElse(Vector.empty)
|
||||
|
||||
override def randomResults(
|
||||
functionalRandom: FunctionalRandom
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ case class UnaffiliatedHeroAppearedAction(
|
||||
// set at all. Mirror the spawn policy: a newly appeared free hero's
|
||||
// backstory is visible to every faction.
|
||||
clientTextVisibilityExtensions =
|
||||
if hero.backstoryVersions.isEmpty then Vector()
|
||||
if hero.backstoryVersions.isEmpty then Vector.empty
|
||||
else
|
||||
Vector(
|
||||
ClientTextVisibilityExtensionC(
|
||||
@@ -87,6 +87,6 @@ case class UnaffiliatedHeroAppearedAction(
|
||||
personalityWords = hero.personalityWords
|
||||
)
|
||||
)
|
||||
else Vector()) ++ nameGenerationRequest
|
||||
else Vector.empty) ++ nameGenerationRequest
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ object InvitationResolutionHelpers {
|
||||
joinedBattalionIds = redirectedArmies
|
||||
.flatMap(_.army.units)
|
||||
.flatMap(_.battalionId),
|
||||
removedBattalionIds = Vector()
|
||||
removedBattalionIds = Vector.empty
|
||||
)
|
||||
) {
|
||||
case (acc, p) =>
|
||||
|
||||
+3
-3
@@ -335,9 +335,9 @@ object HandleCapturedHeroesCommand {
|
||||
actingHeroId = capturingHeroId,
|
||||
actingFactionId = capturingFactionId,
|
||||
provinceId = provinceId,
|
||||
alreadyExecutedHeroIds = Vector(),
|
||||
alreadyImprisonedHeroIds = Vector(),
|
||||
alreadyExiledHeroIds = Vector()
|
||||
alreadyExecutedHeroIds = Vector.empty,
|
||||
alreadyImprisonedHeroIds = Vector.empty,
|
||||
alreadyExiledHeroIds = Vector.empty
|
||||
)
|
||||
|
||||
def make(
|
||||
|
||||
+41
-38
@@ -71,58 +71,61 @@ object HandleRiotCrackDownCommand {
|
||||
((rioterPower / totalPower) * rioterPower).ceil.toInt
|
||||
|
||||
val (changedBattalion, changedHero, destroyedBattalion, removedHero) =
|
||||
if optionalBattalion.isDefined then {
|
||||
if casualties < battalionSize then {
|
||||
(
|
||||
optionalBattalion.map(_.withSize(battalionSize - casualties)),
|
||||
Some(
|
||||
ChangedHeroC(
|
||||
heroId = actingHero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue),
|
||||
strengthXpDelta = Some(CrackDownStrengthXp.intValue),
|
||||
agilityXpDelta = Some(CrackDownAgilityXp.intValue)
|
||||
)
|
||||
),
|
||||
None,
|
||||
None
|
||||
)
|
||||
} else {
|
||||
val heroCasualties = casualties - battalionSize
|
||||
if heroCasualties >= actingHero.vigor then {
|
||||
optionalBattalion match {
|
||||
case Some(battalion) =>
|
||||
if casualties < battalionSize then {
|
||||
(
|
||||
Some(battalion.withSize(battalionSize - casualties)),
|
||||
Some(
|
||||
ChangedHeroC(
|
||||
heroId = actingHero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue),
|
||||
strengthXpDelta = Some(CrackDownStrengthXp.intValue),
|
||||
agilityXpDelta = Some(CrackDownAgilityXp.intValue)
|
||||
)
|
||||
),
|
||||
None,
|
||||
None,
|
||||
optionalBattalion.map(_.id),
|
||||
Some(actingHero.id)
|
||||
None
|
||||
)
|
||||
} else {
|
||||
val heroCasualties = casualties - battalionSize
|
||||
if heroCasualties >= actingHero.vigor then {
|
||||
(
|
||||
None,
|
||||
None,
|
||||
Some(battalion.id),
|
||||
Some(actingHero.id)
|
||||
)
|
||||
} else {
|
||||
(
|
||||
None,
|
||||
Some(
|
||||
ChangedHeroC(
|
||||
heroId = actingHero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue - heroCasualties)
|
||||
)
|
||||
),
|
||||
Some(battalion.id),
|
||||
None
|
||||
)
|
||||
}
|
||||
}
|
||||
case None =>
|
||||
if casualties >= actingHero.vigor then {
|
||||
(None, None, None, Some(actingHero.id))
|
||||
} else {
|
||||
(
|
||||
None,
|
||||
Some(
|
||||
ChangedHeroC(
|
||||
heroId = actingHero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue - heroCasualties)
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue - casualties)
|
||||
)
|
||||
),
|
||||
optionalBattalion.map(_.id),
|
||||
None,
|
||||
None
|
||||
)
|
||||
}
|
||||
}
|
||||
} else if casualties >= actingHero.vigor then {
|
||||
(None, None, None, Some(actingHero.id))
|
||||
} else {
|
||||
(
|
||||
None,
|
||||
Some(
|
||||
ChangedHeroC(
|
||||
heroId = actingHero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue - casualties)
|
||||
)
|
||||
),
|
||||
None,
|
||||
None
|
||||
)
|
||||
}
|
||||
|
||||
val succeeded = removedHero.isEmpty
|
||||
|
||||
@@ -65,7 +65,7 @@ object ReconCommand {
|
||||
details = IncomingRecon(heroId = actingHeroId)
|
||||
)
|
||||
),
|
||||
removedIncomingEndTurnActions = Vector()
|
||||
removedIncomingEndTurnActions = Vector.empty
|
||||
)
|
||||
),
|
||||
changedHeroes = Vector(
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ object ResolveAllianceOfferCommand {
|
||||
case _ =>
|
||||
throw new EagleCommandException(s"Unexpected status: $status")
|
||||
},
|
||||
affectedProvinceIds = Vector(),
|
||||
affectedProvinceIds = Vector.empty,
|
||||
affectedHeroIds = Vector(allianceOffer.messengerHeroId),
|
||||
llm = NotificationT.Llm.Id(llmRequestId),
|
||||
deferred = false
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ object ResolveInvitationCommand {
|
||||
case _ =>
|
||||
throw new EagleCommandException(s"Unexpected status: $status")
|
||||
},
|
||||
affectedProvinceIds = Vector(),
|
||||
affectedProvinceIds = Vector.empty,
|
||||
affectedHeroIds = Vector(invitation.messengerHeroId),
|
||||
llm = NotificationT.Llm.Id(llmRequestId),
|
||||
deferred = status == Imprisoned // Only imprison notifications are deferred
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ object ResolveRansomOfferCommand {
|
||||
case _ =>
|
||||
throw new EagleCommandException(s"Unexpected status: $status")
|
||||
},
|
||||
affectedProvinceIds = Vector(),
|
||||
affectedProvinceIds = Vector.empty,
|
||||
affectedHeroIds = Vector(ransomOffer.messengerHeroId),
|
||||
llm = NotificationT.Llm.Id(llmRequestId),
|
||||
deferred = false
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ object ResolveTruceOfferCommand {
|
||||
s"Invalid diplomacy offer status for command: $resolution"
|
||||
)
|
||||
},
|
||||
affectedProvinceIds = Vector(),
|
||||
affectedProvinceIds = Vector.empty,
|
||||
affectedHeroIds = Vector(truceOffer.messengerHeroId),
|
||||
llm = NotificationT.Llm.Id(llmRequestId),
|
||||
deferred = true
|
||||
|
||||
+41
-38
@@ -143,56 +143,59 @@ object SuppressBeastsCommand {
|
||||
val casualties = ((beastsPower / totalPower) * beastsPower).ceil.toInt
|
||||
|
||||
val (changedBattalion, changedHero, destroyedBattalionId, removedHero) =
|
||||
if optionalBattalion.isDefined then {
|
||||
if casualties < battalionSize then {
|
||||
(
|
||||
optionalBattalion.map(batt =>
|
||||
ChangedBattalionC(
|
||||
to = batt.withSize(battalionSize - casualties)
|
||||
)
|
||||
),
|
||||
ChangedHeroC(
|
||||
heroId = hero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue),
|
||||
strengthXpDelta = Some(SuppressBeastsStrengthXp.intValue),
|
||||
agilityXpDelta = Some(SuppressBeastsAgilityXp.intValue)
|
||||
),
|
||||
None,
|
||||
None
|
||||
)
|
||||
} else {
|
||||
val heroCasualties = casualties - battalionSize
|
||||
if heroCasualties >= hero.vigor then {
|
||||
optionalBattalion match {
|
||||
case Some(battalion) =>
|
||||
if casualties < battalionSize then {
|
||||
(
|
||||
Some(
|
||||
ChangedBattalionC(
|
||||
to = battalion.withSize(battalionSize - casualties)
|
||||
)
|
||||
),
|
||||
ChangedHeroC(
|
||||
heroId = hero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue),
|
||||
strengthXpDelta = Some(SuppressBeastsStrengthXp.intValue),
|
||||
agilityXpDelta = Some(SuppressBeastsAgilityXp.intValue)
|
||||
),
|
||||
None,
|
||||
ChangedHeroC(heroId = hero.id),
|
||||
optionalBattalion.map(_.id),
|
||||
Some(hero.id)
|
||||
None
|
||||
)
|
||||
} else {
|
||||
val heroCasualties = casualties - battalionSize
|
||||
if heroCasualties >= hero.vigor then {
|
||||
(
|
||||
None,
|
||||
ChangedHeroC(heroId = hero.id),
|
||||
Some(battalion.id),
|
||||
Some(hero.id)
|
||||
)
|
||||
} else {
|
||||
(
|
||||
None,
|
||||
ChangedHeroC(
|
||||
heroId = hero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue - heroCasualties)
|
||||
),
|
||||
Some(battalion.id),
|
||||
None
|
||||
)
|
||||
}
|
||||
}
|
||||
case None =>
|
||||
if casualties >= hero.vigor then {
|
||||
(None, ChangedHeroC(heroId = hero.id), None, Some(hero.id))
|
||||
} else {
|
||||
(
|
||||
None,
|
||||
ChangedHeroC(
|
||||
heroId = hero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue - heroCasualties)
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue - casualties)
|
||||
),
|
||||
optionalBattalion.map(_.id),
|
||||
None,
|
||||
None
|
||||
)
|
||||
}
|
||||
}
|
||||
} else if casualties >= hero.vigor then {
|
||||
(None, ChangedHeroC(heroId = hero.id), None, Some(hero.id))
|
||||
} else {
|
||||
(
|
||||
None,
|
||||
ChangedHeroC(
|
||||
heroId = hero.id,
|
||||
vigorChange = StatDelta(-ActionVigorCost.intValue - casualties)
|
||||
),
|
||||
None,
|
||||
None
|
||||
)
|
||||
}
|
||||
|
||||
val heroDied = removedHero.isDefined
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ object CapturedHeroPleaGenerator {
|
||||
s"((already handled ${executed.size} ${imprisoned.size} ${exiled.size}))"
|
||||
}
|
||||
|
||||
private val emptyHandled = AlreadyHandled(Vector(), Vector(), Vector())
|
||||
private val emptyHandled = AlreadyHandled(Vector.empty, Vector.empty, Vector.empty)
|
||||
|
||||
private def initialPlea(
|
||||
gameId: GameId,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user