master #3

Merged
BRNSystems merged 36 commits from Mirrorlandia_minetest/minetest:master into master 2023-12-09 21:39:18 +01:00
2 changed files with 6 additions and 5 deletions
Showing only changes of commit 6106e4e72b - Show all commits

@ -2172,7 +2172,7 @@ void Server::SendPlayerSpeed(session_t peer_id, const v3f &added_vel)
inline s32 Server::nextSoundId() inline s32 Server::nextSoundId()
{ {
s32 free_id = m_playing_sounds_id_last_used; s32 free_id = m_playing_sounds_id_last_used;
while (free_id == 0 || m_playing_sounds.find(free_id) != m_playing_sounds.end()) { do {
if (free_id == INT32_MAX) if (free_id == INT32_MAX)
free_id = 0; // signed overflow is undefined free_id = 0; // signed overflow is undefined
else else
@ -2180,7 +2180,8 @@ inline s32 Server::nextSoundId()
if (free_id == m_playing_sounds_id_last_used) if (free_id == m_playing_sounds_id_last_used)
return 0; return 0;
} } while (free_id == 0 || m_playing_sounds.find(free_id) != m_playing_sounds.end());
m_playing_sounds_id_last_used = free_id; m_playing_sounds_id_last_used = free_id;
return free_id; return free_id;
} }

@ -1638,11 +1638,11 @@ u32 ServerEnvironment::addParticleSpawner(float exptime)
float time = exptime > 0.f ? exptime : PARTICLE_SPAWNER_NO_EXPIRY; float time = exptime > 0.f ? exptime : PARTICLE_SPAWNER_NO_EXPIRY;
u32 free_id = m_particle_spawners_id_last_used; u32 free_id = m_particle_spawners_id_last_used;
while (free_id == 0 || m_particle_spawners.find(free_id) != m_particle_spawners.end()) { do {
free_id++;
if (free_id == m_particle_spawners_id_last_used) if (free_id == m_particle_spawners_id_last_used)
return 0; // full return 0; // full
free_id++; } while (free_id == 0 || m_particle_spawners.find(free_id) != m_particle_spawners.end());
}
m_particle_spawners_id_last_used = free_id; m_particle_spawners_id_last_used = free_id;
m_particle_spawners[free_id] = time; m_particle_spawners[free_id] = time;