Opened 4 years ago

Closed 3 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 raziel-, 4 years ago

Is there an alternative?

Could you add a PR?

comment:2 by raziel-, 4 years ago

Component: --Other--Graphics
Summary: BACKEDS: strange code in sdl-events.cppBACKENDS: SDL - strange code in sdl-events.cpp

comment:3 by ccawley2011, 3 years ago

Owner: set to ccawley2011
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.