mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Fix use of uninitialized variables (thanks valgrind)
This commit is contained in:
parent
ebec94b32b
commit
a14440e1f6
@ -1,9 +1,8 @@
|
||||
// Event.cpp
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unordered_map>
|
||||
#include <assert.h>
|
||||
#include "gettext.h"
|
||||
#include "blupi.h"
|
||||
#include "def.h"
|
||||
@ -1569,7 +1568,10 @@ void CEvent::Create (CPixmap *pPixmap, CDecor *pDecor,
|
||||
|
||||
Sint32 CEvent::GetButtonIndex (Sint32 button)
|
||||
{
|
||||
Sint32 i = 0;
|
||||
int i = 0;
|
||||
|
||||
if (m_index < 0)
|
||||
return -1;
|
||||
|
||||
while (table[m_index].buttons[i].message != 0)
|
||||
{
|
||||
@ -1679,6 +1681,9 @@ void CEvent::RestoreGame()
|
||||
|
||||
if (m_phase == WM_PHASE_PLAY)
|
||||
{
|
||||
if (m_index < 0)
|
||||
return;
|
||||
|
||||
i = 0;
|
||||
while (table[m_index].buttons[i].message != 0)
|
||||
{
|
||||
@ -1707,6 +1712,9 @@ bool CEvent::CreateButtons()
|
||||
if (m_phase == WM_PHASE_PLAY)
|
||||
bMinimizeRedraw = true;
|
||||
|
||||
if (m_index < 0)
|
||||
return false;
|
||||
|
||||
while (table[m_index].buttons[i].message != 0)
|
||||
{
|
||||
pos.x = table[m_index].buttons[i].x;
|
||||
@ -1892,6 +1900,8 @@ bool CEvent::DrawButtons()
|
||||
SetEnable (WM_BUTTON10, bEnable);
|
||||
}
|
||||
|
||||
assert (m_index >= 0);
|
||||
|
||||
// Dessine les boutons.
|
||||
i = 0;
|
||||
while (table[m_index].buttons[i].message != 0)
|
||||
@ -2539,7 +2549,10 @@ bool CEvent::EventButtons (const SDL_Event &event, POINT pos)
|
||||
}
|
||||
else
|
||||
{
|
||||
Sint32 i = 0;
|
||||
int i = 0;
|
||||
|
||||
assert (m_index >= 0);
|
||||
|
||||
while (table[m_index].buttons[i].message != 0)
|
||||
{
|
||||
const auto text = m_buttons[i].GetToolTips (pos);
|
||||
@ -2632,7 +2645,10 @@ bool CEvent::EventButtons (const SDL_Event &event, POINT pos)
|
||||
}
|
||||
|
||||
|
||||
Sint32 i = 0;
|
||||
int i = 0;
|
||||
|
||||
assert (m_index >= 0);
|
||||
|
||||
while (table[m_index].buttons[i].message != 0)
|
||||
{
|
||||
if (m_buttons[i].TreatEvent (event))
|
||||
@ -2656,6 +2672,9 @@ bool CEvent::MouseOnButton (POINT pos)
|
||||
{
|
||||
Sint32 i;
|
||||
|
||||
if (m_index < 0)
|
||||
return false;
|
||||
|
||||
i = 0;
|
||||
while (table[m_index].buttons[i].message != 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user