mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-25 08:23:35 +08:00
C++ layer tidying
This commit is contained in:
parent
a001dd24b2
commit
38ff9badb3
@ -3995,50 +3995,50 @@
|
||||
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
|
||||
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34",
|
||||
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f2/56/753368778315cb50853cd14fcebd",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/45/a1/f26ab1a6af5d324320d8c40ef013",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f7/e6/40091f52b26cee5b554ce9f2f969",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b6/7b/ca36bdb0c07e6db54b589e85e386",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f9/b7/dc87a15acdb8ff6cacb6bdbd5bd0",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/56/6a/045d3ec105543a0a47b3f1d02531",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/71/8b/ae034f8c196e776162f6a4274c41",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/dd/33/abf4b52a891cd048a64f509fd558",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/cd/77/9898c6ebae2ec75423d54adf64be",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/49/21/7630a73dff681f5cf35237bd3fa8",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a4/37/65aae58712a1c91e77ceb7cff9cc",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/89/7a/97c2d82d85d0265d9425e2afe2fd",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d6/ba/f6d4503a8ff7a02a02918159de49",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1b/42/c6df0ef3208a824a91c6b6936e30",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/79/0f/2118c060b946ea72172e487a6673",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/05/36/5279be68e915924f06f748699e36",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ba/b3/961d8e8c573021c04c35ab97d0e2",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ae/80/0eec304d81099449d86223d17be9",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/e0/c5/a1d8137e47716b475f9093904618",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/8a/81/0c3e2486e449768f7b1edb45281a",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fa/42/0893b5c8467664b8704663277eca",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/30/4b/6a415939115147395854d7c50716",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ed/e0/a056311241b1b3700c70ca898178",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2c/70/469b776f7919b514117bcdb16529",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/84/dc/93fc2557c515ecb6ee080fb6b265",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ac/51/5c932c8d9f7ca698e28dcb8dc8d7",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/35/91/8e2437615406c43a15ae67d4714e",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fc/01/cf61a57ea19524febe7bd6edcf4a",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/61/b3/3a269bf8af399980fe46fda021a1",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a9/5b/bff1844978cef9390443b265cdef",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/52/1d/1e2e800f93b25923dfaaa022d2df",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c9/b2/c54c61e7585fc44c2b91dcb4bb3c",
|
||||
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/03/04/09f6b3064533d3298ed6515f69d2",
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c2/b7/ac81850df03263c3e19b97cfda0b",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9d/d2/39bd615a599f5ce014ccdea30924",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/02/39/5e65462a00188a67a438f29b60d1",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/63/51/ef809ce32a76042890a3961d02ea",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/c4/7c/1d715d2c2a8b24b990c0f9ba0972",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/3f/94/ae4c341dc83347996d48e66af558",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/34/b1/c4b1dba36aa71ebe9f60e85cd239",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/d9/ef/e7ded821c1c9e54cf14ebf987167",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/89/95/49ec2633cec7a163cdd674bf83e1",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/3b/0f/5dd18fdd379cdad194556627282a",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/5c/e3/50945f08ce1e42dde7faeb142bc0",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d9/57/123cd8f5f4e59fff6f7ab6301440",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/cc/e4/c0b4ee2723764731b4c583df7632",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7a/ca/250edaa7f67af4728721b13b41ae",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a1/8a/c45b021007b1b440cb7c56c95300",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2e/b1/8cffa62ead9db7791ab6b7d13a44",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/14/d9/c024d934e304796de1b4aff3aae0",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a7/bc/db9eb7138e23276d5b75540a60c6",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/76/b5/62e9a24394fb6a5d46b718b9f846",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/8e/83/223b4a190bf10ff7cece9c6376c4",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/06/ad/fd3a9809664e810c19b6fa554139",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/92/09/c1e4f2e70af0dd1381efb82f1472",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a0/82/54fbd261222c43b807653c86e771",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/8f/0c/2197464e39e8b14b9dde2d445b6b",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a0/40/fbc022e5c5d11f5ba2c1a619e71a",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/86/ab/1df134bc1995a26175784309db3b",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9c/d4/bd65fdaca17a078a1ee1e0ef8fd4",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/0d/0a/5fdae5c69d07610a8cac0f983b79",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/5b/43/3a0f5464d64c34c1cc049f2c5dd6",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/b6/7c/f8bda2f3dbce598e2118860dcc9e",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/3a/66/8b96fdce49a8c4b90f3bc1faa41b",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/02/4d/5652672bc763235bb098c350d56a",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1a/18/764195445dffb753f922a9ed271d",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5b/3f/cd3f804350db1420ae27621225ed",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/25/a8/3440285403322919cf898c588691",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/32/6617f583d30e3670e0de13fcf275",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f0/6b/422a883bcc071a181f0bdde67b73",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/df/5e/c1c2906261112d0fcf2a93e63ec9",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/90/ca/8eb48f0ac0074ae51e57b6c865b2",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c2/42/c226954a0860554d216d4bfde5b6",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/4b/097a75c1a75e4f4ce8ba548bc68c",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/99/b3/2eb848a098fa3ea6237fe6b6c666",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/05/3d/ca92f309675f8d8499be665ee93c",
|
||||
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f7/9d/9ca7c4da9d55f0ec17ad57b10bd3",
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b3/59/c1f138006a8dfde1764847eb9534",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9d/21/2f0c5cadca8f6594c4a0158c35df",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8f/6a/263d0f76099de60bda8a1e9b4f48",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f5/1e/fb527cb55daadb622b37cead85cd",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/47/86/ae60bb70acd670194e295cc7d366",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/47/b9/c8b99dac3f9c30ce03378eb7141f",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/08/2a/8838448d6e0614eaa8fa5bae3302",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/85/d5/a82555f266551105e9e3499f780c",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/59/a4/648c3743893d4b9b8360a7090258",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/15/49/8c08285819c4b0c122601a92bbdb",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/9a/e8/0dcfa1db61409ceeda4c9b3f1f1f",
|
||||
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7",
|
||||
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d"
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.7 (build 20734, api 7, 2022-09-02)
|
||||
### 1.7.7 (build 20736, api 7, 2022-09-02)
|
||||
- Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread.
|
||||
- Improved logging of missing playlist game types.
|
||||
- Some ba.Lstr functionality can now be used in background threads.
|
||||
@ -15,6 +15,7 @@
|
||||
- Spaz starting with gloves no longer loses it after picking up an expiring gloves powerup (thanks itsre3!)
|
||||
- Starting to rename the 'game' thread to the 'logic' thread. This is the thread where most high level app logic happen, not only game logic.
|
||||
- `_ba.in_game_thread()` is now `_ba.in_logic_thread()`.
|
||||
- Misc C++ layer tidying.
|
||||
|
||||
### 1.7.6 (build 20687, api 7, 2022-08-11)
|
||||
- Cleaned up da MetaSubsystem code.
|
||||
|
||||
@ -1 +1 @@
|
||||
185890701695841575150474995410209011627
|
||||
165792406555478528390294774863684706424
|
||||
@ -32,7 +32,7 @@ def bootstrap() -> None:
|
||||
|
||||
# Give a soft warning if we're being used with a different binary
|
||||
# version than we expect.
|
||||
expected_build = 20734
|
||||
expected_build = 20736
|
||||
running_build: int = env['build_number']
|
||||
if running_build != expected_build:
|
||||
print(
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
namespace ballistica {
|
||||
|
||||
// These are set automatically via script; don't modify them here.
|
||||
const int kAppBuildNumber = 20734;
|
||||
const int kAppBuildNumber = 20736;
|
||||
const char* kAppVersion = "1.7.7";
|
||||
|
||||
// Our standalone globals.
|
||||
@ -296,11 +296,6 @@ auto GetCurrentThreadName() -> std::string {
|
||||
|
||||
auto IsBootstrapped() -> bool { return g_app_globals->is_bootstrapped; }
|
||||
|
||||
// Used by our built-in exception type.
|
||||
void SetPythonException(PyExcType python_type, const char* description) {
|
||||
Python::SetPythonException(python_type, description);
|
||||
}
|
||||
|
||||
} // namespace ballistica
|
||||
|
||||
// If desired, define main() in the global namespace.
|
||||
|
||||
@ -258,8 +258,6 @@ inline auto RandomFloat() -> float {
|
||||
(static_cast<double>(rand()) / RAND_MAX)); // NOLINT
|
||||
}
|
||||
|
||||
auto SetPythonException(PyExcType python_type, const char* description) -> void;
|
||||
|
||||
} // namespace ballistica
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
@ -74,8 +74,4 @@ auto Exception::what() const noexcept -> const char* {
|
||||
}
|
||||
}
|
||||
|
||||
void Exception::SetPyError() const noexcept {
|
||||
SetPythonException(python_type_, GetShortExceptionDescription(*this));
|
||||
}
|
||||
|
||||
} // namespace ballistica
|
||||
|
||||
@ -68,6 +68,8 @@ class Exception : public std::exception {
|
||||
|
||||
void SetPyError() const noexcept;
|
||||
|
||||
auto python_type() const { return python_type_; }
|
||||
|
||||
private:
|
||||
std::string thread_name_;
|
||||
std::string message_;
|
||||
|
||||
@ -14,25 +14,19 @@
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
// Support functions we declare in our .cc file; not for public use.
|
||||
// auto InlineDebugExplicitBool(bool val) -> bool;
|
||||
|
||||
/// Return the same bool value passed in, but obfuscated enough in debug mode
|
||||
/// that no 'value is always true/false', 'code will never run', type warnings
|
||||
/// should appear. In release builds it should optimize away to a no-op.
|
||||
inline auto explicit_bool(bool val) -> bool {
|
||||
#if BA_DEBUG_BUILD
|
||||
return InlineDebugExplicitBool(val);
|
||||
#else
|
||||
return val;
|
||||
#endif
|
||||
if (g_buildconfig.debug_build()) {
|
||||
return InlineDebugExplicitBool(val);
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
/// Simply a static_cast, but in debug builds casts the results back to ensure
|
||||
/// the value fits into the receiver unchanged. Handy as a sanity check when
|
||||
/// stuffing a 32 bit value into a 16 bit container, etc.
|
||||
template <typename OUT_TYPE, typename IN_TYPE>
|
||||
auto static_cast_check_fit(IN_TYPE in) -> OUT_TYPE {
|
||||
auto check_static_cast_fit(IN_TYPE in) -> bool {
|
||||
// Make sure we don't try to use this when casting to or from floats or
|
||||
// doubles. We don't expect to always get the same value back
|
||||
// on casting back in that case.
|
||||
@ -44,10 +38,18 @@ auto static_cast_check_fit(IN_TYPE in) -> OUT_TYPE {
|
||||
&& !std::is_same<OUT_TYPE, double>::value
|
||||
&& !std::is_same<OUT_TYPE, const float>::value
|
||||
&& !std::is_same<OUT_TYPE, const double>::value,
|
||||
"static_cast_check_fit cannot be used with floats or doubles.");
|
||||
#if BA_DEBUG_BUILD
|
||||
assert(static_cast<IN_TYPE>(static_cast<OUT_TYPE>(in)) == in);
|
||||
#endif
|
||||
"check_static_cast_fit cannot be used with floats or doubles.");
|
||||
return static_cast<IN_TYPE>(static_cast<OUT_TYPE>(in)) == in;
|
||||
}
|
||||
|
||||
/// Simply a static_cast, but in debug builds casts the results back to ensure
|
||||
/// the value fits into the receiver unchanged. Handy as a sanity check when
|
||||
/// stuffing a 32 bit value into a 16 bit container, etc.
|
||||
template <typename OUT_TYPE, typename IN_TYPE>
|
||||
auto static_cast_check_fit(IN_TYPE in) -> OUT_TYPE {
|
||||
if (g_buildconfig.debug_build()) {
|
||||
assert(check_static_cast_fit<OUT_TYPE>(in));
|
||||
}
|
||||
return static_cast<OUT_TYPE>(in);
|
||||
}
|
||||
|
||||
@ -55,37 +57,35 @@ auto static_cast_check_fit(IN_TYPE in) -> OUT_TYPE {
|
||||
/// throws an Exception on failure.
|
||||
template <typename OUT_TYPE, typename IN_TYPE>
|
||||
auto static_cast_check_fit_always(IN_TYPE in) -> OUT_TYPE {
|
||||
// Make sure we don't try to use this when casting to or from floats or
|
||||
// doubles. We don't expect to always get the same value back
|
||||
// on casting back in that case.
|
||||
static_assert(
|
||||
!std::is_same<IN_TYPE, float>::value
|
||||
&& !std::is_same<IN_TYPE, double>::value
|
||||
&& !std::is_same<IN_TYPE, const float>::value
|
||||
&& !std::is_same<IN_TYPE, const double>::value
|
||||
&& !std::is_same<OUT_TYPE, float>::value
|
||||
&& !std::is_same<OUT_TYPE, double>::value
|
||||
&& !std::is_same<OUT_TYPE, const float>::value
|
||||
&& !std::is_same<OUT_TYPE, const double>::value,
|
||||
"static_cast_always_checked cannot be used with floats or doubles.");
|
||||
auto out = static_cast<OUT_TYPE>(in);
|
||||
if (static_cast<IN_TYPE>(out) != in) {
|
||||
if (!check_static_cast_fit<OUT_TYPE>(in)) {
|
||||
throw Exception("static_cast_check_fit_always failed for value "
|
||||
+ std::to_string(in) + ".");
|
||||
}
|
||||
return static_cast<OUT_TYPE>(in);
|
||||
}
|
||||
|
||||
/// Like static_cast_check_fit, but runs checks even in release builds and
|
||||
/// aborts on failure.
|
||||
template <typename OUT_TYPE, typename IN_TYPE>
|
||||
auto static_cast_check_fit_always_2(IN_TYPE in) -> OUT_TYPE {
|
||||
if (!check_static_cast_fit<OUT_TYPE>(in)) {
|
||||
fprintf(stderr, "static_cast_check_fit_always failed for value %s.",
|
||||
std::to_string(in).c_str());
|
||||
abort();
|
||||
}
|
||||
return static_cast<OUT_TYPE>(in);
|
||||
}
|
||||
|
||||
/// Simply a static_cast, but in debug builds also runs a dynamic cast to
|
||||
/// ensure the results would have been the same. Handy for keeping casts
|
||||
/// lightweight when types are known while still having a sanity check.
|
||||
template <typename OUT_TYPE, typename IN_TYPE>
|
||||
auto static_cast_check_type(IN_TYPE in) -> OUT_TYPE {
|
||||
auto out_static = static_cast<OUT_TYPE>(in);
|
||||
#if BA_DEBUG_BUILD
|
||||
auto out_dynamic = dynamic_cast<OUT_TYPE>(in);
|
||||
assert(out_static == out_dynamic);
|
||||
#endif
|
||||
if (g_buildconfig.debug_build()) {
|
||||
auto out_dynamic = dynamic_cast<OUT_TYPE>(in);
|
||||
assert(out_static == out_dynamic);
|
||||
}
|
||||
return out_static;
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "ballistica/python/class/python_class.h"
|
||||
|
||||
#include "ballistica/ballistica.h"
|
||||
#include "ballistica/python/python.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include "ballistica/game/host_activity.h"
|
||||
#include "ballistica/game/session/host_session.h"
|
||||
#include "ballistica/generic/utils.h"
|
||||
#include "ballistica/python/python.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "ballistica/game/game.h"
|
||||
#include "ballistica/media/component/collide_model.h"
|
||||
#include "ballistica/python/python.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "ballistica/python/class/python_class_context_call.h"
|
||||
|
||||
#include "ballistica/game/game.h"
|
||||
#include "ballistica/python/python.h"
|
||||
#include "ballistica/python/python_context_call.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "ballistica/game/game.h"
|
||||
#include "ballistica/media/component/data.h"
|
||||
#include "ballistica/python/python.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "ballistica/game/game.h"
|
||||
#include "ballistica/media/component/model.h"
|
||||
#include "ballistica/python/python.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "ballistica/game/game.h"
|
||||
#include "ballistica/game/session/session.h"
|
||||
#include "ballistica/generic/utils.h"
|
||||
#include "ballistica/python/python.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "ballistica/game/game.h"
|
||||
#include "ballistica/media/component/sound.h"
|
||||
#include "ballistica/python/python.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "ballistica/game/game.h"
|
||||
#include "ballistica/media/component/texture.h"
|
||||
#include "ballistica/python/python.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "ballistica/game/game.h"
|
||||
#include "ballistica/generic/utils.h"
|
||||
#include "ballistica/graphics/graphics.h"
|
||||
#include "ballistica/python/python.h"
|
||||
#include "ballistica/ui/widget/container_widget.h"
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
@ -68,7 +68,9 @@ namespace ballistica {
|
||||
#pragma ide diagnostic ignored "RedundantCast"
|
||||
|
||||
// Used by our built in exception type.
|
||||
void Python::SetPythonException(PyExcType exctype, const char* description) {
|
||||
void Python::SetPythonException(const Exception& exc) {
|
||||
PyExcType exctype{exc.python_type()};
|
||||
const char* description{GetShortExceptionDescription(exc)};
|
||||
PyObject* pytype{};
|
||||
switch (exctype) {
|
||||
case PyExcType::kRuntime:
|
||||
|
||||
@ -236,7 +236,8 @@ class Python {
|
||||
static void SetNodeAttr(Node* node, const char* attr_name,
|
||||
PyObject* value_obj);
|
||||
|
||||
static void SetPythonException(PyExcType exctype, const char* description);
|
||||
/// Set Python exception from C++ Exception.
|
||||
static void SetPythonException(const Exception& exc);
|
||||
|
||||
static void DoBuildNodeMessage(PyObject* args, int arg_offset,
|
||||
Buffer<char>* b, PyObject** user_message_obj);
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
#define BA_PYTHON_CATCH \
|
||||
} \
|
||||
catch (const Exception& e) { \
|
||||
e.SetPyError(); \
|
||||
Python::SetPythonException(e); \
|
||||
return nullptr; \
|
||||
} \
|
||||
catch (const std::exception& e) { \
|
||||
@ -48,7 +48,7 @@
|
||||
#define BA_PYTHON_NEW_CATCH \
|
||||
} \
|
||||
catch (const Exception& e) { \
|
||||
e.SetPyError(); \
|
||||
Python::SetPythonException(e); \
|
||||
Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self)); \
|
||||
return nullptr; \
|
||||
} \
|
||||
@ -72,7 +72,7 @@
|
||||
#define BA_PYTHON_INT_CATCH \
|
||||
} \
|
||||
catch (const Exception& e) { \
|
||||
e.SetPyError(); \
|
||||
Python::SetPythonException(e); \
|
||||
return -1; \
|
||||
} \
|
||||
catch (const std::exception& e) { \
|
||||
|
||||
@ -25,12 +25,14 @@
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
// All this stuff must be called from the game module.
|
||||
// Note: this stuff is generally intended to be used solely from
|
||||
// the logic thread.
|
||||
|
||||
class UI : public ContextTarget {
|
||||
public:
|
||||
UI();
|
||||
~UI() override;
|
||||
void Reset();
|
||||
auto Reset() -> void;
|
||||
|
||||
// Return the root widget containing all windows & dialogs
|
||||
// Whenever this contains children, the UI is considered to be in focus
|
||||
@ -42,8 +44,8 @@ class UI : public ContextTarget {
|
||||
return overlay_root_widget_.get();
|
||||
}
|
||||
|
||||
// Returns true if there is UI present in either the main or overlay
|
||||
// stacks. Generally this implies the focus should be on the UI.
|
||||
/// Return whether there is UI present in either the main or overlay
|
||||
/// stacks. Generally this implies the focus should be on the UI.
|
||||
auto IsWindowPresent() const -> bool;
|
||||
|
||||
// Return the absolute root widget; this includes persistent UI
|
||||
@ -60,17 +62,17 @@ class UI : public ContextTarget {
|
||||
// Add a widget to a container.
|
||||
// If a parent is provided, the widget is added to it; otherwise it is added
|
||||
// to the root widget.
|
||||
void AddWidget(Widget* w, ContainerWidget* to);
|
||||
auto AddWidget(Widget* w, ContainerWidget* to) -> void;
|
||||
|
||||
// Send message to the active widget.
|
||||
auto SendWidgetMessage(const WidgetMessage& msg) -> int;
|
||||
|
||||
// Use this to destroy any named widget (even those in containers).
|
||||
void DeleteWidget(Widget* widget);
|
||||
auto DeleteWidget(Widget* widget) -> void;
|
||||
|
||||
void ScreenSizeChanged();
|
||||
auto ScreenSizeChanged() -> void;
|
||||
|
||||
void SetUIInputDevice(InputDevice* input_device);
|
||||
auto SetUIInputDevice(InputDevice* input_device) -> void;
|
||||
|
||||
// Returns the input-device that currently owns the menu; otherwise nullptr.
|
||||
auto GetUIInputDevice() const -> InputDevice*;
|
||||
@ -106,13 +108,13 @@ class UI : public ContextTarget {
|
||||
assert(scene_.exists());
|
||||
return scene_.get();
|
||||
}
|
||||
void Update(millisecs_t time_advance);
|
||||
auto Update(millisecs_t time_advance) -> void;
|
||||
auto GetMutableScene() -> Scene* override;
|
||||
|
||||
// Context-target timer support.
|
||||
auto NewTimer(TimeType timetype, TimerMedium length, bool repeat,
|
||||
const Object::Ref<Runnable>& runnable) -> int override;
|
||||
void DeleteTimer(TimeType timetype, int timer_id) override;
|
||||
auto DeleteTimer(TimeType timetype, int timer_id) -> void override;
|
||||
|
||||
RootUI* root_ui() const {
|
||||
assert(root_ui_);
|
||||
@ -120,7 +122,7 @@ class UI : public ContextTarget {
|
||||
}
|
||||
|
||||
private:
|
||||
void StepScene();
|
||||
auto StepScene() -> void;
|
||||
RootUI* root_ui_{};
|
||||
millisecs_t next_prune_time_{};
|
||||
int node_warning_count_{};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user