mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
4813: Don't allow infinite shotgun bounce (fixes #4809) r=heinrich5991 a=def- I hope this kind of physic isn't used anywhere, I couldn't trigger it without being stuck in wall. ## Checklist - [x] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] 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) 4905: Fix move_sqlite (fixes #4902) r=heinrich5991 a=def- <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] 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: def <dennis@felsin9.de>
This commit is contained in:
commit
6cce22d056
|
@ -36,7 +36,7 @@ def transfer(file_from, file_to):
|
|||
conn_from = sqlite3.connect(file_from, isolation_level='EXCLUSIVE')
|
||||
for line in conn_from.iterdump():
|
||||
cursor_to.execute(line)
|
||||
print(line)
|
||||
print(line.encode('utf-8'))
|
||||
cursor_to.close()
|
||||
conn_to.commit()
|
||||
conn_to.close()
|
||||
|
|
|
@ -112,7 +112,12 @@ void CLaser::DoBounce()
|
|||
m_Pos = TempPos;
|
||||
m_Dir = normalize(TempDir);
|
||||
|
||||
m_Energy -= distance(m_From, m_Pos) + GetTuning(m_TuneZone)->m_LaserBounceCost;
|
||||
const float Distance = distance(m_From, m_Pos);
|
||||
// Prevent infinite bounces
|
||||
if(Distance == 0.0f)
|
||||
m_Energy = -1;
|
||||
else
|
||||
m_Energy -= Distance + GetTuning(m_TuneZone)->m_LaserBounceCost;
|
||||
|
||||
m_Bounces++;
|
||||
m_WasTele = false;
|
||||
|
|
|
@ -126,8 +126,12 @@ void CLaser::DoBounce()
|
|||
m_Pos = TempPos;
|
||||
m_Dir = normalize(TempDir);
|
||||
|
||||
if(!m_TuneZone)
|
||||
m_Energy -= distance(m_From, m_Pos) + GameServer()->Tuning()->m_LaserBounceCost;
|
||||
const float Distance = distance(m_From, m_Pos);
|
||||
// Prevent infinite bounces
|
||||
if(Distance == 0.0f)
|
||||
m_Energy = -1;
|
||||
else if(!m_TuneZone)
|
||||
m_Energy -= Distance + GameServer()->Tuning()->m_LaserBounceCost;
|
||||
else
|
||||
m_Energy -= distance(m_From, m_Pos) + GameServer()->TuningList()[m_TuneZone].m_LaserBounceCost;
|
||||
|
||||
|
|
Loading…
Reference in a new issue