Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b2e31ae

Browse files
committedDec 18, 2022
multiple fixes
1 parent fcf5b39 commit b2e31ae

File tree

6 files changed

+24
-31
lines changed

6 files changed

+24
-31
lines changed
 

‎src/engine/server/databases/sqlite.cpp

+4-10
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,8 @@ bool CSqliteConnection::AddSeasonPoints(const char *pPlayer, int Points, char *p
403403
BindInt(2, Points);
404404
BindInt(3, Points);
405405
bool End;
406-
if(Step(&End, pError, ErrorSize))
407-
{
408-
return true;
409-
}
410-
return false;
406+
407+
return Step(&End, pError, ErrorSize);
411408
}
412409

413410
bool CSqliteConnection::ChangePowerStatus(const char *pPlayer, const char *PowerName, int Status, char *pError, int ErrorSize)
@@ -423,11 +420,8 @@ bool CSqliteConnection::ChangePowerStatus(const char *pPlayer, const char *Power
423420
BindInt(1, Status);
424421
BindString(2, pPlayer);
425422
bool End;
426-
if(Step(&End, pError, ErrorSize))
427-
{
428-
return true;
429-
}
430-
return false;
423+
424+
return Step(&End, pError, ErrorSize);
431425
}
432426

433427
std::unique_ptr<IDbConnection> CreateSqliteConnection(const char *pFilename, bool Setup)

‎src/game/server/entities/aura.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ void CAura::Snap(int SnappingClient)
131131

132132
if(m_Owner >= 0)
133133
pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
134+
if(!pOwnerChar)
135+
return;
134136

135-
if(pOwnerChar && pOwnerChar->IsAlive())
137+
if(pOwnerChar->IsAlive())
136138
TeamMask = pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner);
137139

138140
if(!CmaskIsSet(TeamMask, SnappingClient))

‎src/game/server/entities/character.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -2358,11 +2358,12 @@ vec2 CCharacter::GetLastSightInput()
23582358

23592359
void CCharacter::SetCollideOthers(bool on)
23602360
{
2361-
if(m_Core.m_CollisionDisabled == on)
2361+
bool disable = !on;
2362+
if(m_Core.m_CollisionDisabled == disable)
23622363
return;
23632364

2364-
m_Core.m_CollisionDisabled = on;
2365-
if(on)
2365+
m_Core.m_CollisionDisabled = disable;
2366+
if(disable)
23662367
m_NeededFaketuning &= ~FAKETUNE_NOCOLL;
23672368
else
23682369
m_NeededFaketuning |= FAKETUNE_NOCOLL;

‎src/game/server/entities/loot.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,15 @@ CLoot::CLoot(CGameWorld *pGameWorld, int Owner, const char *OwnerName, int Respo
2323
m_Pos = Pos;
2424

2525
GameWorld()->InsertEntity(this);
26-
for(int i = 0; i < NUM_IDS; i++)
27-
{
26+
27+
for(int i : m_IDs)
2828
m_IDs[i] = Server()->SnapNewID();
29-
}
3029
}
3130

3231
CLoot::~CLoot()
3332
{
34-
for(int i = 0; i < NUM_IDS; i++)
35-
{
33+
for(int i : m_IDs)
3634
Server()->SnapFreeID(m_IDs[i]);
37-
}
3835
}
3936

4037
void CLoot::Reset()

‎src/game/server/entities/soundtrack.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,14 @@ CSoundtrack::CSoundtrack(CGameWorld *pGameWorld, int Owner) :
2525
int64_t TeamMask = pOwner->GetCharacter()->Teams()->TeamMask(pOwner->GetCharacter()->Team(), -1, Owner);
2626
GameServer()->CreateSound(m_Pos, SOUND_MENU, TeamMask);
2727

28-
for(int i = 0; i < NUM_IDS; i++)
29-
{
28+
for(int i : m_IDs)
3029
m_IDs[i] = Server()->SnapNewID();
31-
}
3230
}
3331

3432
CSoundtrack::~CSoundtrack()
3533
{
36-
for(int i = 0; i < NUM_IDS; i++)
37-
{
34+
for(int i : m_IDs)
3835
Server()->SnapFreeID(m_IDs[i]);
39-
}
4036
}
4137

4238
void CSoundtrack::Reset()

‎src/game/server/gamecontroller.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,14 @@ int IGameController::SnapRecordFlag(int SnappingClient)
823823
pFlagOwner->GetCharacter()->m_Pos == pFlagOwner->GetCharacter()->m_PrevPos)
824824
return pFlagOwner->GetCID();
825825

826-
// Verify flag owner team mask
827-
int64_t TeamMask = -1LL;
828-
TeamMask = m_pRecordFlagChar->Teams()->TeamMask(m_pRecordFlagChar->Team(), -1, pFlagOwner->GetCID());
829-
if(!CmaskIsSet(TeamMask, SnappingClient))
830-
return pFlagOwner->GetCID();
826+
// Verify flag owner team mask (cannot check that when demo client)
827+
if(SnappingClient != SERVER_DEMO_CLIENT)
828+
{
829+
int64_t TeamMask = -1LL;
830+
TeamMask = m_pRecordFlagChar->Teams()->TeamMask(m_pRecordFlagChar->Team(), -1, pFlagOwner->GetCID());
831+
if(!CmaskIsSet(TeamMask, SnappingClient))
832+
return pFlagOwner->GetCID();
833+
}
831834

832835
// insert flag
833836
CNetObj_Flag *pFlag = (CNetObj_Flag *)Server()->SnapNewItem(NETOBJTYPE_FLAG, TEAM_BLUE, sizeof(CNetObj_Flag));

0 commit comments

Comments
 (0)
Please sign in to comment.