mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-04 14:33:28 +08:00
renaming game thread to logic thread
This commit is contained in:
parent
a264121f85
commit
a001dd24b2
@ -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/7e/d4/165a41fb2c8ea82de272c4645280",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/cc/ca/31d9c869e86bf1594990bcbb6b09",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fb/0e/ea7694603962a6a9b776b63d3995",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1e/07/f2f9fc20a3531891b2d8b87d5b08",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a5/0a/c5260449084a45f148bf84de1c8c",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d8/d6/9a7def584d935559fdaa9ae74275",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b8/b6/a0a96ce6741bd0f40892be18366d",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c9/44/bf67c3ec9a667a12e02b80411340",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/06/0b/3792ea5482a33dbdda335e0e9658",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/23/2d/dd2dbc62263b191e2d4139f6a4d0",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d6/b7/7a5975922a6856ada8ac57725e55",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a2/d1/302df0fb6647a0593629c6903ab1",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/61/c0/3a75272f88e7e1ce6bbf33255451",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/66/1e/ac5f028603d23f38bae63f9521f0",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/20/1e/56f492b79fc05288070b377ca031",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/73/c6/a36e3bca7df79c94f58315dab63a",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/3c/21/3a0ecdf854b98e5fa3cd0b9cbc24",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/df/5b/379e6f5d9dd2850413400f97adac",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/4f/db/7c14cee7267a31d5df6c90ec787d",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/9f/f2/2353a84e64cfab0b95b890402869",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3b/0c/2f4061ab877d415a1c30e0e736db",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3c/5a/2b0714af254c64954ccfe51c70b3",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1f/ae/c8a885b1a1868b6846b606cdb456",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a8/f7/5076f509e31ac616815b094a7ef8",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/02/94/9a3f49a8cafa51751a53515ed805",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b4/64/33bac83d512e30ad625dbf78203d",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ce/61/5685c4876a8fb81129982bcc13a6",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/46/c8/f1649944e6f6cc9d2c2dd8bd2d19",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/da/9787df7e37481f76011134020772",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/bd/0b/255c8b6098f9185f8b4b56ad94b0",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/5f/a84d7a8b97401b814de63d1c0dec",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2f/1c/88c1537599fa83d6bbd1a0d70096",
|
||||
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d2/da/f8494cc0118eec16f3d6481562a1",
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/44/df/efb51d1c226eac613d48e2cbf0b8",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1c/f6/357fe951c86c9fc5b1b737cd91ae",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/04/17/e2de0ab5df6b938d828e8662ce6d",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/ba/40/81867d90f50a7d4182528f0f7a70",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/78/50/70f4eecb3a57958efaa42efecea7",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/95/60/076b20219891d63577d7368530e3",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/5f/e5/429995f1977370843d3a95c8a715",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/4a/f4/b9f59f182811447254afe0d9035e",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/7f/24/dc93a242f74fb7cd4b28e360bb1e",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/bc/f1/ffd0a226708a618dc7fa1ffcd06c",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/2c/00/556f149565fab34bc1890468f3ba",
|
||||
"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",
|
||||
"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 20732, api 7, 2022-09-02)
|
||||
### 1.7.7 (build 20734, 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.
|
||||
@ -13,6 +13,8 @@
|
||||
- Continue window will now pause the game to avoid running up times in the background (thanks vishal332008!)
|
||||
- Keepaway and KingOfTheHill now have epic options (thanks FAL-Guys!)
|
||||
- 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()`.
|
||||
|
||||
### 1.7.6 (build 20687, api 7, 2022-08-11)
|
||||
- Cleaned up da MetaSubsystem code.
|
||||
|
||||
@ -1 +1 @@
|
||||
255596494167977704690488419471262730072
|
||||
185890701695841575150474995410209011627
|
||||
@ -2216,7 +2216,7 @@ def in_game_purchase(item: str, price: int) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def in_game_thread() -> bool:
|
||||
def in_logic_thread() -> bool:
|
||||
"""(internal)
|
||||
|
||||
Returns whether or not the current thread is the game thread.
|
||||
|
||||
@ -351,7 +351,7 @@ class App:
|
||||
from bastd.actor import spazappearance
|
||||
from ba._generated.enums import TimeType
|
||||
|
||||
assert _ba.in_game_thread()
|
||||
assert _ba.in_logic_thread()
|
||||
|
||||
self._aioloop = _asyncio.setup_asyncio()
|
||||
|
||||
@ -448,7 +448,7 @@ class App:
|
||||
|
||||
def on_meta_scan_complete(self) -> None:
|
||||
"""Called by meta-scan when it is done doing its thing."""
|
||||
assert _ba.in_game_thread()
|
||||
assert _ba.in_logic_thread()
|
||||
self.plugins.on_meta_scan_complete()
|
||||
|
||||
assert not self._meta_scan_completed
|
||||
@ -456,7 +456,7 @@ class App:
|
||||
self._update_state()
|
||||
|
||||
def _update_state(self) -> None:
|
||||
assert _ba.in_game_thread()
|
||||
assert _ba.in_logic_thread()
|
||||
|
||||
if self._app_paused:
|
||||
self.state = self.State.PAUSED
|
||||
|
||||
@ -33,7 +33,7 @@ def setup_asyncio() -> asyncio.AbstractEventLoop:
|
||||
import ba
|
||||
from ba._generated.enums import TimeType
|
||||
|
||||
assert _ba.in_game_thread()
|
||||
assert _ba.in_logic_thread()
|
||||
|
||||
# Create our event-loop. We don't expect there to be one
|
||||
# running on this thread before we do.
|
||||
|
||||
@ -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 = 20732
|
||||
expected_build = 20734
|
||||
running_build: int = env['build_number']
|
||||
if running_build != expected_build:
|
||||
print(
|
||||
|
||||
@ -24,7 +24,7 @@ if TYPE_CHECKING:
|
||||
|
||||
def finish_bootstrapping() -> None:
|
||||
"""Do final bootstrapping related bits."""
|
||||
assert _ba.in_game_thread()
|
||||
assert _ba.in_logic_thread()
|
||||
|
||||
# Kick off our asyncio event handling, allowing us to use coroutines
|
||||
# in our game thread alongside our internal event handling.
|
||||
|
||||
@ -144,7 +144,7 @@ class MetadataSubsystem:
|
||||
def _wait_for_scan_results(self) -> ScanResults:
|
||||
"""Return scan results, blocking if the scan is not yet complete."""
|
||||
if self.scanresults is None:
|
||||
if _ba.in_game_thread():
|
||||
if _ba.in_logic_thread():
|
||||
logging.warning(
|
||||
'ba.meta._wait_for_scan_results()'
|
||||
' called in logic thread before scan completed;'
|
||||
@ -177,7 +177,7 @@ class MetadataSubsystem:
|
||||
def _handle_scan_results(self) -> None:
|
||||
"""Called in the logic thread with results of a completed scan."""
|
||||
from ba._language import Lstr
|
||||
assert _ba.in_game_thread()
|
||||
assert _ba.in_logic_thread()
|
||||
|
||||
results = self.scanresults
|
||||
assert results is not None
|
||||
|
||||
@ -133,7 +133,7 @@ class PlaylistAddGameWindow(ba.Window):
|
||||
|
||||
# We asked for a bg thread completion cb so we can do some
|
||||
# filtering here in the bg thread where its not gonna cause hitches.
|
||||
assert not _ba.in_game_thread()
|
||||
assert not _ba.in_logic_thread()
|
||||
sessiontype = self._editcontroller.get_session_type()
|
||||
unowned = get_unowned_game_types()
|
||||
self._game_types = [
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
namespace ballistica {
|
||||
|
||||
Audio::Audio() { assert(InGameThread()); }
|
||||
Audio::Audio() { assert(InLogicThread()); }
|
||||
|
||||
void Audio::Init() {
|
||||
// Init our singleton.
|
||||
@ -17,7 +17,7 @@ void Audio::Init() {
|
||||
}
|
||||
|
||||
void Audio::Reset() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_audio_server->PushResetCall();
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ auto Audio::ShouldPlay(SoundData* sound) -> bool {
|
||||
}
|
||||
|
||||
void Audio::PlaySound(SoundData* sound, float volume) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
BA_DEBUG_FUNCTION_TIMER_BEGIN();
|
||||
assert(sound);
|
||||
if (!ShouldPlay(sound)) {
|
||||
|
||||
@ -1123,7 +1123,7 @@ void AudioServer::AddSoundRefDelete(const Object::Ref<SoundData>* c) {
|
||||
}
|
||||
|
||||
void AudioServer::ClearSoundRefDeleteList() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
std::lock_guard<std::mutex> lock(sound_ref_delete_list_mutex_);
|
||||
for (const Object::Ref<SoundData>* i : sound_ref_delete_list_) {
|
||||
delete i;
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
namespace ballistica {
|
||||
|
||||
// These are set automatically via script; don't modify them here.
|
||||
const int kAppBuildNumber = 20732;
|
||||
const int kAppBuildNumber = 20734;
|
||||
const char* kAppVersion = "1.7.7";
|
||||
|
||||
// Our standalone globals.
|
||||
@ -102,13 +102,13 @@ auto BallisticaMain(int argc, char** argv) -> int {
|
||||
g_app_globals->pausable_threads.push_back(media_thread);
|
||||
auto* audio_thread = new Thread(ThreadIdentifier::kAudio);
|
||||
g_app_globals->pausable_threads.push_back(audio_thread);
|
||||
auto* game_thread = new Thread(ThreadIdentifier::kGame);
|
||||
g_app_globals->pausable_threads.push_back(game_thread);
|
||||
auto* logic_thread = new Thread(ThreadIdentifier::kLogic);
|
||||
g_app_globals->pausable_threads.push_back(logic_thread);
|
||||
auto* network_write_thread = new Thread(ThreadIdentifier::kNetworkWrite);
|
||||
g_app_globals->pausable_threads.push_back(network_write_thread);
|
||||
|
||||
// And add our other standard modules to them.
|
||||
game_thread->AddModule<Game>();
|
||||
logic_thread->AddModule<Game>();
|
||||
network_write_thread->AddModule<NetworkWriteModule>();
|
||||
media_thread->AddModule<MediaServer>();
|
||||
g_main_thread->AddModule<GraphicsServer>();
|
||||
@ -238,7 +238,7 @@ auto GetAppInstanceUUID() -> const std::string& {
|
||||
return session_id;
|
||||
}
|
||||
|
||||
auto InGameThread() -> bool {
|
||||
auto InLogicThread() -> bool {
|
||||
return (g_game && g_game->thread()->IsCurrent());
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ auto AppInternalPushPurchaseTransactionCall(const std::string& item,
|
||||
const std::string& order_id,
|
||||
bool user_initiated) -> void;
|
||||
auto AppInternalGetPublicAccountID() -> std::string;
|
||||
auto AppInternalOnGameThreadPause() -> void;
|
||||
auto AppInternalOnLogicThreadPause() -> void;
|
||||
auto AppInternalDirectSendLogs(const std::string& prefix,
|
||||
const std::string& suffix, bool instant,
|
||||
int* result = nullptr) -> void;
|
||||
@ -215,7 +215,7 @@ auto FatalError(const std::string& message = "") -> void;
|
||||
// Check current-threads.
|
||||
auto InMainThread() -> bool; // (main and graphics are same currently)
|
||||
auto InGraphicsThread() -> bool; // (main and graphics are same currently)
|
||||
auto InGameThread() -> bool;
|
||||
auto InLogicThread() -> bool;
|
||||
auto InAudioThread() -> bool;
|
||||
auto InBGDynamicsThread() -> bool;
|
||||
auto InMediaThread() -> bool;
|
||||
|
||||
@ -25,7 +25,7 @@ auto ContextTarget::GetAsHostActivity() -> HostActivity* { return nullptr; }
|
||||
auto ContextTarget::GetAsUIContext() -> UI* { return nullptr; }
|
||||
auto ContextTarget::GetMutableScene() -> Scene* { return nullptr; }
|
||||
|
||||
Context::Context() : target(g_context->target) { assert(InGameThread()); }
|
||||
Context::Context() : target(g_context->target) { assert(InLogicThread()); }
|
||||
|
||||
auto Context::operator==(const Context& other) const -> bool {
|
||||
return (target.get() == other.target.get());
|
||||
@ -34,7 +34,7 @@ auto Context::operator==(const Context& other) const -> bool {
|
||||
Context::Context(ContextTarget* target_in) : target(target_in) {}
|
||||
|
||||
auto Context::GetHostSession() const -> HostSession* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (target.exists()) return target->GetHostSession();
|
||||
return nullptr;
|
||||
}
|
||||
@ -60,28 +60,28 @@ auto Context::GetUIContext() const -> UI* {
|
||||
}
|
||||
|
||||
ScopedSetContext::ScopedSetContext(const Object::Ref<ContextTarget>& target) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_context);
|
||||
context_prev_ = *g_context;
|
||||
g_context->target = target;
|
||||
}
|
||||
|
||||
ScopedSetContext::ScopedSetContext(ContextTarget* target) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_context);
|
||||
context_prev_ = *g_context;
|
||||
g_context->target = target;
|
||||
}
|
||||
|
||||
ScopedSetContext::ScopedSetContext(const Context& context) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_context);
|
||||
context_prev_ = *g_context;
|
||||
*g_context = context;
|
||||
}
|
||||
|
||||
ScopedSetContext::~ScopedSetContext() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_context);
|
||||
// Restore old.
|
||||
*g_context = context_prev_;
|
||||
|
||||
@ -20,13 +20,13 @@ class Context {
|
||||
assert(g_context);
|
||||
|
||||
// Context can only be accessed from the game thread.
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
|
||||
return *g_context;
|
||||
}
|
||||
static void set_current(const Context& context) {
|
||||
// Context can only be accessed from the game thread.
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
|
||||
*g_context = context;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ auto Object::GetThreadOwnership() const -> Object::ThreadOwnership {
|
||||
}
|
||||
|
||||
auto Object::GetDefaultOwnerThread() const -> ThreadIdentifier {
|
||||
return ThreadIdentifier::kGame;
|
||||
return ThreadIdentifier::kLogic;
|
||||
}
|
||||
|
||||
#if BA_DEBUG_BUILD
|
||||
@ -145,8 +145,8 @@ auto Object::GetDefaultOwnerThread() const -> ThreadIdentifier {
|
||||
static auto GetCurrentThreadIdentifier() -> ThreadIdentifier {
|
||||
if (InMainThread()) {
|
||||
return ThreadIdentifier::kMain;
|
||||
} else if (InGameThread()) {
|
||||
return ThreadIdentifier::kGame;
|
||||
} else if (InLogicThread()) {
|
||||
return ThreadIdentifier::kLogic;
|
||||
} else if (InAudioThread()) {
|
||||
return ThreadIdentifier::kAudio;
|
||||
} else if (InNetworkWriteThread()) {
|
||||
@ -194,9 +194,9 @@ void Object::ObjectThreadCheck() {
|
||||
DO_FAIL("Main");
|
||||
}
|
||||
break;
|
||||
case ThreadIdentifier::kGame:
|
||||
if (!InGameThread()) {
|
||||
DO_FAIL("Game");
|
||||
case ThreadIdentifier::kLogic:
|
||||
if (!InLogicThread()) {
|
||||
DO_FAIL("Logic");
|
||||
}
|
||||
break;
|
||||
case ThreadIdentifier::kAudio:
|
||||
|
||||
@ -59,7 +59,7 @@ class Object {
|
||||
|
||||
/// Return the exact thread to check for with ThreadOwnership::kClassDefault
|
||||
/// (in the default ObjectThreadCheck implementation at least).
|
||||
/// Default returns ThreadIdentifier::kGame
|
||||
/// Default returns ThreadIdentifier::kLogic
|
||||
virtual auto GetDefaultOwnerThread() const -> ThreadIdentifier;
|
||||
|
||||
/// Set thread ownership values for an individual object.
|
||||
@ -70,7 +70,7 @@ class Object {
|
||||
/// with just set_thread_checks_enabled() for temp special cases...
|
||||
void SetThreadOwnership(
|
||||
ThreadOwnership ownership,
|
||||
ThreadIdentifier thread_identifier = ThreadIdentifier::kGame) {
|
||||
ThreadIdentifier thread_identifier = ThreadIdentifier::kLogic) {
|
||||
#if BA_DEBUG_BUILD
|
||||
thread_ownership_ = ownership;
|
||||
if (thread_ownership_ == ThreadOwnership::kNextReferencing) {
|
||||
|
||||
@ -71,7 +71,7 @@ void Thread::KillModules() {
|
||||
// These are all exactly the same, but by running different ones for
|
||||
// different thread groups makes its easy to see which thread is which
|
||||
// in profilers, backtraces, etc.
|
||||
auto Thread::RunGameThread(void* data) -> int {
|
||||
auto Thread::RunLogicThread(void* data) -> int {
|
||||
return static_cast<Thread*>(data)->ThreadMain();
|
||||
}
|
||||
|
||||
@ -295,8 +295,8 @@ Thread::Thread(ThreadIdentifier identifier_in, ThreadType type_in)
|
||||
// it's ready to go.
|
||||
int (*func)(void*);
|
||||
switch (identifier_) {
|
||||
case ThreadIdentifier::kGame:
|
||||
func = RunGameThread;
|
||||
case ThreadIdentifier::kLogic:
|
||||
func = RunLogicThread;
|
||||
break;
|
||||
case ThreadIdentifier::kMedia:
|
||||
func = RunMediaThread;
|
||||
@ -354,8 +354,8 @@ auto Thread::ThreadMain() -> int {
|
||||
|
||||
const char* id_string;
|
||||
switch (identifier_) {
|
||||
case ThreadIdentifier::kGame:
|
||||
id_string = "ballistica game";
|
||||
case ThreadIdentifier::kLogic:
|
||||
id_string = "ballistica logic";
|
||||
break;
|
||||
case ThreadIdentifier::kStdin:
|
||||
id_string = "ballistica stdin";
|
||||
|
||||
@ -223,7 +223,7 @@ class Thread {
|
||||
// These are all exactly the same, but by running different ones for
|
||||
// different thread groups makes its easy to see which thread is which
|
||||
// in profilers, backtraces, etc.
|
||||
static auto RunGameThread(void* data) -> int;
|
||||
static auto RunLogicThread(void* data) -> int;
|
||||
static auto RunAudioThread(void* data) -> int;
|
||||
static auto RunBGDynamicThread(void* data) -> int;
|
||||
static auto RunNetworkWriteThread(void* data) -> int;
|
||||
|
||||
@ -995,10 +995,10 @@ enum class ThreadType {
|
||||
|
||||
/// Used for module-thread identification.
|
||||
/// Mostly just for debugging, through a few things are affected by this
|
||||
/// (the GAME thread manages the python GIL, etc).
|
||||
/// (the Logic thread manages the python GIL, etc).
|
||||
enum class ThreadIdentifier {
|
||||
kInvalid,
|
||||
kGame,
|
||||
kLogic,
|
||||
kMedia,
|
||||
kFileOut,
|
||||
kMain,
|
||||
|
||||
@ -20,13 +20,13 @@ void BGDynamics::Init() {
|
||||
}
|
||||
|
||||
BGDynamics::BGDynamics() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_bg_dynamics == nullptr);
|
||||
g_bg_dynamics = this;
|
||||
}
|
||||
|
||||
void BGDynamics::AddTerrain(CollideModelData* o) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Allocate a fresh reference to keep this collide-model alive as long as
|
||||
// we're using it. Once we're done, we'll pass the pointer back to the
|
||||
@ -36,18 +36,18 @@ void BGDynamics::AddTerrain(CollideModelData* o) {
|
||||
}
|
||||
|
||||
void BGDynamics::RemoveTerrain(CollideModelData* o) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_bg_dynamics_server->PushRemoveTerrainCall(o);
|
||||
}
|
||||
|
||||
void BGDynamics::Emit(const BGDynamicsEmission& e) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_bg_dynamics_server->PushEmitCall(e);
|
||||
}
|
||||
|
||||
// Call friend client to step our sim.
|
||||
void BGDynamics::Step(const Vector3f& cam_pos) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// The BG dynamics thread just processes steps as fast as it can;
|
||||
// we need to throttle what we send or tell it to cut back if its behind
|
||||
@ -158,17 +158,17 @@ void BGDynamics::TooSlow() {
|
||||
}
|
||||
|
||||
void BGDynamics::SetDebrisFriction(float val) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_bg_dynamics_server->PushSetDebrisFrictionCall(val);
|
||||
}
|
||||
|
||||
void BGDynamics::SetDebrisKillHeight(float val) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_bg_dynamics_server->PushSetDebrisKillHeightCall(val);
|
||||
}
|
||||
|
||||
void BGDynamics::Draw(FrameDef* frame_def) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
BGDynamicsDrawSnapshot* ds{draw_snapshot_.get()};
|
||||
if (!ds) {
|
||||
|
||||
@ -23,7 +23,7 @@ class BGDynamicsDrawSnapshot {
|
||||
// These are created in the bg-dynamics thread, and object ownership
|
||||
// needs to be switched back to the game-thread default when it is passed
|
||||
// over or else the debug thread-access-checks will error.
|
||||
void SetGameThreadOwnership() {
|
||||
void SetLogicThreadOwnership() {
|
||||
if (g_buildconfig.debug_build()) {
|
||||
for (Object* o : {static_cast<Object*>(tendril_indices.get()),
|
||||
static_cast<Object*>(tendril_vertices.get()),
|
||||
|
||||
@ -8,7 +8,7 @@ namespace ballistica {
|
||||
|
||||
BGDynamicsFuse::BGDynamicsFuse() {
|
||||
assert(g_bg_dynamics_server);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Allocate our data. We'll pass this to the BGDynamics thread, and
|
||||
// it'll then own it.
|
||||
@ -18,7 +18,7 @@ BGDynamicsFuse::BGDynamicsFuse() {
|
||||
|
||||
BGDynamicsFuse::~BGDynamicsFuse() {
|
||||
assert(g_bg_dynamics_server);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Let the data know the client side is dead
|
||||
// so that we're no longer included in step messages.
|
||||
@ -28,13 +28,13 @@ BGDynamicsFuse::~BGDynamicsFuse() {
|
||||
}
|
||||
|
||||
void BGDynamicsFuse::SetTransform(const Matrix44f& t) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
data_->transform_client_ = t;
|
||||
data_->have_transform_client_ = true;
|
||||
}
|
||||
|
||||
void BGDynamicsFuse::SetLength(float length) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
data_->length_client_ = length;
|
||||
}
|
||||
|
||||
|
||||
@ -2314,7 +2314,7 @@ void BGDynamicsServer::Step(StepData* step_data) {
|
||||
// so they can draw us.
|
||||
BGDynamicsDrawSnapshot* snapshot = CreateDrawSnapshot();
|
||||
g_game->PushCall([snapshot] {
|
||||
snapshot->SetGameThreadOwnership();
|
||||
snapshot->SetLogicThreadOwnership();
|
||||
g_bg_dynamics->SetDrawSnapshot(snapshot);
|
||||
});
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
namespace ballistica {
|
||||
|
||||
BGDynamicsShadow::BGDynamicsShadow(float height_scaling) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// allocate our shadow data... we'll pass this to the BGDynamics thread,
|
||||
// which will then own it.
|
||||
@ -19,7 +19,7 @@ BGDynamicsShadow::BGDynamicsShadow(float height_scaling) {
|
||||
}
|
||||
|
||||
BGDynamicsShadow::~BGDynamicsShadow() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_bg_dynamics_server);
|
||||
|
||||
// let the data know the client side is dead,
|
||||
@ -30,17 +30,17 @@ BGDynamicsShadow::~BGDynamicsShadow() {
|
||||
}
|
||||
|
||||
void BGDynamicsShadow::SetPosition(const Vector3f& pos) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
data_->pos_client = pos;
|
||||
}
|
||||
|
||||
auto BGDynamicsShadow::GetPosition() const -> const Vector3f& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return data_->pos_client;
|
||||
}
|
||||
|
||||
void BGDynamicsShadow::GetValues(float* scale, float* density) const {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(scale);
|
||||
assert(density);
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
namespace ballistica {
|
||||
|
||||
BGDynamicsVolumeLight::BGDynamicsVolumeLight() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
// allocate our light data... we'll pass this to the BGDynamics thread,
|
||||
// which will then own it
|
||||
data_ = new BGDynamicsVolumeLightData();
|
||||
@ -16,7 +16,7 @@ BGDynamicsVolumeLight::BGDynamicsVolumeLight() {
|
||||
}
|
||||
|
||||
BGDynamicsVolumeLight::~BGDynamicsVolumeLight() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// let the data know the client side is dead,
|
||||
// so we're no longer included in step messages
|
||||
@ -28,17 +28,17 @@ BGDynamicsVolumeLight::~BGDynamicsVolumeLight() {
|
||||
}
|
||||
|
||||
void BGDynamicsVolumeLight::SetPosition(const Vector3f& pos) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
data_->pos_client = pos;
|
||||
}
|
||||
|
||||
void BGDynamicsVolumeLight::SetRadius(float radius) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
data_->radius_client = radius;
|
||||
}
|
||||
|
||||
void BGDynamicsVolumeLight::SetColor(float r, float g, float b) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
data_->r_client = r;
|
||||
data_->g_client = g;
|
||||
data_->b_client = b;
|
||||
|
||||
@ -14,7 +14,7 @@ namespace ballistica {
|
||||
class MaterialComponent : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kGame;
|
||||
return ThreadIdentifier::kLogic;
|
||||
}
|
||||
|
||||
auto GetFlattenedSize() -> size_t;
|
||||
|
||||
@ -150,7 +150,7 @@ void Account::SetLogin(V1AccountType account_type, V1LoginState login_state,
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// We call out to Python so need to be in game thread.
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (login_state_ != login_state
|
||||
|| g_app_globals->account_type != account_type || login_id_ != login_id
|
||||
|| login_name_ != login_name) {
|
||||
|
||||
@ -61,7 +61,7 @@ auto ConnectionSet::Update() -> void {
|
||||
}
|
||||
|
||||
auto ConnectionSet::GetConnectedClientCount() const -> int {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
int count = 0;
|
||||
for (auto&& i : connections_to_clients_) {
|
||||
if (i.second.exists() && i.second->can_communicate()) {
|
||||
@ -312,7 +312,7 @@ auto ConnectionSet::HandleClientDisconnected(int id) -> void {
|
||||
}
|
||||
|
||||
auto ConnectionSet::DisconnectClient(int client_id, int ban_seconds) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (connection_to_host_.exists()) {
|
||||
// Kick-votes first appeared in 14248
|
||||
|
||||
@ -24,7 +24,7 @@ class ConnectionSet {
|
||||
// Quick test as to whether there are clients. Does not check if they are
|
||||
// fully connected.
|
||||
auto has_connection_to_clients() const -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return (!connections_to_clients_.empty());
|
||||
}
|
||||
|
||||
|
||||
@ -270,7 +270,7 @@ void ConnectionToHost::HandleGamePacket(const std::vector<uint8_t>& data) {
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
void ConnectionToHost::HandleMessagePacket(const std::vector<uint8_t>& buffer) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (buffer.empty()) {
|
||||
Log("Error: got invalid HandleMessagePacket");
|
||||
|
||||
@ -249,7 +249,7 @@ void Game::PushVRHandsState(const VRHandsState& state) {
|
||||
|
||||
void Game::PushMediaPruneCall(int level) {
|
||||
PushCall([level] {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_media->Prune(level);
|
||||
});
|
||||
}
|
||||
@ -268,7 +268,7 @@ void Game::PushInitialScreenCreatedCall() {
|
||||
}
|
||||
|
||||
void Game::InitialScreenCreated() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Ok; graphics-server is telling us we've got a screen.
|
||||
|
||||
@ -305,7 +305,7 @@ void Game::Prune() { g_media->Prune(); }
|
||||
|
||||
// Launch into main menu or whatever else.
|
||||
void Game::RunAppLaunchCommands() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(!ran_app_launch_commands_);
|
||||
|
||||
// First off, run our python app-launch call.
|
||||
@ -336,7 +336,7 @@ Game::~Game() = default;
|
||||
|
||||
// Set up our sleeping based on what we're doing.
|
||||
void Game::UpdateProcessTimer() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// This might get called before we set up our timer in some cases. (such as
|
||||
// very early) should be safe to ignore since we update the interval
|
||||
@ -496,7 +496,7 @@ void Game::HandleQuitOnIdle() {
|
||||
idle_exiting_ = true;
|
||||
|
||||
PushCall([this, idle_seconds] {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Just go through _ba.quit()
|
||||
// FIXME: Shouldn't need to go out to the python layer here...
|
||||
@ -509,7 +509,7 @@ void Game::HandleQuitOnIdle() {
|
||||
// Bring our scenes, real-time timers, etc up to date.
|
||||
void Game::Update() {
|
||||
auto startms{Platform::GetCurrentMilliseconds()};
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
millisecs_t real_time = GetRealTime();
|
||||
g_platform->SetDebugKey("LastUpdateTime", std::to_string(startms));
|
||||
if (first_update_) {
|
||||
@ -667,7 +667,7 @@ void Game::Update() {
|
||||
|
||||
// Reset the game to a blank slate.
|
||||
void Game::Reset() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Tear down any existing setup.
|
||||
// This should allow high-level objects to die gracefully.
|
||||
@ -707,7 +707,7 @@ auto Game::IsInUIContext() const -> bool {
|
||||
|
||||
void Game::PushShowURLCall(const std::string& url) {
|
||||
PushCall([url] {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_python);
|
||||
g_python->ShowURL(url);
|
||||
});
|
||||
@ -724,7 +724,7 @@ auto Game::GetForegroundContext() -> Context {
|
||||
|
||||
void Game::PushBackButtonCall(InputDevice* input_device) {
|
||||
PushCall([this, input_device] {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Ignore if UI isn't up yet.
|
||||
if (!g_ui || !g_ui->overlay_root_widget() || !g_ui->screen_root_widget()) {
|
||||
@ -773,12 +773,12 @@ void Game::PushStringEditCancelCall() {
|
||||
// Called by a newly made Session instance to set itself as the current
|
||||
// session.
|
||||
void Game::SetForegroundSession(Session* s) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
foreground_session_ = s;
|
||||
}
|
||||
|
||||
void Game::SetForegroundScene(Scene* sg) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (foreground_scene_.get() != sg) {
|
||||
foreground_scene_ = sg;
|
||||
|
||||
@ -795,7 +795,7 @@ void Game::LaunchClientSession() {
|
||||
"can't launch a session from within a session update; use "
|
||||
"ba.pushcall()");
|
||||
}
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Don't want to pick up any old stuff in here.
|
||||
ScopedSetContext cp(nullptr);
|
||||
@ -824,7 +824,7 @@ void Game::LaunchReplaySession(const std::string& file_name) {
|
||||
"can't launch a session from within a session update; use "
|
||||
"ba.pushcall()");
|
||||
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Don't want to pick up any old stuff in here.
|
||||
ScopedSetContext cp(nullptr);
|
||||
@ -856,7 +856,7 @@ void Game::LaunchHostSession(PyObject* session_type_obj,
|
||||
"ba.pushcall()");
|
||||
}
|
||||
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
connections_->PrepareForLaunchHostSession();
|
||||
|
||||
@ -884,12 +884,12 @@ void Game::LaunchHostSession(PyObject* session_type_obj,
|
||||
}
|
||||
|
||||
void Game::RunMainMenu() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (g_app_globals->shutting_down) {
|
||||
return;
|
||||
}
|
||||
assert(g_python);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PythonRef result =
|
||||
g_python->obj(Python::ObjID::kLaunchMainMenuSessionCall).Call();
|
||||
if (!result.exists()) {
|
||||
@ -964,7 +964,7 @@ void Game::PushStdinScriptCommand(const std::string& command) {
|
||||
|
||||
void Game::PushInterruptSignalCall() {
|
||||
PushCall([this] {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Special case; when running under the server-wrapper, we completely
|
||||
// ignore interrupt signals (the wrapper acts on them).
|
||||
@ -979,7 +979,7 @@ void Game::PushInterruptSignalCall() {
|
||||
|
||||
void Game::PushAskUserForTelnetAccessCall() {
|
||||
PushCall([this] {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
ScopedSetContext cp(GetUIContext());
|
||||
g_python->obj(Python::ObjID::kTelnetAccessRequestCall).Call();
|
||||
});
|
||||
@ -990,12 +990,12 @@ void Game::HandleThreadPause() {
|
||||
|
||||
// Let Python and internal layers do their thing.
|
||||
g_python->obj(Python::ObjID::kOnAppPauseCall).Call();
|
||||
AppInternalOnGameThreadPause();
|
||||
AppInternalOnLogicThreadPause();
|
||||
}
|
||||
|
||||
void Game::PushPythonCall(const Object::Ref<PythonContextCall>& call) {
|
||||
// Since we're mucking with refs, need to limit to game thread.
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
BA_PRECONDITION(call->object_strong_ref_count() > 0);
|
||||
PushCall([call] {
|
||||
assert(call.exists());
|
||||
@ -1006,7 +1006,7 @@ void Game::PushPythonCall(const Object::Ref<PythonContextCall>& call) {
|
||||
void Game::PushPythonCallArgs(const Object::Ref<PythonContextCall>& call,
|
||||
const PythonRef& args) {
|
||||
// Since we're mucking with refs, need to limit to game thread.
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
BA_PRECONDITION(call->object_strong_ref_count() > 0);
|
||||
PushCall([call, args] {
|
||||
assert(call.exists());
|
||||
@ -1016,7 +1016,7 @@ void Game::PushPythonCallArgs(const Object::Ref<PythonContextCall>& call,
|
||||
|
||||
void Game::PushPythonWeakCall(const Object::WeakRef<PythonContextCall>& call) {
|
||||
// Since we're mucking with refs, need to limit to game thread.
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
|
||||
// Even though we only hold a weak ref, we expect a valid strong-reffed
|
||||
// object to be passed in.
|
||||
@ -1033,7 +1033,7 @@ void Game::PushPythonWeakCall(const Object::WeakRef<PythonContextCall>& call) {
|
||||
void Game::PushPythonWeakCallArgs(
|
||||
const Object::WeakRef<PythonContextCall>& call, const PythonRef& args) {
|
||||
// Since we're mucking with refs, need to limit to game thread.
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
|
||||
// Even though we only hold a weak ref, we expect a valid strong-reffed
|
||||
// object to be passed in.
|
||||
@ -1046,7 +1046,7 @@ void Game::PushPythonWeakCallArgs(
|
||||
|
||||
void Game::PushPythonRawCallable(PyObject* callable) {
|
||||
PushCall([this, callable] {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Lets run this in the UI context.
|
||||
// (can add other options if we need later)
|
||||
@ -1079,7 +1079,7 @@ void Game::SetDebugSpeedExponent(int val) {
|
||||
}
|
||||
|
||||
void Game::ChangeGameSpeed(int offs) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// If we're in a replay session, adjust playback speed there.
|
||||
if (dynamic_cast<ReplayClientSession*>(GetForegroundSession())) {
|
||||
@ -1126,7 +1126,7 @@ void Game::PushMainMenuPressCall(InputDevice* device) {
|
||||
}
|
||||
|
||||
void Game::MainMenuPress(InputDevice* device) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_python->HandleDeviceMenuPress(device);
|
||||
}
|
||||
|
||||
@ -1139,7 +1139,7 @@ void Game::PushScreenResizeCall(float virtual_width, float virtual_height,
|
||||
|
||||
void Game::ScreenResize(float virtual_width, float virtual_height,
|
||||
float pixel_width, float pixel_height) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_graphics != nullptr);
|
||||
if (g_graphics) {
|
||||
g_graphics->ScreenResize(virtual_width, virtual_height, pixel_width,
|
||||
@ -1161,7 +1161,7 @@ void Game::PushGameServiceAchievementListCall(
|
||||
void Game::GameServiceAchievementList(
|
||||
const std::set<std::string>& achievements) {
|
||||
assert(g_python);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
AppInternalDispatchRemoteAchievementList(achievements);
|
||||
}
|
||||
|
||||
@ -1177,7 +1177,7 @@ void Game::ScoresToBeatResponse(bool success,
|
||||
const std::list<ScoreToBeat>& scores,
|
||||
void* py_callback) {
|
||||
assert(g_python);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_python->DispatchScoresToBeatResponse(success, scores, py_callback);
|
||||
}
|
||||
|
||||
@ -1191,7 +1191,7 @@ void Game::PushFriendScoreSetCall(const FriendScoreSet& score_set) {
|
||||
|
||||
void Game::PushConfirmQuitCall() {
|
||||
PushCall([this] {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (HeadlessMode()) {
|
||||
Log("PushConfirmQuitCall() unhandled on headless.");
|
||||
} else {
|
||||
@ -1266,7 +1266,7 @@ void Game::PushOnAppResumeCall() {
|
||||
|
||||
// Look through everything in our config dict and act on it.
|
||||
void Game::ApplyConfig() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Not relevant for fullscreen anymore
|
||||
// since we're fullscreen windows everywhere.
|
||||
@ -1451,7 +1451,7 @@ void Game::PushHavePendingLoadsDoneCall() {
|
||||
}
|
||||
|
||||
void Game::ToggleConsole() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (auto console = g_app_globals->console) {
|
||||
console->ToggleState();
|
||||
}
|
||||
@ -1481,7 +1481,7 @@ void Game::PushShutdownCall(bool soft) {
|
||||
}
|
||||
|
||||
void Game::Shutdown(bool soft) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (!g_app_globals->shutting_down) {
|
||||
g_app_globals->shutting_down = true;
|
||||
@ -1508,13 +1508,13 @@ void Game::Shutdown(bool soft) {
|
||||
}
|
||||
|
||||
void Game::ResetInput() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_input->ResetKeyboardHeldKeys();
|
||||
g_input->ResetJoyStickHeldButtons();
|
||||
}
|
||||
|
||||
auto Game::RemovePlayer(Player* player) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (HostSession* host_session = player->GetHostSession()) {
|
||||
host_session->RemovePlayer(player);
|
||||
} else {
|
||||
@ -1542,13 +1542,13 @@ void Game::SetRealTimerLength(int timer_id, millisecs_t length) {
|
||||
}
|
||||
|
||||
void Game::Process() {
|
||||
have_pending_loads_ = g_media->RunPendingLoadsGameThread();
|
||||
have_pending_loads_ = g_media->RunPendingLoadsLogicThread();
|
||||
UpdateProcessTimer();
|
||||
}
|
||||
|
||||
void Game::SetLanguageKeys(
|
||||
const std::unordered_map<std::string, std::string>& language) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(language_mutex_);
|
||||
language_ = language;
|
||||
@ -1818,7 +1818,7 @@ auto Game::CharStr(SpecialChar id) -> std::string {
|
||||
}
|
||||
|
||||
auto Game::ShouldAnnouncePartyJoinsAndLeaves() -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// At the moment we don't announce these for public internet parties.. (too
|
||||
// much noise).
|
||||
@ -1840,7 +1840,7 @@ void Game::CleanUpBeforeConnectingToHost() {
|
||||
}
|
||||
|
||||
auto Game::GetPartySize() const -> int {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(game_roster_ != nullptr);
|
||||
return cJSON_GetArraySize(game_roster_);
|
||||
}
|
||||
@ -2020,7 +2020,7 @@ void Game::BanPlayer(const PlayerSpec& spec, millisecs_t duration) {
|
||||
}
|
||||
|
||||
void Game::UpdateGameRoster() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
assert(game_roster_ != nullptr);
|
||||
if (game_roster_ != nullptr) {
|
||||
@ -2131,7 +2131,7 @@ void Game::UpdateGameRoster() {
|
||||
}
|
||||
|
||||
void Game::SetPublicPartyEnabled(bool val) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (val == public_party_enabled_) {
|
||||
return;
|
||||
}
|
||||
@ -2140,7 +2140,7 @@ void Game::SetPublicPartyEnabled(bool val) {
|
||||
}
|
||||
|
||||
void Game::SetPublicPartySize(int count) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (count == public_party_size_) {
|
||||
return;
|
||||
}
|
||||
@ -2154,7 +2154,7 @@ void Game::SetPublicPartySize(int count) {
|
||||
}
|
||||
|
||||
void Game::SetPublicPartyMaxSize(int count) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (count == public_party_max_size_) {
|
||||
return;
|
||||
}
|
||||
@ -2168,7 +2168,7 @@ void Game::SetPublicPartyMaxSize(int count) {
|
||||
}
|
||||
|
||||
void Game::SetPublicPartyName(const std::string& name) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (name == public_party_name_) {
|
||||
return;
|
||||
}
|
||||
@ -2182,7 +2182,7 @@ void Game::SetPublicPartyName(const std::string& name) {
|
||||
}
|
||||
|
||||
void Game::SetPublicPartyStatsURL(const std::string& url) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (url == public_party_stats_url_) {
|
||||
return;
|
||||
}
|
||||
@ -2196,7 +2196,7 @@ void Game::SetPublicPartyStatsURL(const std::string& url) {
|
||||
}
|
||||
|
||||
void Game::SetPublicPartyPlayerCount(int count) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (count == public_party_player_count_) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ class Game : public Module {
|
||||
|
||||
// Used to know which globals is in control currently/etc.
|
||||
auto GetForegroundScene() const -> Scene* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return foreground_scene_.get();
|
||||
}
|
||||
auto SetForegroundScene(Scene* sg) -> void;
|
||||
|
||||
@ -125,7 +125,7 @@ void HostActivity::StepScene() {
|
||||
}
|
||||
|
||||
for (int cycle = 0; cycle < cycle_count; ++cycle) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Clear our player-positions for this step.
|
||||
// FIXME: Move this to scene and/or player node.
|
||||
@ -365,19 +365,19 @@ auto HostActivity::NewBaseTimer(millisecs_t length, bool repeat,
|
||||
}
|
||||
|
||||
void HostActivity::DeleteSimTimer(int timer_id) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (shutting_down_) return;
|
||||
sim_timers_.DeleteTimer(timer_id);
|
||||
}
|
||||
|
||||
void HostActivity::DeleteBaseTimer(int timer_id) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (shutting_down_) return;
|
||||
base_timers_.DeleteTimer(timer_id);
|
||||
}
|
||||
|
||||
auto HostActivity::Update(millisecs_t time_advance) -> millisecs_t {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// We can be killed at any time, so let's keep an eye out for that.
|
||||
WeakRef<HostActivity> test_ref(this);
|
||||
|
||||
@ -17,11 +17,11 @@ namespace ballistica {
|
||||
Player::Player(int id_in, HostSession* host_session)
|
||||
: id_(id_in), creation_time_(GetRealTime()), host_session_(host_session) {
|
||||
assert(host_session);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
}
|
||||
|
||||
Player::~Player() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// If we have an input-device attached to us, detach it.
|
||||
InputDevice* input_device = input_device_.get();
|
||||
@ -56,7 +56,7 @@ auto Player::GetHostActivity() const -> HostActivity* {
|
||||
}
|
||||
|
||||
void Player::SetHostActivity(HostActivity* a) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Make sure we get pulled out of one activity before being added to another.
|
||||
if (a && in_activity_) {
|
||||
@ -137,7 +137,7 @@ auto Player::GetPyActivityPlayer() -> PyObject* {
|
||||
}
|
||||
|
||||
auto Player::GetPyRef(bool new_ref) -> PyObject* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (py_ref_ == nullptr) {
|
||||
py_ref_ = PythonClassSessionPlayer::Create(this);
|
||||
}
|
||||
@ -148,7 +148,7 @@ auto Player::GetPyRef(bool new_ref) -> PyObject* {
|
||||
}
|
||||
|
||||
void Player::AssignInputCall(InputType type, PyObject* call_obj) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(static_cast<int>(type) >= 0
|
||||
&& static_cast<int>(type) < static_cast<int>(InputType::kLast));
|
||||
|
||||
@ -203,7 +203,7 @@ void Player::AssignInputCall(InputType type, PyObject* call_obj) {
|
||||
}
|
||||
|
||||
void Player::RunInput(InputType type, float value) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
const float threshold = kJoystickDiscreteThresholdFloat;
|
||||
|
||||
@ -357,7 +357,7 @@ auto Player::GetHostSession() const -> HostSession* {
|
||||
|
||||
void Player::SetName(const std::string& name, const std::string& full_name,
|
||||
bool is_real) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
HostSession* host_session = GetHostSession();
|
||||
BA_PRECONDITION(host_session);
|
||||
name_is_real_ = is_real;
|
||||
@ -372,7 +372,7 @@ void Player::SetName(const std::string& name, const std::string& full_name,
|
||||
}
|
||||
|
||||
void Player::InputCommand(InputType type, float value) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
switch (type) {
|
||||
case InputType::kUpDown:
|
||||
case InputType::kLeftRight:
|
||||
@ -393,7 +393,7 @@ void Player::SetInputDevice(InputDevice* input_device) {
|
||||
}
|
||||
|
||||
auto Player::GetPublicAccountID() const -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (input_device_.exists()) {
|
||||
return input_device_->GetPublicAccountID();
|
||||
}
|
||||
|
||||
@ -42,11 +42,11 @@ class Player : public Object {
|
||||
|
||||
// Set the player node for the current activity.
|
||||
auto set_node(Node* node) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
node_ = node;
|
||||
}
|
||||
auto node() const -> Node* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return node_.get();
|
||||
}
|
||||
|
||||
|
||||
@ -965,7 +965,7 @@ void ClientSession::End() {
|
||||
}
|
||||
|
||||
void ClientSession::HandleSessionMessage(const std::vector<uint8_t>& buffer) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
BA_PRECONDITION(!buffer.empty());
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ namespace ballistica {
|
||||
HostSession::HostSession(PyObject* session_type_obj)
|
||||
: last_kick_idle_players_decrement_time_(GetRealTime()) {
|
||||
assert(g_game);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(session_type_obj != nullptr);
|
||||
|
||||
ScopedSetContext cp(this);
|
||||
@ -196,7 +196,7 @@ auto HostSession::NewTimer(TimerMedium length, bool repeat,
|
||||
}
|
||||
|
||||
void HostSession::DeleteTimer(int timer_id) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (shutting_down_) return;
|
||||
sim_timers_.DeleteTimer(timer_id);
|
||||
}
|
||||
@ -237,7 +237,7 @@ auto HostSession::GetForegroundContext() -> Context {
|
||||
}
|
||||
|
||||
void HostSession::RequestPlayer(InputDevice* device) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Ignore if we have no Python session obj.
|
||||
if (!GetSessionPyObj()) {
|
||||
@ -309,7 +309,7 @@ void HostSession::RemovePlayer(Player* player) {
|
||||
|
||||
void HostSession::IssuePlayerLeft(Player* player) {
|
||||
assert(player);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
try {
|
||||
if (GetSessionPyObj()) {
|
||||
@ -334,7 +334,7 @@ void HostSession::IssuePlayerLeft(Player* player) {
|
||||
|
||||
void HostSession::SetKickIdlePlayers(bool enable) {
|
||||
// If this has changed, reset our disconnect-time reporting.
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (enable != kick_idle_players_) {
|
||||
last_kick_idle_players_decrement_time_ = GetRealTime();
|
||||
}
|
||||
@ -343,7 +343,7 @@ void HostSession::SetKickIdlePlayers(bool enable) {
|
||||
|
||||
void HostSession::SetForegroundHostActivity(HostActivity* a) {
|
||||
assert(a);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (shutting_down_) {
|
||||
Log("WARNING: SetForegroundHostActivity called during session shutdown; "
|
||||
@ -490,7 +490,7 @@ void HostSession::StepScene() {
|
||||
}
|
||||
|
||||
void HostSession::Update(int time_advance) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// We can be killed at any time, so let's keep an eye out for that.
|
||||
WeakRef<HostSession> test_ref(this);
|
||||
|
||||
@ -17,16 +17,16 @@ class RealTimer : public Object {
|
||||
public:
|
||||
RealTimer(millisecs_t length, bool repeat, T* delegate) {
|
||||
assert(g_game);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
timer_id_ = g_game->NewRealTimer(
|
||||
length, repeat, Object::New<Runnable, Callback>(delegate, this));
|
||||
}
|
||||
void SetLength(uint32_t length) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_game->SetRealTimerLength(timer_id_, length);
|
||||
}
|
||||
~RealTimer() override {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
g_game->DeleteRealTimer(timer_id_);
|
||||
}
|
||||
|
||||
|
||||
@ -428,7 +428,7 @@ static const char* g_default_random_names[] = {
|
||||
static std::list<std::string>* g_random_names_list = nullptr;
|
||||
|
||||
auto Utils::GetRandomNameList() -> const std::list<std::string>& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (g_random_names_list == nullptr) {
|
||||
// This will init the list with our default english names.
|
||||
SetRandomNameList(std::list<std::string>(1, "DEFAULT_NAMES"));
|
||||
@ -445,7 +445,7 @@ auto Utils::GetRandomNameList() -> const std::list<std::string>& {
|
||||
}
|
||||
|
||||
void Utils::SetRandomNameList(const std::list<std::string>& custom_names) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!g_random_names_list) {
|
||||
g_random_names_list = new std::list<std::string>;
|
||||
} else {
|
||||
|
||||
@ -852,13 +852,13 @@ void Camera::ManualHandleMouseMove(float move_h, float move_v) {
|
||||
}
|
||||
|
||||
auto Camera::NewAreaOfInterest(bool in_focus) -> AreaOfInterest* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
areas_of_interest_.emplace_back(in_focus);
|
||||
return &areas_of_interest_.back();
|
||||
}
|
||||
|
||||
void Camera::DeleteAreaOfInterest(AreaOfInterest* a) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
for (auto i = areas_of_interest_.begin(); i != areas_of_interest_.end();
|
||||
++i) {
|
||||
if (&(*i) == a) {
|
||||
|
||||
@ -14,7 +14,7 @@ void RenderComponent::ScissorPush(const Rect& rIn) {
|
||||
|
||||
#if BA_DEBUG_BUILD
|
||||
void RenderComponent::ConfigForEmptyDebugChecks(bool transparent) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (g_graphics->drawing_opaque_only() && transparent) {
|
||||
throw Exception("Transparent component submitted in opaque-only section");
|
||||
}
|
||||
@ -24,7 +24,7 @@ void RenderComponent::ConfigForEmptyDebugChecks(bool transparent) {
|
||||
}
|
||||
|
||||
void RenderComponent::ConfigForShadingDebugChecks(ShadingType shading_type) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (g_graphics->drawing_opaque_only()
|
||||
&& Graphics::IsShaderTransparent(shading_type)) {
|
||||
throw Exception("Transparent component submitted in opaque-only section");
|
||||
|
||||
@ -26,10 +26,10 @@ FrameDef::FrameDef()
|
||||
new RenderPass(RenderPass::Type::kOverlayFlatPass, this)),
|
||||
blit_pass_(new RenderPass(RenderPass::Type::kBlitPass, this)) {}
|
||||
|
||||
FrameDef::~FrameDef() { assert(InGameThread()); }
|
||||
FrameDef::~FrameDef() { assert(InLogicThread()); }
|
||||
|
||||
void FrameDef::Reset() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
real_time_ = 0;
|
||||
base_time_ = 0;
|
||||
base_time_elapsed_ = 0;
|
||||
|
||||
@ -788,7 +788,7 @@ void Graphics::AddScreenMessage(const std::string& msg, const Vector3f& color,
|
||||
// So we know we're always dealing with valid utf8.
|
||||
std::string m = Utils::GetValidUTF8(msg.c_str(), "ga9msg");
|
||||
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (top) {
|
||||
float start_v = -40.0f;
|
||||
if (!screen_messages_top_.empty()) {
|
||||
@ -842,7 +842,7 @@ void Graphics::InitInternalComponents(FrameDef* frame_def) {
|
||||
}
|
||||
|
||||
auto Graphics::GetEmptyFrameDef() -> FrameDef* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
FrameDef* frame_def;
|
||||
|
||||
// Grab a ready-to-use recycled one if available.
|
||||
@ -857,7 +857,7 @@ auto Graphics::GetEmptyFrameDef() -> FrameDef* {
|
||||
}
|
||||
|
||||
void Graphics::ClearFrameDefDeleteList() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
std::lock_guard<std::mutex> lock(frame_def_delete_list_mutex_);
|
||||
|
||||
for (auto& i : frame_def_delete_list_) {
|
||||
@ -986,7 +986,7 @@ void Graphics::DrawWorld(Session* session, FrameDef* frame_def) {
|
||||
}
|
||||
|
||||
void Graphics::BuildAndPushFrameDef() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(camera_.exists());
|
||||
|
||||
// We should not be building/pushing any frames until after
|
||||
@ -1320,7 +1320,7 @@ void Graphics::DrawFades(FrameDef* frame_def, millisecs_t real_time) {
|
||||
}
|
||||
|
||||
void Graphics::DrawCursor(RenderPass* pass, millisecs_t real_time) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
bool can_show_cursor = g_platform->IsRunningOnDesktop();
|
||||
bool should_show_cursor = camera_->manual() || g_input->IsCursorVisible();
|
||||
@ -1427,7 +1427,7 @@ void Graphics::ReturnCompletedFrameDef(FrameDef* frame_def) {
|
||||
}
|
||||
|
||||
void Graphics::AddMeshDataCreate(MeshData* d) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_graphics);
|
||||
|
||||
// Add this to our list of new-mesh-datas. We'll include this with our
|
||||
@ -1437,7 +1437,7 @@ void Graphics::AddMeshDataCreate(MeshData* d) {
|
||||
}
|
||||
|
||||
void Graphics::AddMeshDataDestroy(MeshData* d) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_graphics);
|
||||
|
||||
// Add this to our list of delete-mesh-datas; we'll include this with our
|
||||
@ -1447,7 +1447,7 @@ void Graphics::AddMeshDataDestroy(MeshData* d) {
|
||||
}
|
||||
|
||||
void Graphics::EnableProgressBar(bool fade_in) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
progress_bar_loads_ = g_media->GetGraphicalPendingLoadCount();
|
||||
assert(progress_bar_loads_ >= 0);
|
||||
if (progress_bar_loads_ > 0) {
|
||||
@ -1460,7 +1460,7 @@ void Graphics::EnableProgressBar(bool fade_in) {
|
||||
}
|
||||
|
||||
void Graphics::ToggleManualCamera() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
camera_->SetManual(!camera_->manual());
|
||||
if (camera_->manual()) {
|
||||
ScreenMessage("Manual Camera On");
|
||||
@ -1470,14 +1470,14 @@ void Graphics::ToggleManualCamera() {
|
||||
}
|
||||
|
||||
void Graphics::LocalCameraShake(float mag) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (camera_.exists()) {
|
||||
camera_->Shake(mag);
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::ToggleNetworkDebugDisplay() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
network_debug_display_enabled_ = !network_debug_display_enabled_;
|
||||
if (network_debug_display_enabled_) {
|
||||
ScreenMessage("Network Debug Display Enabled");
|
||||
@ -1487,7 +1487,7 @@ void Graphics::ToggleNetworkDebugDisplay() {
|
||||
}
|
||||
|
||||
void Graphics::ToggleDebugDraw() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
debug_draw_ = !debug_draw_;
|
||||
if (g_graphics_server->renderer()) {
|
||||
g_graphics_server->renderer()->set_debug_draw_mode(debug_draw_);
|
||||
@ -1522,7 +1522,7 @@ void Graphics::DoDrawBlotch(std::vector<uint16_t>* indices,
|
||||
std::vector<VertexSprite>* verts,
|
||||
const Vector3f& pos, float size, float r, float g,
|
||||
float b, float a) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(indices && verts);
|
||||
|
||||
// Add verts.
|
||||
@ -1789,7 +1789,7 @@ auto Graphics::ScreenMessageEntry::GetText() -> TextGroup& {
|
||||
|
||||
void Graphics::ScreenResize(float virtual_width, float virtual_height,
|
||||
float pixel_width, float pixel_height) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
res_x_virtual_ = virtual_width;
|
||||
res_y_virtual_ = virtual_height;
|
||||
res_x_ = pixel_width;
|
||||
|
||||
@ -136,70 +136,70 @@ class Graphics {
|
||||
auto ToggleNetworkDebugDisplay() -> void;
|
||||
auto SetGyroEnabled(bool enable) -> void;
|
||||
auto floor_reflection() const -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return floor_reflection_;
|
||||
}
|
||||
auto set_floor_reflection(bool val) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
floor_reflection_ = val;
|
||||
}
|
||||
auto set_shadow_offset(const Vector3f& val) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
shadow_offset_ = val;
|
||||
}
|
||||
auto set_shadow_scale(float x, float y) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
shadow_scale_.x = x;
|
||||
shadow_scale_.y = y;
|
||||
}
|
||||
auto set_shadow_ortho(bool o) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
shadow_ortho_ = o;
|
||||
}
|
||||
auto tint() -> const Vector3f& { return tint_; }
|
||||
auto set_tint(const Vector3f& val) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
tint_ = val;
|
||||
}
|
||||
|
||||
auto set_ambient_color(const Vector3f& val) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
ambient_color_ = val;
|
||||
}
|
||||
auto set_vignette_outer(const Vector3f& val) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
vignette_outer_ = val;
|
||||
}
|
||||
auto set_vignette_inner(const Vector3f& val) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
vignette_inner_ = val;
|
||||
}
|
||||
auto shadow_offset() const -> const Vector3f& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return shadow_offset_;
|
||||
}
|
||||
auto shadow_scale() const -> const Vector2f& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return shadow_scale_;
|
||||
}
|
||||
auto tint() const -> const Vector3f& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return tint_;
|
||||
}
|
||||
auto ambient_color() const -> const Vector3f& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return ambient_color_;
|
||||
}
|
||||
auto vignette_outer() const -> const Vector3f& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return vignette_outer_;
|
||||
}
|
||||
auto vignette_inner() const -> const Vector3f& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return vignette_inner_;
|
||||
}
|
||||
auto shadow_ortho() const -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return shadow_ortho_;
|
||||
}
|
||||
auto SetShadowRange(float lower_bottom, float lower_top, float upper_bottom,
|
||||
@ -209,11 +209,11 @@ class Graphics {
|
||||
|
||||
// FIXME - move to graphics_server
|
||||
auto set_tv_border(bool val) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
tv_border_ = val;
|
||||
}
|
||||
auto tv_border() const -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return tv_border_;
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ class TextGraphics::TextSpanBoundsCacheEntry : public Object {
|
||||
};
|
||||
|
||||
void TextGraphics::Init() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_text_graphics == nullptr);
|
||||
g_text_graphics = new TextGraphics();
|
||||
}
|
||||
@ -1000,7 +1000,7 @@ auto TextGraphics::GetGlyph(uint32_t val, bool big) -> TextGraphics::Glyph* {
|
||||
|
||||
void TextGraphics::GetOSTextSpanBoundsAndWidth(const std::string& s, Rect* r,
|
||||
float* width) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Asking the OS to calculate text bounds sounds expensive,
|
||||
// so let's use a cache of recent results.
|
||||
|
||||
@ -39,14 +39,14 @@ class VRGraphics : public Graphics {
|
||||
void set_vr_head_up(const Vector3f& v) { vr_head_up_ = v; }
|
||||
void set_vr_head_translate(const Vector3f& v) { vr_head_translate_ = v; }
|
||||
void set_vr_overlay_center(const Vector3f& val) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
vr_overlay_center_ = val;
|
||||
}
|
||||
auto vr_overlay_center() const -> const Vector3f& {
|
||||
return vr_overlay_center_;
|
||||
}
|
||||
void set_vr_overlay_center_enabled(bool val) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
vr_overlay_center_enabled_ = val;
|
||||
}
|
||||
auto vr_overlay_center_enabled() const -> bool {
|
||||
|
||||
@ -41,7 +41,7 @@ auto ClientInputDevice::GetPlayerProfiles() const -> PyObject* {
|
||||
}
|
||||
|
||||
auto ClientInputDevice::GetAccountName(bool full) const -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (connection_to_client_.exists()) {
|
||||
if (full) {
|
||||
return connection_to_client_->peer_spec().GetDisplayString();
|
||||
@ -53,7 +53,7 @@ auto ClientInputDevice::GetAccountName(bool full) const -> std::string {
|
||||
}
|
||||
|
||||
auto ClientInputDevice::GetPublicAccountID() const -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (connection_to_client_.exists()) {
|
||||
return connection_to_client_->peer_public_account_id();
|
||||
}
|
||||
|
||||
@ -28,12 +28,12 @@ auto InputDevice::ShouldBeHiddenFromUser() -> bool {
|
||||
}
|
||||
|
||||
auto InputDevice::GetDeviceName() -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return GetRawDeviceName();
|
||||
}
|
||||
|
||||
void InputDevice::ResetRandomNames() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (g_rand_name_registry == nullptr) return;
|
||||
g_rand_name_registry->clear();
|
||||
}
|
||||
@ -41,7 +41,7 @@ void InputDevice::ResetRandomNames() {
|
||||
// Given a full name "SomeJoyStick #3" etc, reserves/returns a persistent random
|
||||
// name for it.
|
||||
static auto GetRandomName(const std::string& full_name) -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Hmm; statically allocating this is giving some crashes on shutdown :-(
|
||||
if (g_rand_name_registry == nullptr) {
|
||||
@ -75,7 +75,7 @@ static auto GetRandomName(const std::string& full_name) -> std::string {
|
||||
auto InputDevice::GetPlayerProfiles() const -> PyObject* { return nullptr; }
|
||||
|
||||
auto InputDevice::GetPublicAccountID() const -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// This default implementation assumes the device is local
|
||||
// so just returns the locally signed in account's public id.
|
||||
@ -84,7 +84,7 @@ auto InputDevice::GetPublicAccountID() const -> std::string {
|
||||
}
|
||||
|
||||
auto InputDevice::GetAccountName(bool full) const -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (full) {
|
||||
return PlayerSpec::GetAccountPlayerSpec().GetDisplayString();
|
||||
} else {
|
||||
@ -97,7 +97,7 @@ auto InputDevice::IsRemoteClient() const -> bool { return false; }
|
||||
auto InputDevice::GetClientID() const -> int { return -1; }
|
||||
|
||||
auto InputDevice::GetDefaultPlayerName() -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
char buffer[256];
|
||||
snprintf(buffer, sizeof(buffer), "%s %s", GetDeviceName().c_str(),
|
||||
GetPersistentIdentifier().c_str());
|
||||
@ -120,14 +120,14 @@ auto InputDevice::GetAxisName(int id) -> std::string {
|
||||
auto InputDevice::HasMeaningfulButtonNames() -> bool { return false; }
|
||||
|
||||
auto InputDevice::GetPersistentIdentifier() const -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
char buffer[128];
|
||||
snprintf(buffer, sizeof(buffer), "#%d", number_);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
InputDevice::~InputDevice() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(!player_.exists());
|
||||
// release our python ref to ourself if we have one
|
||||
if (py_ref_) {
|
||||
@ -203,7 +203,7 @@ auto InputDevice::GetRemotePlayer() const -> ConnectionToHost* {
|
||||
// Called to let the current host/client-session know that we'd like to control
|
||||
// something please.
|
||||
void InputDevice::RequestPlayer() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Make note that we're being used in some way.
|
||||
last_input_time_ = g_game->master_time();
|
||||
@ -274,7 +274,7 @@ void InputDevice::UpdateLastInputTime() {
|
||||
}
|
||||
|
||||
void InputDevice::InputCommand(InputType type, float value) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Make note that we're being used in some way.
|
||||
UpdateLastInputTime();
|
||||
@ -306,7 +306,7 @@ void InputDevice::InputCommand(InputType type, float value) {
|
||||
void InputDevice::ResetHeldStates() {}
|
||||
|
||||
auto InputDevice::GetPyInputDevice(bool new_ref) -> PyObject* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (py_ref_ == nullptr) {
|
||||
py_ref_ = PythonClassInputDevice::Create(this);
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ auto Joystick::GetButtonName(int index) -> std::string {
|
||||
}
|
||||
|
||||
Joystick::~Joystick() {
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Log("Error: Joystick dying in wrong thread.");
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ auto Joystick::GetDefaultPlayerName() -> std::string {
|
||||
return InputDevice::GetDefaultPlayerName();
|
||||
}
|
||||
|
||||
void Joystick::ConnectionComplete() { assert(InGameThread()); }
|
||||
void Joystick::ConnectionComplete() { assert(InLogicThread()); }
|
||||
|
||||
auto Joystick::ShouldBeHiddenFromUser() -> bool {
|
||||
std::string d_name = GetDeviceName();
|
||||
@ -362,7 +362,7 @@ auto Joystick::GetCalibratedValue(float raw, float neutral) const -> int32_t {
|
||||
void Joystick::Update() {
|
||||
InputDevice::Update();
|
||||
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// We seem to get a fair amount of bogus direction-pressed events from newly
|
||||
// plugged in joysticks.. this leads to continuous scrolling in menus and such
|
||||
@ -530,7 +530,7 @@ void Joystick::ResetHeldStates() {
|
||||
}
|
||||
|
||||
void Joystick::HandleSDLEvent(const SDL_Event* e) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// If we've got a child joystick, send them any events they're set to handle.
|
||||
if (child_joy_stick_) {
|
||||
@ -1290,7 +1290,7 @@ void Joystick::UpdateRunningState() {
|
||||
}
|
||||
|
||||
void Joystick::UpdateMapping() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// This doesn't apply to manual ones (except children which are).
|
||||
if (!can_configure_ && !parent_joy_stick_) {
|
||||
|
||||
@ -373,7 +373,7 @@ void KeyboardInput::UpdateRun(SDL_Keycode key, bool down) {
|
||||
}
|
||||
|
||||
void KeyboardInput::UpdateMapping() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
SDL_Keycode up_key_default, down_key_default, left_key_default,
|
||||
right_key_default, jump_key_default, punch_key_default, bomb_key_default,
|
||||
|
||||
@ -351,7 +351,7 @@ void TouchInput::UpdateDPad() {
|
||||
}
|
||||
|
||||
void TouchInput::Draw(FrameDef* frame_def) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
bool active = (!g_ui->IsWindowPresent());
|
||||
millisecs_t real_time = frame_def->real_time();
|
||||
|
||||
@ -831,7 +831,7 @@ void TouchInput::Draw(FrameDef* frame_def) {
|
||||
}
|
||||
|
||||
void TouchInput::UpdateMapping() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
std::string touch_movement_type =
|
||||
g_app_config->Resolve(AppConfig::StringID::kTouchMovementControlType);
|
||||
@ -895,7 +895,7 @@ void TouchInput::UpdateMapping() {
|
||||
}
|
||||
|
||||
auto TouchInput::HandleTouchDown(void* touch, float x, float y) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
float width = g_graphics->screen_virtual_width();
|
||||
float height = g_graphics->screen_virtual_height();
|
||||
@ -985,7 +985,7 @@ auto TouchInput::HandleTouchDown(void* touch, float x, float y) -> bool {
|
||||
}
|
||||
|
||||
auto TouchInput::HandleTouchUp(void* touch, float x, float y) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Release dpad drag touch.
|
||||
if (touch == d_pad_drag_touch_) {
|
||||
@ -1027,7 +1027,7 @@ auto TouchInput::HandleTouchUp(void* touch, float x, float y) -> bool {
|
||||
}
|
||||
|
||||
auto TouchInput::HandleTouchMoved(void* touch, float x, float y) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (touch == d_pad_drag_touch_) {
|
||||
float width = g_graphics->screen_virtual_width();
|
||||
float height = g_graphics->screen_virtual_height();
|
||||
|
||||
@ -322,7 +322,7 @@ Input::Input() {
|
||||
// assert(g_input == nullptr);
|
||||
// g_input = this;
|
||||
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Config should have always been read by this point; right?
|
||||
// assert(g_python);
|
||||
@ -334,7 +334,7 @@ void Input::PushCreateKeyboardInputDevices() {
|
||||
}
|
||||
|
||||
void Input::CreateKeyboardInputDevices() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (keyboard_input_ != nullptr || keyboard_input_2_ != nullptr) {
|
||||
Log("Error: CreateKeyboardInputDevices called with existing kbs.");
|
||||
return;
|
||||
@ -350,7 +350,7 @@ void Input::PushDestroyKeyboardInputDevices() {
|
||||
}
|
||||
|
||||
void Input::DestroyKeyboardInputDevices() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (keyboard_input_ == nullptr || keyboard_input_2_ == nullptr) {
|
||||
Log("Error: DestroyKeyboardInputDevices called with null kb(s).");
|
||||
return;
|
||||
@ -372,7 +372,7 @@ auto Input::GetInputDevice(int id) -> InputDevice* {
|
||||
|
||||
auto Input::GetInputDevice(const std::string& name,
|
||||
const std::string& unique_id) -> InputDevice* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
for (auto&& i : input_devices_) {
|
||||
if (i.exists() && (i->GetDeviceName() == name)
|
||||
&& i->GetPersistentIdentifier() == unique_id) {
|
||||
@ -384,7 +384,7 @@ auto Input::GetInputDevice(const std::string& name,
|
||||
|
||||
auto Input::GetNewNumberedIdentifier(const std::string& name,
|
||||
const std::string& identifier) -> int {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Stuff like reserved_identifiers["JoyStickType"]["0x812312314"] = 2;
|
||||
|
||||
@ -520,7 +520,7 @@ void Input::AnnounceDisconnects() {
|
||||
}
|
||||
|
||||
void Input::ShowStandardInputDeviceConnectedMessage(InputDevice* j) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
std::string suffix;
|
||||
suffix += j->GetPersistentIdentifier();
|
||||
suffix += j->GetDeviceExtraDescription();
|
||||
@ -538,7 +538,7 @@ void Input::ShowStandardInputDeviceConnectedMessage(InputDevice* j) {
|
||||
}
|
||||
|
||||
void Input::ShowStandardInputDeviceDisconnectedMessage(InputDevice* j) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
newly_disconnected_controllers_.push_back(j->GetDeviceName() + " "
|
||||
+ j->GetPersistentIdentifier()
|
||||
@ -560,7 +560,7 @@ void Input::PushAddInputDeviceCall(InputDevice* input_device,
|
||||
}
|
||||
|
||||
void Input::AddInputDevice(InputDevice* input, bool standard_message) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Lets go through and find the first unused input-device id and use that
|
||||
// (might as well keep our list small if we can).
|
||||
@ -622,7 +622,7 @@ void Input::PushRemoveInputDeviceCall(InputDevice* input_device,
|
||||
}
|
||||
|
||||
void Input::RemoveInputDevice(InputDevice* input, bool standard_message) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (standard_message && !input->ShouldBeHiddenFromUser()) {
|
||||
ShowStandardInputDeviceDisconnectedMessage(input);
|
||||
@ -668,7 +668,7 @@ void Input::RemoveInputDevice(InputDevice* input, bool standard_message) {
|
||||
}
|
||||
|
||||
void Input::UpdateInputDeviceCounts() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
have_button_using_inputs_ = false;
|
||||
have_start_activated_default_button_inputs_ = false;
|
||||
@ -711,7 +711,7 @@ void Input::UpdateInputDeviceCounts() {
|
||||
}
|
||||
|
||||
auto Input::GetLocalActiveInputDeviceCount() -> int {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// This can get called alot so lets cache the value.
|
||||
millisecs_t current_time = g_game->master_time();
|
||||
@ -737,7 +737,7 @@ auto Input::GetLocalActiveInputDeviceCount() -> int {
|
||||
}
|
||||
|
||||
auto Input::HaveControllerWithPlayer() -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
// NOLINTNEXTLINE(readability-use-anyofallof)
|
||||
for (auto& input_device : input_devices_) {
|
||||
if (input_device.exists() && (*input_device).IsController()
|
||||
@ -749,7 +749,7 @@ auto Input::HaveControllerWithPlayer() -> bool {
|
||||
}
|
||||
|
||||
auto Input::HaveRemoteAppController() -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
// NOLINTNEXTLINE(readability-use-anyofallof)
|
||||
for (auto& input_device : input_devices_) {
|
||||
if (input_device.exists() && (*input_device).IsRemoteApp()) {
|
||||
@ -776,7 +776,7 @@ auto Input::GetInputDevicesWithName(const std::string& name)
|
||||
}
|
||||
|
||||
auto Input::GetConfigurableGamePads() -> std::vector<InputDevice*> {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
std::vector<InputDevice*> vals;
|
||||
if (!HeadlessMode()) {
|
||||
for (auto& input_device : input_devices_) {
|
||||
@ -830,7 +830,7 @@ void Input::UpdateEnabledControllerSubsystems() {
|
||||
|
||||
// Tells all inputs to update their controls based on the app config.
|
||||
void Input::ApplyAppConfig() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
UpdateEnabledControllerSubsystems();
|
||||
|
||||
@ -846,7 +846,7 @@ void Input::ApplyAppConfig() {
|
||||
}
|
||||
|
||||
void Input::Update() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
millisecs_t real_time = GetRealTime();
|
||||
|
||||
@ -890,7 +890,7 @@ void Input::Update() {
|
||||
}
|
||||
|
||||
void Input::Reset() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Detach all inputs from players.
|
||||
for (auto& input_device : input_devices_) {
|
||||
@ -901,7 +901,7 @@ void Input::Reset() {
|
||||
}
|
||||
|
||||
void Input::LockAllInput(bool permanent, const std::string& label) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (permanent) {
|
||||
input_lock_count_permanent_++;
|
||||
input_lock_permanent_labels_.push_back(label);
|
||||
@ -921,7 +921,7 @@ void Input::LockAllInput(bool permanent, const std::string& label) {
|
||||
}
|
||||
|
||||
void Input::UnlockAllInput(bool permanent, const std::string& label) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
recent_input_locks_unlocks_.push_back(
|
||||
permanent
|
||||
@ -1057,7 +1057,7 @@ void Input::ProcessStressTesting(int player_count) {
|
||||
}
|
||||
|
||||
void Input::HandleBackPress(bool from_toolbar) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// This can come through occasionally before our UI is up it seems?
|
||||
// Just ignore in that case.
|
||||
@ -1112,7 +1112,7 @@ auto Input::PushJoystickEvent(const SDL_Event& event, InputDevice* input_device)
|
||||
|
||||
void Input::HandleJoystickEvent(const SDL_Event& event,
|
||||
InputDevice* input_device) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(input_device);
|
||||
|
||||
if (ShouldCompletelyIgnoreInputDevice(input_device)) {
|
||||
@ -1145,7 +1145,7 @@ void Input::PushKeyReleaseEvent(const SDL_Keysym& keysym) {
|
||||
}
|
||||
|
||||
void Input::HandleKeyPress(const SDL_Keysym* keysym) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
mark_input_active();
|
||||
|
||||
@ -1319,7 +1319,7 @@ void Input::HandleKeyPress(const SDL_Keysym* keysym) {
|
||||
}
|
||||
|
||||
void Input::HandleKeyRelease(const SDL_Keysym* keysym) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Note: we want to let these through even if input is locked.
|
||||
|
||||
@ -1396,7 +1396,7 @@ auto Input::PushMouseScrollEvent(const Vector2f& amount) -> void {
|
||||
}
|
||||
|
||||
auto Input::HandleMouseScroll(const Vector2f& amount) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (IsInputLocked()) {
|
||||
return;
|
||||
}
|
||||
@ -1432,7 +1432,7 @@ auto Input::PushSmoothMouseScrollEvent(const Vector2f& velocity, bool momentum)
|
||||
|
||||
auto Input::HandleSmoothMouseScroll(const Vector2f& velocity, bool momentum)
|
||||
-> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (IsInputLocked()) {
|
||||
return;
|
||||
}
|
||||
@ -1465,7 +1465,7 @@ auto Input::PushMouseMotionEvent(const Vector2f& position) -> void {
|
||||
|
||||
auto Input::HandleMouseMotion(const Vector2f& position) -> void {
|
||||
assert(g_graphics);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
mark_input_active();
|
||||
|
||||
float old_cursor_pos_x = cursor_pos_x_;
|
||||
@ -1517,7 +1517,7 @@ auto Input::PushMouseDownEvent(int button, const Vector2f& position) -> void {
|
||||
|
||||
auto Input::HandleMouseDown(int button, const Vector2f& position) -> void {
|
||||
assert(g_graphics);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (IsInputLocked()) {
|
||||
return;
|
||||
@ -1593,7 +1593,7 @@ auto Input::PushMouseUpEvent(int button, const Vector2f& position) -> void {
|
||||
}
|
||||
|
||||
auto Input::HandleMouseUp(int button, const Vector2f& position) -> void {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
mark_input_active();
|
||||
|
||||
// Convert normalized view coords to our virtual ones.
|
||||
@ -1641,7 +1641,7 @@ void Input::PushTouchEvent(const TouchEvent& e) {
|
||||
}
|
||||
|
||||
void Input::HandleTouchEvent(const TouchEvent& e) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_graphics);
|
||||
|
||||
if (IsInputLocked()) {
|
||||
@ -1713,7 +1713,7 @@ void Input::ResetJoyStickHeldButtons() {
|
||||
|
||||
// Send key-ups for any currently-held keys.
|
||||
void Input::ResetKeyboardHeldKeys() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!HeadlessMode()) {
|
||||
// Synthesize key-ups for all our held keys.
|
||||
while (!keys_held_.empty()) {
|
||||
@ -1733,7 +1733,7 @@ void Input::Draw(FrameDef* frame_def) {
|
||||
}
|
||||
|
||||
auto Input::IsCursorVisible() const -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!g_ui) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ namespace ballistica {
|
||||
|
||||
CollideModel::CollideModel(const std::string& name, Scene* scene)
|
||||
: MediaComponent(name, scene), dead_(false) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (scene) {
|
||||
if (GameStream* os = scene->GetGameStream()) {
|
||||
os->AddCollideModel(this);
|
||||
|
||||
@ -8,7 +8,7 @@ namespace ballistica {
|
||||
|
||||
CubeMapTexture::CubeMapTexture(const std::string& name, Scene* scene)
|
||||
: MediaComponent(name, scene) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// cant currently add these to scenes so nothing to do here..
|
||||
{
|
||||
|
||||
@ -10,7 +10,7 @@ namespace ballistica {
|
||||
|
||||
Data::Data(const std::string& name, Scene* scene)
|
||||
: MediaComponent(name, scene), dead_(false) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (scene) {
|
||||
if (GameStream* os = scene->GetGameStream()) {
|
||||
|
||||
@ -10,7 +10,7 @@ namespace ballistica {
|
||||
|
||||
Model::Model(const std::string& name, Scene* scene)
|
||||
: MediaComponent(name, scene), dead_(false) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (scene) {
|
||||
if (GameStream* os = scene->GetGameStream()) {
|
||||
|
||||
@ -12,7 +12,7 @@ namespace ballistica {
|
||||
|
||||
Sound::Sound(const std::string& name, Scene* scene)
|
||||
: MediaComponent(name, scene) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (scene) {
|
||||
if (GameStream* os = scene->GetGameStream()) {
|
||||
os->AddSound(this);
|
||||
|
||||
@ -11,7 +11,7 @@ namespace ballistica {
|
||||
|
||||
Texture::Texture(const std::string& name, Scene* scene)
|
||||
: MediaComponent(name, scene), dead_(false) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Add to the provided scene to get a numeric ID.
|
||||
if (scene) {
|
||||
@ -28,7 +28,7 @@ Texture::Texture(const std::string& name, Scene* scene)
|
||||
|
||||
// qrcode version
|
||||
Texture::Texture(const std::string& qr_url) : MediaComponent(qr_url, nullptr) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
{
|
||||
Media::MediaListsLock lock;
|
||||
texture_data_ = g_media->GetTextureDataQRCode(qr_url);
|
||||
|
||||
@ -97,7 +97,7 @@ void CollideModelData::DoPreload() {
|
||||
#endif // dSINGLE
|
||||
} // namespace ballistica
|
||||
|
||||
void CollideModelData::DoLoad() { assert(InGameThread()); }
|
||||
void CollideModelData::DoLoad() { assert(InLogicThread()); }
|
||||
|
||||
void CollideModelData::DoUnload() {
|
||||
// TODO(ericf): if we want to support in-game reloading we need
|
||||
|
||||
@ -32,7 +32,7 @@ void DataData::DoPreload() {
|
||||
}
|
||||
|
||||
void DataData::DoLoad() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(valid_);
|
||||
PythonRef args(Py_BuildValue("(s)", raw_input_.c_str()), PythonRef::kSteal);
|
||||
object_ = g_python->obj(Python::ObjID::kJsonLoadsCall).Call(args);
|
||||
@ -42,7 +42,7 @@ void DataData::DoLoad() {
|
||||
}
|
||||
|
||||
void DataData::DoUnload() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(valid_);
|
||||
object_.Release();
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ class DataData : public MediaComponentData {
|
||||
}
|
||||
}
|
||||
auto object() -> const PythonRef& {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(loaded());
|
||||
return object_;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
namespace ballistica {
|
||||
|
||||
MediaComponentData::MediaComponentData() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_media);
|
||||
last_used_time_ = GetRealTime();
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ void Media::LoadSystemModel(SystemModelID id, const char* name) {
|
||||
}
|
||||
|
||||
void Media::LoadSystemMedia() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_audio_server && g_media_server && g_graphics_server);
|
||||
assert(g_graphics_server
|
||||
&& g_graphics_server->texture_compression_types_are_set());
|
||||
@ -378,7 +378,7 @@ void Media::PrintLoadInfo() {
|
||||
}
|
||||
|
||||
void Media::MarkAllMediaForLoad() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Need to keep lists locked while iterating over them.
|
||||
MediaListsLock m_lock;
|
||||
@ -465,7 +465,7 @@ auto Media::GetComponentData(
|
||||
const std::string& file_name,
|
||||
std::unordered_map<std::string, Object::Ref<T> >* c_list)
|
||||
-> Object::Ref<T> {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(media_lists_locked_);
|
||||
auto i = c_list->find(file_name);
|
||||
if (i != c_list->end()) {
|
||||
@ -484,7 +484,7 @@ auto Media::GetComponentData(
|
||||
}
|
||||
|
||||
auto Media::GetTextureData(TextPacker* packer) -> Object::Ref<TextureData> {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(media_lists_locked_);
|
||||
const std::string& hash(packer->hash());
|
||||
auto i = text_textures_.find(hash);
|
||||
@ -505,7 +505,7 @@ auto Media::GetTextureData(TextPacker* packer) -> Object::Ref<TextureData> {
|
||||
|
||||
auto Media::GetTextureDataQRCode(const std::string& url)
|
||||
-> Object::Ref<TextureData> {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(media_lists_locked_);
|
||||
auto i = qr_textures_.find(url);
|
||||
if (i != qr_textures_.end()) {
|
||||
@ -527,7 +527,7 @@ auto Media::GetTextureDataQRCode(const std::string& url)
|
||||
// ..should fix.
|
||||
auto Media::GetCubeMapTextureData(const std::string& file_name)
|
||||
-> Object::Ref<TextureData> {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(media_lists_locked_);
|
||||
auto i = textures_.find(file_name);
|
||||
if (i != textures_.end()) {
|
||||
@ -550,7 +550,7 @@ auto Media::GetCubeMapTextureData(const std::string& file_name)
|
||||
// settings, etc). Should fix.
|
||||
auto Media::GetTextureData(const std::string& file_name)
|
||||
-> Object::Ref<TextureData> {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(media_lists_locked_);
|
||||
auto i = textures_.find(file_name);
|
||||
if (i != textures_.end()) {
|
||||
@ -603,7 +603,7 @@ auto Media::GetTextureData(const std::string& file_name)
|
||||
}
|
||||
|
||||
void Media::MarkComponentForLoad(MediaComponentData* c) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
assert(c->locked());
|
||||
|
||||
@ -708,7 +708,7 @@ template <class T>
|
||||
auto Media::GetComponentPendingLoadCount(
|
||||
std::unordered_map<std::string, Object::Ref<T> >* t_list, MediaType type)
|
||||
-> int {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(media_lists_locked_);
|
||||
|
||||
int c = 0;
|
||||
@ -742,8 +742,8 @@ auto Media::RunPendingGraphicsLoads() -> bool {
|
||||
|
||||
// Runs the pending loads that run in the main thread. Also clears the list of
|
||||
// done loads.
|
||||
auto Media::RunPendingLoadsGameThread() -> bool {
|
||||
assert(InGameThread());
|
||||
auto Media::RunPendingLoadsLogicThread() -> bool {
|
||||
assert(InLogicThread());
|
||||
return RunPendingLoadList(&pending_loads_other_);
|
||||
}
|
||||
|
||||
@ -826,7 +826,7 @@ auto Media::RunPendingLoadList(std::vector<Object::Ref<T>*>* c_list) -> bool {
|
||||
}
|
||||
|
||||
void Media::Prune(int level) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
millisecs_t current_time = GetRealTime();
|
||||
|
||||
// need lists locked while accessing/modifying them
|
||||
@ -1066,7 +1066,7 @@ auto Media::FindMediaFile(FileType type, const std::string& name)
|
||||
std::string file_out;
|
||||
|
||||
// We don't protect package-path access so make sure its always from here.
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
const char* ext = "";
|
||||
const char* prefix = "";
|
||||
@ -1199,7 +1199,7 @@ void Media::AddPendingLoad(Object::Ref<MediaComponentData>* c) {
|
||||
}
|
||||
|
||||
void Media::ClearPendingLoadsDoneList() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
std::lock_guard<std::mutex> lock(pending_load_list_mutex_);
|
||||
|
||||
@ -1229,7 +1229,7 @@ void Media::PreloadRunnable::Run() {
|
||||
|
||||
void Media::AddPackage(const std::string& name, const std::string& path) {
|
||||
// we don't protect package-path access so make sure its always from here..
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
#if BA_DEBUG_BUILD
|
||||
if (packages_.find(name) != packages_.end()) {
|
||||
Log("WARNING: adding duplicate package: '" + name + "'");
|
||||
|
||||
@ -25,7 +25,7 @@ class Media {
|
||||
static auto GetMedia(
|
||||
std::unordered_map<std::string, Object::WeakRef<T> >* list,
|
||||
const std::string& name, Scene* scene) -> Object::Ref<T> {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(list);
|
||||
auto i = list->find(name);
|
||||
|
||||
@ -47,7 +47,7 @@ class Media {
|
||||
|
||||
/// Finish loading any media that has been preloaded but still needs to be
|
||||
/// loaded by the proper thread.
|
||||
auto RunPendingLoadsGameThread() -> bool;
|
||||
auto RunPendingLoadsLogicThread() -> bool;
|
||||
|
||||
/// Return true if audio loads remain to be done.
|
||||
auto RunPendingAudioLoads() -> bool;
|
||||
@ -110,25 +110,25 @@ class Media {
|
||||
// Get system assets.
|
||||
auto GetTexture(SystemTextureID id) -> TextureData* {
|
||||
BA_PRECONDITION_FATAL(system_media_loaded_); // Revert to assert later.
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(static_cast<size_t>(id) < system_textures_.size());
|
||||
return system_textures_[static_cast<int>(id)].get();
|
||||
}
|
||||
auto GetCubeMapTexture(SystemCubeMapTextureID id) -> TextureData* {
|
||||
BA_PRECONDITION_FATAL(system_media_loaded_); // Revert to assert later.
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(static_cast<size_t>(id) < system_cube_map_textures_.size());
|
||||
return system_cube_map_textures_[static_cast<int>(id)].get();
|
||||
}
|
||||
auto GetSound(SystemSoundID id) -> SoundData* {
|
||||
BA_PRECONDITION_FATAL(system_media_loaded_); // Revert to assert later.
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(static_cast<size_t>(id) < system_sounds_.size());
|
||||
return system_sounds_[static_cast<int>(id)].get();
|
||||
}
|
||||
auto GetModel(SystemModelID id) -> ModelData* {
|
||||
BA_PRECONDITION_FATAL(system_media_loaded_); // Revert to assert later.
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(static_cast<size_t>(id) < system_models_.size());
|
||||
return system_models_[static_cast<int>(id)].get();
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ struct Networking::ScanResultsEntryPriv {
|
||||
};
|
||||
|
||||
Networking::Networking() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
Resume();
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ Networking::~Networking() = default;
|
||||
// non-blocking mode they're still blocking for 3-4ms sometimes. But for now
|
||||
// since this is only used minimally and only while in the UI i guess it's ok.
|
||||
void Networking::HostScanCycle() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// We need to create a scanner socket - an ipv4 socket we can send out
|
||||
// broadcast messages from.
|
||||
|
||||
@ -222,7 +222,7 @@ void TelnetServer::PushPrint(const std::string& s) {
|
||||
void TelnetServer::Print(const std::string& s) {
|
||||
// Currently we make the assumption that *only* the game thread writes to our
|
||||
// socket.
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (client_sd_ != -1) {
|
||||
send(client_sd_, s.c_str(),
|
||||
static_cast_check_fit<socket_send_length_t>(s.size()), 0);
|
||||
|
||||
@ -678,7 +678,7 @@ void Platform::CreateApp() {
|
||||
}
|
||||
|
||||
auto Platform::CreateGraphics() -> Graphics* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
#if BA_VR_BUILD
|
||||
return new VRGraphics();
|
||||
#else
|
||||
|
||||
@ -64,7 +64,7 @@ auto PythonClassActivityData::tp_new(PyTypeObject* type, PyObject* args,
|
||||
reinterpret_cast<PythonClassActivityData*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -81,7 +81,7 @@ void PythonClassActivityData::tp_dealloc(PythonClassActivityData* self) {
|
||||
|
||||
// These have to be destructed in the game thread; send them along to
|
||||
// it if need be; otherwise do it immediately.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::WeakRef<HostActivity>* h = self->host_activity_;
|
||||
g_game->PushCall([h] { delete h; });
|
||||
} else {
|
||||
|
||||
@ -66,7 +66,7 @@ auto PythonClassCollideModel::tp_new(PyTypeObject* type, PyObject* args,
|
||||
reinterpret_cast<PythonClassCollideModel*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -87,7 +87,7 @@ auto PythonClassCollideModel::tp_new(PyTypeObject* type, PyObject* args,
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
void PythonClassCollideModel::Delete(Object::Ref<CollideModel>* ref) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
// if we're the py-object for a collide_model, clear them out
|
||||
// (FIXME - we should pass the old pointer in here to sanity-test that we
|
||||
// were their ref)
|
||||
@ -101,7 +101,7 @@ void PythonClassCollideModel::tp_dealloc(PythonClassCollideModel* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// these have to be deleted in the game thread - send the ptr along if need
|
||||
// be; otherwise do it immediately
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::Ref<CollideModel>* c = self->collide_model_;
|
||||
g_game->PushCall([c] { Delete(c); });
|
||||
} else {
|
||||
|
||||
@ -132,7 +132,7 @@ auto PythonClassContext::tp_new(PyTypeObject* type, PyObject* args,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -184,7 +184,7 @@ void PythonClassContext::tp_dealloc(PythonClassContext* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// Contexts have to be deleted in the game thread;
|
||||
// ship them to it for deletion if need be; otherwise do it immediately.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Context* c = self->context_;
|
||||
Context* c2 = self->context_prev_;
|
||||
g_game->PushCall([c, c2] {
|
||||
|
||||
@ -98,7 +98,7 @@ auto PythonClassContextCall::tp_new(PyTypeObject* type, PyObject* args,
|
||||
// something goes wrong afterwards
|
||||
PyObject* source_obj = Py_None;
|
||||
if (!PyArg_ParseTuple(args, "O", &source_obj)) return nullptr;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -115,7 +115,7 @@ void PythonClassContextCall::tp_dealloc(PythonClassContextCall* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// these have to be deleted in the game thread - send the ptr along if need
|
||||
// be; otherwise do it immediately
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::Ref<PythonContextCall>* c = self->context_call_;
|
||||
g_game->PushCall([c] { delete c; });
|
||||
} else {
|
||||
|
||||
@ -63,7 +63,7 @@ auto PythonClassData::tp_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
|
||||
auto* self = reinterpret_cast<PythonClassData*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -83,7 +83,7 @@ auto PythonClassData::tp_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
void PythonClassData::Delete(Object::Ref<Data>* ref) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// if we're the py-object for a data, clear them out
|
||||
// (FIXME - wej should pass the old pointer in here to sanity-test that we
|
||||
@ -98,7 +98,7 @@ void PythonClassData::tp_dealloc(PythonClassData* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// these have to be deleted in the game thread - send the ptr along if need
|
||||
// be; otherwise do it immediately
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::Ref<Data>* s = self->data_;
|
||||
g_game->PushCall([s] { Delete(s); });
|
||||
} else {
|
||||
|
||||
@ -122,7 +122,7 @@ auto PythonClassInputDevice::tp_new(PyTypeObject* type, PyObject* args,
|
||||
reinterpret_cast<PythonClassInputDevice*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -140,7 +140,7 @@ void PythonClassInputDevice::tp_dealloc(PythonClassInputDevice* self) {
|
||||
// need be.
|
||||
// FIXME: Technically the main thread has a pointer to a dead PyObject
|
||||
// until the delete goes through; could that ever be a problem?
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::WeakRef<InputDevice>* d = self->input_device_;
|
||||
g_game->PushCall([d] { delete d; });
|
||||
} else {
|
||||
@ -347,7 +347,7 @@ auto PythonClassInputDevice::GetAxisName(PythonClassInputDevice* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
int id;
|
||||
static const char* kwlist[] = {"axis_id", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "i",
|
||||
@ -366,7 +366,7 @@ auto PythonClassInputDevice::GetButtonName(PythonClassInputDevice* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
int id{};
|
||||
static const char* kwlist[] = {"button_id", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "i",
|
||||
|
||||
@ -88,7 +88,7 @@ auto PythonClassMaterial::tp_new(PyTypeObject* type, PyObject* args,
|
||||
|
||||
// Do anything that might throw an exception *before* our placement-new
|
||||
// stuff so we don't have to worry about cleaning it up on errors.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -130,7 +130,7 @@ auto PythonClassMaterial::tp_new(PyTypeObject* type, PyObject* args,
|
||||
}
|
||||
|
||||
void PythonClassMaterial::Delete(Object::Ref<Material>* m) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// If we're the py-object for a material, clear them out.
|
||||
if (m->exists()) {
|
||||
@ -145,7 +145,7 @@ void PythonClassMaterial::tp_dealloc(PythonClassMaterial* self) {
|
||||
|
||||
// These have to be deleted in the game thread - push a call if
|
||||
// need be.. otherwise do it immediately.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::Ref<Material>* ptr = self->material_;
|
||||
g_game->PushCall([ptr] { Delete(ptr); });
|
||||
} else {
|
||||
@ -229,7 +229,7 @@ auto PythonClassMaterial::Dir(PythonClassMaterial* self) -> PyObject* {
|
||||
auto PythonClassMaterial::AddActions(PythonClassMaterial* self, PyObject* args,
|
||||
PyObject* keywds) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* conditions_obj{Py_None};
|
||||
PyObject* actions_obj{nullptr};
|
||||
const char* kwlist[] = {"actions", "conditions", nullptr};
|
||||
@ -430,7 +430,7 @@ PyMethodDef PythonClassMaterial::tp_methods[] = {
|
||||
|
||||
void DoAddConditions(PyObject* cond_obj,
|
||||
Object::Ref<MaterialConditionNode>* c) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (PyTuple_Check(cond_obj)) {
|
||||
Py_ssize_t size = PyTuple_GET_SIZE(cond_obj);
|
||||
if (size < 1) {
|
||||
@ -560,7 +560,7 @@ void DoAddConditions(PyObject* cond_obj,
|
||||
|
||||
void DoAddAction(PyObject* actions_obj,
|
||||
std::vector<Object::Ref<MaterialAction> >* actions) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!PyTuple_Check(actions_obj)) {
|
||||
throw Exception("Expected a tuple.", PyExcType::kType);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ auto PythonClassModel::tp_new(PyTypeObject* type, PyObject* args,
|
||||
auto* self = reinterpret_cast<PythonClassModel*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -84,7 +84,7 @@ auto PythonClassModel::tp_new(PyTypeObject* type, PyObject* args,
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
void PythonClassModel::Delete(Object::Ref<Model>* ref) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// if we're the py-object for a model, clear them out
|
||||
// (FIXME - we should pass the old pointer in here to sanity-test that we
|
||||
@ -99,7 +99,7 @@ void PythonClassModel::tp_dealloc(PythonClassModel* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// these have to be deleted in the game thread - send the ptr along if need
|
||||
// be; otherwise do it immediately
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::Ref<Model>* m = self->model_;
|
||||
g_game->PushCall([m] { Delete(m); });
|
||||
} else {
|
||||
|
||||
@ -83,7 +83,7 @@ auto PythonClassNode::tp_new(PyTypeObject* type, PyObject* args,
|
||||
auto* self = reinterpret_cast<PythonClassNode*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -111,7 +111,7 @@ void PythonClassNode::tp_dealloc(PythonClassNode* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// These have to be deleted in the game thread; send the ptr along if need
|
||||
// be; otherwise do it immediately.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::WeakRef<Node>* n = self->node_;
|
||||
g_game->PushCall([n] { delete n; });
|
||||
} else {
|
||||
|
||||
@ -61,7 +61,7 @@ auto PythonClassSessionData::tp_new(PyTypeObject* type, PyObject* args,
|
||||
reinterpret_cast<PythonClassSessionData*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -79,7 +79,7 @@ void PythonClassSessionData::tp_dealloc(PythonClassSessionData* self) {
|
||||
// ...send the ptr along if need be.
|
||||
// FIXME: technically the main thread has a pointer to a dead PyObject
|
||||
// until the delete goes through; could that ever be a problem?
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::WeakRef<Session>* s = self->session_;
|
||||
g_game->PushCall([s] { delete s; });
|
||||
} else {
|
||||
|
||||
@ -153,7 +153,7 @@ auto PythonClassSessionPlayer::tp_new(PyTypeObject* type, PyObject* args,
|
||||
reinterpret_cast<PythonClassSessionPlayer*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -185,7 +185,7 @@ void PythonClassSessionPlayer::tp_dealloc(PythonClassSessionPlayer* self) {
|
||||
|
||||
// These have to be deleted in the game thread - send the ptr along if need
|
||||
// be; otherwise do it immediately.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::WeakRef<Player>* p = self->player_;
|
||||
g_game->PushCall([p] { delete p; });
|
||||
} else {
|
||||
@ -199,7 +199,7 @@ auto PythonClassSessionPlayer::tp_getattro(PythonClassSessionPlayer* self,
|
||||
PyObject* attr) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Assuming this will always be a str?
|
||||
assert(PyUnicode_Check(attr));
|
||||
@ -336,7 +336,7 @@ auto PythonClassSessionPlayer::GetName(PythonClassSessionPlayer* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
int full = false;
|
||||
int icon = true;
|
||||
static const char* kwlist[] = {"full", "icon", nullptr};
|
||||
@ -356,7 +356,7 @@ auto PythonClassSessionPlayer::GetName(PythonClassSessionPlayer* self,
|
||||
auto PythonClassSessionPlayer::Exists(PythonClassSessionPlayer* self)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (self->player_->exists()) {
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
@ -368,7 +368,7 @@ auto PythonClassSessionPlayer::SetName(PythonClassSessionPlayer* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* name_obj;
|
||||
PyObject* full_name_obj = Py_None;
|
||||
|
||||
@ -395,7 +395,7 @@ auto PythonClassSessionPlayer::SetName(PythonClassSessionPlayer* self,
|
||||
auto PythonClassSessionPlayer::ResetInput(PythonClassSessionPlayer* self)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
Player* p = self->player_->get();
|
||||
if (!p) {
|
||||
throw Exception(PyExcType::kSessionPlayerNotFound);
|
||||
@ -409,7 +409,7 @@ auto PythonClassSessionPlayer::AssignInputCall(PythonClassSessionPlayer* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* input_type_obj;
|
||||
PyObject* call_obj;
|
||||
static const char* kwlist[] = {"type", "call", nullptr};
|
||||
@ -449,7 +449,7 @@ auto PythonClassSessionPlayer::AssignInputCall(PythonClassSessionPlayer* self,
|
||||
auto PythonClassSessionPlayer::RemoveFromGame(PythonClassSessionPlayer* self)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
Player* player = self->player_->get();
|
||||
if (!player) {
|
||||
throw Exception(PyExcType::kSessionPlayerNotFound);
|
||||
@ -468,7 +468,7 @@ auto PythonClassSessionPlayer::RemoveFromGame(PythonClassSessionPlayer* self)
|
||||
auto PythonClassSessionPlayer::GetTeam(PythonClassSessionPlayer* self)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
Player* p = self->player_->get();
|
||||
if (!p) {
|
||||
throw Exception(PyExcType::kSessionPlayerNotFound);
|
||||
@ -484,7 +484,7 @@ auto PythonClassSessionPlayer::GetTeam(PythonClassSessionPlayer* self)
|
||||
auto PythonClassSessionPlayer::GetV1AccountID(PythonClassSessionPlayer* self)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
Player* p = self->player_->get();
|
||||
if (!p) {
|
||||
throw Exception(PyExcType::kSessionPlayerNotFound);
|
||||
@ -501,7 +501,7 @@ auto PythonClassSessionPlayer::SetData(PythonClassSessionPlayer* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* team_obj;
|
||||
PyObject* character_obj;
|
||||
PyObject* color_obj;
|
||||
@ -529,7 +529,7 @@ auto PythonClassSessionPlayer::SetData(PythonClassSessionPlayer* self,
|
||||
auto PythonClassSessionPlayer::GetIconInfo(PythonClassSessionPlayer* self)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
Player* p = self->player_->get();
|
||||
if (!p) {
|
||||
throw Exception(PyExcType::kSessionPlayerNotFound);
|
||||
@ -547,7 +547,7 @@ auto PythonClassSessionPlayer::SetIconInfo(PythonClassSessionPlayer* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* texture_name_obj;
|
||||
PyObject* tint_texture_name_obj;
|
||||
PyObject* tint_color_obj;
|
||||
@ -582,7 +582,7 @@ auto PythonClassSessionPlayer::SetActivity(PythonClassSessionPlayer* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* activity_obj;
|
||||
static const char* kwlist[] = {"activity", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "O",
|
||||
@ -608,7 +608,7 @@ auto PythonClassSessionPlayer::SetNode(PythonClassSessionPlayer* self,
|
||||
PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* node_obj;
|
||||
static const char* kwlist[] = {"node", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "O",
|
||||
@ -634,7 +634,7 @@ auto PythonClassSessionPlayer::SetNode(PythonClassSessionPlayer* self,
|
||||
auto PythonClassSessionPlayer::GetIcon(PythonClassSessionPlayer* self)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
Player* p = self->player_->get();
|
||||
if (!p) {
|
||||
throw Exception(PyExcType::kSessionPlayerNotFound);
|
||||
|
||||
@ -63,7 +63,7 @@ auto PythonClassSound::tp_new(PyTypeObject* type, PyObject* args,
|
||||
auto* self = reinterpret_cast<PythonClassSound*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -83,7 +83,7 @@ auto PythonClassSound::tp_new(PyTypeObject* type, PyObject* args,
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
void PythonClassSound::Delete(Object::Ref<Sound>* ref) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// if we're the py-object for a sound, clear them out
|
||||
// (FIXME - wej should pass the old pointer in here to sanity-test that we
|
||||
@ -98,7 +98,7 @@ void PythonClassSound::tp_dealloc(PythonClassSound* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// these have to be deleted in the game thread - send the ptr along if need
|
||||
// be; otherwise do it immediately
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::Ref<Sound>* s = self->sound_;
|
||||
g_game->PushCall([s] { Delete(s); });
|
||||
} else {
|
||||
|
||||
@ -58,7 +58,7 @@ auto PythonClassTexture::tp_new(PyTypeObject* type, PyObject* args,
|
||||
auto* self = reinterpret_cast<PythonClassTexture*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -76,7 +76,7 @@ auto PythonClassTexture::tp_new(PyTypeObject* type, PyObject* args,
|
||||
}
|
||||
|
||||
void PythonClassTexture::Delete(Object::Ref<Texture>* ref) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// If we're the py-object for a texture, kill our reference to it.
|
||||
// (FIXME - we should pass the old py obj pointer in here to
|
||||
@ -91,7 +91,7 @@ void PythonClassTexture::tp_dealloc(PythonClassTexture* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// These have to be deleted in the game thread - send the ptr along if need
|
||||
// be; otherwise do it immediately.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::Ref<Texture>* t = self->texture_;
|
||||
g_game->PushCall([t] { Delete(t); });
|
||||
} else {
|
||||
|
||||
@ -72,7 +72,7 @@ auto PythonClassTimer::tp_new(PyTypeObject* type, PyObject* args,
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -148,7 +148,7 @@ auto PythonClassTimer::tp_new(PyTypeObject* type, PyObject* args,
|
||||
}
|
||||
void PythonClassTimer::DoDelete(bool have_timer, TimeType time_type,
|
||||
int timer_id, Context* context) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
@ -161,7 +161,7 @@ void PythonClassTimer::DoDelete(bool have_timer, TimeType time_type,
|
||||
void PythonClassTimer::tp_dealloc(PythonClassTimer* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// These have to be deleted in the game thread.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
auto a0 = self->have_timer_;
|
||||
auto a1 = self->time_type_;
|
||||
auto a2 = self->timer_id_;
|
||||
|
||||
@ -73,7 +73,7 @@ auto PythonClassWidget::tp_new(PyTypeObject* type, PyObject* args,
|
||||
auto* self = reinterpret_cast<PythonClassWidget*>(type->tp_alloc(type, 0));
|
||||
if (self) {
|
||||
BA_PYTHON_TRY;
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception(
|
||||
"ERROR: " + std::string(type_obj.tp_name)
|
||||
+ " objects must only be created in the game thread (current is ("
|
||||
@ -89,7 +89,7 @@ void PythonClassWidget::tp_dealloc(PythonClassWidget* self) {
|
||||
BA_PYTHON_TRY;
|
||||
// these have to be destructed in the game thread - send them along to it if
|
||||
// need be
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Object::WeakRef<Widget>* w = self->widget_;
|
||||
g_game->PushCall([w] { delete w; });
|
||||
} else {
|
||||
|
||||
@ -130,7 +130,7 @@ auto PyNewReplaySession(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
auto PyIsInReplay(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
static const char* kwlist[] = {nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "",
|
||||
const_cast<char**>(kwlist))) {
|
||||
@ -147,7 +147,7 @@ auto PyIsInReplay(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
auto PyRegisterSession(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* session_obj;
|
||||
static const char* kwlist[] = {"session", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "O",
|
||||
@ -169,7 +169,7 @@ auto PyRegisterSession(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
auto PyRegisterActivity(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* activity_obj;
|
||||
static const char* kwlist[] = {"activity", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "O",
|
||||
@ -197,7 +197,7 @@ auto PyGetForegroundHostSession(PyObject* self, PyObject* args,
|
||||
}
|
||||
|
||||
// Note: we return None if not in the game thread.
|
||||
HostSession* s = InGameThread()
|
||||
HostSession* s = InLogicThread()
|
||||
? g_game->GetForegroundContext().GetHostSession()
|
||||
: nullptr;
|
||||
if (s != nullptr) {
|
||||
@ -259,7 +259,7 @@ auto PyGetActivity(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
}
|
||||
|
||||
// Fail gracefully if called from outside the game thread.
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@ -293,8 +293,8 @@ auto PyPushCall(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
|
||||
if (from_other_thread) {
|
||||
// Warn the user not to use this from the game thread since it doesnt
|
||||
// save/restore context.
|
||||
if (!suppress_warning && InGameThread()) {
|
||||
g_python->IssueCallInGameThreadWarning(call_obj);
|
||||
if (!suppress_warning && InLogicThread()) {
|
||||
g_python->IssueCallInLogicThreadWarning(call_obj);
|
||||
}
|
||||
|
||||
// This gets called from other python threads so we can't construct
|
||||
@ -304,7 +304,7 @@ auto PyPushCall(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
|
||||
Py_INCREF(call_obj);
|
||||
g_game->PushPythonRawCallable(call_obj);
|
||||
} else {
|
||||
if (!InGameThread()) {
|
||||
if (!InLogicThread()) {
|
||||
throw Exception("You must use from_other_thread mode.");
|
||||
}
|
||||
g_game->PushPythonCall(Object::New<PythonContextCall>(call_obj));
|
||||
@ -361,7 +361,7 @@ auto PyTime(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
|
||||
|
||||
auto PyTimer(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
PyObject* length_obj;
|
||||
int64_t length;
|
||||
|
||||
@ -182,7 +182,7 @@ auto PyGetCollisionInfo(PyObject* self, PyObject* args) -> PyObject* {
|
||||
auto PyCameraShake(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
float intensity = 1.0f;
|
||||
static const char* kwlist[] = {"intensity", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|f",
|
||||
@ -198,7 +198,7 @@ auto PyPlaySound(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
PyObject* sound_obj;
|
||||
float volume = 1.0f;
|
||||
int host_only = 0;
|
||||
@ -253,7 +253,7 @@ auto PyEmitFx(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
|
||||
const char* chunk_type_str = "rock";
|
||||
const char* emit_type_str = "chunks";
|
||||
const char* tendril_type_str = "smoke";
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!PyArg_ParseTupleAndKeywords(
|
||||
args, keywds, "O|Oiffsss", const_cast<char**>(kwlist), &pos_obj,
|
||||
&vel_obj, &count, &scale, &spread, &chunk_type_str, &emit_type_str,
|
||||
@ -361,7 +361,7 @@ auto PySetMapBounds(PyObject* self, PyObject* args) -> PyObject* {
|
||||
throw Exception(PyExcType::kContext);
|
||||
}
|
||||
float xmin, ymin, zmin, xmax, ymax, zmax;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!PyArg_ParseTuple(args, "(ffffff)", &xmin, &ymin, &zmin, &xmax, &ymax,
|
||||
&zmax)) {
|
||||
return nullptr;
|
||||
@ -381,7 +381,7 @@ auto PyGetForegroundHostActivity(PyObject* self, PyObject* args,
|
||||
}
|
||||
|
||||
// Note: we return None if not in the game thread.
|
||||
HostActivity* h = InGameThread()
|
||||
HostActivity* h = InLogicThread()
|
||||
? g_game->GetForegroundContext().GetHostActivity()
|
||||
: nullptr;
|
||||
if (h != nullptr) {
|
||||
@ -396,7 +396,7 @@ auto PyGetForegroundHostActivity(PyObject* self, PyObject* args,
|
||||
auto PyGetGameRoster(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
static const char* kwlist[] = {nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "",
|
||||
const_cast<char**>(kwlist))) {
|
||||
|
||||
@ -56,7 +56,7 @@ auto PySetTouchscreenEditing(PyObject* self, PyObject* args) -> PyObject* {
|
||||
|
||||
auto PyCaptureGamePadInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_python);
|
||||
PyObject* obj;
|
||||
if (!PyArg_ParseTuple(args, "O", &obj)) {
|
||||
@ -69,7 +69,7 @@ auto PyCaptureGamePadInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
|
||||
auto PyReleaseGamePadInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_python);
|
||||
g_python->ReleaseGamePadInput();
|
||||
Py_RETURN_NONE;
|
||||
@ -78,7 +78,7 @@ auto PyReleaseGamePadInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
|
||||
auto PyCaptureKeyboardInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!g_python) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -93,7 +93,7 @@ auto PyCaptureKeyboardInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
|
||||
auto PyReleaseKeyboardInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!g_python) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -104,7 +104,7 @@ auto PyReleaseKeyboardInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
|
||||
auto PyLockAllInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_input);
|
||||
g_input->LockAllInput(false, Python::GetPythonFileLocation());
|
||||
Py_RETURN_NONE;
|
||||
@ -113,7 +113,7 @@ auto PyLockAllInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
|
||||
auto PyUnlockAllInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_input);
|
||||
g_input->UnlockAllInput(false, Python::GetPythonFileLocation());
|
||||
Py_RETURN_NONE;
|
||||
@ -123,7 +123,7 @@ auto PyUnlockAllInput(PyObject* self, PyObject* args) -> PyObject* {
|
||||
auto PyGetUIInputDevice(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
static const char* kwlist[] = {nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "",
|
||||
const_cast<char**>(kwlist))) {
|
||||
@ -141,7 +141,7 @@ auto PyGetUIInputDevice(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
auto PySetUIInputDevice(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
static const char* kwlist[] = {"input", nullptr};
|
||||
PyObject* input_device_obj = Py_None;
|
||||
if (!PyArg_ParseTupleAndKeywords(
|
||||
@ -159,7 +159,7 @@ auto PySetUIInputDevice(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
auto PyGetInputDevice(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
const char* name;
|
||||
const char* unique_id;
|
||||
int doraise = true;
|
||||
|
||||
@ -336,7 +336,7 @@ auto PySetMasterServerSource(PyObject* self, PyObject* args) -> PyObject* {
|
||||
auto PySetTelnetAccessEnabled(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
int enable;
|
||||
static const char* kwlist[] = {"enable", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "p",
|
||||
|
||||
@ -97,7 +97,7 @@ auto PyIsRunningOnFireTV(PyObject* self, PyObject* args) -> PyObject* {
|
||||
auto PyHavePermission(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
Permission permission;
|
||||
PyObject* permission_obj;
|
||||
static const char* kwlist[] = {"permission", nullptr};
|
||||
@ -118,7 +118,7 @@ auto PyHavePermission(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
auto PyRequestPermission(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
Permission permission;
|
||||
PyObject* permission_obj;
|
||||
static const char* kwlist[] = {"permission", nullptr};
|
||||
@ -134,7 +134,7 @@ auto PyRequestPermission(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
BA_PYTHON_CATCH;
|
||||
}
|
||||
|
||||
auto PyInGameThread(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
auto PyInLogicThread(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
static const char* kwlist[] = {nullptr};
|
||||
@ -142,7 +142,7 @@ auto PyInGameThread(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
const_cast<char**>(kwlist))) {
|
||||
return nullptr;
|
||||
}
|
||||
if (InGameThread()) {
|
||||
if (InLogicThread()) {
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
Py_RETURN_FALSE;
|
||||
@ -1052,9 +1052,9 @@ auto PythonMethodsSystem::GetMethods() -> std::vector<PyMethodDef> {
|
||||
"available). Thread names are only for debugging and should not be\n"
|
||||
"used in logic, as naming behavior can vary across platforms.\n"},
|
||||
|
||||
{"in_game_thread", (PyCFunction)PyInGameThread,
|
||||
{"in_logic_thread", (PyCFunction)PyInLogicThread,
|
||||
METH_VARARGS | METH_KEYWORDS,
|
||||
"in_game_thread() -> bool\n"
|
||||
"in_logic_thread() -> bool\n"
|
||||
"\n"
|
||||
"(internal)\n"
|
||||
"\n"
|
||||
|
||||
@ -1841,7 +1841,7 @@ auto PyFocusWindow(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
const_cast<char**>(kwlist))) {
|
||||
return nullptr;
|
||||
}
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
#if BA_OSTYPE_MACOS && BA_XCODE_BUILD && !BA_HEADLESS_BUILD \
|
||||
&& !BA_XCODE_NEW_PROJECT
|
||||
SDL_ericf_focus();
|
||||
@ -1898,7 +1898,7 @@ auto PyFadeScreen(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
|
||||
auto PyShowAd(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
const char* purpose;
|
||||
PyObject* on_completion_call_obj = Py_None;
|
||||
int pass_actually_showed = false;
|
||||
@ -1928,7 +1928,7 @@ auto PyShowAd(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
|
||||
auto PyShowAd2(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
const char* purpose;
|
||||
PyObject* on_completion_call_obj = Py_None;
|
||||
int pass_actually_showed = true;
|
||||
@ -2040,7 +2040,7 @@ auto PyGetChatMessages(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
static const char* kwlist[] = {nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "",
|
||||
const_cast<char**>(kwlist))) {
|
||||
@ -2114,7 +2114,7 @@ auto PyCanShowAd(PyObject* self, PyObject* args, PyObject* keywds)
|
||||
-> PyObject* {
|
||||
BA_PYTHON_TRY;
|
||||
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
// if we've got any network connections, no ads..
|
||||
// (don't want to make someone on the other end wait or risk disconnecting
|
||||
// them or whatnot) also disallow ads if remote apps are connected; at least
|
||||
|
||||
@ -852,7 +852,7 @@ auto Python::GetPyVector3f(PyObject* o) -> Vector3f {
|
||||
Python::Python() = default;
|
||||
|
||||
void Python::Reset(bool do_init) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(g_python);
|
||||
|
||||
bool was_inited = inited_;
|
||||
@ -1149,7 +1149,7 @@ auto Python::GetTranslation(const char* category, const char* s)
|
||||
}
|
||||
|
||||
void Python::RunDeepLink(const std::string& url) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (objexists(ObjID::kDeepLinkCall)) {
|
||||
ScopedSetContext cp(g_game->GetUIContext());
|
||||
PythonRef args(Py_BuildValue("(s)", url.c_str()), PythonRef::kSteal);
|
||||
@ -1160,7 +1160,7 @@ void Python::RunDeepLink(const std::string& url) {
|
||||
}
|
||||
|
||||
void Python::PlayMusic(const std::string& music_type, bool continuous) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (music_type.empty()) {
|
||||
PythonRef args(
|
||||
Py_BuildValue("(OO)", Py_None, continuous ? Py_True : Py_False),
|
||||
@ -1992,7 +1992,7 @@ auto Python::GetNodeAttr(Node* node, const char* attr_name) -> PyObject* {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Python::IssueCallInGameThreadWarning(PyObject* call_obj) {
|
||||
void Python::IssueCallInLogicThreadWarning(PyObject* call_obj) {
|
||||
Log("WARNING: ba.pushcall() called from the game thread with "
|
||||
"from_other_thread set to true (call "
|
||||
+ ObjToString(call_obj) + " at " + GetPythonFileLocation()
|
||||
@ -2000,7 +2000,7 @@ void Python::IssueCallInGameThreadWarning(PyObject* call_obj) {
|
||||
}
|
||||
|
||||
void Python::LaunchStringEdit(TextWidget* w) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
BA_PRECONDITION(w);
|
||||
|
||||
ScopedSetContext cp(g_game->GetUIContext());
|
||||
@ -2016,7 +2016,7 @@ void Python::LaunchStringEdit(TextWidget* w) {
|
||||
}
|
||||
|
||||
void Python::CaptureGamePadInput(PyObject* obj) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
ReleaseGamePadInput();
|
||||
if (PyCallable_Check(obj)) {
|
||||
game_pad_call_.Acquire(obj);
|
||||
@ -2028,7 +2028,7 @@ void Python::CaptureGamePadInput(PyObject* obj) {
|
||||
void Python::ReleaseGamePadInput() { game_pad_call_.Release(); }
|
||||
|
||||
void Python::CaptureKeyboardInput(PyObject* obj) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
ReleaseKeyboardInput();
|
||||
if (PyCallable_Check(obj)) {
|
||||
keyboard_call_.Acquire(obj);
|
||||
@ -2073,7 +2073,7 @@ void Python::HandleFriendScoresCB(const FriendScoreSet& score_set) {
|
||||
}
|
||||
|
||||
auto Python::HandleKeyPressEvent(const SDL_Keysym& keysym) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!keyboard_call_.exists()) {
|
||||
return false;
|
||||
}
|
||||
@ -2088,7 +2088,7 @@ auto Python::HandleKeyPressEvent(const SDL_Keysym& keysym) -> bool {
|
||||
return true;
|
||||
}
|
||||
auto Python::HandleKeyReleaseEvent(const SDL_Keysym& keysym) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (!keyboard_call_.exists()) {
|
||||
return false;
|
||||
}
|
||||
@ -2104,7 +2104,7 @@ auto Python::HandleKeyReleaseEvent(const SDL_Keysym& keysym) -> bool {
|
||||
|
||||
auto Python::HandleJoystickEvent(const SDL_Event& event,
|
||||
InputDevice* input_device) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(input_device != nullptr);
|
||||
if (!game_pad_call_.exists()) {
|
||||
return false;
|
||||
@ -2208,21 +2208,21 @@ auto Python::GetContextBaseString() -> std::string {
|
||||
}
|
||||
|
||||
void Python::LogContextForCallableLabel(const char* label) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(label);
|
||||
std::string s = std::string(" root call: ") + label;
|
||||
s += g_python->GetContextBaseString();
|
||||
Log(s);
|
||||
}
|
||||
|
||||
void Python::LogContextNonGameThread() {
|
||||
void Python::LogContextNonLogicThread() {
|
||||
std::string s =
|
||||
std::string(" root call: <not in game thread; context unavailable>");
|
||||
Log(s);
|
||||
}
|
||||
|
||||
void Python::LogContextEmpty() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
std::string s = std::string(" root call: <unavailable>");
|
||||
s += g_python->GetContextBaseString();
|
||||
Log(s);
|
||||
@ -2232,8 +2232,8 @@ void Python::LogContextAuto() {
|
||||
// Lets print whatever context info is available.
|
||||
// FIXME: If we have recursive calls this may not print
|
||||
// the context we'd expect; we'd need a unified stack.
|
||||
if (!InGameThread()) {
|
||||
LogContextNonGameThread();
|
||||
if (!InLogicThread()) {
|
||||
LogContextNonLogicThread();
|
||||
} else if (const char* label = ScopedCallLabel::current_label()) {
|
||||
LogContextForCallableLabel(label);
|
||||
} else if (PythonCommand* cmd = PythonCommand::current_command()) {
|
||||
@ -2402,7 +2402,7 @@ void Python::StoreObjCallable(ObjID id, const char* expr, PyObject* context) {
|
||||
}
|
||||
|
||||
void Python::SetRawConfigValue(const char* name, float value) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(objexists(ObjID::kConfig));
|
||||
PythonRef value_obj(PyFloat_FromDouble(value), PythonRef::kSteal);
|
||||
int result =
|
||||
@ -2416,14 +2416,14 @@ void Python::SetRawConfigValue(const char* name, float value) {
|
||||
}
|
||||
|
||||
auto Python::GetRawConfigValue(const char* name) -> PyObject* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(objexists(ObjID::kConfig));
|
||||
return PyDict_GetItemString(obj(ObjID::kConfig).get(), name);
|
||||
}
|
||||
|
||||
auto Python::GetRawConfigValue(const char* name, const char* default_value)
|
||||
-> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(objexists(ObjID::kConfig));
|
||||
PyObject* value = PyDict_GetItemString(obj(ObjID::kConfig).get(), name);
|
||||
if (value == nullptr || !PyUnicode_Check(value)) {
|
||||
@ -2433,7 +2433,7 @@ auto Python::GetRawConfigValue(const char* name, const char* default_value)
|
||||
}
|
||||
|
||||
auto Python::GetRawConfigValue(const char* name, float default_value) -> float {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(objexists(ObjID::kConfig));
|
||||
PyObject* value = PyDict_GetItemString(obj(ObjID::kConfig).get(), name);
|
||||
if (value == nullptr) {
|
||||
@ -2450,7 +2450,7 @@ auto Python::GetRawConfigValue(const char* name, float default_value) -> float {
|
||||
auto Python::GetRawConfigValue(const char* name,
|
||||
std::optional<float> default_value)
|
||||
-> std::optional<float> {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(objexists(ObjID::kConfig));
|
||||
PyObject* value = PyDict_GetItemString(obj(ObjID::kConfig).get(), name);
|
||||
if (value == nullptr) {
|
||||
@ -2468,7 +2468,7 @@ auto Python::GetRawConfigValue(const char* name,
|
||||
}
|
||||
|
||||
auto Python::GetRawConfigValue(const char* name, int default_value) -> int {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(objexists(ObjID::kConfig));
|
||||
PyObject* value = PyDict_GetItemString(obj(ObjID::kConfig).get(), name);
|
||||
if (value == nullptr) {
|
||||
@ -2483,7 +2483,7 @@ auto Python::GetRawConfigValue(const char* name, int default_value) -> int {
|
||||
}
|
||||
|
||||
auto Python::GetRawConfigValue(const char* name, bool default_value) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(objexists(ObjID::kConfig));
|
||||
PyObject* value = PyDict_GetItemString(obj(ObjID::kConfig).get(), name);
|
||||
if (value == nullptr) {
|
||||
@ -2549,7 +2549,7 @@ void Python::TimeFormatCheck(TimeFormat time_format, PyObject* length_obj) {
|
||||
|
||||
auto Python::ValidatedPackageAssetName(PyObject* package, const char* name)
|
||||
-> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
assert(objexists(ObjID::kAssetPackageClass));
|
||||
|
||||
if (!PyObject_IsInstance(package, obj(ObjID::kAssetPackageClass).get())) {
|
||||
|
||||
@ -78,7 +78,7 @@ class Python {
|
||||
static void LogContextForCallableLabel(const char* label);
|
||||
static void LogContextEmpty();
|
||||
static void LogContextAuto();
|
||||
static void LogContextNonGameThread();
|
||||
static void LogContextNonLogicThread();
|
||||
Python();
|
||||
~Python();
|
||||
|
||||
@ -105,7 +105,7 @@ class Python {
|
||||
void CaptureKeyboardInput(PyObject* obj);
|
||||
void ReleaseKeyboardInput();
|
||||
void HandleFriendScoresCB(const FriendScoreSet& ss);
|
||||
void IssueCallInGameThreadWarning(PyObject* call);
|
||||
void IssueCallInLogicThreadWarning(PyObject* call);
|
||||
|
||||
/// Borrowed from python's source code: used in overriding of objects' dir()
|
||||
/// results.
|
||||
|
||||
@ -13,7 +13,7 @@ namespace ballistica {
|
||||
PythonContextCall* PythonContextCall::current_call_ = nullptr;
|
||||
|
||||
PythonContextCall::PythonContextCall(PyObject* obj_in) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
// as a sanity test, store the current context ptr just to make sure it
|
||||
// hasn't changed when we run
|
||||
#if BA_DEBUG_BUILD
|
||||
@ -125,7 +125,7 @@ void PythonContextCall::Run(PyObject* args) {
|
||||
}
|
||||
|
||||
void PythonContextCall::LogContext() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
std::string s = std::string(" root call: ") + object().Str();
|
||||
s += ("\n root call origin: " + file_loc());
|
||||
s += g_python->GetContextBaseString();
|
||||
|
||||
@ -222,7 +222,7 @@ void Node::SetDelegate(PyObject* delegate_obj) {
|
||||
}
|
||||
|
||||
auto Node::GetPyRef(bool new_ref) -> PyObject* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (py_ref_ == nullptr) {
|
||||
py_ref_ = PythonClassNode::Create(this);
|
||||
}
|
||||
@ -353,7 +353,7 @@ void Node::DispatchImpactDamageMessage(float intensity) {
|
||||
}
|
||||
|
||||
void Node::DispatchUserMessage(PyObject* obj, const char* label) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (scene_->shutting_down()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ TimeDisplayNode::TimeDisplayNode(Scene* scene) : Node(scene, node_type) {}
|
||||
TimeDisplayNode::~TimeDisplayNode() = default;
|
||||
|
||||
auto TimeDisplayNode::GetOutput() -> std::string {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (translations_dirty_) {
|
||||
time_suffix_hours_ =
|
||||
g_game->CompileResourceString(R"({"r":"timeSuffixHoursText"})", "tda");
|
||||
|
||||
@ -314,21 +314,21 @@ void Scene::DeleteNode(Node* node) {
|
||||
}
|
||||
|
||||
void Scene::GraphicsQualityChanged(GraphicsQuality q) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
for (auto&& i : nodes_) {
|
||||
i->OnGraphicsQualityChanged(q);
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::ScreenSizeChanged() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
for (auto&& i : nodes_) {
|
||||
i->OnScreenSizeChange(); // New.
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::LanguageChanged() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
for (auto&& i : nodes_) {
|
||||
i->OnLanguageChange(); // New.
|
||||
}
|
||||
@ -344,7 +344,7 @@ auto Scene::GetNodeMessageFormat(NodeMessageType type) -> const char* {
|
||||
|
||||
auto Scene::NewNode(const std::string& type_string, const std::string& name,
|
||||
PyObject* delegate) -> Node* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Clion incorrectly things in_step_ will always be false.
|
||||
#pragma clang diagnostic push
|
||||
@ -373,7 +373,7 @@ auto Scene::NewNode(const std::string& type_string, const std::string& name,
|
||||
}
|
||||
|
||||
void Scene::Dump(GameStream* stream) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
stream->AddScene(this);
|
||||
|
||||
// If we're the foreground one, communicate that fact as well.
|
||||
|
||||
@ -21,7 +21,7 @@ const int kActivateKey1 = SDLK_BACKQUOTE;
|
||||
const int kActivateKey2 = SDLK_F2;
|
||||
|
||||
Console::Console() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
std::string title = std::string("BallisticaCore ") + kAppVersion + " ("
|
||||
+ std::to_string(kAppBuildNumber) + ")";
|
||||
if (g_buildconfig.debug_build()) {
|
||||
@ -45,7 +45,7 @@ Console::Console() {
|
||||
Console::~Console() = default;
|
||||
|
||||
auto Console::HandleKeyPress(const SDL_Keysym* keysym) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// Handle our toggle buttons no matter whether we're active.
|
||||
switch (keysym->sym) {
|
||||
@ -158,7 +158,7 @@ void Console::ToggleState() {
|
||||
}
|
||||
|
||||
auto Console::HandleTextEditing(const std::string& text) -> bool {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (state_ == State::kInactive) {
|
||||
return false;
|
||||
}
|
||||
@ -186,7 +186,7 @@ auto Console::HandleKeyRelease(const SDL_Keysym* keysym) -> bool {
|
||||
#pragma ide diagnostic ignored "LocalValueEscapesScope"
|
||||
|
||||
void Console::Print(const std::string& s_in) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
std::string s = Utils::GetValidUTF8(s_in.c_str(), "cspr");
|
||||
last_line_ += s;
|
||||
std::vector<std::string> broken_up;
|
||||
|
||||
@ -42,7 +42,7 @@ RootUI::RootUI() {
|
||||
RootUI::~RootUI() = default;
|
||||
|
||||
void RootUI::TogglePartyWindowKeyPress() {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
if (g_game->GetPartySize() > 1 || g_game->connections()->connection_to_host()
|
||||
|| always_draw_party_icon()) {
|
||||
ActivatePartyIcon();
|
||||
@ -50,7 +50,7 @@ void RootUI::TogglePartyWindowKeyPress() {
|
||||
}
|
||||
|
||||
void RootUI::ActivatePartyIcon() const {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
ScopedSetContext cp(g_game->GetUIContext());
|
||||
|
||||
// Originate from center of party icon. If menu button is shown, it is to the
|
||||
|
||||
@ -89,7 +89,7 @@ auto UI::IsWindowPresent() const -> bool {
|
||||
}
|
||||
|
||||
void UI::SetUIInputDevice(InputDevice* input_device) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
ui_input_device_ = input_device;
|
||||
|
||||
@ -99,7 +99,7 @@ void UI::SetUIInputDevice(InputDevice* input_device) {
|
||||
|
||||
UI::UILock::UILock(bool write) {
|
||||
assert(g_ui);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
if (write && g_ui->ui_lock_count_ != 0) {
|
||||
BA_LOG_ERROR_TRACE_ONCE("Illegal operation: UI is locked");
|
||||
@ -122,7 +122,7 @@ void UI::StepScene() {
|
||||
}
|
||||
|
||||
void UI::Update(millisecs_t time_advance) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
millisecs_t target_base_time = base_time_ + time_advance;
|
||||
while (!base_timers_.empty()
|
||||
@ -209,7 +209,7 @@ auto UI::ShouldShowButtonShortcuts() const -> bool {
|
||||
}
|
||||
|
||||
void UI::AddWidget(Widget* w, ContainerWidget* parent) {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
BA_PRECONDITION(parent != nullptr);
|
||||
|
||||
@ -249,13 +249,13 @@ void UI::ScreenSizeChanged() {
|
||||
}
|
||||
|
||||
auto UI::GetUIInputDevice() const -> InputDevice* {
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
return ui_input_device_.get();
|
||||
}
|
||||
|
||||
auto UI::GetWidgetForInput(InputDevice* input_device) -> Widget* {
|
||||
assert(input_device);
|
||||
assert(InGameThread());
|
||||
assert(InLogicThread());
|
||||
|
||||
// We only allow input-devices to control the UI when there's a window/dialog
|
||||
// on the screen (even though our top/bottom bars still exist).
|
||||
|
||||
@ -1055,7 +1055,7 @@ void ContainerWidget::Activate() {
|
||||
}
|
||||
|
||||
void ContainerWidget::AddWidget(Widget* w) {
|
||||
BA_PRECONDITION(InGameThread());
|
||||
BA_PRECONDITION(InLogicThread());
|
||||
Object::WeakRef<ContainerWidget> weakthis(this);
|
||||
{
|
||||
BA_DEBUG_UI_WRITE_LOCK;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user