aboutsummaryrefslogtreecommitdiff
path: root/src/environment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/environment.cpp')
-rw-r--r--src/environment.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 60a26e65f..f75e7a0b7 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -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);