Browse Source

🎨 readability-convert-member-functions-to-static

pull/1643/head
Anders Jenbo 5 years ago
parent
commit
def7ba5a50
  1. 2
      Source/controls/devices/game_controller.cpp
  2. 4
      Source/controls/devices/game_controller.h
  3. 6
      Source/controls/devices/joystick.cpp
  4. 8
      Source/controls/devices/joystick.h
  5. 10
      Source/dvlnet/protocol_zt.h

2
Source/controls/devices/game_controller.cpp

@ -81,7 +81,7 @@ ControllerButton GameController::ToControllerButton(const SDL_Event &event)
return ControllerButton_NONE;
}
SDL_GameControllerButton GameController::ToSdlGameControllerButton(ControllerButton button) const
SDL_GameControllerButton GameController::ToSdlGameControllerButton(ControllerButton button)
{
if (button == ControllerButton_AXIS_TRIGGERLEFT || button == ControllerButton_AXIS_TRIGGERRIGHT)
UNIMPLEMENTED();

4
Source/controls/devices/game_controller.h

@ -26,10 +26,10 @@ public:
ControllerButton ToControllerButton(const SDL_Event &event);
bool IsPressed(ControllerButton button) const;
bool ProcessAxisMotion(const SDL_Event &event);
static bool ProcessAxisMotion(const SDL_Event &event);
private:
SDL_GameControllerButton ToSdlGameControllerButton(ControllerButton button) const;
static SDL_GameControllerButton ToSdlGameControllerButton(ControllerButton button);
SDL_GameController *sdl_game_controller_ = NULL;
SDL_JoystickID instance_id_ = -1;

6
Source/controls/devices/joystick.cpp

@ -12,7 +12,7 @@ extern bool sgbControllerActive;
std::vector<Joystick> *const Joystick::joysticks_ = new std::vector<Joystick>;
ControllerButton Joystick::ToControllerButton(const SDL_Event &event) const
ControllerButton Joystick::ToControllerButton(const SDL_Event &event)
{
switch (event.type) {
case SDL_JOYBUTTONDOWN:
@ -111,7 +111,7 @@ ControllerButton Joystick::ToControllerButton(const SDL_Event &event) const
return ControllerButton_NONE;
}
int Joystick::ToSdlJoyButton(ControllerButton button) const
int Joystick::ToSdlJoyButton(ControllerButton button)
{
if (button == ControllerButton_AXIS_TRIGGERLEFT || button == ControllerButton_AXIS_TRIGGERRIGHT)
UNIMPLEMENTED();
@ -177,7 +177,7 @@ int Joystick::ToSdlJoyButton(ControllerButton button) const
}
}
bool Joystick::IsHatButtonPressed(ControllerButton button) const
bool Joystick::IsHatButtonPressed(ControllerButton button)
{
switch (button) {
#if defined(JOY_HAT_DPAD_UP_HAT) && defined(JOY_HAT_DPAD_UP)

8
Source/controls/devices/joystick.h

@ -25,9 +25,9 @@ public:
static const std::vector<Joystick> &All();
static bool IsPressedOnAnyJoystick(ControllerButton button);
ControllerButton ToControllerButton(const SDL_Event &event) const;
static ControllerButton ToControllerButton(const SDL_Event &event);
bool IsPressed(ControllerButton button) const;
bool ProcessAxisMotion(const SDL_Event &event);
static bool ProcessAxisMotion(const SDL_Event &event);
SDL_JoystickID instance_id() const
{
@ -35,8 +35,8 @@ public:
}
private:
int ToSdlJoyButton(ControllerButton button) const;
bool IsHatButtonPressed(ControllerButton button) const;
static int ToSdlJoyButton(ControllerButton button);
static bool IsHatButtonPressed(ControllerButton button);
SDL_Joystick *sdl_joystick_ = NULL;
SDL_JoystickID instance_id_ = -1;

10
Source/dvlnet/protocol_zt.h

@ -62,7 +62,7 @@ public:
bool send_oob_mc(const buffer_t &data);
bool recv(endpoint &peer, buffer_t &data);
bool network_online();
std::string make_default_gamename();
static std::string make_default_gamename();
private:
static constexpr uint32_t PKTBUF_LEN = 65536;
@ -80,12 +80,12 @@ private:
int fd_tcp = -1;
int fd_udp = -1;
uint64_t current_ms();
static uint64_t current_ms();
void close_all();
void set_nonblock(int fd);
void set_nodelay(int fd);
void set_reuseaddr(int fd);
static void set_nonblock(int fd);
static void set_nodelay(int fd);
static void set_reuseaddr(int fd);
bool send_queued_peer(const endpoint &peer);
bool recv_peer(const endpoint &peer);

Loading…
Cancel
Save