Opened 6 years ago
Closed 5 years ago
#12055 closed defect (fixed)
BACKENDS: SDL - strange code in sdl-events.cpp
| Reported by: | fedor4ever | Owned by: | ccawley2011 |
|---|---|---|---|
| Priority: | normal | Component: | Graphics |
| Version: | Keywords: | ||
| Cc: | Game: |
Description
This code present till commit 7de9982 from line 178. Code smells bad. Why used dynamic_cast? It's unsafe and lower perfomance.
if (_graphicsManager) {
if (dynamic_cast<SdlGraphics3dManager *>(_graphicsManager)) {
dynamic_cast<SdlGraphics3dManager *>(_graphicsManager)->notifyMousePosition(event.mouse);
} else if (dynamic_cast<SdlGraphicsManager *>(_graphicsManager)) {
dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->notifyMousePosition(event.mouse);
}
}
Change History (3)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
| Component: | --Other-- → Graphics |
|---|---|
| Summary: | BACKEDS: strange code in sdl-events.cpp → BACKENDS: SDL - strange code in sdl-events.cpp |
comment:3 by , 5 years ago
| Owner: | set to |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
This was fixed in https://github.com/scummvm/scummvm/pull/2937.
Note:
See TracTickets
for help on using tickets.

Is there an alternative?
Could you add a PR?