mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives
This commit is contained in:
parent
a603a76787
commit
ced6d20295
62 changed files with 299 additions and 294 deletions
|
@ -77,9 +77,9 @@ void Environment::addPlayer(Player *player)
|
|||
*/
|
||||
// If peer id is non-zero, it has to be unique.
|
||||
if(player->peer_id != 0)
|
||||
assert(getPlayer(player->peer_id) == NULL);
|
||||
FATAL_ERROR_IF(getPlayer(player->peer_id) != NULL, "Peer id not unique");
|
||||
// Name has to be unique.
|
||||
assert(getPlayer(player->getName()) == NULL);
|
||||
FATAL_ERROR_IF(getPlayer(player->getName()) != NULL, "Player name not unique");
|
||||
// Add.
|
||||
m_players.push_back(player);
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ void ServerEnvironment::clearAllObjects()
|
|||
i != loaded_blocks.end(); ++i) {
|
||||
v3s16 p = *i;
|
||||
MapBlock *block = m_map->getBlockNoCreateNoEx(p);
|
||||
assert(block);
|
||||
assert(block != NULL);
|
||||
block->refGrab();
|
||||
}
|
||||
|
||||
|
@ -1295,7 +1295,7 @@ u16 getFreeServerActiveObjectId(
|
|||
|
||||
u16 ServerEnvironment::addActiveObject(ServerActiveObject *object)
|
||||
{
|
||||
assert(object);
|
||||
assert(object); // Pre-condition
|
||||
m_added_objects++;
|
||||
u16 id = addActiveObjectRaw(object, true, 0);
|
||||
return id;
|
||||
|
@ -1473,7 +1473,7 @@ ActiveObjectMessage ServerEnvironment::getActiveObjectMessage()
|
|||
u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object,
|
||||
bool set_changed, u32 dtime_s)
|
||||
{
|
||||
assert(object);
|
||||
assert(object); // Pre-condition
|
||||
if(object->getId() == 0){
|
||||
u16 new_id = getFreeServerActiveObjectId(m_active_objects);
|
||||
if(new_id == 0)
|
||||
|
@ -2051,7 +2051,8 @@ void ClientEnvironment::addPlayer(Player *player)
|
|||
It is a failure if player is local and there already is a local
|
||||
player
|
||||
*/
|
||||
assert(!(player->isLocal() == true && getLocalPlayer() != NULL));
|
||||
FATAL_ERROR_IF(player->isLocal() == true && getLocalPlayer() != NULL,
|
||||
"Player is local but there is already a local player");
|
||||
|
||||
Environment::addPlayer(player);
|
||||
}
|
||||
|
@ -2439,7 +2440,7 @@ u16 getFreeClientActiveObjectId(
|
|||
|
||||
u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
|
||||
{
|
||||
assert(object);
|
||||
assert(object); // Pre-condition
|
||||
if(object->getId() == 0)
|
||||
{
|
||||
u16 new_id = getFreeClientActiveObjectId(m_active_objects);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue