*/
#include "collision.h"
+#include <cmath>
#include "mapblock.h"
#include "map.h"
#include "nodedef.h"
box.MinEdge += *pos_f;
box.MaxEdge += *pos_f;
}
- if (fabs(cbox.MaxEdge.Y - box.MinEdge.Y) < 0.15f * BS) {
+ if (std::fabs(cbox.MaxEdge.Y - box.MinEdge.Y) < 0.15f * BS) {
result.touching_ground = true;
if (box_info.is_object)
#include "genericobject.h"
#include "settings.h"
#include <algorithm>
+#include <cmath>
std::map<u16, ServerActiveObject::Factory> ServerActiveObject::m_types;
float move_d = m_base_position.getDistanceFrom(m_last_sent_position);
move_d += m_last_sent_move_precision;
float vel_d = m_velocity.getDistanceFrom(m_last_sent_velocity);
- if(move_d > minchange || vel_d > minchange ||
- fabs(m_yaw - m_last_sent_yaw) > 1.0){
+ if (move_d > minchange || vel_d > minchange ||
+ std::fabs(m_yaw - m_last_sent_yaw) > 1.0) {
sendPosition(true, false);
}
}
// Ridged mountains
float ridge_mnt = hilliness * (1.f - std::fabs(n_ridge_mnt));
- float ridged_mountains = pow(rter, 3.f) * ridge_mnt;
+ float ridged_mountains = std::pow(rter, 3.f) * ridge_mnt;
// Step (terraced) mountains
float step_mnt = hilliness * getSteps(n_step_mnt);
- float step_mountains = pow(ster, 3.f) * step_mnt;
+ float step_mountains = std::pow(ster, 3.f) * step_mnt;
// Final terrain level
float mountains = hills + ridged_mountains + step_mountains;
#include "content_sao.h"
#include "nodedef.h"
#include "voxelalgorithms.h"
-//#include "profiler.h" // For TimeTaker
#include "settings.h" // For g_settings
#include "emerge.h"
#include "dungeongen.h"
float altitude = y - water_level;
float height_mod = (altitude + 17) / 2.5;
- float width_mod = width - fabs(uwatern);
+ float width_mod = width - std::fabs(uwatern);
float nridge = noise_ridge->result[index] * MYMAX(altitude, 0) / 7.0;
if (nridge + width_mod * height_mod < 0.6)
{
// Check to make sure this isn't a request for a location in a river.
float rivers = NoisePerlin2D(&noise_rivers->np, p.X, p.Y, seed);
- if (fabs(rivers) < river_size_factor)
+ if (std::fabs(rivers) < river_size_factor)
return MAX_MAP_GENERATION_LIMIT; // Unsuitable spawn point
s16 level_at_point = terrainLevelAtPoint(p.X, p.Y);
*/
#include "serveractiveobjectmap.h"
+#include <cmath>
#include "constants.h"
#include "log.h"
#include "serverobject.h"
static aabb3s16 calcBox(const aabb3f &cb)
{
return aabb3s16(
- floor(cb.MinEdge.X / granularity),
- floor(cb.MinEdge.Y / granularity),
- floor(cb.MinEdge.Z / granularity),
- ceil(cb.MaxEdge.X / granularity),
- ceil(cb.MaxEdge.Y / granularity),
- ceil(cb.MaxEdge.Z / granularity));
+ std::floor(cb.MinEdge.X / granularity),
+ std::floor(cb.MinEdge.Y / granularity),
+ std::floor(cb.MinEdge.Z / granularity),
+ std::ceil(cb.MaxEdge.X / granularity),
+ std::ceil(cb.MaxEdge.Y / granularity),
+ std::ceil(cb.MaxEdge.Z / granularity));
}
void ServerActiveObjectMap::addObject(ServerActiveObject *object)
UASSERT(std::fabs(modulo360f(f) - fmodf(f, 360)) < 0.001);
UASSERT(std::fabs(wrapDegrees_180(f) - ref_WrapDegrees180(f)) < 0.001);
UASSERT(std::fabs(wrapDegrees_0_360(f) - ref_WrapDegrees_0_360(f)) < 0.001);
- UASSERT(wrapDegrees_0_360(fabs(wrapDegrees_180(f) - wrapDegrees_0_360(f))) < 0.001);
+ UASSERT(wrapDegrees_0_360(
+ std::fabs(wrapDegrees_180(f) - wrapDegrees_0_360(f))) < 0.001);
}
}
return dist;
// new_dist = dist * ((1 - cos(FOV / 2)) / (1-cos(zoomFOV /2))) ^ (1/3)
- return round(dist * cbrt((1.0f - cos(default_fov / 2.0f)) /
- (1.0f - cos(zoom_fov / 2.0f))));
+ return round(dist * cbrt((1.0f - std::cos(default_fov / 2.0f)) /
+ (1.0f - std::cos(zoom_fov / 2.0f))));
}