Properly and efficiently use split utility headers

master
Perttu Ahola 2012-06-17 02:40:36 +03:00
parent 1bc37d576c
commit d0ea6f9920
73 changed files with 130 additions and 159 deletions

View File

@ -199,7 +199,6 @@ set(common_SRCS
mapsector.cpp
map.cpp
player.cpp
utility.cpp
test.cpp
sha1.cpp
base64.cpp

View File

@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gamedef.h"
#include "sound.h"
#include "event.h"
#include "util/numeric.h"
Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
IGameDef *gamedef):
@ -234,17 +235,17 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
#if 1
f32 bobknob = 1.2;
f32 bobtmp = sin(pow(bobfrac, bobknob) * PI);
//f32 bobtmp2 = cos(pow(bobfrac, bobknob) * PI);
f32 bobtmp = sin(pow(bobfrac, bobknob) * M_PI);
//f32 bobtmp2 = cos(pow(bobfrac, bobknob) * M_PI);
v3f bobvec = v3f(
0.3 * bobdir * sin(bobfrac * PI),
0.3 * bobdir * sin(bobfrac * M_PI),
-0.28 * bobtmp * bobtmp,
0.);
//rel_cam_pos += 0.2 * bobvec;
//rel_cam_target += 0.03 * bobvec;
//rel_cam_up.rotateXYBy(0.02 * bobdir * bobtmp * PI);
//rel_cam_up.rotateXYBy(0.02 * bobdir * bobtmp * M_PI);
float f = 1.0;
f *= g_settings->getFloat("view_bobbing_amount");
rel_cam_pos += bobvec * f;
@ -253,10 +254,10 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
rel_cam_target.Z -= 0.005 * bobvec.Z * f;
//rel_cam_target.X -= 0.005 * bobvec.X * f;
//rel_cam_target.Y -= 0.005 * bobvec.Y * f;
rel_cam_up.rotateXYBy(-0.03 * bobdir * bobtmp * PI * f);
rel_cam_up.rotateXYBy(-0.03 * bobdir * bobtmp * M_PI * f);
#else
f32 angle_deg = 1 * bobdir * sin(bobfrac * PI);
f32 angle_rad = angle_deg * PI / 180;
f32 angle_deg = 1 * bobdir * sin(bobfrac * M_PI);
f32 angle_rad = angle_deg * M_PI / 180;
f32 r = 0.05;
v3f off = v3f(
r * sin(angle_rad),
@ -289,7 +290,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
// FOV and aspect ratio
m_aspect = (f32)screensize.X / (f32) screensize.Y;
m_fov_y = fov_degrees * PI / 180.0;
m_fov_y = fov_degrees * M_PI / 180.0;
// Increase vertical FOV on lower aspect ratios (<16:10)
m_fov_y *= MYMAX(1.0, MYMIN(1.4, sqrt(16./10. / m_aspect)));
// WTF is this? It can't be right
@ -320,22 +321,22 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
if (m_digging_button != -1)
{
f32 digfrac = m_digging_anim;
wield_position.X -= 30 * sin(pow(digfrac, 0.8f) * PI);
wield_position.Y += 15 * sin(digfrac * 2 * PI);
wield_position.X -= 30 * sin(pow(digfrac, 0.8f) * M_PI);
wield_position.Y += 15 * sin(digfrac * 2 * M_PI);
wield_position.Z += 5 * digfrac;
// Euler angles are PURE EVIL, so why not use quaternions?
core::quaternion quat_begin(wield_rotation * core::DEGTORAD);
core::quaternion quat_end(v3f(90, -10, -130) * core::DEGTORAD);
core::quaternion quat_slerp;
quat_slerp.slerp(quat_begin, quat_end, sin(digfrac * PI));
quat_slerp.slerp(quat_begin, quat_end, sin(digfrac * M_PI));
quat_slerp.toEuler(wield_rotation);
wield_rotation *= core::RADTODEG;
}
else {
f32 bobfrac = my_modf(m_view_bobbing_anim);
wield_position.X -= sin(bobfrac*PI*2.0) * 3.0;
wield_position.Y += sin(my_modf(bobfrac*2.0)*PI) * 3.0;
wield_position.X -= sin(bobfrac*M_PI*2.0) * 3.0;
wield_position.Y += sin(my_modf(bobfrac*2.0)*M_PI) * 3.0;
}
m_wieldnode->setPosition(wield_position);
m_wieldnode->setRotation(wield_rotation);
@ -538,7 +539,7 @@ void Camera::drawWieldedTool()
// Draw the wielded node (in a separate scene manager)
scene::ICameraSceneNode* cam = m_wieldmgr->getActiveCamera();
cam->setAspectRatio(m_cameranode->getAspectRatio());
cam->setFOV(72.0*PI/180.0);
cam->setFOV(72.0*M_PI/180.0);
cam->setNearValue(0.1);
cam->setFarValue(100);
m_wieldmgr->drawAll();

View File

@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "inventory.h"
#include "mesh.h"
#include "tile.h"
#include "utility.h"
#include "util/numeric.h"
#include <ICameraSceneNode.h>
class LocalPlayer;

View File

@ -19,10 +19,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "chat.h"
#include "debug.h"
#include "utility.h"
#include <cassert>
#include <cctype>
#include <sstream>
#include "util/string.h"
#include "util/numeric.h"
ChatBuffer::ChatBuffer(u32 scrollback):
m_scrollback(scrollback),

View File

@ -18,7 +18,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "client.h"
#include "utility.h"
#include <iostream>
#include "clientserver.h"
#include "jmutexautolock.h"

View File

@ -28,12 +28,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <set>
#include <vector>
#include "clientobject.h"
#include "utility.h" // For IntervalLimiter
#include "gamedef.h"
#include "inventorymanager.h"
#include "filesys.h"
#include "filecache.h"
#include "localplayer.h"
#include "util/pointedthing.h"
struct MeshMakeData;
class MapBlockMesh;

View File

@ -46,7 +46,7 @@ ClientMap::ClientMap(
m_control(control),
m_camera_position(0,0,0),
m_camera_direction(0,0,1),
m_camera_fov(PI)
m_camera_fov(M_PI)
{
m_camera_mutex.Init();
assert(m_camera_mutex.IsInitialized());

View File

@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef CLIENTSERVER_HEADER
#define CLIENTSERVER_HEADER
#include "utility.h"
#include "util/serialize.h"
/*
changes by PROTOCOL_VERSION:

View File

@ -22,10 +22,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serialization.h"
#include "log.h"
#include "porting.h"
#include "util/serialize.h"
#include "util/numeric.h"
#include "util/string.h"
namespace con
{
static u16 readPeerId(u8 *packetdata)
{
return readU16(&packetdata[4]);
}
static u8 readChannel(u8 *packetdata)
{
return readU8(&packetdata[6]);
}
BufferedPacket makePacket(Address &address, u8 *data, u32 datasize,
u32 protocol_id, u16 sender_peer_id, u8 channel)
{

View File

@ -20,14 +20,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef CONNECTION_HEADER
#define CONNECTION_HEADER
#include <iostream>
#include <fstream>
#include "debug.h"
#include "common_irrlicht.h"
#include "irrlichttypes.h"
#include "socket.h"
#include "utility.h"
#include "exceptions.h"
#include "constants.h"
#include "util/pointer.h"
#include "util/container.h"
#include "util/thread.h"
#include <iostream>
#include <fstream>
namespace con
{
@ -107,15 +108,6 @@ public:
{}
};
inline u16 readPeerId(u8 *packetdata)
{
return readU16(&packetdata[4]);
}
inline u8 readChannel(u8 *packetdata)
{
return readU8(&packetdata[6]);
}
#define SEQNUM_MAX 65535
inline bool seqnum_higher(u16 higher, u16 lower)
{

View File

@ -28,8 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Some things here are legacy crap.
*/
#define PI 3.14159
/*
Connection
*/

View File

@ -30,13 +30,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "clientobject.h"
#include "content_object.h"
#include "mesh.h"
#include "utility.h" // For IntervalLimiter
#include "itemdef.h"
#include "tool.h"
#include "content_cso.h"
#include "sound.h"
#include "nodedef.h"
#include "localplayer.h"
#include "util/numeric.h" // For IntervalLimiter
#include "util/serialize.h"
class Settings;
struct ToolCapabilities;
@ -935,7 +937,7 @@ public:
}
}
if(fabs(m_prop.automatic_rotate) > 0.001){
m_yaw += dtime * m_prop.automatic_rotate * 180 / PI;
m_yaw += dtime * m_prop.automatic_rotate * 180 / M_PI;
updateNodePos();
}
}
@ -961,7 +963,7 @@ public:
else if(cam_to_entity.Y < -0.75)
col += 4;
else{
float mob_dir = atan2(cam_to_entity.Z, cam_to_entity.X) / PI * 180.;
float mob_dir = atan2(cam_to_entity.Z, cam_to_entity.X) / M_PI * 180.;
float dir = mob_dir - m_yaw;
dir = wrapDegrees_180(dir);
//infostream<<"id="<<m_id<<" dir="<<dir<<std::endl;

View File

@ -25,6 +25,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h"
#include "tile.h"
#include "gamedef.h"
#include "util/numeric.h"
#include "util/serialize.h"
#include "util/directiontables.h"
// Create a cuboid.
// collector - the MeshCollector for the resulting polygons

View File

@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes.h"
#include "mapnode.h"
#include "nodedef.h"
#include "utility.h"
#include "nameidmapping.h"
#include <map>

View File

@ -20,7 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_nodemeta.h"
#include "inventory.h"
#include "log.h"
#include "utility.h"
#include "util/serialize.h"
#include "util/string.h"
#include "constants.h" // MAP_BLOCKSIZE
#include <sstream>
#define NODEMETA_GENERIC 1

View File

@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "player.h"
#include "scriptapi.h"
#include "genericobject.h"
#include "util/serialize.h"
core::map<u16, ServerActiveObject::Factory> ServerActiveObject::m_types;

View File

@ -23,9 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include <sstream>
#include <set>
#include "utility.h"
#include "gamedef.h"
#include "inventory.h"
#include "util/serialize.h"
// Check if input matches recipe
// Takes recipe groups into account

View File

@ -35,8 +35,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "player.h"
#include "map.h"
#include <ostream>
#include "utility.h"
#include "activeobject.h"
#include "util/container.h"
#include "util/numeric.h"
class Server;
class ServerEnvironment;

View File

@ -23,12 +23,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "clientserver.h"
#include "log.h"
#include "filesys.h"
#include "utility.h"
#include "hex.h"
#include "sha1.h"
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
bool FileCache::loadByPath(const std::string &path, std::ostream &os)
{

View File

@ -18,8 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "genericobject.h"
#include "utility.h"
#include <sstream>
#include "util/serialize.h"
std::string gob_cmd_set_properties(const ObjectProperties &prop)
{

View File

@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "modalMenu.h"
#include "utility.h"
#include <string>
struct ConfirmDest

View File

@ -27,8 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <IGUIStaticText.h>
#include <IGUIFont.h>
#include <IGUIListBox.h>
#include "gettext.h"
#include "util/string.h"
enum
{

View File

@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "modalMenu.h"
#include "utility.h"
#include <string>
#include "subgame.h"

View File

@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "modalMenu.h"
#include "utility.h"
#include <string>
class IRespawnInitiator

View File

@ -30,6 +30,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <IGUIFont.h>
#include "log.h"
#include "tile.h" // ITextureSource
#include "util/string.h"
#include "util/numeric.h"
void drawItemStack(video::IVideoDriver *driver,
gui::IGUIFont *font,

View File

@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "inventory.h"
#include "inventorymanager.h"
#include "utility.h"
#include "modalMenu.h"
class IGameDef;

View File

@ -23,7 +23,6 @@
#define GUIKEYCHANGEMENU_HEADER
#include "common_irrlicht.h"
#include "utility.h"
#include "modalMenu.h"
#include "client.h"
#include "gettext.h"

View File

@ -36,9 +36,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// For IGameCallback
#include "guiPauseMenu.h"
#include "gettext.h"
#include "utility.h"
#include "tile.h" // getTexturePath
#include "filesys.h"
#include "util/string.h"
struct CreateWorldDestMainMenu : public CreateWorldDest
{

View File

@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "modalMenu.h"
#include "utility.h"
#include <string>
class GUIMessageMenu : public GUIModalMenu

View File

@ -21,7 +21,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "common_irrlicht.h"
#include "modalMenu.h"
#include "utility.h"
#include "client.h"
#include <string>

View File

@ -28,8 +28,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <IGUIButton.h>
#include <IGUIStaticText.h>
#include <IGUIFont.h>
#include "gettext.h"
#include "util/string.h"
GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id,

View File

@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "modalMenu.h"
#include "utility.h"
#include <string>
struct TextDest

View File

@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "inventory.h"
#include "serialization.h"
#include "utility.h"
#include "debug.h"
#include <sstream>
#include "log.h"
@ -27,6 +26,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "strfnd.h"
#include "content_mapnode.h" // For loading legacy MaterialItems
#include "nameidmapping.h" // For loading legacy MaterialItems
#include "util/serialize.h"
#include "util/string.h"
/*
ItemStack

View File

@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serverobject.h"
#include "main.h" // for g_settings
#include "settings.h"
#include "utility.h"
#include "craftdef.h"
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"

View File

@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "tile.h"
#endif
#include "log.h"
#include "utility.h"
#include "util/serialize.h"
#include <map>
#include <set>

View File

@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "localplayer.h"
#include "main.h" // For g_settings
#include "event.h"
#include "collision.h"
@ -25,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h"
#include "settings.h"
#include "map.h"
#include "util/numeric.h"
/*
LocalPlayer

View File

@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapblock.h"
#include "main.h"
#include "filesys.h"
#include "utility.h"
#include "voxel.h"
#include "porting.h"
#include "mapgen.h"
@ -32,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "profiler.h"
#include "nodedef.h"
#include "gamedef.h"
#include "util/directiontables.h"
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"

View File

@ -26,12 +26,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iostream>
#include <sstream>
#include "common_irrlicht.h"
#include "irrlichttypes.h"
#include "mapnode.h"
#include "constants.h"
#include "voxel.h"
#include "utility.h" // Needed for UniqueQueue, a member of Map
#include "modifiedstate.h"
#include "util/container.h"
extern "C" {
#include "sqlite3.h"

View File

@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef SERVER
#include "mapblock_mesh.h"
#endif
#include "util/string.h"
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
@ -409,7 +410,7 @@ void MapBlock::actuallyUpdateDayNightDiff()
void MapBlock::expireDayNightDiff()
{
INodeDefManager *nodemgr = m_gamedef->ndef();
//INodeDefManager *nodemgr = m_gamedef->ndef();
if(data == NULL){
m_day_night_differs = false;
@ -976,7 +977,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
("MapBlock::deSerialize: no enough input data");
is_underground = tmp;
is.read((char*)*databuf_nodelist, nodecount * ser_length);
if(is.gcount() != nodecount * ser_length)
if((u32)is.gcount() != nodecount * ser_length)
throw SerializationError
("MapBlock::deSerialize: no enough input data");
}

View File

@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodemetadata.h"
#include "nodetimer.h"
#include "modifiedstate.h"
#include "util/numeric.h" // getContainerPos
class Map;
class NodeMetadataList;

View File

@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_mapblock.h"
#include "noise.h"
#include "settings.h"
#include "util/directiontables.h"
/*
MeshMakeData

View File

@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MAPGEN_HEADER
#include "common_irrlicht.h"
#include "utility.h" // UniqueQueue
#include "util/container.h" // UniqueQueue
struct BlockMakeData;
class MapBlock;

View File

@ -20,11 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "mapnode.h"
#include "porting.h"
#include <string>
#include "main.h" // For g_settings
#include "nodedef.h"
#include "content_mapnode.h" // For mapnode_translate_*_internal
#include "serialization.h" // For ser_ver_supported
#include "util/serialize.h"
#include <string>
#include <sstream>
/*
MapNode

View File

@ -18,7 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "nameidmapping.h"
#include "utility.h"
#include "util/serialize.h"
void NameIdMapping::serialize(std::ostream &os) const
{

View File

@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "settings.h"
#include "nameidmapping.h"
#include "util/serialize.h"
/*
NodeBox

View File

@ -30,6 +30,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif
#include "itemgroup.h"
#include "sound.h" // SimpleSoundSpec
#include "constants.h" // BS
class IItemDefManager;
class ITextureSource;
class IGameDef;

View File

@ -18,12 +18,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "nodemetadata.h"
#include "utility.h"
#include "exceptions.h"
#include "gamedef.h"
#include "inventory.h"
#include <sstream>
#include "log.h"
#include "util/serialize.h"
#include "constants.h" // MAP_BLOCKSIZE
#include <sstream>
/*
NodeMetadata

View File

@ -18,8 +18,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "nodetimer.h"
#include "utility.h"
#include "log.h"
#include "util/serialize.h"
#include "constants.h" // MAP_BLOCKSIZE
/*
NodeTimer

View File

@ -18,7 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "object_properties.h"
#include "utility.h"
#include "util/serialize.h"
#include <sstream>
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
#define PP2(x) "("<<(x).X<<","<<(x).Y<<")"

View File

@ -19,11 +19,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "player.h"
#include "constants.h"
#include "utility.h"
#include "gamedef.h"
#include "connection.h" // PEER_ID_INEXISTENT
#include "settings.h"
#include "content_sao.h"
#include "util/numeric.h"
Player::Player(IGameDef *gamedef):
touching_ground(false),

View File

@ -22,10 +22,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include <string>
#include "utility.h"
#include <jmutex.h>
#include <jmutexautolock.h>
#include <map>
#include "util/timetaker.h"
#include "util/numeric.h" // paging()
/*
Time profiler

View File

@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "quicktune.h"
#include <jmutex.h>
#include <jmutexautolock.h>
#include "utility.h"
#include "util/string.h"
std::string QuicktuneValue::getString()
{

View File

@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define QVT_SHORTCUTTER_HEADER
#include "quicktune.h"
#include "utility.h"
class QuicktuneShortcutter
{

View File

@ -43,10 +43,10 @@ extern "C" {
#include "nodemetadata.h"
#include "mapblock.h" // For getNodeBlockPos
#include "content_nodemeta.h"
#include "utility.h"
#include "tool.h"
#include "daynightratio.h"
#include "noise.h" // PseudoRandom for LuaPseudoRandom
#include "util/pointedthing.h"
static void stackDump(lua_State *L, std::ostream &o)
{

View File

@ -18,7 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "serialization.h"
#include "utility.h"
#include "util/serialize.h"
#ifdef _WIN32
#define ZLIB_WINAPI
#endif

View File

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "exceptions.h"
#include <iostream>
#include "utility.h"
#include "util/pointer.h"
/*
Map format serialization version

View File

@ -18,7 +18,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "server.h"
#include "utility.h"
#include <iostream>
#include <queue>
#include "clientserver.h"
@ -49,10 +48,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "sha1.h"
#include "base64.h"
#include "tool.h"
#include "util/string.h"
#include "sound.h" // dummySoundManager
#include "event_manager.h"
#include "hex.h"
#include "util/string.h"
#include "util/pointedthing.h"
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
@ -676,7 +676,7 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
FOV setting. The default of 72 degrees is fine.
*/
float camera_fov = (72.0*PI/180) * 4./3.;
float camera_fov = (72.0*M_PI/180) * 4./3.;
if(isBlockInSight(p, camera_pos, camera_dir, camera_fov, 10000*BS) == false)
{
continue;

View File

@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "connection.h"
#include "environment.h"
#include "common_irrlicht.h"
#include "irrlichttypes.h"
#include <string>
#include "porting.h"
#include "map.h"
@ -34,6 +34,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "inventorymanager.h"
#include "subgame.h"
#include "sound.h"
#include "util/thread.h"
#include "util/string.h"
struct LuaState;
typedef struct lua_State lua_State;
class IWritableItemDefManager;

View File

@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "servercommand.h"
#include "utility.h"
#include "settings.h"
#include "main.h" // For g_settings
#include "content_sao.h"

View File

@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serverobject.h"
#include <fstream>
#include "inventory.h"
#include "constants.h" // BS
ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
ActiveObject(0),
@ -66,6 +67,11 @@ void ServerActiveObject::registerType(u16 type, Factory f)
m_types.insert(type, f);
}
float ServerActiveObject::getMinimumSavedMovement()
{
return 2.0*BS;
}
ItemStack ServerActiveObject::getWieldedItem() const
{
const Inventory *inv = getInventory();

View File

@ -22,9 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes.h"
#include "activeobject.h"
#include "utility.h"
#include "inventorymanager.h"
#include "itemgroup.h"
#include "util/container.h"
/*
@ -96,8 +96,7 @@ public:
{ setBasePosition(pos); }
// If object has moved less than this and data has not changed,
// saving to disk may be omitted
virtual float getMinimumSavedMovement()
{ return 2.0*BS; }
virtual float getMinimumSavedMovement();
virtual bool isPeaceful(){return true;}

View File

@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef SETTINGS_HEADER
#define SETTINGS_HEADER
#include "common_irrlicht.h"
#include "irrlichttypes.h"
#include <string>
#include <jthread.h>
#include <jmutex.h>
@ -30,8 +30,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <fstream>
#include <sstream>
#include "debug.h"
#include "utility.h"
#include "log.h"
#include "util/string.h"
enum ValueType
{

View File

@ -3,11 +3,11 @@
#include "ISceneManager.h"
#include "ICameraSceneNode.h"
#include "S3DVertex.h"
#include "utility.h" // MYMIN
#include "tile.h" // getTexturePath
#include "noise.h" // easeCurve
#include "main.h" // g_profiler
#include "profiler.h"
#include "util/numeric.h" // MYMIN
//! constructor
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id):

View File

@ -50,7 +50,8 @@ typedef int socket_t;
#include <iostream>
#include <stdlib.h>
#include <errno.h>
#include "utility.h"
#include "util/string.h"
#include "util/numeric.h"
bool socket_enable_debug_output = false;
#define DP socket_enable_debug_output

View File

@ -38,8 +38,10 @@ with this program; ifnot, write to the Free Software Foundation, Inc.,
#endif
#include <vorbis/vorbisfile.h>
#include "log.h"
#include "utility.h" // myrand()
#include "filesys.h"
#include "util/numeric.h" // myrand()
#include "debug.h" // assert()
#include "porting.h"
#include <map>
#include <vector>
#include <fstream>

View File

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include <string>
#include <sstream>
#include "utility.h"
#include "util/serialize.h"
struct StaticObject
{

View File

@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "main.h"
#include "socket.h"
#include "connection.h"
#include "utility.h"
#include "serialization.h"
#include "voxel.h"
#include <sstream>
@ -38,6 +37,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/string.h"
#include "voxelalgorithms.h"
#include "inventory.h"
#include "util/numeric.h"
#include "util/serialize.h"
/*
Asserts that the exception occurs

View File

@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "debug.h"
#include "main.h" // for g_settings
#include "filesys.h"
#include "utility.h"
#include "settings.h"
#include "mesh.h"
#include <ICameraSceneNode.h>
@ -30,6 +29,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h" // For texture atlas making
#include "gamedef.h"
#include "util/string.h"
#include "util/container.h"
#include "util/thread.h"
#include "util/numeric.h"
/*
A cache from texture name to texture path

View File

@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common_irrlicht.h"
#include "threads.h"
#include "utility.h"
#include <string>
class IGameDef;
@ -205,11 +204,6 @@ struct TileSpec
// Sets everything else except the texture in the material
void applyMaterialOptions(video::SMaterial &material) const
{
if(alpha != 255 && material_type != MATERIAL_ALPHA_VERTEX)
dstream<<"WARNING: TileSpec: alpha != 255 "
"but not MATERIAL_ALPHA_VERTEX"
<<std::endl;
if(material_type == MATERIAL_ALPHA_NONE)
material.MaterialType = video::EMT_SOLID;
else if(material_type == MATERIAL_ALPHA_VERTEX)
@ -230,7 +224,7 @@ struct TileSpec
}
AtlasPointer texture;
// Vertex alpha
// Vertex alpha (when MATERIAL_ALPHA_VERTEX is used)
u8 alpha;
// Material parameters
u8 material_type;

View File

@ -18,10 +18,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "tool.h"
#include "utility.h"
#include "itemdef.h" // For itemgroup_get()
#include "log.h"
#include "inventory.h"
#include "util/serialize.h"
#include "util/numeric.h"
void ToolCapabilities::serialize(std::ostream &os) const
{

View File

@ -1,20 +0,0 @@
/*
Minetest-c55
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

View File

@ -1,35 +0,0 @@
/*
Minetest-c55
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTILITY_HEADER
#define UTILITY_HEADER
// Headers whose content was previously here
#include "util/serialize.h"
#include "util/directiontables.h"
#include "util/pointer.h"
#include "util/string.h"
#include "util/container.h"
#include "util/thread.h"
#include "util/numeric.h"
#include "util/timetaker.h"
#include "util/pointedthing.h"
#endif

View File

@ -19,9 +19,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "voxel.h"
#include "map.h"
#include "utility.h" // For TimeTaker
#include "gettime.h"
#include "nodedef.h"
#include "util/timetaker.h"
/*
Debug stuff