4002: Populate jetpack field properly r=Jupeyy a=Learath2

Noticed by Anime.pdf on discord

Doesn't seem to break anything else unintendedly but I'd be more comfortable with it if `@trml` takes a look.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Learath <learath2@gmail.com>
This commit is contained in:
bors[bot] 2021-08-14 12:59:58 +00:00 committed by GitHub
commit 5f1f13da95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View file

@ -1293,6 +1293,7 @@ void CGameClient::OnNewSnapshot()
CClientData *pClient = &m_aClients[Item.m_ID];
// Collision
pClient->m_Solo = pCharacterData->m_Flags & CHARACTERFLAG_SOLO;
pClient->m_Jetpack = pCharacterData->m_Flags & CHARACTERFLAG_JETPACK;
pClient->m_NoCollision = pCharacterData->m_Flags & CHARACTERFLAG_NO_COLLISION;
pClient->m_NoHammerHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_HAMMER_HIT;
pClient->m_NoGrenadeHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_GRENADE_HIT;

View file

@ -1132,12 +1132,16 @@ void CCharacter::Read(CNetObj_Character *pChar, CNetObj_DDNetCharacter *pExtende
{
m_LastJetpackStrength = Tuning()->m_JetpackStrength;
m_Jetpack = true;
m_Core.m_Jetpack = true;
m_aWeapons[WEAPON_GUN].m_Got = true;
m_aWeapons[WEAPON_GUN].m_Ammo = -1;
m_NinjaJetpack = pChar->m_Weapon == WEAPON_NINJA;
}
else if(pChar->m_Weapon != WEAPON_NINJA)
{
m_Jetpack = false;
m_Core.m_Jetpack = false;
}
// number of jumps
if(GameWorld()->m_WorldConfig.m_PredictTiles)

View file

@ -543,6 +543,7 @@ void CCharacterCore::ReadDDNet(const CNetObj_DDNetCharacter *pObjDDNet)
{
// Collision
m_Solo = pObjDDNet->m_Flags & CHARACTERFLAG_SOLO;
m_Jetpack = pObjDDNet->m_Flags & CHARACTERFLAG_JETPACK;
m_NoCollision = pObjDDNet->m_Flags & CHARACTERFLAG_NO_COLLISION;
m_NoHammerHit = pObjDDNet->m_Flags & CHARACTERFLAG_NO_HAMMER_HIT;
m_NoGrenadeHit = pObjDDNet->m_Flags & CHARACTERFLAG_NO_GRENADE_HIT;