File tree Expand file tree Collapse file tree 1 file changed +14
-15
lines changed
Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -23,21 +23,20 @@ ON_EVENT(SESSION_START) {
2323 if (!env) break ;
2424 vphysEnvironments.push_back (env);
2525 }
26-
27- switch (vphysEnvironments.size ()) {
28- default :
29- lastWasFast = false ;
30- break ;
31- case 3 :
32- // Fast load, destroy one unused environment
33- // The first env is unused, and the second one persists through
34- // fast load(s). That means on the first fast load we'll destroy
35- // the first environment, and subsequent fast loads we'll destroy
36- // the second environment. (since it's now using the first one)
37- int *env = vphysEnvironments[lastWasFast ? 1 : 0 ];
38- vphysics->DestroyPhysicsEnvironment (env);
39- lastWasFast = true ;
40- break ;
26+ if (vphysEnvironments.size () == 3 ) {
27+ // Fast load, destroy one unused environment
28+ // The first env is unused, and the second one persists through
29+ // fast load(s). That means on the first fast load we'll destroy
30+ // the first environment, and subsequent fast loads we'll destroy
31+ // the second environment. (since it's now using the first one)
32+ int *env = vphysEnvironments[lastWasFast ? 1 : 0 ];
33+ vphysics->DestroyPhysicsEnvironment (env);
34+ lastWasFast = true ;
35+ } else {
36+ lastWasFast = false ;
37+ if (vphysEnvironments.size () > 3 ) {
38+ console->Warning (" VPhysics: Detected more than 3 physics environments (%zu), this is unexpected!\n " , vphysEnvironments.size ());
39+ }
4140 }
4241}
4342
You can’t perform that action at this time.
0 commit comments