Commit 6864eb1
fix data race in ship-ship collision submodel checking
ship_ship_check_collision() toggled pmi->submodel[].collision_checked
flags on the heavy ship's polymodel_instance to selectively enable/
disable submodel collision checks. When two collision pairs shared the
same heavy ship, worker threads would race on the same pmi entries.
Fix: add a collision_checked_override pointer to mc_info that lets
callers provide a thread-local array of collision_checked values.
model_collide() uses the override when set, falling back to the
pmi->submodel[] field otherwise. ship_ship_check_collision() now
builds a local SCP_vector<char> and passes it via the override,
completely avoiding writes to shared polymodel_instance state.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 833c452 commit 6864eb1
3 files changed
Lines changed: 24 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1282 | 1282 | | |
1283 | 1283 | | |
1284 | 1284 | | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
1285 | 1291 | | |
1286 | 1292 | | |
1287 | 1293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1098 | 1098 | | |
1099 | 1099 | | |
1100 | 1100 | | |
1101 | | - | |
| 1101 | + | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | 1104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
262 | 269 | | |
263 | | - | |
264 | 270 | | |
265 | | - | |
| 271 | + | |
266 | 272 | | |
267 | 273 | | |
268 | 274 | | |
269 | 275 | | |
| 276 | + | |
270 | 277 | | |
271 | 278 | | |
272 | 279 | | |
273 | 280 | | |
274 | 281 | | |
275 | 282 | | |
276 | 283 | | |
277 | | - | |
278 | | - | |
279 | 284 | | |
280 | | - | |
| 285 | + | |
281 | 286 | | |
282 | | - | |
| 287 | + | |
283 | 288 | | |
284 | | - | |
| 289 | + | |
285 | 290 | | |
286 | 291 | | |
287 | 292 | | |
| |||
315 | 320 | | |
316 | 321 | | |
317 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
318 | 326 | | |
319 | 327 | | |
| 328 | + | |
| 329 | + | |
320 | 330 | | |
321 | 331 | | |
322 | 332 | | |
| |||
0 commit comments