Skip to content

Commit

Permalink
Code format for CHuntHammer
Browse files Browse the repository at this point in the history
  • Loading branch information
Hu1night committed Sep 8, 2024
1 parent d98cd7b commit affde90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/game/server/weapons/hunthammer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CHuntHammer::CHuntHammer(CCharacter *pOwnerChar) :
m_AmmoRegenTime = g_pData->m_Weapons.m_aId[WEAPON_HAMMER].m_Ammoregentime;
m_FireDelay = g_pData->m_Weapons.m_aId[WEAPON_HAMMER].m_Firedelay;

IndicatorSnapID = Server()->SnapNewID();
m_SnapID = Server()->SnapNewID();
}

void CHuntHammer::Snap(int SnappingClient, int OtherMode)
Expand All @@ -20,16 +20,16 @@ void CHuntHammer::Snap(int SnappingClient, int OtherMode)
if(!(Character()->GetInput()->m_Fire & 1) || m_ReloadTimer > 1)
return;

CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, IndicatorSnapID, sizeof(CNetObj_Laser)));
CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_SnapID, sizeof(CNetObj_Laser)));
if(!pObj)
return;

CEntity *IndCharacter = GameWorld()->ClosestEntity(Pos(), 8192, CGameWorld::ENTTYPE_CHARACTER, Character());
CEntity *IndCharacter = GameWorld()->ClosestEntity(Pos(), 8192.f, CGameWorld::ENTTYPE_CHARACTER, Character());
if(!IndCharacter)
return;

vec2 IndicatorFrom = Pos();
vec2 IndicatorTo = IndicatorFrom + normalize(IndCharacter->m_Pos - IndicatorFrom) * 120;
vec2 IndicatorTo = IndicatorFrom + normalize(IndCharacter->m_Pos - IndicatorFrom) * 128.f;

pObj->m_X = (int)IndicatorTo.x;
pObj->m_Y = (int)IndicatorTo.y;
Expand Down
6 changes: 3 additions & 3 deletions src/game/server/weapons/hunthammer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ class CHuntHammer : public CWeapon
{
public:
CHuntHammer(CCharacter *pOwnerChar);
~CHuntHammer() { if(IndicatorSnapID)Server()->SnapFreeID(IndicatorSnapID); }
~CHuntHammer() { if(m_SnapID)Server()->SnapFreeID(m_SnapID); }

void Fire(vec2 Direction) override;
void Snap(int SnappingClient, int OtherMode) override;
int GetType() override { return WEAPON_HAMMER; }

private:
int IndicatorSnapID;
protected:
int m_SnapID;
};

#endif // GAME_SERVER_WEAPONS_HAMMER_H

0 comments on commit affde90

Please sign in to comment.