mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 09:35:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
731d8a72ad | ||
|
|
6a9e1d7ad7 | ||
|
|
84f182d74f | ||
|
|
d08402c502 | ||
|
|
b6a7c38a70 | ||
|
|
9513c1e404 | ||
|
|
d67d8b9784 | ||
|
|
fdc643bac0 | ||
|
|
9e7890a1a6 | ||
|
|
e9d876e5c9 | ||
|
|
524c15b824 | ||
|
|
0891ccb0af | ||
|
|
179288fa25 | ||
|
|
4a8b6df484 | ||
|
|
73b5e1a8cc | ||
|
|
8fa012cb73 | ||
|
|
8561c606eb | ||
|
|
abed097cad | ||
|
|
ccd7e6db18 | ||
|
|
e6c648c03e | ||
|
|
a4278cb6f2 | ||
|
|
ce9ddc049e | ||
|
|
3646fd868a | ||
|
|
288428c874 | ||
|
|
1f30d13454 | ||
|
|
6712a495ff | ||
|
|
8ac26578e3 | ||
|
|
049c7abb81 | ||
|
|
123e0066d7 | ||
|
|
3cff277132 | ||
|
|
ebb6a55ef8 | ||
|
|
a2d371fcfc | ||
|
|
b1d30c4f03 | ||
|
|
67911c12f6 | ||
|
|
25db6649f3 | ||
|
|
6a5d9df1a4 | ||
|
|
8254600b5c | ||
|
|
8b0d43a5ee | ||
|
|
99b1827048 | ||
|
|
8368f4f762 | ||
|
|
eda94bd881 | ||
|
|
2c8b3e6089 | ||
|
|
d9376ee870 | ||
|
|
94473eaac6 | ||
|
|
ff2caaac1c | ||
|
|
2fc7d91b6b | ||
|
|
f74ef641d8 | ||
|
|
1aa23d2992 | ||
|
|
2fd86301ce | ||
|
|
2c2a6a083b | ||
|
|
3462d7e6b3 | ||
|
|
d9a56d5cc5 | ||
|
|
db8a50edab | ||
|
|
e815438212 | ||
|
|
a31ce39009 | ||
|
|
8d8abf0f90 | ||
|
|
c9faf440ce | ||
|
|
14aec4f6d0 | ||
|
|
5b11135abb | ||
|
|
3ce4ad3770 | ||
|
|
65bc952a5a | ||
|
|
01be354271 | ||
|
|
2634c7c3c8 | ||
|
|
30789f86f6 | ||
|
|
404028bb59 | ||
|
|
ea25b9ea79 | ||
|
|
423940ad3b | ||
|
|
44d8ba6c40 | ||
|
|
87ea1f1727 | ||
|
|
76c70166ee | ||
|
|
40706f96a3 | ||
|
|
f04bcd61f7 | ||
|
|
d415e97672 | ||
|
|
e22a6d987c | ||
|
|
ba60421024 | ||
|
|
0dd7d75878 | ||
|
|
e77afba638 | ||
|
|
2d69336245 | ||
|
|
934f3c594e | ||
|
|
4cb56f80c6 | ||
|
|
212f19ba40 | ||
|
|
9e4f052653 | ||
|
|
afa85afebf | ||
|
|
c6514be984 | ||
|
|
719323d3c7 | ||
|
|
47fd3733b2 | ||
|
|
d7a6241a90 | ||
|
|
ce37e37fb6 | ||
|
|
536af1f547 | ||
|
|
7c69a9da0e | ||
|
|
548f72e6fc | ||
|
|
1d5aa0c7aa | ||
|
|
c00631d6dc | ||
|
|
f3e6285828 | ||
|
|
866c39283d |
@@ -22,6 +22,32 @@ common --per_file_copt=src/test/cpp/.*@-Wno-sign-compare
|
||||
common --per_file_copt=src/test/cpp/.*@-Wno-unknown-warning-option
|
||||
common --host_cxxopt="--std=c++23"
|
||||
|
||||
# C++ sanitizer configs for targeted Shardok safety checks.
|
||||
# Example: bazel test --config=asan //src/test/cpp/net/eagle0/shardok/library/...
|
||||
build:asan --compilation_mode=dbg
|
||||
build:asan --strip=never
|
||||
build:asan --copt=-fno-omit-frame-pointer
|
||||
build:asan --copt=-Wno-macro-redefined
|
||||
build:asan --copt=-fsanitize=address
|
||||
build:asan --linkopt=-fsanitize=address
|
||||
test:asan --test_env=ASAN_OPTIONS=detect_leaks=0:strict_init_order=1
|
||||
|
||||
build:ubsan --compilation_mode=dbg
|
||||
build:ubsan --strip=never
|
||||
build:ubsan --copt=-fno-omit-frame-pointer
|
||||
build:ubsan --copt=-Wno-macro-redefined
|
||||
build:ubsan --copt=-fsanitize=undefined
|
||||
build:ubsan --linkopt=-fsanitize=undefined
|
||||
test:ubsan --test_env=UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
|
||||
|
||||
build:tsan --compilation_mode=dbg
|
||||
build:tsan --strip=never
|
||||
build:tsan --copt=-fno-omit-frame-pointer
|
||||
build:tsan --copt=-Wno-macro-redefined
|
||||
build:tsan --copt=-fsanitize=thread
|
||||
build:tsan --linkopt=-fsanitize=thread
|
||||
test:tsan --test_env=TSAN_OPTIONS=halt_on_error=1
|
||||
|
||||
common --javacopt="-Xlint:-options"
|
||||
|
||||
# Prefer protobuf's prebuilt protoc toolchain instead of building protoc from
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
Checks: >
|
||||
-*,
|
||||
bugprone-*,
|
||||
performance-*,
|
||||
readability-*,
|
||||
modernize-*,
|
||||
cppcoreguidelines-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-owning-memory,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-const-cast,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-cppcoreguidelines-pro-type-union-access,
|
||||
-cppcoreguidelines-pro-type-vararg,
|
||||
-modernize-use-trailing-return-type,
|
||||
-readability-convert-member-functions-to-static,
|
||||
-readability-function-cognitive-complexity,
|
||||
-readability-identifier-length,
|
||||
-readability-magic-numbers
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: 'src/(main|test)/cpp/net/eagle0/(shardok|common)/.*'
|
||||
FormatStyle: file
|
||||
CheckOptions:
|
||||
readability-braces-around-statements.ShortStatementLines: '1'
|
||||
readability-function-size.LineThreshold: '160'
|
||||
readability-function-size.StatementThreshold: '80'
|
||||
readability-function-size.BranchThreshold: '20'
|
||||
modernize-use-nullptr.NullMacros: 'NULL'
|
||||
@@ -287,7 +287,7 @@ jobs:
|
||||
|
||||
./ci/github_actions/detect_addressables_changes.sh "$BASE_SHA" "${{ github.sha }}"
|
||||
- name: Build Windows unity
|
||||
run: ./ci/github_actions/build_unity.sh "${{ env.EAGLE0_BUILD_DIR }}/eagle0WIN" "${{ steps.addressables.outputs.changed }}" "${{ steps.addressables.outputs.changed }}"
|
||||
run: ./ci/github_actions/build_unity.sh "${{ env.EAGLE0_BUILD_DIR }}/eagle0WIN" true "${{ steps.addressables.outputs.changed }}"
|
||||
|
||||
- name: Save build SHA for Bee/ cache invalidation
|
||||
if: success()
|
||||
|
||||
@@ -59,6 +59,20 @@ if [ $UNITY_EXIT_CODE -ne 0 ]; then
|
||||
exit $UNITY_EXIT_CODE
|
||||
fi
|
||||
|
||||
if [ ! -f "$LOG_PATH" ]; then
|
||||
echo ""
|
||||
echo "ERROR: Unity exited successfully but did not write an editor log at $LOG_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$BUILD_PATH/Data/Raw/aa/settings.json" ]; then
|
||||
echo ""
|
||||
echo "ERROR: iOS player is missing Addressables runtime data at:"
|
||||
echo " $BUILD_PATH/Data/Raw/aa/settings.json"
|
||||
echo "Build Addressables before packaging the player so Addressables can initialize at runtime."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fail the build if any prefab references are broken — this produces a player
|
||||
# that launches but has null Inspector fields, which is hard to debug.
|
||||
if grep -q "Missing Prefab" "$LOG_PATH"; then
|
||||
|
||||
@@ -57,6 +57,14 @@ if [ ! -f "$LOG_PATH" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$BUILD_DIR/eagle0_Data/StreamingAssets/aa/settings.json" ]; then
|
||||
echo ""
|
||||
echo "ERROR: Windows player is missing Addressables runtime data at:"
|
||||
echo " $BUILD_DIR/eagle0_Data/StreamingAssets/aa/settings.json"
|
||||
echo "Build Addressables before packaging the player so Addressables can initialize at runtime."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fail the build if any prefab references are broken — this produces a player
|
||||
# that launches but has null Inspector fields, which is hard to debug.
|
||||
if grep -q "Missing Prefab" "$LOG_PATH"; then
|
||||
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Runs the repository-pinned clang-tidy binary from the workspace root.
|
||||
#
|
||||
# Bazel's `run` command executes clang-tidy from its runfiles tree, which makes
|
||||
# workspace-relative source paths and .clang-tidy discovery fail. This wrapper
|
||||
# builds the tool and then invokes the produced binary directly.
|
||||
|
||||
set -e
|
||||
|
||||
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Usage: scripts/run-clang-tidy.sh [clang-tidy args] <files> [-- <compiler args>]"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " scripts/run-clang-tidy.sh --verify-config"
|
||||
echo " scripts/run-clang-tidy.sh src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp -- -I$repo_root -std=c++23"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
bazel build @llvm_toolchain//:clang-tidy
|
||||
|
||||
bazel_bin="$(bazel info bazel-bin)"
|
||||
clang_tidy="$bazel_bin/external/toolchains_llvm++llvm+llvm_toolchain/clang-tidy"
|
||||
|
||||
if [ ! -x "$clang_tidy" ]; then
|
||||
echo "Unable to find clang-tidy binary at $clang_tidy"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$clang_tidy" --config-file="$repo_root/.clang-tidy" "$@"
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2017 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FilesystemUtils_hpp
|
||||
#define FilesystemUtils_hpp
|
||||
#ifndef EAGLE0_COMMON_FILESYSTEM_UTILS_HPP
|
||||
#define EAGLE0_COMMON_FILESYSTEM_UTILS_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -36,4 +36,4 @@ public:
|
||||
static auto LoadFromPath(const string& path) -> byte_vector;
|
||||
};
|
||||
|
||||
#endif /* FilesystemUtils_hpp */
|
||||
#endif // EAGLE0_COMMON_FILESYSTEM_UTILS_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MapUtils_hpp
|
||||
#define MapUtils_hpp
|
||||
#ifndef EAGLE0_COMMON_MAP_UTILS_HPP
|
||||
#define EAGLE0_COMMON_MAP_UTILS_HPP
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@@ -19,4 +19,4 @@ auto IntForKey(const std::unordered_map<std::string, std::string>& map, const st
|
||||
auto BoolForKey(const std::unordered_map<std::string, std::string>& map, const std::string& key)
|
||||
-> bool;
|
||||
|
||||
#endif /* MapUtils_hpp */
|
||||
#endif // EAGLE0_COMMON_MAP_UTILS_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ProtobufWarningSuppression_h
|
||||
#define ProtobufWarningSuppression_h
|
||||
#ifndef EAGLE0_COMMON_PROTOBUF_WARNING_SUPPRESSION_HPP
|
||||
#define EAGLE0_COMMON_PROTOBUF_WARNING_SUPPRESSION_HPP
|
||||
|
||||
#define SUPPRESS_PROTOBUF_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wpragmas\"") \
|
||||
@@ -19,4 +19,4 @@
|
||||
"GCC diagnostic ignored \"-Wshorten-64-to-32\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wnested-anon-types\"")
|
||||
|
||||
#endif /* ProtobufWarningSuppression_h */
|
||||
#endif // EAGLE0_COMMON_PROTOBUF_WARNING_SUPPRESSION_HPP
|
||||
|
||||
@@ -6,11 +6,13 @@
|
||||
// Copyright (c) 2015 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __eagle0__ShardokRandomGenerator__
|
||||
#define __eagle0__ShardokRandomGenerator__
|
||||
#ifndef EAGLE0_COMMON_RANDOM_GENERATOR_HPP
|
||||
#define EAGLE0_COMMON_RANDOM_GENERATOR_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
|
||||
class RandomGenerator;
|
||||
|
||||
@@ -22,6 +24,10 @@ private:
|
||||
|
||||
public:
|
||||
RandomGenerator() = default;
|
||||
RandomGenerator(const RandomGenerator&) = default;
|
||||
auto operator=(const RandomGenerator&) -> RandomGenerator& = default;
|
||||
RandomGenerator(RandomGenerator&&) = default;
|
||||
auto operator=(RandomGenerator&&) -> RandomGenerator& = default;
|
||||
|
||||
virtual ~RandomGenerator() = default;
|
||||
|
||||
@@ -35,7 +41,7 @@ public:
|
||||
|
||||
template<class T>
|
||||
auto RandomElement(const std::vector<T>& vec) -> T {
|
||||
return vec[IntBelow((int)vec.size())];
|
||||
return vec.at(static_cast<std::size_t>(IntBelow(static_cast<int>(vec.size()))));
|
||||
}
|
||||
|
||||
static auto ChanceOpenEndedPercentileAtOrAbove(double value) -> double;
|
||||
@@ -56,4 +62,4 @@ public:
|
||||
auto IntBetween(int min, int max) -> int override; // inclusive, exclusive (min<=return<max)
|
||||
};
|
||||
|
||||
#endif /* defined(__eagle0__ShardokRandomGenerator__) */
|
||||
#endif // EAGLE0_COMMON_RANDOM_GENERATOR_HPP
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SequenceRandomGenerator_h
|
||||
#define SequenceRandomGenerator_h
|
||||
#ifndef EAGLE0_COMMON_SEQUENCE_RANDOM_GENERATOR_HPP
|
||||
#define EAGLE0_COMMON_SEQUENCE_RANDOM_GENERATOR_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "src/main/cpp/net/eagle0/common/RandomGenerator.hpp"
|
||||
@@ -24,22 +25,22 @@
|
||||
// which produces: initial=2 (triggers open-ended), accumulated=52, final=2-52=-50
|
||||
class SequenceRandomGenerator : public ::RandomGenerator {
|
||||
private:
|
||||
const std::vector<double> sequence;
|
||||
std::vector<double> sequence;
|
||||
size_t position = 0;
|
||||
|
||||
auto DoubleZeroToOne() -> double override {
|
||||
const double nextVal = sequence[position];
|
||||
const double nextVal = sequence.at(position);
|
||||
position++;
|
||||
if (position >= sequence.size()) { position = 0; }
|
||||
return nextVal;
|
||||
}
|
||||
|
||||
public:
|
||||
explicit SequenceRandomGenerator(std::vector<double> s) : sequence(std::move(s)), position(0) {}
|
||||
explicit SequenceRandomGenerator(std::vector<double> s) : sequence(std::move(s)) {}
|
||||
static auto WithSequence(const std::vector<double>& s)
|
||||
-> std::shared_ptr<SequenceRandomGenerator> {
|
||||
return std::make_shared<SequenceRandomGenerator>(s);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* SequenceRandomGenerator_h */
|
||||
#endif // EAGLE0_COMMON_SEQUENCE_RANDOM_GENERATOR_HPP
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef TsvParser_hpp
|
||||
#define TsvParser_hpp
|
||||
#ifndef EAGLE0_COMMON_TSV_PARSER_HPP
|
||||
#define EAGLE0_COMMON_TSV_PARSER_HPP
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
typedef std::unordered_map<std::string, std::string> StringMap;
|
||||
using StringMap = std::unordered_map<std::string, std::string>;
|
||||
|
||||
// Parses a TSV, with the first column becoming map keys and subsequent columns becoming values
|
||||
// for different maps in the returned vector.
|
||||
@@ -23,4 +23,4 @@ public:
|
||||
std::vector<StringMap> ParseColumnEntryTsv(std::string tsv);
|
||||
};
|
||||
|
||||
#endif /* TsvParser_hpp */
|
||||
#endif // EAGLE0_COMMON_TSV_PARSER_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2017 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef byte_vector_h
|
||||
#define byte_vector_h
|
||||
#ifndef EAGLE0_COMMON_BYTE_VECTOR_HPP
|
||||
#define EAGLE0_COMMON_BYTE_VECTOR_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
@@ -184,4 +184,4 @@ inline auto operator<<(std::ostream& ostr, byte_vector vec) -> std::ostream& {
|
||||
return ostr;
|
||||
}
|
||||
|
||||
#endif /* byte_vector_h */
|
||||
#endif // EAGLE0_COMMON_BYTE_VECTOR_HPP
|
||||
|
||||
@@ -141,9 +141,8 @@ public:
|
||||
// Default implementation: no filtering, so filtered index = original index
|
||||
[[nodiscard]] virtual size_t mapFilteredIndexToOriginal(
|
||||
size_t filteredIndex,
|
||||
const MCTSGameState& state) const {
|
||||
const MCTSGameState& /*state*/) const {
|
||||
// Default: no filtering, index stays the same
|
||||
(void)state; // Suppress unused parameter warning
|
||||
return filteredIndex;
|
||||
}
|
||||
|
||||
@@ -158,4 +157,4 @@ public:
|
||||
} // namespace mcts
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_MCTS_GAME_ENGINE_HPP
|
||||
#endif // EAGLE0_MCTS_GAME_ENGINE_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// and flee vs fight evaluation for final round scenarios
|
||||
//
|
||||
|
||||
#ifndef AIFleeDecisionCalculator_hpp
|
||||
#define AIFleeDecisionCalculator_hpp
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_FLEE_DECISION_CALCULATOR_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_FLEE_DECISION_CALCULATOR_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokEngine.hpp"
|
||||
@@ -63,4 +63,4 @@ private:
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* AIFleeDecisionCalculator_hpp */
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_FLEE_DECISION_CALCULATOR_HPP
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2017 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ShardokAIClient_hpp
|
||||
#define ShardokAIClient_hpp
|
||||
#ifndef EAGLE0_SHARDOK_AI_SHARDOK_AI_CLIENT_HPP
|
||||
#define EAGLE0_SHARDOK_AI_SHARDOK_AI_CLIENT_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -95,4 +95,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ShardokAIClient_hpp */
|
||||
#endif // EAGLE0_SHARDOK_AI_SHARDOK_AI_CLIENT_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2017 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ShardokGameController_hpp
|
||||
#define ShardokGameController_hpp
|
||||
#ifndef EAGLE0_SHARDOK_CONTROLLER_SHARDOK_GAME_CONTROLLER_HPP
|
||||
#define EAGLE0_SHARDOK_CONTROLLER_SHARDOK_GAME_CONTROLLER_HPP
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
@@ -213,4 +213,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ShardokGameController_hpp */
|
||||
#endif // EAGLE0_SHARDOK_CONTROLLER_SHARDOK_GAME_CONTROLLER_HPP
|
||||
|
||||
@@ -11,36 +11,44 @@
|
||||
|
||||
namespace shardok {
|
||||
struct ActionCost {
|
||||
enum ActionCostType : uint8_t {
|
||||
enum class ActionCostType : uint8_t {
|
||||
impossible, // This action cannot be performed at any price.
|
||||
standard, // This is a normal action, that requires and consumes the specified number of
|
||||
// points.
|
||||
usesAll // This action requires the minimum points, but consumes anything that is left.
|
||||
};
|
||||
|
||||
static constexpr ActionCostType impossible = ActionCostType::impossible;
|
||||
static constexpr ActionCostType standard = ActionCostType::standard;
|
||||
static constexpr ActionCostType usesAll = ActionCostType::usesAll;
|
||||
|
||||
ActionCostType type;
|
||||
ActionPoints points;
|
||||
|
||||
ActionCost(const ActionCostType type, const ActionPoints points) : type(type), points(points) {}
|
||||
constexpr ActionCost(const ActionCostType type, const ActionPoints points) noexcept
|
||||
: type(type),
|
||||
points(points) {}
|
||||
|
||||
[[nodiscard]] bool IsPossible(const ActionPoints cmpPoints) const {
|
||||
[[nodiscard]] constexpr auto IsPossible(const ActionPoints cmpPoints) const noexcept -> bool {
|
||||
return type != impossible && cmpPoints >= points;
|
||||
}
|
||||
|
||||
bool operator==(const ActionCost &rhs) const {
|
||||
[[nodiscard]] constexpr auto operator==(const ActionCost &rhs) const noexcept -> bool {
|
||||
return type == rhs.type && points == rhs.points;
|
||||
}
|
||||
|
||||
static inline auto StandardActionCost(const ActionPoints points) -> ActionCost {
|
||||
[[nodiscard]] static constexpr auto StandardActionCost(const ActionPoints points) noexcept
|
||||
-> ActionCost {
|
||||
return ActionCost{ActionCost::standard, points};
|
||||
}
|
||||
|
||||
static inline auto UsesAllActionCost(const ActionPoints points) -> ActionCost {
|
||||
return ActionCost(ActionCost::usesAll, points);
|
||||
[[nodiscard]] static constexpr auto UsesAllActionCost(const ActionPoints points) noexcept
|
||||
-> ActionCost {
|
||||
return {ActionCost::usesAll, points};
|
||||
}
|
||||
};
|
||||
|
||||
const ActionCost IMPOSSIBLE_ACTION_COST{ActionCost::impossible, 0};
|
||||
inline constexpr ActionCost IMPOSSIBLE_ACTION_COST{ActionCost::impossible, 0};
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef AvailableCommandsFactory_hpp
|
||||
#define AvailableCommandsFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_AVAILABLE_COMMANDS_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_AVAILABLE_COMMANDS_FACTORY_HPP
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
@@ -46,4 +46,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* AvailableCommandsFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_AVAILABLE_COMMANDS_FACTORY_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright (c) 2014 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __eagle0__BattalionType__
|
||||
#define __eagle0__BattalionType__
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_BATTALION_TYPE_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_BATTALION_TYPE_HPP
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
@@ -111,8 +111,8 @@ struct BattalionType {
|
||||
|
||||
if (HasCastle(terrain.modifier())) {
|
||||
const double castleIntegrity = terrain.modifier().castle().integrity().value();
|
||||
return (castleIntegrity * damageTakenMultiplierForCastle +
|
||||
(100.0 - castleIntegrity) * terrainTypeMultiplier) /
|
||||
return ((castleIntegrity * damageTakenMultiplierForCastle) +
|
||||
((100.0 - castleIntegrity) * terrainTypeMultiplier)) /
|
||||
100.0;
|
||||
}
|
||||
return terrainTypeMultiplier;
|
||||
@@ -125,8 +125,8 @@ struct BattalionType {
|
||||
|
||||
if (terrain->modifier().castle().present()) {
|
||||
const double castleIntegrity = terrain->modifier().castle().integrity();
|
||||
return (castleIntegrity * damageTakenMultiplierForCastle +
|
||||
(100.0 - castleIntegrity) * terrainTypeMultiplier) /
|
||||
return ((castleIntegrity * damageTakenMultiplierForCastle) +
|
||||
((100.0 - castleIntegrity) * terrainTypeMultiplier)) /
|
||||
100.0;
|
||||
}
|
||||
return terrainTypeMultiplier;
|
||||
@@ -199,7 +199,8 @@ struct BattalionType {
|
||||
|
||||
auto terrainCost = GetCostToEnterTerrainType(terrain.type());
|
||||
if (HasSnow(terrain.modifier())) {
|
||||
terrainCost.points += int(snowPenalty * terrain.modifier().snow().integrity().value());
|
||||
terrainCost.points +=
|
||||
static_cast<int>(snowPenalty * terrain.modifier().snow().integrity().value());
|
||||
}
|
||||
return terrainCost;
|
||||
}
|
||||
@@ -215,7 +216,9 @@ struct BattalionType {
|
||||
if (tm.ice().present()) return costToEnterIce;
|
||||
|
||||
auto terrainCost = GetCostToEnterTerrainType(terrainType);
|
||||
if (tm.snow().present()) { terrainCost.points += int(snowPenalty * tm.snow().integrity()); }
|
||||
if (tm.snow().present()) {
|
||||
terrainCost.points += static_cast<int>(snowPenalty * tm.snow().integrity());
|
||||
}
|
||||
return terrainCost;
|
||||
}
|
||||
|
||||
@@ -256,8 +259,15 @@ struct BattalionType {
|
||||
const double trainingDifference = chargerTraining - defenderTraining;
|
||||
const double trainingValue =
|
||||
trainingDifferenceMultiplierForStunChanceOnCharge * trainingDifference;
|
||||
OtherFactor trainingFactor = MakeOtherFactor((int16_t)trainingValue, "training difference");
|
||||
return MakeOdds((int16_t)baseStunChanceOnCharge, 0, 0, 0, {}, {trainingFactor});
|
||||
OtherFactor trainingFactor =
|
||||
MakeOtherFactor(static_cast<int16_t>(trainingValue), "training difference");
|
||||
return MakeOdds(
|
||||
static_cast<int16_t>(baseStunChanceOnCharge),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{},
|
||||
{trainingFactor});
|
||||
}
|
||||
|
||||
[[nodiscard]] auto GetDailyFoodCostPerTroop() const -> double {
|
||||
@@ -268,7 +278,7 @@ struct BattalionType {
|
||||
-> std::shared_ptr<const BattalionType>;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<const BattalionType> BattalionTypeSPtr;
|
||||
using BattalionTypeSPtr = std::shared_ptr<const BattalionType>;
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* defined(__eagle0__BattalionType__) */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_BATTALION_TYPE_HPP
|
||||
|
||||
@@ -6,15 +6,20 @@
|
||||
// Copyright (c) 2014 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __eagle0__CombatDamage__
|
||||
#define __eagle0__CombatDamage__
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMBAT_DAMAGE_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMBAT_DAMAGE_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace shardok {
|
||||
// Normal and penetrating damage for each kind
|
||||
enum DamageType {
|
||||
enum class DamageType : std::uint8_t {
|
||||
DamageType_slashing = 0,
|
||||
DamageType_puncturing,
|
||||
DamageType_stabbing,
|
||||
@@ -27,6 +32,17 @@ enum DamageType {
|
||||
NUM_DAMAGE_TYPES
|
||||
};
|
||||
|
||||
inline constexpr DamageType DamageType_slashing = DamageType::DamageType_slashing;
|
||||
inline constexpr DamageType DamageType_puncturing = DamageType::DamageType_puncturing;
|
||||
inline constexpr DamageType DamageType_stabbing = DamageType::DamageType_stabbing;
|
||||
inline constexpr DamageType DamageType_crushing = DamageType::DamageType_crushing;
|
||||
inline constexpr DamageType DamageType_fire = DamageType::DamageType_fire;
|
||||
inline constexpr DamageType DamageType_cold = DamageType::DamageType_cold;
|
||||
inline constexpr DamageType DamageType_lightning = DamageType::DamageType_lightning;
|
||||
inline constexpr DamageType DamageType_aessence = DamageType::DamageType_aessence;
|
||||
inline constexpr DamageType DamageType_impact = DamageType::DamageType_impact;
|
||||
inline constexpr int NUM_DAMAGE_TYPES = static_cast<int>(DamageType::NUM_DAMAGE_TYPES);
|
||||
|
||||
static inline bool DamageTypeGetsTerrainDefense(const DamageType type) {
|
||||
switch (type) {
|
||||
case DamageType_slashing:
|
||||
@@ -47,9 +63,21 @@ static inline bool DamageTypeGetsTerrainDefense(const DamageType type) {
|
||||
}
|
||||
|
||||
struct CombatDamage {
|
||||
const std::vector<double> damageByType;
|
||||
private:
|
||||
static constexpr size_t kDamageValueCount = 2 * static_cast<size_t>(NUM_DAMAGE_TYPES);
|
||||
|
||||
CombatDamage() : damageByType{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} {};
|
||||
std::array<double, kDamageValueCount> damageByType{};
|
||||
|
||||
[[nodiscard]] static constexpr auto NormalIndex(const DamageType type) -> size_t {
|
||||
return 2 * static_cast<size_t>(type);
|
||||
}
|
||||
|
||||
[[nodiscard]] static constexpr auto PenetratingIndex(const DamageType type) -> size_t {
|
||||
return NormalIndex(type) + 1;
|
||||
}
|
||||
|
||||
public:
|
||||
CombatDamage() = default;
|
||||
CombatDamage(
|
||||
const double sl,
|
||||
const double pu,
|
||||
@@ -89,37 +117,40 @@ struct CombatDamage {
|
||||
im,
|
||||
pim} {}
|
||||
|
||||
CombatDamage(const std::vector<double> byType) : damageByType(byType) {}
|
||||
explicit CombatDamage(const std::vector<double>& byType) {
|
||||
std::copy_n(
|
||||
byType.begin(),
|
||||
std::min(byType.size(), damageByType.size()),
|
||||
damageByType.begin());
|
||||
}
|
||||
|
||||
CombatDamage(const CombatDamage& toCopy) : damageByType(toCopy.damageByType) {}
|
||||
|
||||
public:
|
||||
double GetNormalDamageOfType(const DamageType type) const { return damageByType[2 * type]; }
|
||||
double GetPenetratingDamageOfType(const DamageType type) const {
|
||||
return damageByType[2 * type + 1];
|
||||
[[nodiscard]] auto GetNormalDamageOfType(const DamageType type) const -> double {
|
||||
return damageByType.at(NormalIndex(type));
|
||||
}
|
||||
[[nodiscard]] auto GetPenetratingDamageOfType(const DamageType type) const -> double {
|
||||
return damageByType.at(PenetratingIndex(type));
|
||||
};
|
||||
|
||||
bool operator==(const CombatDamage& cmpr) const {
|
||||
for (size_t type = 0; type < 2 * NUM_DAMAGE_TYPES; type++) {
|
||||
if (damageByType[type] != cmpr.damageByType[type]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool operator==(const CombatDamage& cmpr) const { return damageByType == cmpr.damageByType; }
|
||||
|
||||
bool operator!=(const CombatDamage& cmpr) const { return !(*this == cmpr); }
|
||||
|
||||
bool operator<=(const CombatDamage& cmpr) const {
|
||||
for (size_t type = 0; type < 2 * NUM_DAMAGE_TYPES; type++) {
|
||||
if (damageByType[type] > cmpr.damageByType[type]) return false;
|
||||
}
|
||||
return true;
|
||||
return std::ranges::equal(
|
||||
damageByType,
|
||||
cmpr.damageByType,
|
||||
[](const double damage, const double comparedDamage) {
|
||||
return damage <= comparedDamage;
|
||||
});
|
||||
}
|
||||
|
||||
bool operator>=(const CombatDamage& cmpr) const {
|
||||
for (size_t type = 0; type < 2 * NUM_DAMAGE_TYPES; type++) {
|
||||
if (damageByType[type] < cmpr.damageByType[type]) return false;
|
||||
}
|
||||
return true;
|
||||
return std::ranges::equal(
|
||||
damageByType,
|
||||
cmpr.damageByType,
|
||||
[](const double damage, const double comparedDamage) {
|
||||
return damage >= comparedDamage;
|
||||
});
|
||||
}
|
||||
|
||||
bool operator>(const CombatDamage& cmpr) const { return ((*this >= cmpr) && !(*this == cmpr)); }
|
||||
@@ -212,11 +243,11 @@ public:
|
||||
.Build();
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
char buffer[1024];
|
||||
[[nodiscard]] auto ToString() const -> std::string {
|
||||
std::array<char, 1024> buffer{};
|
||||
snprintf(
|
||||
buffer,
|
||||
1024,
|
||||
buffer.data(),
|
||||
buffer.size(),
|
||||
"slashing=%f / %f, puncturing=%f / %f, stabbing=%f / %f, crushing=%f / %f, "
|
||||
"fire=%f / "
|
||||
"%f, cold=%f / %f, lightning=%f / %f, aessence=%f / %f, impact=%f / %f",
|
||||
@@ -239,7 +270,7 @@ public:
|
||||
GetNormalDamageOfType(DamageType_impact),
|
||||
GetPenetratingDamageOfType(DamageType_impact));
|
||||
|
||||
return std::string(buffer);
|
||||
return {buffer.data()};
|
||||
}
|
||||
|
||||
class Builder {
|
||||
@@ -265,7 +296,7 @@ public:
|
||||
double penetrating_impact = 0.0;
|
||||
|
||||
public:
|
||||
Builder() {}
|
||||
Builder() = default;
|
||||
Builder& SetSlashing(const double sl) {
|
||||
slashing = sl;
|
||||
return *this;
|
||||
@@ -392,9 +423,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
CombatDamage Build() {
|
||||
return CombatDamage(
|
||||
slashing,
|
||||
[[nodiscard]] auto Build() const -> CombatDamage {
|
||||
return {slashing,
|
||||
puncturing,
|
||||
stabbing,
|
||||
crushing,
|
||||
@@ -411,21 +441,16 @@ public:
|
||||
penetrating_cold,
|
||||
penetrating_lightning,
|
||||
penetrating_aessence,
|
||||
penetrating_impact);
|
||||
penetrating_impact};
|
||||
}
|
||||
};
|
||||
|
||||
Builder ToBuilder() {
|
||||
[[nodiscard]] auto ToBuilder() const -> Builder {
|
||||
Builder builder = Builder();
|
||||
for (int i = 0; i < (int)NUM_DAMAGE_TYPES; i++) {
|
||||
builder.SetDamageByType(
|
||||
(DamageType)i,
|
||||
false,
|
||||
this->GetNormalDamageOfType((DamageType)i));
|
||||
builder.SetDamageByType(
|
||||
(DamageType)i,
|
||||
true,
|
||||
this->GetPenetratingDamageOfType((DamageType)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));
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
@@ -434,4 +459,4 @@ public:
|
||||
inline CombatDamage operator*(const double factor, const CombatDamage& dmg) { return dmg * factor; }
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* defined(__eagle0__CombatDamage__) */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMBAT_DAMAGE_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FireManager_hpp
|
||||
#define FireManager_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_FIRE_UTILS_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_FIRE_UTILS_HPP
|
||||
|
||||
#include "CombatDamage.hpp"
|
||||
#include "PercentileRollOdds.hpp"
|
||||
@@ -51,4 +51,4 @@ auto GetStartFireOdds(
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* FireManager_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_FIRE_UTILS_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef PercentileRollOdds_hpp
|
||||
#define PercentileRollOdds_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_PERCENTILE_ROLL_ODDS_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_PERCENTILE_ROLL_ODDS_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -18,8 +18,8 @@
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
namespace shardok {
|
||||
typedef net::eagle0::shardok::storage::Odds PercentileRollOdds;
|
||||
typedef net::eagle0::shardok::storage::Odds_OtherFactor OtherFactor;
|
||||
using PercentileRollOdds = net::eagle0::shardok::storage::Odds;
|
||||
using OtherFactor = net::eagle0::shardok::storage::Odds_OtherFactor;
|
||||
|
||||
double BonusFromStat(double stat);
|
||||
|
||||
@@ -50,4 +50,4 @@ bool PercentileRollSucceeds(const PercentileRollOdds &odds, double roll);
|
||||
int16_t GetSuccessChance(const PercentileRollOdds &odds);
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* PercentileRollOdds_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_PERCENTILE_ROLL_ODDS_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright (c) 2014 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __eagle0__ShardokAction__
|
||||
#define __eagle0__ShardokAction__
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_SHARDOK_ACTION_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_SHARDOK_ACTION_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -69,8 +69,8 @@ public:
|
||||
|
||||
class ShardokAction;
|
||||
|
||||
typedef std::shared_ptr<ShardokAction> ActionSPtr;
|
||||
typedef std::vector<ActionSPtr> ActionList;
|
||||
using ActionSPtr = std::shared_ptr<ShardokAction>;
|
||||
using ActionList = std::vector<ActionSPtr>;
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* defined(__eagle0__ShardokAction__) */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_SHARDOK_ACTION_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2017 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ShardokCTypes_h
|
||||
#define ShardokCTypes_h
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_SHARDOK_CTYPES_H
|
||||
#define EAGLE0_SHARDOK_LIBRARY_SHARDOK_CTYPES_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -23,9 +23,13 @@ using RoundId = int32_t;
|
||||
using MapIndex = int8_t;
|
||||
using ActionPoints = uint8_t;
|
||||
|
||||
enum AttackOrientation { front, flank, rear };
|
||||
enum class AttackOrientation : std::uint8_t { front, flank, rear };
|
||||
|
||||
inline constexpr AttackOrientation front = AttackOrientation::front;
|
||||
inline constexpr AttackOrientation flank = AttackOrientation::flank;
|
||||
inline constexpr AttackOrientation rear = AttackOrientation::rear;
|
||||
|
||||
constexpr PlayerId UNCONTROLLED_PLAYER_ID = 99;
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ShardokCTypes_h */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_SHARDOK_CTYPES_H
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright (c) 2015 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __eagle0__ShardokEngine__
|
||||
#define __eagle0__ShardokEngine__
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_SHARDOK_ENGINE_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_SHARDOK_ENGINE_HPP
|
||||
|
||||
#include <flatbuffers/flatbuffers.h>
|
||||
|
||||
@@ -254,4 +254,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* defined(__eagle0__ShardokEngine__) */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_SHARDOK_ENGINE_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2017 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ShardokException_h
|
||||
#define ShardokException_h
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_SHARDOK_EXCEPTION_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_SHARDOK_EXCEPTION_HPP
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
@@ -59,4 +59,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ShardokException_h */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_SHARDOK_EXCEPTION_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FireOutActionFactory_hpp
|
||||
#define FireOutActionFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_FIRE_OUT_ACTION_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_FIRE_OUT_ACTION_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokAction.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
|
||||
@@ -38,4 +38,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* FireOutActionFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_FIRE_OUT_ACTION_FACTORY_HPP
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FireSpreadActionFactory_hpp
|
||||
#define FireSpreadActionFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_FIRE_SPREAD_ACTION_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_FIRE_SPREAD_ACTION_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokAction.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/map/Coordinates.hpp"
|
||||
@@ -41,4 +41,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* FireSpreadActionFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_FIRE_SPREAD_ACTION_FACTORY_HPP
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MeteorCastActionFactory_hpp
|
||||
#define MeteorCastActionFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_METEOR_CAST_ACTION_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_METEOR_CAST_ACTION_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokAction.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
|
||||
@@ -25,4 +25,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* MeteorCastActionFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_ACTION_FACTORIES_METEOR_CAST_ACTION_FACTORY_HPP
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ActionResultApplier_hpp
|
||||
#define ActionResultApplier_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_ACTION_RESULT_APPLIER_ACTION_RESULT_APPLIER_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_ACTION_RESULT_APPLIER_ACTION_RESULT_APPLIER_HPP
|
||||
|
||||
#include <flatbuffers/flatbuffers.h>
|
||||
|
||||
@@ -33,4 +33,4 @@ auto ApplyResults(
|
||||
const SettingsGetter& settings) -> GameStateW;
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ActionResultApplier_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_ACTION_RESULT_APPLIER_ACTION_RESULT_APPLIER_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FallIntoWaterAction_hpp
|
||||
#define FallIntoWaterAction_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_ACTIONS_FALL_INTO_WATER_ACTION_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_ACTIONS_FALL_INTO_WATER_ACTION_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokAction.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
|
||||
@@ -57,4 +57,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* FallIntoWaterAction_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_ACTIONS_FALL_INTO_WATER_ACTION_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FireOutAction_hpp
|
||||
#define FireOutAction_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_ACTIONS_FIRE_OUT_ACTION_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_ACTIONS_FIRE_OUT_ACTION_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokAction.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/map/Coordinates.hpp"
|
||||
@@ -36,4 +36,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* FireOutAction_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_ACTIONS_FIRE_OUT_ACTION_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FireSpreadAction_hpp
|
||||
#define FireSpreadAction_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_ACTIONS_FIRE_SPREAD_ACTION_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_ACTIONS_FIRE_SPREAD_ACTION_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokAction.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/map/Coordinates.hpp"
|
||||
@@ -37,4 +37,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* FireSpreadAction_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_ACTIONS_FIRE_SPREAD_ACTION_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MeteorCastAction_hpp
|
||||
#define MeteorCastAction_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_ACTIONS_METEOR_CAST_ACTION_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_ACTIONS_METEOR_CAST_ACTION_HPP
|
||||
|
||||
#include <utility>
|
||||
|
||||
@@ -71,4 +71,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* MeteorCastAction_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_ACTIONS_METEOR_CAST_ACTION_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ChargeActionFactory_hpp
|
||||
#define ChargeActionFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_CHARGE_COMMAND_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_CHARGE_COMMAND_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/CommandFactory.hpp"
|
||||
@@ -45,4 +45,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ChargeActionFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_CHARGE_COMMAND_FACTORY_HPP
|
||||
|
||||
+3
-3
@@ -3,8 +3,8 @@
|
||||
// eagle0
|
||||
//
|
||||
|
||||
#ifndef EvacuatePrisonersCommandFactory_hpp
|
||||
#define EvacuatePrisonersCommandFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_EVACUATE_PRISONERS_COMMAND_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_EVACUATE_PRISONERS_COMMAND_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/CommandFactory.hpp"
|
||||
|
||||
@@ -22,4 +22,4 @@ public:
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* EvacuatePrisonersCommandFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_EVACUATE_PRISONERS_COMMAND_FACTORY_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FleeCommandFactory_hpp
|
||||
#define FleeCommandFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_FLEE_COMMAND_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_FLEE_COMMAND_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/CommandFactory.hpp"
|
||||
@@ -36,4 +36,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* FleeCommandFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_FLEE_COMMAND_FACTORY_HPP
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef HolyWaveActionFactory_hpp
|
||||
#define HolyWaveActionFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_HOLY_WAVE_COMMAND_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_HOLY_WAVE_COMMAND_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/CommandFactory.hpp"
|
||||
@@ -34,4 +34,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* HolyWaveActionFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_HOLY_WAVE_COMMAND_FACTORY_HPP
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ReinforceCommandFactory_hpp
|
||||
#define ReinforceCommandFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_REINFORCE_COMMAND_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_REINFORCE_COMMAND_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/CommandFactory.hpp"
|
||||
@@ -41,4 +41,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ReinforceCommandFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_REINFORCE_COMMAND_FACTORY_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef RetreatCommandFactory_hpp
|
||||
#define RetreatCommandFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_RETREAT_COMMAND_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_RETREAT_COMMAND_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/CommandFactory.hpp"
|
||||
@@ -32,4 +32,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* RetreatCommandFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_RETREAT_COMMAND_FACTORY_HPP
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef StealthManager_hpp
|
||||
#define StealthManager_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_AMBUSH_ODDS_AMBUSH_ODDS_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_AMBUSH_ODDS_AMBUSH_ODDS_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/PercentileRollOdds.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/map/Terrain.hpp"
|
||||
@@ -24,4 +24,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* StealthManager_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_AMBUSH_ODDS_AMBUSH_ODDS_HPP
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MeleeActionFactory_hpp
|
||||
#define MeleeActionFactory_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_MELEE_COMMAND_FACTORY_MELEE_COMMAND_FACTORY_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_MELEE_COMMAND_FACTORY_MELEE_COMMAND_FACTORY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/CommandFactory.hpp"
|
||||
@@ -42,4 +42,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* MeleeActionFactory_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMAND_FACTORIES_MELEE_COMMAND_FACTORY_MELEE_COMMAND_FACTORY_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2021 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef GoIntoExileCommand_hpp
|
||||
#define GoIntoExileCommand_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_BECOME_OUTLAW_COMMAND_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_BECOME_OUTLAW_COMMAND_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
@@ -48,4 +48,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* GoIntoExileCommand_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_BECOME_OUTLAW_COMMAND_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ChargeAction_hpp
|
||||
#define ChargeAction_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_CHARGE_COMMAND_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_CHARGE_COMMAND_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
@@ -67,4 +67,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ChargeAction_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_CHARGE_COMMAND_HPP
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// eagle0
|
||||
//
|
||||
|
||||
#ifndef EvacuatePrisonersCommand_hpp
|
||||
#define EvacuatePrisonersCommand_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_EVACUATE_PRISONERS_COMMAND_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_EVACUATE_PRISONERS_COMMAND_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -45,4 +45,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* EvacuatePrisonersCommand_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_EVACUATE_PRISONERS_COMMAND_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FleeCommand_hpp
|
||||
#define FleeCommand_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_FLEE_COMMAND_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_FLEE_COMMAND_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
@@ -49,4 +49,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* FleeCommand_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_FLEE_COMMAND_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef HolyWaveAction_hpp
|
||||
#define HolyWaveAction_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_HOLY_WAVE_COMMAND_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_HOLY_WAVE_COMMAND_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
@@ -47,4 +47,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* HolyWaveAction_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_HOLY_WAVE_COMMAND_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MeleeCommand_hpp
|
||||
#define MeleeCommand_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_MELEE_COMMAND_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_MELEE_COMMAND_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
@@ -65,4 +65,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* MeleeCommand_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_MELEE_COMMAND_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ReinforceCommand_hpp
|
||||
#define ReinforceCommand_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_REINFORCE_COMMAND_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_REINFORCE_COMMAND_HPP
|
||||
|
||||
#include <utility>
|
||||
|
||||
@@ -65,4 +65,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ReinforceCommand_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_REINFORCE_COMMAND_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef RetreatCommand_hpp
|
||||
#define RetreatCommand_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_RETREAT_COMMAND_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_RETREAT_COMMAND_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
|
||||
@@ -27,11 +27,11 @@ public:
|
||||
RetreatCommand(const ActionCost& cost, PlayerId playerId, UnitId retreatingUnitId);
|
||||
~RetreatCommand(){};
|
||||
|
||||
virtual CommandType GetCommandType() const override {
|
||||
CommandType GetCommandType() const override {
|
||||
return net::eagle0::shardok::common::RETREAT_COMMAND;
|
||||
}
|
||||
|
||||
virtual CommandProto GetCommandProto() const override;
|
||||
CommandProto GetCommandProto() const override;
|
||||
|
||||
[[nodiscard]] auto CanBeFollowUp() const -> bool override { return false; }
|
||||
[[nodiscard]] auto CanDoWithLowMorale() const -> bool override { return true; }
|
||||
@@ -44,4 +44,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* RetreatCommand_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_RETREAT_COMMAND_HPP
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef DuelManager_hpp
|
||||
#define DuelManager_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_CHALLENGE_DUEL_COMMAND_DUEL_UTILS_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_CHALLENGE_DUEL_COMMAND_DUEL_UTILS_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/PercentileRollOdds.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
|
||||
@@ -25,4 +25,4 @@ PercentileRollOdds GetAcceptOdds(
|
||||
const Terrain &defenderTerrain);
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* DuelManager_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_COMMANDS_CHALLENGE_DUEL_COMMAND_DUEL_UTILS_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Coords_h
|
||||
#define Coords_h
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_MAP_COORDINATES_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_MAP_COORDINATES_HPP
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@@ -62,4 +62,4 @@ struct hash<net::eagle0::shardok::common::Coords> {
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif /* Coords_h */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_MAP_COORDINATES_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright (c) 2014 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef eagle0_ShardokOrientation_h
|
||||
#define eagle0_ShardokOrientation_h
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_MAP_HEX_MAP_DIRECTION_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_MAP_HEX_MAP_DIRECTION_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/common/ProtobufWarningSuppression.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokException.hpp"
|
||||
@@ -40,7 +40,7 @@ inline HexMapDirection& operator++(HexMapDirection& dir) {
|
||||
return dir;
|
||||
}
|
||||
|
||||
typedef struct HexMapDirectionsTo {
|
||||
struct HexMapDirectionsTo {
|
||||
HexMapDirection main;
|
||||
HexMapDirection secondary; // Only valid if exactly on the line
|
||||
bool usesSecondary;
|
||||
@@ -48,7 +48,7 @@ typedef struct HexMapDirectionsTo {
|
||||
bool Matches(const HexMapDirection dir) {
|
||||
return dir == main || (usesSecondary && dir == secondary);
|
||||
}
|
||||
} HexMapDirectionsTo;
|
||||
};
|
||||
|
||||
inline bool operator==(const HexMapDirectionsTo& lhs, const HexMapDirectionsTo& rhs) {
|
||||
if (lhs.usesSecondary != rhs.usesSecondary) return false;
|
||||
@@ -58,4 +58,4 @@ inline bool operator==(const HexMapDirectionsTo& lhs, const HexMapDirectionsTo&
|
||||
}
|
||||
} // namespace shardok
|
||||
|
||||
#endif
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_MAP_HEX_MAP_DIRECTION_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef HexMapTile_hpp
|
||||
#define HexMapTile_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_MAP_TERRAIN_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_MAP_TERRAIN_HPP
|
||||
|
||||
#include <utility>
|
||||
|
||||
@@ -57,4 +57,4 @@ auto MakeHexMapTerrain(
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* HexMapTile_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_MAP_TERRAIN_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef TileModifiers_hpp
|
||||
#define TileModifiers_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_MAP_TILE_MODIFIER_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_MAP_TILE_MODIFIER_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
@@ -63,7 +63,7 @@ static inline TileModifierProto& IncreaseFrozen(TileModifierProto& tm, const dou
|
||||
|
||||
// Removes bridge if integrity <= 0.0
|
||||
static inline TileModifierProto& SetBridge(TileModifierProto& tm, double integrity) {
|
||||
if (integrity > 100.0) { integrity = 100.0; }
|
||||
integrity = std::min(integrity, 100.0);
|
||||
if (integrity > 0.0) {
|
||||
*tm.mutable_bridge() = MakeSingleModifier(integrity);
|
||||
} else {
|
||||
@@ -74,7 +74,7 @@ static inline TileModifierProto& SetBridge(TileModifierProto& tm, double integri
|
||||
|
||||
static inline auto SetBridge(net::eagle0::shardok::storage::fb::TileModifier& tm, double integrity)
|
||||
-> net::eagle0::shardok::storage::fb::TileModifier& {
|
||||
if (integrity > 100.0) { integrity = 100.0; }
|
||||
integrity = std::min(integrity, 100.0);
|
||||
if (integrity > 0.0) {
|
||||
tm.mutable_bridge().mutate_present(true);
|
||||
tm.mutable_bridge().mutate_integrity(integrity);
|
||||
@@ -112,8 +112,7 @@ static inline TileModifierProto WithReducedBridgeIntegrity(
|
||||
}
|
||||
|
||||
static inline TileModifierProto& SetCastle(TileModifierProto& tm, double integrity) {
|
||||
if (integrity > 100.0) { integrity = 100.0; }
|
||||
if (integrity < 0.0) { integrity = 0.0; }
|
||||
integrity = std::clamp(integrity, 0.0, 100.0);
|
||||
*tm.mutable_castle() = MakeSingleModifier(integrity);
|
||||
return tm;
|
||||
}
|
||||
@@ -121,8 +120,7 @@ static inline TileModifierProto& SetCastle(TileModifierProto& tm, double integri
|
||||
static inline net::eagle0::shardok::storage::fb::TileModifier& SetCastle(
|
||||
net::eagle0::shardok::storage::fb::TileModifier& tm,
|
||||
double integrity) {
|
||||
if (integrity > 100.0) { integrity = 100.0; }
|
||||
if (integrity < 0.0) { integrity = 0.0; }
|
||||
integrity = std::clamp(integrity, 0.0, 100.0);
|
||||
tm.mutable_castle().mutate_integrity(integrity);
|
||||
tm.mutable_castle().mutate_present(true);
|
||||
return tm;
|
||||
@@ -132,7 +130,7 @@ static inline net::eagle0::shardok::storage::fb::TileModifier& SetCastle(
|
||||
static inline void ReduceCastleIntegrity(TileModifierProto& tm, const double damage) {
|
||||
if (HasCastle(tm)) {
|
||||
double newIntegrity = tm.castle().integrity().value() - damage;
|
||||
if (newIntegrity < 0.0) newIntegrity = 0.0;
|
||||
newIntegrity = std::max(newIntegrity, 0.0);
|
||||
SetCastle(tm, newIntegrity);
|
||||
}
|
||||
}
|
||||
@@ -156,7 +154,7 @@ static inline TileModifierProto WithReducedCastleIntegrity(
|
||||
const double damage) {
|
||||
if (HasCastle(tm)) {
|
||||
double newIntegrity = tm.castle().integrity().value() - damage;
|
||||
if (newIntegrity < 0.0) newIntegrity = 0.0;
|
||||
newIntegrity = std::max(newIntegrity, 0.0);
|
||||
SetCastle(tm, newIntegrity);
|
||||
}
|
||||
|
||||
@@ -165,7 +163,7 @@ static inline TileModifierProto WithReducedCastleIntegrity(
|
||||
|
||||
static inline auto SetIce(net::eagle0::shardok::storage::fb::TileModifier& tm, double integrity)
|
||||
-> net::eagle0::shardok::storage::fb::TileModifier& {
|
||||
if (integrity > 100.0) { integrity = 100.0; }
|
||||
integrity = std::min(integrity, 100.0);
|
||||
if (integrity > 0.0) {
|
||||
tm.mutable_ice().mutate_present(true);
|
||||
tm.mutable_ice().mutate_integrity(integrity);
|
||||
@@ -177,7 +175,7 @@ static inline auto SetIce(net::eagle0::shardok::storage::fb::TileModifier& tm, d
|
||||
|
||||
static inline auto SetSnow(net::eagle0::shardok::storage::fb::TileModifier& tm, double integrity)
|
||||
-> net::eagle0::shardok::storage::fb::TileModifier& {
|
||||
if (integrity > 100.0) { integrity = 100.0; }
|
||||
integrity = std::min(integrity, 100.0);
|
||||
if (integrity > 0.0) {
|
||||
tm.mutable_snow().mutate_present(true);
|
||||
tm.mutable_snow().mutate_integrity(integrity);
|
||||
@@ -197,4 +195,4 @@ static inline auto operator==(const TileModifierProto& lhs, const TileModifierPr
|
||||
}
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* TileModifiers_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_MAP_TILE_MODIFIER_HPP
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "src/main/protobuf/net/eagle0/shardok/common/tile_modifier_with_coords.pb.h"
|
||||
|
||||
namespace shardok {
|
||||
typedef net::eagle0::shardok::common::TileModifierWithCoords TileModifierWithCoords;
|
||||
using TileModifierWithCoords = net::eagle0::shardok::common::TileModifierWithCoords;
|
||||
|
||||
auto MakeTmc(const Coords &coordinates, const TileModifierProto &modifier)
|
||||
-> TileModifierWithCoords;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef GameSettings_hpp
|
||||
#define GameSettings_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_SETTINGS_GAME_SETTINGS_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_SETTINGS_GAME_SETTINGS_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -123,9 +123,9 @@ public:
|
||||
virtual ~GameSettings() = default;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<GameSettings> GameSettingsSPtr;
|
||||
typedef GameSettings::Getter SettingsGetter;
|
||||
typedef GameSettings::Setter SettingsSetter;
|
||||
using GameSettingsSPtr = std::shared_ptr<GameSettings>;
|
||||
using SettingsGetter = GameSettings::Getter;
|
||||
using SettingsSetter = GameSettings::Setter;
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* GameSettings_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_SETTINGS_GAME_SETTINGS_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright 2025 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef TutorialBattleController_hpp
|
||||
#define TutorialBattleController_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_TUTORIAL_TUTORIAL_BATTLE_CONTROLLER_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_TUTORIAL_TUTORIAL_BATTLE_CONTROLLER_HPP
|
||||
|
||||
#include <optional>
|
||||
#include <set>
|
||||
@@ -113,4 +113,4 @@ private:
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* TutorialBattleController_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_TUTORIAL_TUTORIAL_BATTLE_CONTROLLER_HPP
|
||||
|
||||
@@ -17,10 +17,7 @@ namespace shardok {
|
||||
auto MutatingMaybeSetMorale(Battalion *battalion, double newVal, const BattalionTypeSPtr &type)
|
||||
-> double {
|
||||
if (type->adjustsMorale) {
|
||||
if (newVal < 0.0) newVal = 0.0;
|
||||
else if (newVal > 100.0)
|
||||
newVal = 100.0;
|
||||
|
||||
newVal = std::clamp(newVal, 0.0, 100.0);
|
||||
battalion->mutate_morale(newVal);
|
||||
}
|
||||
|
||||
@@ -46,17 +43,14 @@ auto MutatingAdjustMorale(
|
||||
|
||||
auto MutatingSetMorale(net::eagle0::shardok::storage::fb::Battalion &battalion, double newVal)
|
||||
-> double {
|
||||
if (newVal < 0.0) newVal = 0.0;
|
||||
else if (newVal > 100.0)
|
||||
newVal = 100.0;
|
||||
|
||||
newVal = std::clamp(newVal, 0.0, 100.0);
|
||||
battalion.mutate_morale(newVal);
|
||||
|
||||
return newVal;
|
||||
}
|
||||
|
||||
inline double factorIntoAdjustment(const double factorPercentile, const double swingPercentile) {
|
||||
return 1.0 + ((factorPercentile - 50.0) * swingPercentile / 100.0) / 100.0;
|
||||
return 1.0 + (((factorPercentile - 50.0) * swingPercentile / 100.0) / 100.0);
|
||||
}
|
||||
|
||||
int32_t MutatingInternalTakeDamage(
|
||||
@@ -67,7 +61,7 @@ int32_t MutatingInternalTakeDamage(
|
||||
double flankingAdjustment,
|
||||
double moralePerCasualty,
|
||||
double baseDeadliness,
|
||||
const BattalionTypeSPtr type);
|
||||
BattalionTypeSPtr type);
|
||||
|
||||
int32_t MutatingTakeDamageFrom(
|
||||
Battalion *battalion,
|
||||
@@ -82,9 +76,15 @@ int32_t MutatingTakeDamageFrom(
|
||||
const BattalionTypeSPtr &fromType) {
|
||||
const double braveryAdjustment = factorIntoAdjustment(cmdrBravery, recipientType->braverySwing);
|
||||
double flankingAdjustment = 1.0;
|
||||
if (direction == flank) flankingAdjustment = recipientType->flankDamageMultiplier;
|
||||
else if (direction == rear)
|
||||
flankingAdjustment = recipientType->rearDamageMultiplier;
|
||||
switch (direction) {
|
||||
case AttackOrientation::flank:
|
||||
flankingAdjustment = recipientType->flankDamageMultiplier;
|
||||
break;
|
||||
case AttackOrientation::rear:
|
||||
flankingAdjustment = recipientType->rearDamageMultiplier;
|
||||
break;
|
||||
case AttackOrientation::front: break;
|
||||
}
|
||||
|
||||
const int32_t casualties = MutatingInternalTakeDamage(
|
||||
battalion,
|
||||
@@ -130,24 +130,24 @@ int32_t MutatingInternalTakeDamage(
|
||||
|
||||
double takenDamage = 0.0;
|
||||
|
||||
for (int i = 0; i < (int)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] +
|
||||
(battalion->armament() / 100.0) * type->maxAugmentResistanceByType[i]) /
|
||||
100.0;
|
||||
double newDamage = damage.GetNormalDamageOfType((DamageType)i) * braveryAdjustment *
|
||||
1.0 - ((type->baseResistanceByType[i] +
|
||||
(battalion->armament() / 100.0) * type->maxAugmentResistanceByType[i]) /
|
||||
100.0);
|
||||
double newDamage = damage.GetNormalDamageOfType(damageType) * braveryAdjustment *
|
||||
flankingAdjustment * armamentAdjustment;
|
||||
|
||||
newDamage += damage.GetPenetratingDamageOfType((DamageType)i) * braveryAdjustment *
|
||||
newDamage += damage.GetPenetratingDamageOfType(damageType) * braveryAdjustment *
|
||||
flankingAdjustment;
|
||||
|
||||
if (DamageTypeGetsTerrainDefense((DamageType)i)) { newDamage *= terrainAdjustment; }
|
||||
if (DamageTypeGetsTerrainDefense(damageType)) { newDamage *= terrainAdjustment; }
|
||||
|
||||
takenDamage += newDamage;
|
||||
}
|
||||
|
||||
int32_t newNumber;
|
||||
const int32_t casualties = (int32_t)(takenDamage * baseDeadliness);
|
||||
const auto casualties = static_cast<int32_t>(takenDamage * baseDeadliness);
|
||||
|
||||
if (casualties < 0) {
|
||||
throw ShardokInternalErrorException(
|
||||
@@ -155,11 +155,7 @@ int32_t MutatingInternalTakeDamage(
|
||||
" (takenDamage=" + std::to_string(takenDamage) + ")");
|
||||
}
|
||||
|
||||
if (battalion->size() > casualties) {
|
||||
newNumber = battalion->size() - casualties;
|
||||
} else {
|
||||
newNumber = 0;
|
||||
}
|
||||
const int32_t newNumber = std::max(0, battalion->size() - casualties);
|
||||
|
||||
battalion->mutate_size(newNumber);
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright (c) 2014 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __eagle0__Battalion__
|
||||
#define __eagle0__Battalion__
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_UNIT_BATTALION_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_UNIT_BATTALION_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
@@ -63,4 +63,4 @@ auto MutatingTakeEnvironmentalDamage(
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* defined(__eagle0__Battalion__) */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_UNIT_BATTALION_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright (c) 2014 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __eagle0__Hero__
|
||||
#define __eagle0__Hero__
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_UNIT_HERO_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_UNIT_HERO_HPP
|
||||
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
@@ -42,4 +42,4 @@ auto MutatingTakeDamage(
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* defined(__eagle0__Hero__) */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_UNIT_HERO_HPP
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/unit/Unit.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
namespace shardok {
|
||||
@@ -25,7 +26,7 @@ auto InternalTakeDamageFb(
|
||||
|
||||
inline auto factorIntoAdjustment(const double factorPercentile, const double swingPercentile)
|
||||
-> double {
|
||||
return 1.0 + (factorPercentile * swingPercentile / 100.0) / 100.0;
|
||||
return 1.0 + ((factorPercentile * swingPercentile / 100.0) / 100.0);
|
||||
}
|
||||
|
||||
auto MaxActionPoints(const Unit &unit) -> ActionPoints {
|
||||
@@ -39,31 +40,30 @@ auto MaxActionPoints(const Unit &unit) -> ActionPoints {
|
||||
}
|
||||
|
||||
auto OpponentKnowledge(const Unit &unit, const PlayerId toPlayer) -> int {
|
||||
if (unit.opponent_knowledge()->size() == 0) return 0;
|
||||
else if (toPlayer == -1) {
|
||||
if (unit.opponent_knowledge()->size() == 0) { return 0; }
|
||||
if (toPlayer == -1) {
|
||||
// handle observer, with pid -1
|
||||
int8_t max = 0;
|
||||
for (int i = 0; i < unit.opponent_knowledge()->size(); i++) {
|
||||
max = std::max(max, unit.opponent_knowledge()->Get(i));
|
||||
}
|
||||
return max;
|
||||
} else
|
||||
return unit.opponent_knowledge()->Get(toPlayer);
|
||||
}
|
||||
return unit.opponent_knowledge()->Get(toPlayer);
|
||||
}
|
||||
|
||||
auto OpponentKnowledge(const Unit *unit, const PlayerId toPlayer) -> int {
|
||||
if (unit->opponent_knowledge()->size() == 0) return 0;
|
||||
else if (toPlayer >= unit->opponent_knowledge()->size())
|
||||
return 0;
|
||||
else if (toPlayer == -1) {
|
||||
if (unit->opponent_knowledge()->size() == 0) { return 0; }
|
||||
if (toPlayer >= unit->opponent_knowledge()->size()) { return 0; }
|
||||
if (toPlayer == -1) {
|
||||
// handle observer, with pid -1
|
||||
int8_t max = 0;
|
||||
for (int i = 0; i < unit->opponent_knowledge()->size(); i++) {
|
||||
max = std::max(max, unit->opponent_knowledge()->Get(i));
|
||||
}
|
||||
return max;
|
||||
} else
|
||||
return unit->opponent_knowledge()->Get(toPlayer);
|
||||
}
|
||||
return unit->opponent_knowledge()->Get(toPlayer);
|
||||
}
|
||||
|
||||
auto MutatingApplyDamageFrom(
|
||||
@@ -140,7 +140,7 @@ void MutatingSpendActionPoints(Unit *unit, const ActionCost &cost) {
|
||||
|
||||
if (unit->has_attached_hero()) {
|
||||
const double currentVigor = unit->attached_hero().vigor();
|
||||
const double vigorSpend = -(double)cost.points * ACTION_COST_TO_VIGOR_COST;
|
||||
const double vigorSpend = -static_cast<double>(cost.points) * ACTION_COST_TO_VIGOR_COST;
|
||||
|
||||
const double newVigor = std::max(currentVigor + vigorSpend, 0.0);
|
||||
unit->mutable_attached_hero().mutate_vigor(newVigor);
|
||||
@@ -212,8 +212,7 @@ auto InternalTakeDamageFb(
|
||||
|
||||
const auto battalion = victim->battalion();
|
||||
|
||||
if (heroDamageRatio > 1.0) heroDamageRatio = 1.0;
|
||||
if (heroDamageRatio < 0.0) heroDamageRatio = 0.0;
|
||||
heroDamageRatio = std::clamp(heroDamageRatio, 0.0, 1.0);
|
||||
|
||||
if (victim->has_attached_hero()) {
|
||||
const auto hero = victim->attached_hero();
|
||||
@@ -221,8 +220,9 @@ auto InternalTakeDamageFb(
|
||||
|
||||
double vigorHit = 0.0;
|
||||
for (int i = 0; i < NUM_DAMAGE_TYPES; i++) {
|
||||
vigorHit += heroDamage.GetNormalDamageOfType(DamageType(i)) * heroMortalityFactor;
|
||||
vigorHit += heroDamage.GetPenetratingDamageOfType(DamageType(i)) * heroMortalityFactor;
|
||||
const auto damageType = static_cast<DamageType>(i);
|
||||
vigorHit += heroDamage.GetNormalDamageOfType(damageType) * heroMortalityFactor;
|
||||
vigorHit += heroDamage.GetPenetratingDamageOfType(damageType) * heroMortalityFactor;
|
||||
// TODO: hero should have adjustments for damage types too
|
||||
}
|
||||
|
||||
@@ -236,24 +236,25 @@ auto InternalTakeDamageFb(
|
||||
double takenDamage = 0.0;
|
||||
double terrainAdjustment = battalionType->GetDamageTakenMultiplierForTerrain(&terrain);
|
||||
|
||||
for (int i = 0; i < (int)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) *
|
||||
battalionType->maxAugmentResistanceByType[i]) /
|
||||
100.0;
|
||||
double newDamage =
|
||||
(battalionDamage.GetNormalDamageOfType((DamageType)i) * flankingAdjustment *
|
||||
(battalionDamage.GetNormalDamageOfType(damageType) * flankingAdjustment *
|
||||
armamentAdjustment);
|
||||
|
||||
newDamage += battalionDamage.GetPenetratingDamageOfType((DamageType)i) * flankingAdjustment;
|
||||
newDamage += battalionDamage.GetPenetratingDamageOfType(damageType) * flankingAdjustment;
|
||||
|
||||
if (DamageTypeGetsTerrainDefense((DamageType)i)) { newDamage *= terrainAdjustment; }
|
||||
if (DamageTypeGetsTerrainDefense(damageType)) { newDamage *= terrainAdjustment; }
|
||||
|
||||
takenDamage += newDamage;
|
||||
}
|
||||
|
||||
int32_t newNumber;
|
||||
auto casualties = (int32_t)(takenDamage * baseDeadliness);
|
||||
int32_t newNumber = 0;
|
||||
const auto casualties = static_cast<int32_t>(takenDamage * baseDeadliness);
|
||||
|
||||
if (battalion.size() > casualties) {
|
||||
newNumber = battalion.size() - casualties;
|
||||
@@ -285,31 +286,26 @@ auto WithTakenDamageFb(
|
||||
|
||||
double flankingAdjustment = 1.0;
|
||||
const BattalionTypeSPtr &type = settings.GetBattalionType(victim->battalion().type());
|
||||
if (orientation == flank) flankingAdjustment = type->flankDamageMultiplier;
|
||||
else if (orientation == rear)
|
||||
if (orientation == flank) {
|
||||
flankingAdjustment = type->flankDamageMultiplier;
|
||||
} else if (orientation == rear) {
|
||||
flankingAdjustment = type->rearDamageMultiplier;
|
||||
|
||||
if (shouldReduceForFortified && victim->fortified()) {
|
||||
return InternalTakeDamageFb(
|
||||
victim,
|
||||
amount * settings.Backing().fortify_damage_taken_multiplier(),
|
||||
settings.GetBattalionType(victim->battalion().type()),
|
||||
terrain,
|
||||
heroDamageRatio,
|
||||
flankingAdjustment,
|
||||
settings.Backing().hero_mortality_factor(),
|
||||
settings.Backing().base_deadliness());
|
||||
} else {
|
||||
return InternalTakeDamageFb(
|
||||
victim,
|
||||
amount,
|
||||
settings.GetBattalionType(victim->battalion().type()),
|
||||
terrain,
|
||||
heroDamageRatio,
|
||||
flankingAdjustment,
|
||||
settings.Backing().hero_mortality_factor(),
|
||||
settings.Backing().base_deadliness());
|
||||
}
|
||||
|
||||
const CombatDamage adjustedAmount =
|
||||
shouldReduceForFortified && victim->fortified()
|
||||
? amount * settings.Backing().fortify_damage_taken_multiplier()
|
||||
: amount;
|
||||
|
||||
return InternalTakeDamageFb(
|
||||
victim,
|
||||
adjustedAmount,
|
||||
settings.GetBattalionType(victim->battalion().type()),
|
||||
terrain,
|
||||
heroDamageRatio,
|
||||
flankingAdjustment,
|
||||
settings.Backing().hero_mortality_factor(),
|
||||
settings.Backing().base_deadliness());
|
||||
}
|
||||
|
||||
auto ReserveUnitsForPlayer(const Units *units, const PlayerId pid)
|
||||
@@ -318,8 +314,9 @@ auto ReserveUnitsForPlayer(const Units *units, const PlayerId pid)
|
||||
std::map<UnitId, const Unit *> reserves{};
|
||||
for (const Unit *unit : *units) {
|
||||
if (unit->player_id() == pid &&
|
||||
unit->status() == net::eagle0::shardok::storage::fb::UnitStatus_RESERVE_UNIT)
|
||||
unit->status() == net::eagle0::shardok::storage::fb::UnitStatus_RESERVE_UNIT) {
|
||||
reserves[unit->unit_id()] = unit;
|
||||
}
|
||||
}
|
||||
|
||||
return reserves;
|
||||
@@ -332,8 +329,9 @@ auto PlacedUnitsForPlayer(const Units *units, const PlayerId pid)
|
||||
for (const Unit *unit : *units) {
|
||||
if (unit->player_id() == pid &&
|
||||
unit->status() != net::eagle0::shardok::storage::fb::UnitStatus_RESERVE_UNIT &&
|
||||
unit->status() != net::eagle0::shardok::storage::fb::UnitStatus_PENDING_REINFORCEMENT)
|
||||
unit->status() != net::eagle0::shardok::storage::fb::UnitStatus_PENDING_REINFORCEMENT) {
|
||||
placedUnits[unit->unit_id()] = unit;
|
||||
}
|
||||
}
|
||||
|
||||
return placedUnits;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Unit_hpp
|
||||
#define Unit_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_UNIT_UNIT_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_UNIT_UNIT_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCTypes.h"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
|
||||
@@ -81,4 +81,4 @@ auto PlacedUnitsForPlayer(const Units *units, PlayerId pid) -> map<UnitId, const
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* Unit_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_UNIT_UNIT_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MeleeUtils_hpp
|
||||
#define MeleeUtils_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_UTIL_COMBAT_UTILS_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_UTIL_COMBAT_UTILS_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/unit/Unit.hpp"
|
||||
@@ -87,4 +87,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* MeleeUtils_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_UTIL_COMBAT_UTILS_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef HexMapUtils_hpp
|
||||
#define HexMapUtils_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_UTIL_HEX_MAP_UTILS_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_UTIL_HEX_MAP_UTILS_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <ranges>
|
||||
@@ -325,4 +325,4 @@ auto IsBelievedEmpty(PlayerId playerId, const Coords &coords, const Units *units
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* HexMapUtils_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_UTIL_HEX_MAP_UTILS_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ZoneOfControlCalculator_hpp
|
||||
#define ZoneOfControlCalculator_hpp
|
||||
#ifndef EAGLE0_SHARDOK_LIBRARY_UTIL_ZONE_OF_CONTROL_CALCULATOR_HPP
|
||||
#define EAGLE0_SHARDOK_LIBRARY_UTIL_ZONE_OF_CONTROL_CALCULATOR_HPP
|
||||
|
||||
#include "HexMapUtils.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
|
||||
@@ -46,4 +46,4 @@ ExertsZoneOfControl(const SettingsGetter &settings, const Unit *unit, PlayerId t
|
||||
const Coords &destination) -> AttackOrientation;
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ZoneOfControlCalculator_hpp */
|
||||
#endif // EAGLE0_SHARDOK_LIBRARY_UTIL_ZONE_OF_CONTROL_CALCULATOR_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef EagleInterfaceGrpcServer_hpp
|
||||
#define EagleInterfaceGrpcServer_hpp
|
||||
#ifndef EAGLE0_SHARDOK_SERVER_EAGLE_INTERFACE_GRPC_SERVER_HPP
|
||||
#define EAGLE0_SHARDOK_SERVER_EAGLE_INTERFACE_GRPC_SERVER_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -91,4 +91,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* EagleInterfaceGrpcServer_hpp */
|
||||
#endif // EAGLE0_SHARDOK_SERVER_EAGLE_INTERFACE_GRPC_SERVER_HPP
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef GameOverResponsePopulator_hpp
|
||||
#define GameOverResponsePopulator_hpp
|
||||
#ifndef EAGLE0_SHARDOK_SERVER_GAME_OVER_RESPONSE_POPULATOR_HPP
|
||||
#define EAGLE0_SHARDOK_SERVER_GAME_OVER_RESPONSE_POPULATOR_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -33,4 +33,4 @@ auto FromInternalStatus(
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* GameOverResponsePopulator_hpp */
|
||||
#endif // EAGLE0_SHARDOK_SERVER_GAME_OVER_RESPONSE_POPULATOR_HPP
|
||||
|
||||
@@ -57,7 +57,7 @@ ServerConfiguration::ServerConfiguration(const string& filePath) {
|
||||
istr.getline(line, 256);
|
||||
if (strnlen(line, 256) < 3) continue;
|
||||
string key = strtok(line, " =");
|
||||
string value = strtok(NULL, " =");
|
||||
string value = strtok(nullptr, " =");
|
||||
|
||||
configValues[key] = value;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2018 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ServerConfiguration_hpp
|
||||
#define ServerConfiguration_hpp
|
||||
#ifndef EAGLE0_SHARDOK_SERVER_SERVER_CONFIGURATION_HPP
|
||||
#define EAGLE0_SHARDOK_SERVER_SERVER_CONFIGURATION_HPP
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@@ -32,4 +32,4 @@ public:
|
||||
const static string kAuthTokenPath;
|
||||
};
|
||||
|
||||
#endif /* ServerConfiguration_hpp */
|
||||
#endif // EAGLE0_SHARDOK_SERVER_SERVER_CONFIGURATION_HPP
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "ShardokGamesManager.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
#include <utility>
|
||||
|
||||
@@ -68,7 +69,7 @@ auto ShardokGamesManager::UnlockedCreateFromGameStateBytes(
|
||||
const byte_vector &gameStateBytes,
|
||||
int32_t startingHistoryCount,
|
||||
const string &mapName) -> GameId {
|
||||
std::shared_lock<std::shared_mutex> lk(runningControllersLock);
|
||||
std::unique_lock<std::shared_mutex> lk(runningControllersLock);
|
||||
|
||||
auto gs = GameStateW::FromByteVector(gameStateBytes);
|
||||
|
||||
@@ -90,7 +91,7 @@ auto ShardokGamesManager::UnlockedCreateSpecifiedGame(
|
||||
const string &serializedRequest,
|
||||
const std::vector<std::pair<int32_t, std::vector<PlayerId>>> &watcherAllies) -> GameId {
|
||||
// Check for existing game with this ID and early-exit
|
||||
std::shared_lock<std::shared_mutex> lk(runningControllersLock);
|
||||
std::unique_lock<std::shared_mutex> lk(runningControllersLock);
|
||||
const auto existingGame = runningControllers.find(gameId);
|
||||
|
||||
// If it exists, register new handlers and early-exit
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2017 none. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef ServerGamesManager_hpp
|
||||
#define ServerGamesManager_hpp
|
||||
#ifndef EAGLE0_SHARDOK_SERVER_SHARDOK_GAMES_MANAGER_HPP
|
||||
#define EAGLE0_SHARDOK_SERVER_SHARDOK_GAMES_MANAGER_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -121,4 +121,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* ServerGamesManager_hpp */
|
||||
#endif // EAGLE0_SHARDOK_SERVER_SHARDOK_GAMES_MANAGER_HPP
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Validates Bearer tokens in the 'authorization' metadata header.
|
||||
//
|
||||
|
||||
#ifndef TokenAuthInterceptor_hpp
|
||||
#define TokenAuthInterceptor_hpp
|
||||
#ifndef EAGLE0_SHARDOK_SERVER_TOKEN_AUTH_INTERCEPTOR_HPP
|
||||
#define EAGLE0_SHARDOK_SERVER_TOKEN_AUTH_INTERCEPTOR_HPP
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
@@ -116,4 +116,4 @@ inline auto ReadAuthTokenFromFile(const std::string& filePath) -> std::string {
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif /* TokenAuthInterceptor_hpp */
|
||||
#endif // EAGLE0_SHARDOK_SERVER_TOKEN_AUTH_INTERCEPTOR_HPP
|
||||
|
||||
@@ -68,9 +68,6 @@ void handler(const int sig) {
|
||||
}
|
||||
|
||||
auto main(const int argc, char **argv) -> int {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
signal(SIGSEGV, handler); // install our handler
|
||||
|
||||
FilesystemUtils::SetExecPath(argv[0]);
|
||||
|
||||
@@ -252,7 +252,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 1, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: -10, y: 0}
|
||||
m_SizeDelta: {x: 32, y: 32}
|
||||
m_SizeDelta: {x: 44, y: 44}
|
||||
m_Pivot: {x: 1, y: 0.5}
|
||||
--- !u!222 &8373916935102330305
|
||||
CanvasRenderer:
|
||||
|
||||
+7
-7
@@ -1162,7 +1162,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 86.59145, y: -127}
|
||||
m_SizeDelta: {x: 120, y: 26}
|
||||
m_SizeDelta: {x: 120, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4354027254114168199
|
||||
CanvasRenderer:
|
||||
@@ -1272,9 +1272,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 120
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3969,7 +3969,7 @@ PrefabInstance:
|
||||
- target: {fileID: 4374038768321626813, guid: fee9323a39d4d49338c3ef7ef85f6985,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 25
|
||||
value: 44
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4374038768321626813, guid: fee9323a39d4d49338c3ef7ef85f6985,
|
||||
type: 3}
|
||||
@@ -4049,7 +4049,7 @@ PrefabInstance:
|
||||
- target: {fileID: 5648968011886801047, guid: fee9323a39d4d49338c3ef7ef85f6985,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 25
|
||||
value: 44
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5648968011886801047, guid: fee9323a39d4d49338c3ef7ef85f6985,
|
||||
type: 3}
|
||||
@@ -4079,7 +4079,7 @@ PrefabInstance:
|
||||
- target: {fileID: 5678746054507640123, guid: fee9323a39d4d49338c3ef7ef85f6985,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 25
|
||||
value: 44
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5678746054507640123, guid: fee9323a39d4d49338c3ef7ef85f6985,
|
||||
type: 3}
|
||||
@@ -4369,7 +4369,7 @@ PrefabInstance:
|
||||
- target: {fileID: 8728618441403129635, guid: fee9323a39d4d49338c3ef7ef85f6985,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 25
|
||||
value: 44
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8728618441403129635, guid: fee9323a39d4d49338c3ef7ef85f6985,
|
||||
type: 3}
|
||||
|
||||
+15
-15
@@ -2088,7 +2088,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 277.5, y: -17.5}
|
||||
m_SizeDelta: {x: 225, y: 35}
|
||||
m_SizeDelta: {x: 225, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &6568002168404457349
|
||||
MonoBehaviour:
|
||||
@@ -2152,9 +2152,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 225
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -2896,7 +2896,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1012.5, y: -17.5}
|
||||
m_SizeDelta: {x: 225, y: 35}
|
||||
m_SizeDelta: {x: 225, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2536113809541095963
|
||||
MonoBehaviour:
|
||||
@@ -2960,9 +2960,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 225
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3004,7 +3004,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 767.5, y: -17.5}
|
||||
m_SizeDelta: {x: 225, y: 35}
|
||||
m_SizeDelta: {x: 225, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4949409443685672109
|
||||
MonoBehaviour:
|
||||
@@ -3068,9 +3068,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 225
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3435,7 +3435,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 650, y: -225.5}
|
||||
m_SizeDelta: {x: 1290, y: 35}
|
||||
m_SizeDelta: {x: 1290, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5169051346157033462
|
||||
CanvasRenderer:
|
||||
@@ -3472,9 +3472,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: -854.3499
|
||||
m_PreferredHeight: -1
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 1
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
@@ -3931,7 +3931,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 522.5, y: -17.5}
|
||||
m_SizeDelta: {x: 225, y: 35}
|
||||
m_SizeDelta: {x: 225, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4110992760340391202
|
||||
MonoBehaviour:
|
||||
@@ -3995,9 +3995,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 225
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+6
-6
@@ -2576,9 +2576,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 225
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3345,9 +3345,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 225
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3916,9 +3916,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 200
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+3
-3
@@ -4281,7 +4281,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 95.40441, y: -215}
|
||||
m_SizeDelta: {x: 150, y: 30}
|
||||
m_SizeDelta: {x: 150, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8982402502509954525
|
||||
CanvasRenderer:
|
||||
@@ -4403,9 +4403,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+9
-9
@@ -2086,7 +2086,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 90, y: -134}
|
||||
m_SizeDelta: {x: 180, y: 35}
|
||||
m_SizeDelta: {x: 180, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7501192298675143721
|
||||
MonoBehaviour:
|
||||
@@ -2150,9 +2150,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 0
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 180
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -2639,7 +2639,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 90, y: -89}
|
||||
m_SizeDelta: {x: 180, y: 35}
|
||||
m_SizeDelta: {x: 180, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7174305543327231876
|
||||
MonoBehaviour:
|
||||
@@ -2703,9 +2703,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 0
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 180
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3057,7 +3057,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 90, y: -44}
|
||||
m_SizeDelta: {x: 180, y: 35}
|
||||
m_SizeDelta: {x: 180, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1699620799270868465
|
||||
MonoBehaviour:
|
||||
@@ -3121,9 +3121,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 0
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 180
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+23
-23
@@ -131,7 +131,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 960.1557, y: -16.5}
|
||||
m_SizeDelta: {x: 198.59923, y: 33}
|
||||
m_SizeDelta: {x: 198.59923, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &9126053559433354862
|
||||
MonoBehaviour:
|
||||
@@ -195,9 +195,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 220
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -280,9 +280,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: 1
|
||||
m_LayoutPriority: 1
|
||||
@@ -2102,7 +2102,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1189.7277, y: -16.5}
|
||||
m_SizeDelta: {x: 180.54474, y: 33}
|
||||
m_SizeDelta: {x: 180.54474, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6112751865803778905
|
||||
CanvasRenderer:
|
||||
@@ -2212,9 +2212,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 200
|
||||
m_PreferredHeight: -1
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: 1
|
||||
m_LayoutPriority: 1
|
||||
@@ -2498,7 +2498,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 541.01166, y: -16.5}
|
||||
m_SizeDelta: {x: 162.49026, y: 33}
|
||||
m_SizeDelta: {x: 162.49026, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &3896912302030604581
|
||||
MonoBehaviour:
|
||||
@@ -2562,9 +2562,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 180
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3536,7 +3536,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 329.1829, y: -16.5}
|
||||
m_SizeDelta: {x: 221.16731, y: 33}
|
||||
m_SizeDelta: {x: 221.16731, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1345808385683317494
|
||||
MonoBehaviour:
|
||||
@@ -3600,9 +3600,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 245
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3719,7 +3719,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 741.55646, y: -16.5}
|
||||
m_SizeDelta: {x: 198.59923, y: 33}
|
||||
m_SizeDelta: {x: 198.59923, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &8494862080301576888
|
||||
MonoBehaviour:
|
||||
@@ -3783,9 +3783,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 220
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3833,7 +3833,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 640, y: -211.5}
|
||||
m_SizeDelta: {x: 1280, y: 33}
|
||||
m_SizeDelta: {x: 1280, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3604403311084700028
|
||||
CanvasRenderer:
|
||||
@@ -3870,9 +3870,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: -854.3499
|
||||
m_PreferredHeight: -1
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 1
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
@@ -4203,7 +4203,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 99.29962, y: -16.5}
|
||||
m_SizeDelta: {x: 198.59923, y: 33}
|
||||
m_SizeDelta: {x: 198.59923, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2588932345895194830
|
||||
MonoBehaviour:
|
||||
@@ -4267,9 +4267,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 220
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+4
-4
@@ -686,7 +686,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 10, y: -10}
|
||||
m_AnchoredPosition: {x: 22, y: -22}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &926632779962815960
|
||||
@@ -904,7 +904,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: -214.00003, y: -209}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_SizeDelta: {x: 44, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &8242559266383646029
|
||||
MonoBehaviour:
|
||||
@@ -1427,7 +1427,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: -214.00003, y: -158.99998}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_SizeDelta: {x: 44, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &5011652097361437691
|
||||
MonoBehaviour:
|
||||
@@ -1642,7 +1642,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 10, y: -10}
|
||||
m_AnchoredPosition: {x: 22, y: -22}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1009416593887454201
|
||||
|
||||
+6
-6
@@ -1712,7 +1712,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 324, y: -119}
|
||||
m_SizeDelta: {x: 24, y: 24}
|
||||
m_SizeDelta: {x: 44, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6574377907172759685
|
||||
CanvasRenderer:
|
||||
@@ -1822,7 +1822,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
@@ -1844,7 +1844,7 @@ MonoBehaviour:
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: 24
|
||||
m_PreferredHeight: 24
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -2136,7 +2136,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 46, y: -119}
|
||||
m_SizeDelta: {x: 24, y: 24}
|
||||
m_SizeDelta: {x: 44, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6996475469755520655
|
||||
CanvasRenderer:
|
||||
@@ -2246,7 +2246,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
@@ -2268,7 +2268,7 @@ MonoBehaviour:
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: 24
|
||||
m_PreferredHeight: 24
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+19
-19
@@ -251,7 +251,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 338.31927, y: -12.923078}
|
||||
m_SizeDelta: {x: 96.75219, y: 25.846155}
|
||||
m_SizeDelta: {x: 96.75219, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7706371227584479729
|
||||
MonoBehaviour:
|
||||
@@ -315,9 +315,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 180
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -1137,7 +1137,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 59.126343, y: -12.923078}
|
||||
m_SizeDelta: {x: 118.25268, y: 25.846155}
|
||||
m_SizeDelta: {x: 118.25268, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &3005629370892248399
|
||||
MonoBehaviour:
|
||||
@@ -1201,9 +1201,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 220
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -2034,7 +2034,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 204.09793, y: -12.923078}
|
||||
m_SizeDelta: {x: 131.69049, y: 25.846155}
|
||||
m_SizeDelta: {x: 131.69049, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1248166195846916077
|
||||
MonoBehaviour:
|
||||
@@ -2098,9 +2098,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 245
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -3400,7 +3400,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 410.35156, y: -230.07692}
|
||||
m_SizeDelta: {x: 810.7031, y: 25.846155}
|
||||
m_SizeDelta: {x: 810.7031, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4496069533907013775
|
||||
CanvasRenderer:
|
||||
@@ -4101,7 +4101,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 756.95197, y: -12.923078}
|
||||
m_SizeDelta: {x: 107.50243, y: 25.846155}
|
||||
m_SizeDelta: {x: 107.50243, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &50070872754773658
|
||||
CanvasRenderer:
|
||||
@@ -4211,9 +4211,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 200
|
||||
m_PreferredHeight: -1
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: 1
|
||||
m_LayoutPriority: 1
|
||||
@@ -4319,7 +4319,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 465.82172, y: -12.923078}
|
||||
m_SizeDelta: {x: 118.25268, y: 25.846155}
|
||||
m_SizeDelta: {x: 118.25268, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &6791613139375434283
|
||||
MonoBehaviour:
|
||||
@@ -4383,9 +4383,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 220
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -4748,7 +4748,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 604.0744, y: -12.923078}
|
||||
m_SizeDelta: {x: 118.25268, y: 25.846155}
|
||||
m_SizeDelta: {x: 118.25268, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &159881109546823439
|
||||
MonoBehaviour:
|
||||
@@ -4812,9 +4812,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 220
|
||||
m_PreferredHeight: 35
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+3
-3
@@ -1411,7 +1411,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 136.27197, y: -200.5}
|
||||
m_SizeDelta: {x: 150, y: 25}
|
||||
m_SizeDelta: {x: 150, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8538181288592016588
|
||||
CanvasRenderer:
|
||||
@@ -1533,9 +1533,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 135
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: 25
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+3
-3
@@ -1120,7 +1120,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: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7054265081857237224
|
||||
CanvasRenderer:
|
||||
@@ -1230,9 +1230,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 150
|
||||
m_PreferredHeight: 30
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
+2
-2
@@ -324,7 +324,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 215, y: 24}
|
||||
m_SizeDelta: {x: 250, y: 20}
|
||||
m_SizeDelta: {x: 250, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1949439835697595086
|
||||
MonoBehaviour:
|
||||
@@ -1434,7 +1434,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 194, y: -42}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_SizeDelta: {x: 160, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7346251710853780603
|
||||
CanvasRenderer:
|
||||
|
||||
+6
-6
@@ -1928,7 +1928,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 77.5, y: -16}
|
||||
m_SizeDelta: {x: 25, y: 25}
|
||||
m_SizeDelta: {x: 44, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5162963118205884471
|
||||
CanvasRenderer:
|
||||
@@ -2038,7 +2038,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 25
|
||||
m_PreferredHeight: 25
|
||||
m_FlexibleWidth: -1
|
||||
@@ -2060,7 +2060,7 @@ MonoBehaviour:
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: 18
|
||||
m_PreferredHeight: 18
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
@@ -2299,7 +2299,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 522.5, y: -16}
|
||||
m_SizeDelta: {x: 25, y: 25}
|
||||
m_SizeDelta: {x: 44, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3327516808560080911
|
||||
CanvasRenderer:
|
||||
@@ -2409,7 +2409,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 25
|
||||
m_PreferredHeight: 25
|
||||
m_FlexibleWidth: -1
|
||||
@@ -2431,7 +2431,7 @@ MonoBehaviour:
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: 18
|
||||
m_PreferredHeight: 18
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 0
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
|
||||
@@ -6826,8 +6826,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 490, y: -267.73685}
|
||||
m_SizeDelta: {x: 980, y: 20.526316}
|
||||
m_AnchoredPosition: {x: 490, y: -279.4737}
|
||||
m_SizeDelta: {x: 980, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &52167055
|
||||
MonoBehaviour:
|
||||
@@ -6843,9 +6843,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: 1
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
@@ -27729,8 +27729,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 660, y: -10.263158}
|
||||
m_SizeDelta: {x: 120, y: 20.526316}
|
||||
m_AnchoredPosition: {x: 660, y: -22}
|
||||
m_SizeDelta: {x: 120, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &220244842
|
||||
MonoBehaviour:
|
||||
@@ -27746,9 +27746,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 120
|
||||
m_PreferredHeight: 25
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -53444,8 +53444,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 920, y: -10.263158}
|
||||
m_SizeDelta: {x: 120, y: 20.526316}
|
||||
m_AnchoredPosition: {x: 920, y: -22}
|
||||
m_SizeDelta: {x: 120, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &396655493
|
||||
MonoBehaviour:
|
||||
@@ -53461,9 +53461,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 120
|
||||
m_PreferredHeight: 25
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
@@ -129615,8 +129615,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 790, y: -10.263158}
|
||||
m_SizeDelta: {x: 120, y: 20.526316}
|
||||
m_AnchoredPosition: {x: 790, y: -22}
|
||||
m_SizeDelta: {x: 120, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &909477096
|
||||
MonoBehaviour:
|
||||
@@ -129632,9 +129632,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_MinHeight: 44
|
||||
m_PreferredWidth: 120
|
||||
m_PreferredHeight: 25
|
||||
m_PreferredHeight: 44
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
|
||||
@@ -17,7 +17,6 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -1486,7 +1485,7 @@ func handleGameUpload(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Validate zip file
|
||||
zipReader, err := zip.NewReader(bytes.NewReader(zipBytes), int64(len(zipBytes)))
|
||||
_, err = zip.NewReader(bytes.NewReader(zipBytes), int64(len(zipBytes)))
|
||||
if err != nil {
|
||||
log.Printf("Failed to read zip file: %v", err)
|
||||
http.Error(w, "Invalid zip file", http.StatusBadRequest)
|
||||
@@ -1576,57 +1575,11 @@ func handleGameUpload(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("Removed existing game %s from memory for replacement", gameIDHex)
|
||||
}
|
||||
|
||||
// Extract to save directory
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.Printf("Failed to get home directory: %v", err)
|
||||
http.Error(w, "Failed to get home directory", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
saveDir := filepath.Join(homeDir, "eagle0", "eagle", "save", gameIDHex)
|
||||
|
||||
// Create save directory
|
||||
if err := os.MkdirAll(saveDir, 0755); err != nil {
|
||||
log.Printf("Failed to create save directory %s: %v", saveDir, err)
|
||||
http.Error(w, "Failed to create save directory", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
// Unzip to saveDir
|
||||
for _, f := range zipReader.File {
|
||||
destPath := filepath.Join(saveDir, f.Name)
|
||||
// Security check: prevent path traversal
|
||||
if !strings.HasPrefix(destPath, saveDir) {
|
||||
log.Printf("Invalid file path in zip: %s", f.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
outFile, err := os.Create(destPath)
|
||||
if err != nil {
|
||||
log.Printf("Failed to create file %s: %v", destPath, err)
|
||||
continue
|
||||
}
|
||||
rc, err := f.Open()
|
||||
if err != nil {
|
||||
outFile.Close()
|
||||
log.Printf("Failed to open zip entry %s: %v", f.Name, err)
|
||||
continue
|
||||
}
|
||||
_, err = io.Copy(outFile, rc)
|
||||
rc.Close()
|
||||
outFile.Close()
|
||||
if err != nil {
|
||||
log.Printf("Failed to extract %s: %v", f.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Call gRPC to register the game
|
||||
// Stream the zip to Eagle so extraction happens beside Eagle's save directory.
|
||||
importCtx, importCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer importCancel()
|
||||
|
||||
resp, err := gameAdminClient.ImportGame(importCtx, &gameadminpb.ImportGameRequest{
|
||||
GameId: int64(gameIDUint),
|
||||
})
|
||||
resp, err := uploadGameSave(importCtx, int64(gameIDUint), forceReplace, zipBytes)
|
||||
if err != nil {
|
||||
log.Printf("Failed to import game %s via gRPC: %v", gameIDHex, err)
|
||||
http.Error(w, fmt.Sprintf("Failed to register game: %v", err), http.StatusInternalServerError)
|
||||
@@ -1645,6 +1598,30 @@ func handleGameUpload(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, fmt.Sprintf("/games/%s", gameIDHex), http.StatusFound)
|
||||
}
|
||||
|
||||
func uploadGameSave(ctx context.Context, gameID int64, overwriteExisting bool, zipBytes []byte) (*gameadminpb.UploadGameSaveResponse, error) {
|
||||
stream, err := gameAdminClient.UploadGameSave(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
const chunkSize = 64 * 1024
|
||||
for offset := 0; offset < len(zipBytes); offset += chunkSize {
|
||||
end := offset + chunkSize
|
||||
if end > len(zipBytes) {
|
||||
end = len(zipBytes)
|
||||
}
|
||||
if err := stream.Send(&gameadminpb.UploadGameSaveRequest{
|
||||
GameId: gameID,
|
||||
OverwriteExisting: overwriteExisting,
|
||||
Chunk: zipBytes[offset:end],
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return stream.CloseAndRecv()
|
||||
}
|
||||
|
||||
// API handlers (keep JSON endpoints for programmatic access)
|
||||
|
||||
func handleGamesAPI(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<div class="alert warning">Game failed to load: {{.ErrorMsg}}<br>
|
||||
Showing raw action history (no faction/date info). Rewind uses raw file truncation.</div>
|
||||
Showing raw action history (no faction/date info). Rewind truncates persisted history directly.</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
@@ -26,7 +26,7 @@
|
||||
<button class="btn-rewind"
|
||||
hx-post="/games/{{$.GameID}}/{{if $.IsRawMode}}raw-rewind{{else}}rewind{{end}}"
|
||||
hx-vals='{"targetAction": "{{.Index}}"}'
|
||||
hx-confirm="{{if $.IsRawMode}}Raw rewind game to action {{.Index}}? This truncates persisted files and cannot be undone.{{else}}Rewind game to action {{.Index}}? This will disconnect all clients and cannot be undone.{{end}}"
|
||||
hx-confirm="{{if $.IsRawMode}}Raw rewind game to action {{.Index}}? This truncates persisted history directly and cannot be undone.{{else}}Rewind game to action {{.Index}}? This will disconnect all clients and cannot be undone.{{end}}"
|
||||
hx-target="#rewind-result"
|
||||
hx-swap="innerHTML"
|
||||
onclick="event.stopPropagation()">
|
||||
|
||||
@@ -52,6 +52,9 @@ service GameAdmin {
|
||||
// Import a game from save files
|
||||
rpc ImportGame(ImportGameRequest) returns (ImportGameResponse) {}
|
||||
|
||||
// Upload and import a zipped game save on the Eagle server
|
||||
rpc UploadGameSave(stream UploadGameSaveRequest) returns (UploadGameSaveResponse) {}
|
||||
|
||||
// Delete a game (optionally including save files)
|
||||
rpc DeleteGame(DeleteGameRequest) returns (DeleteGameResponse) {}
|
||||
|
||||
@@ -340,6 +343,7 @@ message RewindGameResponse {
|
||||
// ImportGame
|
||||
message ImportGameRequest {
|
||||
int64 game_id = 1;
|
||||
bool overwrite_existing = 2;
|
||||
}
|
||||
|
||||
message ImportGameResponse {
|
||||
@@ -353,6 +357,17 @@ message ImportGameResponse {
|
||||
string error_message = 2;
|
||||
}
|
||||
|
||||
message UploadGameSaveRequest {
|
||||
int64 game_id = 1;
|
||||
bool overwrite_existing = 2;
|
||||
bytes chunk = 3;
|
||||
}
|
||||
|
||||
message UploadGameSaveResponse {
|
||||
ImportGameResponse.Result result = 1;
|
||||
string error_message = 2;
|
||||
}
|
||||
|
||||
// DeleteGame
|
||||
message DeleteGameRequest {
|
||||
int64 game_id = 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.eagle0.common
|
||||
|
||||
import scala.annotation.{nowarn, tailrec}
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.SeqFactory
|
||||
|
||||
case class RandomState[+T](
|
||||
@@ -160,10 +160,9 @@ abstract class FunctionalRandom {
|
||||
)(
|
||||
f: (T, FunctionalRandom) => RandomState[S[U]]
|
||||
)(using xFactory: FACT): RandomState[S[U]] = {
|
||||
@nowarn def foldGen(rsU: RandomState[S[U]], t: T): RandomState[S[U]] =
|
||||
rsU.continue {
|
||||
case (us: S[U], fr: FunctionalRandom) =>
|
||||
f(t, fr).map(x => (us ++ x).asInstanceOf[S[U]])
|
||||
def foldGen(rsU: RandomState[S[U]], t: T): RandomState[S[U]] =
|
||||
rsU.continue { (us, fr) =>
|
||||
f(t, fr).map(x => xFactory.from(us ++ x))
|
||||
}
|
||||
FunctionalRandom.nextFoldLeft(
|
||||
seq,
|
||||
@@ -179,17 +178,16 @@ abstract class FunctionalRandom {
|
||||
nextFlatMapImpl[T, U, Vector, SeqFactory[Vector]](vec)(f)(using Vector)
|
||||
|
||||
private def nextMapImpl[T, U, S[X] <: Seq[X], FACT <: SeqFactory[S]](
|
||||
seq: Vector[T]
|
||||
seq: S[T]
|
||||
)(
|
||||
f: (T, FunctionalRandom) => RandomState[U]
|
||||
)(using xFactory: FACT): RandomState[S[U]] = {
|
||||
@nowarn def foldGen(
|
||||
def foldGen(
|
||||
rsU: RandomState[S[U]],
|
||||
t: T
|
||||
): RandomState[S[U]] =
|
||||
rsU.continue {
|
||||
case (us: S[U], fr: FunctionalRandom) =>
|
||||
f(t, fr).map(x => (us :+ x).asInstanceOf[S[U]])
|
||||
rsU.continue { (us, fr) =>
|
||||
f(t, fr).map(x => xFactory.from(us :+ x))
|
||||
}
|
||||
|
||||
FunctionalRandom.nextFoldLeft(seq, RandomState(xFactory.empty[U], this))(
|
||||
|
||||
@@ -71,6 +71,12 @@ trait ClientTextStore {
|
||||
|
||||
def withMovedBackToUnrequested(id: ClientTextId): ClientTextStore
|
||||
|
||||
/**
|
||||
* Removes generated text rows created after a rewind target. Anything past the retained action count belongs to
|
||||
* history that no longer exists, and deterministic request IDs may be reused if the game re-advances.
|
||||
*/
|
||||
def withoutTextsAfter(maxHistoryCount: Int): ClientTextStore
|
||||
|
||||
/** Adds a pre-existing complete text directly (for pregenerated texts like hero names). */
|
||||
def withAddedCompleteText(
|
||||
id: ClientTextId,
|
||||
|
||||
@@ -219,6 +219,26 @@ case class ClientTextStoreImpl(
|
||||
this
|
||||
}
|
||||
|
||||
override def withoutTextsAfter(maxHistoryCount: Int): ClientTextStore = {
|
||||
val removedIds =
|
||||
completeTexts.values.filter(_.requestedAfterHistoryCount > maxHistoryCount).map(_.id).toSet ++
|
||||
incompleteTexts.values.filter(_.requestedAfterHistoryCount > maxHistoryCount).map(_.id).toSet ++
|
||||
unrequestedTexts.values.filter(_.requestedAfterHistoryCount > maxHistoryCount).map(_.id).toSet
|
||||
|
||||
if removedIds.isEmpty then this
|
||||
else
|
||||
copy(
|
||||
completeTexts = completeTexts -- removedIds,
|
||||
incompleteTexts = incompleteTexts -- removedIds,
|
||||
unrequestedTexts = unrequestedTexts -- removedIds,
|
||||
accessibleTo = accessibleTo -- removedIds,
|
||||
hiddenFromClients = hiddenFromClients -- removedIds,
|
||||
incompleteTextsAreSaved = false,
|
||||
accessibleToIsSaved = false,
|
||||
hiddenFromClientsIsSaved = false
|
||||
)
|
||||
}
|
||||
|
||||
def withAddedCompleteText(
|
||||
id: ClientTextId,
|
||||
text: String,
|
||||
|
||||
@@ -426,6 +426,80 @@ class PostgresClientTextStore private[client_text] (
|
||||
this
|
||||
}
|
||||
|
||||
override def withoutTextsAfter(maxHistoryCount: Int): ClientTextStore = {
|
||||
val selectSql =
|
||||
"""SELECT id FROM client_texts
|
||||
|WHERE requested_after_history_count > ?""".stripMargin
|
||||
val selectStmt = connection.prepareStatement(selectSql)
|
||||
val ids = JfrEvents.postgresQuery(
|
||||
databaseName,
|
||||
"PostgresClientTextStore.withoutTextsAfter.selectIds",
|
||||
selectSql
|
||||
) { event =>
|
||||
try {
|
||||
selectStmt.setInt(1, maxHistoryCount)
|
||||
val rs = selectStmt.executeQuery()
|
||||
val result = scala.collection.mutable.ArrayBuffer[ClientTextId]()
|
||||
while rs.next() do result += rs.getString("id")
|
||||
event.rows = result.size
|
||||
result.toVector
|
||||
} finally selectStmt.close()
|
||||
}
|
||||
|
||||
if ids.isEmpty then return this
|
||||
|
||||
println(
|
||||
s"Removing ${ids.size} generated text row(s) after rewound history count $maxHistoryCount: ${ids.mkString(", ")}"
|
||||
)
|
||||
|
||||
var idsArray: java.sql.Array = null
|
||||
try {
|
||||
idsArray = connection.createArrayOf("text", ids.toArray)
|
||||
|
||||
val deleteVisibilitySql = "DELETE FROM client_text_visibility WHERE text_id = ANY(?)"
|
||||
val deleteVisibilityStmt = connection.prepareStatement(deleteVisibilitySql)
|
||||
JfrEvents.postgresQuery(
|
||||
databaseName,
|
||||
"PostgresClientTextStore.withoutTextsAfter.deleteVisibility",
|
||||
deleteVisibilitySql
|
||||
) { event =>
|
||||
try {
|
||||
deleteVisibilityStmt.setArray(1, idsArray)
|
||||
event.rows = deleteVisibilityStmt.executeUpdate()
|
||||
} finally deleteVisibilityStmt.close()
|
||||
}
|
||||
|
||||
val deleteHiddenSql = "DELETE FROM client_text_hidden WHERE text_id = ANY(?)"
|
||||
val deleteHiddenStmt = connection.prepareStatement(deleteHiddenSql)
|
||||
JfrEvents.postgresQuery(
|
||||
databaseName,
|
||||
"PostgresClientTextStore.withoutTextsAfter.deleteHidden",
|
||||
deleteHiddenSql
|
||||
) { event =>
|
||||
try {
|
||||
deleteHiddenStmt.setArray(1, idsArray)
|
||||
event.rows = deleteHiddenStmt.executeUpdate()
|
||||
} finally deleteHiddenStmt.close()
|
||||
}
|
||||
|
||||
val deleteTextsSql = "DELETE FROM client_texts WHERE id = ANY(?)"
|
||||
val deleteTextsStmt = connection.prepareStatement(deleteTextsSql)
|
||||
JfrEvents.postgresQuery(
|
||||
databaseName,
|
||||
"PostgresClientTextStore.withoutTextsAfter.deleteTexts",
|
||||
deleteTextsSql
|
||||
) { event =>
|
||||
try {
|
||||
deleteTextsStmt.setArray(1, idsArray)
|
||||
event.rows = deleteTextsStmt.executeUpdate()
|
||||
} finally deleteTextsStmt.close()
|
||||
}
|
||||
} finally if idsArray != null then idsArray.free()
|
||||
end try
|
||||
|
||||
this
|
||||
}
|
||||
|
||||
override def withAddedCompleteText(
|
||||
id: ClientTextId,
|
||||
text: String,
|
||||
|
||||
@@ -506,6 +506,49 @@ class SqliteClientTextStore private[client_text] (
|
||||
this
|
||||
}
|
||||
|
||||
override def withoutTextsAfter(maxHistoryCount: Int): ClientTextStore = {
|
||||
val idsStmt = connection.prepareStatement(
|
||||
"""SELECT id FROM texts
|
||||
|WHERE requested_after_history_count > ?""".stripMargin
|
||||
)
|
||||
val ids =
|
||||
try {
|
||||
idsStmt.setInt(1, maxHistoryCount)
|
||||
val rs = idsStmt.executeQuery()
|
||||
val result = scala.collection.mutable.ArrayBuffer[ClientTextId]()
|
||||
while rs.next() do result += rs.getString("id")
|
||||
result.toVector
|
||||
} finally idsStmt.close()
|
||||
|
||||
if ids.isEmpty then return this
|
||||
|
||||
println(
|
||||
s"Removing ${ids.size} generated text row(s) after rewound history count $maxHistoryCount: ${ids.mkString(", ")}"
|
||||
)
|
||||
|
||||
ids.foreach { id =>
|
||||
val visStmt = connection.prepareStatement("DELETE FROM visibility WHERE text_id = ?")
|
||||
try {
|
||||
visStmt.setString(1, id)
|
||||
visStmt.executeUpdate()
|
||||
} finally visStmt.close()
|
||||
|
||||
val hiddenStmt = connection.prepareStatement("DELETE FROM hidden_texts WHERE text_id = ?")
|
||||
try {
|
||||
hiddenStmt.setString(1, id)
|
||||
hiddenStmt.executeUpdate()
|
||||
} finally hiddenStmt.close()
|
||||
|
||||
val textStmt = connection.prepareStatement("DELETE FROM texts WHERE id = ?")
|
||||
try {
|
||||
textStmt.setString(1, id)
|
||||
textStmt.executeUpdate()
|
||||
} finally textStmt.close()
|
||||
}
|
||||
|
||||
this
|
||||
}
|
||||
|
||||
override def withAddedCompleteText(
|
||||
id: ClientTextId,
|
||||
text: String,
|
||||
|
||||
@@ -1478,6 +1478,7 @@ scala_library(
|
||||
"//src/main/scala/net/eagle0/eagle:eagle_pkg",
|
||||
"//src/main/scala/net/eagle0/eagle/library:eagle_internal_exception",
|
||||
"//src/main/scala/net/eagle0/eagle/library/actions/applier:action_result_applier",
|
||||
"//src/main/scala/net/eagle0/eagle/library/actions/llm_request_generators/captured_hero_helpers:captured_hero_plea_generator",
|
||||
"//src/main/scala/net/eagle0/eagle/library/actions/util:shattered_army_utils",
|
||||
"//src/main/scala/net/eagle0/eagle/library/settings:battle_agriculture_devastation_delta",
|
||||
"//src/main/scala/net/eagle0/eagle/library/settings:battle_economy_devastation_delta",
|
||||
|
||||
+42
-13
@@ -2,6 +2,7 @@ package net.eagle0.eagle.library.actions.impl.action
|
||||
|
||||
import net.eagle0.eagle.{BattalionId, FactionId, HeroId, ProvinceId, RoundId}
|
||||
import net.eagle0.eagle.library.actions.applier.{ActionResultApplier, ActionResultWithResultingState}
|
||||
import net.eagle0.eagle.library.actions.generated_text_request_generators.captured_hero_helpers.CapturedHeroPleaGenerator
|
||||
import net.eagle0.eagle.library.actions.util.ShatteredArmyUtils
|
||||
import net.eagle0.eagle.library.settings.{
|
||||
BattleAgricultureDevastationDelta,
|
||||
@@ -40,6 +41,10 @@ case class ResolveBattleAction(
|
||||
startingGameState: GameState,
|
||||
resolvedBattles: Vector[BattleResolution]
|
||||
) {
|
||||
private case class SecuredPrisonerProvinceChange(
|
||||
provinceChange: ChangedProvinceC,
|
||||
securingFactionId: FactionId
|
||||
)
|
||||
|
||||
def fleeProvince(hero: HeroT, battle: ShardokBattle): Option[ProvinceId] =
|
||||
battle.players
|
||||
@@ -356,7 +361,9 @@ case class ResolveBattleAction(
|
||||
}
|
||||
}.toVector
|
||||
|
||||
ActionResultC(
|
||||
val securedPrisonerChanges = securedPrisonerProvinceChanges(battle, battleResolution)
|
||||
|
||||
val battleEnded = ActionResultC(
|
||||
actionResultType = BattleEnded,
|
||||
resolvedBattle = Some(battle.shardokGameId),
|
||||
changedHeroes = changedHeroes,
|
||||
@@ -365,12 +372,28 @@ case class ResolveBattleAction(
|
||||
batt = battle,
|
||||
br = battleResolution,
|
||||
destroyedBattalionIds = destroyedBattalionIds(battleResolution)
|
||||
) :+ defenderCP(
|
||||
) ++ securedPrisonerChanges.map(_.provinceChange) :+ defenderCP(
|
||||
battle = battle,
|
||||
battleResolution = battleResolution
|
||||
),
|
||||
destroyedBattalionIds = destroyedBattalionIds(battleResolution)
|
||||
) +: winnersFulfilledQuestActionResults(
|
||||
)
|
||||
|
||||
securedPrisonerChanges.foldLeft(battleEnded: ActionResultT) {
|
||||
case (ar, securedPrisonerChange) =>
|
||||
securedPrisonerChange.provinceChange.newCapturedHeroes.headOption
|
||||
.map(capturedHero =>
|
||||
CapturedHeroPleaGenerator.withPleaForCapturedHero(
|
||||
gameId = startingState.gameId,
|
||||
currentRoundId = startingState.currentRoundId,
|
||||
capturingFactionId = securedPrisonerChange.securingFactionId,
|
||||
provinceId = securedPrisonerChange.provinceChange.provinceId,
|
||||
capturedHero = capturedHero,
|
||||
actionResult = ar
|
||||
)
|
||||
)
|
||||
.getOrElse(ar)
|
||||
} +: winnersFulfilledQuestActionResults(
|
||||
startingState = startingState,
|
||||
battle = battle,
|
||||
battleResolution = battleResolution
|
||||
@@ -711,12 +734,12 @@ case class ResolveBattleAction(
|
||||
shatteredArmy = ma,
|
||||
battleProvinceId = batt.defenderProvince
|
||||
)
|
||||
)).toVector ++ securedPrisonerProvinceChanges(batt, br)
|
||||
)).toVector
|
||||
|
||||
private def securedPrisonerProvinceChanges(
|
||||
batt: ShardokBattle,
|
||||
br: BattleResolution
|
||||
): Vector[ChangedProvinceC] = {
|
||||
): Vector[SecuredPrisonerProvinceChange] = {
|
||||
val playersByFaction = batt.players.map(sp => sp.eagleFid -> sp).toMap
|
||||
val resolvedByFaction = br.resolvedPlayers.map(rsp => rsp.eagleFid -> rsp).toMap
|
||||
|
||||
@@ -735,7 +758,7 @@ case class ResolveBattleAction(
|
||||
factionId -> destinationProvinceIds.head
|
||||
}
|
||||
|
||||
val securedByProvince = for {
|
||||
val securedByProvinceAndFaction = for {
|
||||
rsp <- br.resolvedPlayers.toVector
|
||||
secured <- rsp.units.filter(_.status == UnitStatus.Secured)
|
||||
securedByFactionId = secured.securedByEagleFactionId.getOrElse(
|
||||
@@ -759,19 +782,25 @@ case class ResolveBattleAction(
|
||||
playersByFaction(securedByFactionId).isDefender != playersByFaction(rsp.eagleFid).isDefender,
|
||||
s"Secured hero ${secured.hero.id} was secured by same-side faction $securedByFactionId"
|
||||
)
|
||||
} yield destinationProvinceId -> CapturedHero(
|
||||
} yield (destinationProvinceId, securedByFactionId) -> CapturedHero(
|
||||
heroId = secured.hero.id,
|
||||
recruitmentAttempted = false,
|
||||
previousFactionId = secured.hero.factionId.get
|
||||
)
|
||||
|
||||
securedByProvince.groupBy { case (provinceId, _) => provinceId }.toVector.sortBy {
|
||||
case (provinceId, _) => provinceId
|
||||
securedByProvinceAndFaction.groupBy {
|
||||
case ((provinceId, securingFactionId), _) =>
|
||||
(provinceId, securingFactionId)
|
||||
}.toVector.sortBy {
|
||||
case ((provinceId, securingFactionId), _) => (provinceId, securingFactionId)
|
||||
}.map {
|
||||
case (provinceId, capturedHeroes) =>
|
||||
ChangedProvinceC(
|
||||
provinceId = provinceId,
|
||||
newCapturedHeroes = capturedHeroes.map { case (_, capturedHero) => capturedHero }
|
||||
case ((provinceId, securingFactionId), capturedHeroes) =>
|
||||
SecuredPrisonerProvinceChange(
|
||||
provinceChange = ChangedProvinceC(
|
||||
provinceId = provinceId,
|
||||
newCapturedHeroes = capturedHeroes.map { case (_, capturedHero) => capturedHero }
|
||||
),
|
||||
securingFactionId = securingFactionId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user