From d27464d9cd67a318137e072e43f0d80a8bbf841e Mon Sep 17 00:00:00 2001 From: GAMMACASE <31375974+GAMMACASE@users.noreply.github.com> Date: Fri, 28 Nov 2025 19:04:30 +0300 Subject: [PATCH] Add few QoL methods to CPlayerSlot --- public/playerslot.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/public/playerslot.h b/public/playerslot.h index da9bc53c..f859ea71 100644 --- a/public/playerslot.h +++ b/public/playerslot.h @@ -5,24 +5,19 @@ #pragma once #endif +#include "const.h" + class CPlayerSlot { public: - CPlayerSlot(int slot) : m_Data(slot) - { - } + CPlayerSlot( int slot ) : m_Data( slot ) {} - int Get() const - { - return m_Data; - } + void Invalidate() { m_Data = -1; } + bool IsValid() const { return m_Data >= 0 && m_Data < ABSOLUTE_PLAYER_LIMIT; } + int Get() const { return m_Data; } - bool operator==(const CPlayerSlot &other) const { - return other.m_Data == m_Data; - } - bool operator!=(const CPlayerSlot &other) const { - return other.m_Data != m_Data; - } + bool operator==( const CPlayerSlot &other ) const { return other.m_Data == m_Data; } + bool operator!=( const CPlayerSlot &other ) const { return other.m_Data != m_Data; } private: int m_Data;