mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Don't memset SEvent directly (#15359)
Fixes a compiler warning by manually zeroing the tag and the largest union member instead
This commit is contained in:
parent
8b85a62310
commit
5c5538685e
3 changed files with 7 additions and 8 deletions
|
@ -18,7 +18,7 @@ enum EEVENT_TYPE
|
|||
to mouse or keyboard events. When a GUI element receives an event it will either
|
||||
process it and return true, or pass the event to its parent. If an event is not absorbed
|
||||
before it reaches the root element then it will then be passed to the user receiver. */
|
||||
EET_GUI_EVENT = 0,
|
||||
EET_GUI_EVENT = 1,
|
||||
|
||||
//! A mouse input event.
|
||||
/** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser
|
||||
|
@ -332,6 +332,9 @@ struct SEvent
|
|||
//! True if ctrl was also pressed
|
||||
bool Control : 1;
|
||||
|
||||
//! Is this a simulated mouse event generated by the engine itself?
|
||||
bool Simulated : 1;
|
||||
|
||||
//! A bitmap of button states. You can use isButtonPressed() to determine
|
||||
//! if a button is pressed or not.
|
||||
u32 ButtonStates;
|
||||
|
@ -347,9 +350,6 @@ struct SEvent
|
|||
|
||||
//! Type of mouse event
|
||||
EMOUSE_INPUT_EVENT Event;
|
||||
|
||||
//! Is this a simulated mouse event generated by Minetest itself?
|
||||
bool Simulated;
|
||||
};
|
||||
|
||||
//! Any kind of keyboard event.
|
||||
|
@ -543,8 +543,9 @@ struct SEvent
|
|||
};
|
||||
|
||||
SEvent() {
|
||||
// would be left uninitialized in many places otherwise
|
||||
MouseInput.Simulated = false;
|
||||
EventType = static_cast<EEVENT_TYPE>(0);
|
||||
// zero the biggest union member we have, which clears all others too
|
||||
memset(&JoystickEvent, 0, sizeof(JoystickEvent));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue