mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-22 23:58:48 -05:00
Fix all warnings and remove -Wno-unused-but-set cflag
This commit is contained in:
parent
e36681101e
commit
38bd9e93a2
@ -656,13 +656,6 @@ else()
|
||||
set(RELEASE_WARNING_FLAGS "")
|
||||
endif()
|
||||
|
||||
if(NOT APPLE AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
CHECK_CXX_COMPILER_FLAG("-Wno-unused-but-set-variable" HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
||||
if(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable")
|
||||
endif(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# clang does not understand __extern_always_inline but libc headers use it
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"")
|
||||
|
32
src/client.h
32
src/client.h
@ -74,7 +74,7 @@ public:
|
||||
MeshUpdateQueue();
|
||||
|
||||
~MeshUpdateQueue();
|
||||
|
||||
|
||||
/*
|
||||
peer_id=0 adds with nobody to send to
|
||||
*/
|
||||
@ -90,7 +90,7 @@ public:
|
||||
JMutexAutoLock lock(m_mutex);
|
||||
return m_queue.size();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::vector<QueuedMeshUpdate*> m_queue;
|
||||
std::set<v3s16> m_urgents;
|
||||
@ -127,7 +127,7 @@ public:
|
||||
MutexedQueue<MeshUpdateResult> m_queue_out;
|
||||
|
||||
IGameDef *m_gamedef;
|
||||
|
||||
|
||||
v3s16 m_camera_offset;
|
||||
};
|
||||
|
||||
@ -152,8 +152,8 @@ struct ClientEvent
|
||||
{
|
||||
ClientEventType type;
|
||||
union{
|
||||
struct{
|
||||
} none;
|
||||
//struct{
|
||||
//} none;
|
||||
struct{
|
||||
u8 amount;
|
||||
} player_damage;
|
||||
@ -171,8 +171,8 @@ struct ClientEvent
|
||||
std::string *formspec;
|
||||
std::string *formname;
|
||||
} show_formspec;
|
||||
struct{
|
||||
} textures_updated;
|
||||
//struct{
|
||||
//} textures_updated;
|
||||
struct{
|
||||
v3f *pos;
|
||||
v3f *vel;
|
||||
@ -315,7 +315,7 @@ public:
|
||||
MtEventManager *event,
|
||||
bool ipv6
|
||||
);
|
||||
|
||||
|
||||
~Client();
|
||||
|
||||
/*
|
||||
@ -362,11 +362,11 @@ public:
|
||||
|
||||
ClientEnvironment& getEnv()
|
||||
{ return m_env; }
|
||||
|
||||
|
||||
// Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
|
||||
void removeNode(v3s16 p);
|
||||
void addNode(v3s16 p, MapNode n, bool remove_metadata = true);
|
||||
|
||||
|
||||
void setPlayerControl(PlayerControl &control);
|
||||
|
||||
void selectPlayerItem(u16 item);
|
||||
@ -378,7 +378,7 @@ public:
|
||||
bool getLocalInventoryUpdated();
|
||||
// Copies the inventory of the local player to parameter
|
||||
void getLocalInventory(Inventory &dst);
|
||||
|
||||
|
||||
/* InventoryManager interface */
|
||||
Inventory* getInventory(const InventoryLocation &loc);
|
||||
void inventoryAction(InventoryAction *a);
|
||||
@ -416,13 +416,13 @@ public:
|
||||
// Including blocks at appropriate edges
|
||||
void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
|
||||
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
|
||||
|
||||
|
||||
void updateCameraOffset(v3s16 camera_offset)
|
||||
{ m_mesh_update_thread.m_camera_offset = camera_offset; }
|
||||
|
||||
// Get event from queue. CE_NONE is returned if queue is empty.
|
||||
ClientEvent getClientEvent();
|
||||
|
||||
|
||||
bool accessDenied()
|
||||
{ return m_access_denied; }
|
||||
|
||||
@ -476,14 +476,14 @@ private:
|
||||
// Virtual methods from con::PeerHandler
|
||||
void peerAdded(con::Peer *peer);
|
||||
void deletingPeer(con::Peer *peer, bool timeout);
|
||||
|
||||
|
||||
void ReceiveAll();
|
||||
void Receive();
|
||||
|
||||
|
||||
void sendPlayerPos();
|
||||
// Send the item number 'item' as player item to the server
|
||||
void sendPlayerItem(u16 item);
|
||||
|
||||
|
||||
float m_packetcounter_timer;
|
||||
float m_connection_reinit_timer;
|
||||
float m_avg_rtt_timer;
|
||||
|
@ -179,7 +179,7 @@ void RemoteClient::GetNextBlocks(
|
||||
s32 nearest_emerged_d = -1;
|
||||
s32 nearest_emergefull_d = -1;
|
||||
s32 nearest_sent_d = -1;
|
||||
bool queue_is_full = false;
|
||||
//bool queue_is_full = false;
|
||||
|
||||
s16 d;
|
||||
for(d = d_start; d <= d_max; d++)
|
||||
@ -214,7 +214,7 @@ void RemoteClient::GetNextBlocks(
|
||||
// Don't select too many blocks for sending
|
||||
if(num_blocks_selected >= max_simul_dynamic)
|
||||
{
|
||||
queue_is_full = true;
|
||||
//queue_is_full = true;
|
||||
goto queue_full_break;
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
|
||||
v3f camera_position = m_camera_position;
|
||||
v3f camera_direction = m_camera_direction;
|
||||
f32 camera_fov = m_camera_fov;
|
||||
v3s16 camera_offset = m_camera_offset;
|
||||
//v3s16 camera_offset = m_camera_offset;
|
||||
m_camera_mutex.Unlock();
|
||||
|
||||
// Use a higher fov to accomodate faster camera movements.
|
||||
|
@ -707,14 +707,14 @@ void Channel::UpdateTimers(float dtime,bool legacy_peer)
|
||||
|
||||
unsigned int packet_loss = 11; /* use a neutral value for initialization */
|
||||
unsigned int packets_successfull = 0;
|
||||
unsigned int packet_too_late = 0;
|
||||
//unsigned int packet_too_late = 0;
|
||||
|
||||
bool reasonable_amount_of_data_transmitted = false;
|
||||
|
||||
{
|
||||
JMutexAutoLock internal(m_internal_mutex);
|
||||
packet_loss = current_packet_loss;
|
||||
packet_too_late = current_packet_too_late;
|
||||
//packet_too_late = current_packet_too_late;
|
||||
packets_successfull = current_packet_successfull;
|
||||
|
||||
if (current_bytes_transfered > (unsigned int) (window_size*512/2))
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
// And never save to disk
|
||||
bool isStaticAllowed() const
|
||||
{ return false; }
|
||||
|
||||
|
||||
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
||||
const std::string &data)
|
||||
{
|
||||
@ -99,7 +99,7 @@ public:
|
||||
}
|
||||
u8 getType() const
|
||||
{ return ACTIVEOBJECT_TYPE_TEST; }
|
||||
|
||||
|
||||
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
||||
const std::string &data)
|
||||
{
|
||||
@ -170,7 +170,7 @@ class ItemSAO : public ServerActiveObject
|
||||
public:
|
||||
u8 getType() const
|
||||
{ return ACTIVEOBJECT_TYPE_ITEM; }
|
||||
|
||||
|
||||
float getMinimumSavedMovement()
|
||||
{ return 0.1*BS; }
|
||||
|
||||
@ -212,7 +212,7 @@ public:
|
||||
if(m_move_interval.step(dtime, interval)==false)
|
||||
return;
|
||||
dtime = interval;
|
||||
|
||||
|
||||
core::aabbox3d<f32> box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.);
|
||||
collisionMoveResult moveresult;
|
||||
// Apply gravity
|
||||
@ -223,13 +223,12 @@ public:
|
||||
if(m_speed_f.getLength()*dtime > pos_max_d)
|
||||
m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime);
|
||||
v3f pos_f = getBasePosition();
|
||||
v3f pos_f_old = pos_f;
|
||||
v3f accel_f = v3f(0,0,0);
|
||||
f32 stepheight = 0;
|
||||
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
|
||||
pos_max_d, box, stepheight, dtime,
|
||||
pos_f, m_speed_f, accel_f);
|
||||
|
||||
|
||||
if(send_recommended == false)
|
||||
return;
|
||||
|
||||
@ -327,7 +326,7 @@ public:
|
||||
m_itemstring_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -392,7 +391,7 @@ LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos,
|
||||
ServerActiveObject::registerType(getType(), create);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Initialize something to armor groups
|
||||
m_armor_groups["fleshy"] = 100;
|
||||
}
|
||||
@ -407,11 +406,11 @@ LuaEntitySAO::~LuaEntitySAO()
|
||||
void LuaEntitySAO::addedToEnvironment(u32 dtime_s)
|
||||
{
|
||||
ServerActiveObject::addedToEnvironment(dtime_s);
|
||||
|
||||
|
||||
// Create entity from name
|
||||
m_registered = m_env->getScriptIface()->
|
||||
luaentity_Add(m_id, m_init_name.c_str());
|
||||
|
||||
|
||||
if(m_registered){
|
||||
// Get properties
|
||||
m_env->getScriptIface()->
|
||||
@ -671,10 +670,10 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// It's best that attachments cannot be punched
|
||||
// It's best that attachments cannot be punched
|
||||
if(isAttached())
|
||||
return 0;
|
||||
|
||||
|
||||
ItemStack *punchitem = NULL;
|
||||
ItemStack punchitem_static;
|
||||
if(puncher){
|
||||
@ -687,11 +686,11 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
toolcap,
|
||||
punchitem,
|
||||
time_from_last_punch);
|
||||
|
||||
|
||||
if(result.did_punch)
|
||||
{
|
||||
setHP(getHP() - result.damage);
|
||||
|
||||
|
||||
|
||||
std::string punchername = "nil";
|
||||
|
||||
@ -701,7 +700,7 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
actionstream<<getDescription()<<" punched by "
|
||||
<<punchername<<", damage "<<result.damage
|
||||
<<" hp, health now "<<getHP()<<" hp"<<std::endl;
|
||||
|
||||
|
||||
{
|
||||
std::string str = gob_cmd_punched(result.damage, getHP());
|
||||
// create message and add to list
|
||||
@ -887,7 +886,7 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
|
||||
// If the object is attached client-side, don't waste bandwidth sending its position to clients
|
||||
if(isAttached())
|
||||
return;
|
||||
|
||||
|
||||
m_last_sent_move_precision = m_base_position.getDistanceFrom(
|
||||
m_last_sent_position);
|
||||
m_last_sent_position_timer = 0;
|
||||
@ -1272,7 +1271,7 @@ int PlayerSAO::punch(v3f dir,
|
||||
ServerActiveObject *puncher,
|
||||
float time_from_last_punch)
|
||||
{
|
||||
// It's best that attachments cannot be punched
|
||||
// It's best that attachments cannot be punched
|
||||
if(isAttached())
|
||||
return 0;
|
||||
|
||||
@ -1488,15 +1487,12 @@ bool PlayerSAO::checkMovementCheat()
|
||||
*/
|
||||
|
||||
float player_max_speed = 0;
|
||||
float player_max_speed_up = 0;
|
||||
if(m_privs.count("fast") != 0){
|
||||
// Fast speed
|
||||
player_max_speed = m_player->movement_speed_fast;
|
||||
player_max_speed_up = m_player->movement_speed_fast;
|
||||
} else {
|
||||
// Normal speed
|
||||
player_max_speed = m_player->movement_speed_walk;
|
||||
player_max_speed_up = m_player->movement_speed_walk;
|
||||
}
|
||||
// Tolerance. With the lag pool we shouldn't need it.
|
||||
//player_max_speed *= 2.5;
|
||||
|
@ -167,7 +167,7 @@ video::ITexture* draw_image(const v2u32& screensize,
|
||||
image = images[1];
|
||||
else
|
||||
image = images[0];
|
||||
|
||||
|
||||
driver->setRenderTarget(image, true, true,
|
||||
irr::video::SColor(255,
|
||||
skycolor.getRed(), skycolor.getGreen(), skycolor.getBlue()));
|
||||
@ -421,79 +421,74 @@ void draw_scene(video::IVideoDriver* driver, scene::ISceneManager* smgr,
|
||||
gui::IGUIEnvironment* guienv, std::vector<aabb3f> hilightboxes,
|
||||
const v2u32& screensize, video::SColor skycolor, bool show_hud)
|
||||
{
|
||||
//TODO check if usefull
|
||||
u32 scenetime = 0;
|
||||
{
|
||||
TimeTaker timer("smgr");
|
||||
TimeTaker timer("smgr");
|
||||
|
||||
bool draw_wield_tool = (show_hud &&
|
||||
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
|
||||
camera.getCameraMode() < CAMERA_MODE_THIRD );
|
||||
bool draw_wield_tool = (show_hud &&
|
||||
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
|
||||
camera.getCameraMode() < CAMERA_MODE_THIRD );
|
||||
|
||||
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
|
||||
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
|
||||
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
|
||||
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
try {
|
||||
draw_crosshair = !g_settings->getBool("touchtarget");
|
||||
}
|
||||
catch(SettingNotFoundException) {}
|
||||
try {
|
||||
draw_crosshair = !g_settings->getBool("touchtarget");
|
||||
}
|
||||
catch(SettingNotFoundException) {}
|
||||
#endif
|
||||
|
||||
std::string draw_mode = g_settings->get("3d_mode");
|
||||
std::string draw_mode = g_settings->get("3d_mode");
|
||||
|
||||
smgr->drawAll();
|
||||
smgr->drawAll();
|
||||
|
||||
if (draw_mode == "anaglyph")
|
||||
{
|
||||
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, draw_wield_tool, client, guienv);
|
||||
draw_crosshair = false;
|
||||
}
|
||||
else if (draw_mode == "interlaced")
|
||||
{
|
||||
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
draw_crosshair = false;
|
||||
}
|
||||
else if (draw_mode == "sidebyside")
|
||||
{
|
||||
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
show_hud = false;
|
||||
}
|
||||
else if (draw_mode == "topbottom")
|
||||
{
|
||||
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
show_hud = false;
|
||||
}
|
||||
else {
|
||||
draw_plain(camera, show_hud, hud, hilightboxes, driver,
|
||||
draw_wield_tool, client, guienv);
|
||||
}
|
||||
|
||||
/*
|
||||
Post effects
|
||||
*/
|
||||
{
|
||||
client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
|
||||
}
|
||||
|
||||
//TODO how to make those 3d too
|
||||
if (show_hud)
|
||||
{
|
||||
if (draw_crosshair)
|
||||
hud.drawCrosshair();
|
||||
hud.drawHotbar(client.getPlayerItem());
|
||||
hud.drawLuaElements(camera.getOffset());
|
||||
}
|
||||
|
||||
guienv->drawAll();
|
||||
|
||||
scenetime = timer.stop(true);
|
||||
if (draw_mode == "anaglyph")
|
||||
{
|
||||
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, draw_wield_tool, client, guienv);
|
||||
draw_crosshair = false;
|
||||
}
|
||||
else if (draw_mode == "interlaced")
|
||||
{
|
||||
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
draw_crosshair = false;
|
||||
}
|
||||
else if (draw_mode == "sidebyside")
|
||||
{
|
||||
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
show_hud = false;
|
||||
}
|
||||
else if (draw_mode == "topbottom")
|
||||
{
|
||||
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
show_hud = false;
|
||||
}
|
||||
else {
|
||||
draw_plain(camera, show_hud, hud, hilightboxes, driver,
|
||||
draw_wield_tool, client, guienv);
|
||||
}
|
||||
|
||||
/*
|
||||
Post effects
|
||||
*/
|
||||
{
|
||||
client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
|
||||
}
|
||||
|
||||
//TODO how to make those 3d too
|
||||
if (show_hud)
|
||||
{
|
||||
if (draw_crosshair)
|
||||
hud.drawCrosshair();
|
||||
hud.drawHotbar(client.getPlayerItem());
|
||||
hud.drawLuaElements(camera.getOffset());
|
||||
}
|
||||
|
||||
guienv->drawAll();
|
||||
|
||||
timer.stop(true);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
Player * getNearestConnectedPlayer(v3f pos);
|
||||
std::list<Player*> getPlayers();
|
||||
std::list<Player*> getPlayers(bool ignore_disconnected);
|
||||
|
||||
|
||||
u32 getDayNightRatio();
|
||||
|
||||
// 0-23999
|
||||
@ -96,7 +96,7 @@ public:
|
||||
void stepTimeOfDay(float dtime);
|
||||
|
||||
void setTimeOfDaySpeed(float speed);
|
||||
|
||||
|
||||
float getTimeOfDaySpeed();
|
||||
|
||||
void setDayNightRatioOverride(bool enable, u32 value)
|
||||
@ -132,7 +132,7 @@ protected:
|
||||
* a later release.
|
||||
*/
|
||||
bool m_cache_enable_shaders;
|
||||
|
||||
|
||||
private:
|
||||
JMutex m_lock;
|
||||
|
||||
@ -150,7 +150,7 @@ class ActiveBlockModifier
|
||||
public:
|
||||
ActiveBlockModifier(){};
|
||||
virtual ~ActiveBlockModifier(){};
|
||||
|
||||
|
||||
// Set of contents to trigger on
|
||||
virtual std::set<std::string> getTriggerContents()=0;
|
||||
// Set of required neighbors (trigger doesn't happen if none are found)
|
||||
@ -255,7 +255,7 @@ public:
|
||||
Returns 0 if not added and thus deleted.
|
||||
*/
|
||||
u16 addActiveObject(ServerActiveObject *object);
|
||||
|
||||
|
||||
/*
|
||||
Add an active object as a static object to the corresponding
|
||||
MapBlock.
|
||||
@ -264,7 +264,7 @@ public:
|
||||
(note: not used, pending removal from engine)
|
||||
*/
|
||||
//bool addActiveObjectAsStatic(ServerActiveObject *object);
|
||||
|
||||
|
||||
/*
|
||||
Find out what new objects have been added to
|
||||
inside a radius around a position
|
||||
@ -282,7 +282,7 @@ public:
|
||||
s16 player_radius,
|
||||
std::set<u16> ¤t_objects,
|
||||
std::set<u16> &removed_objects);
|
||||
|
||||
|
||||
/*
|
||||
Get the next message emitted by some active object.
|
||||
Returns a message with id=0 if no messages are available.
|
||||
@ -311,16 +311,16 @@ public:
|
||||
bool setNode(v3s16 p, const MapNode &n);
|
||||
bool removeNode(v3s16 p);
|
||||
bool swapNode(v3s16 p, const MapNode &n);
|
||||
|
||||
|
||||
// Find all active objects inside a radius around a point
|
||||
std::set<u16> getObjectsInsideRadius(v3f pos, float radius);
|
||||
|
||||
|
||||
// Clear all objects, loading and going through every MapBlock
|
||||
void clearAllObjects();
|
||||
|
||||
|
||||
// This makes stuff happen
|
||||
void step(f32 dtime);
|
||||
|
||||
|
||||
//check if there's a line of sight between two positions
|
||||
bool line_of_sight(v3f pos1, v3f pos2, float stepsize=1.0, v3s16 *p=NULL);
|
||||
|
||||
@ -328,9 +328,9 @@ public:
|
||||
|
||||
void reportMaxLagEstimate(float f) { m_max_lag_estimate = f; }
|
||||
float getMaxLagEstimate() { return m_max_lag_estimate; }
|
||||
|
||||
|
||||
std::set<v3s16>* getForceloadedBlocks() { return &m_active_blocks.m_forceloaded_list; };
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
@ -349,17 +349,17 @@ private:
|
||||
Returns 0 if not added and thus deleted.
|
||||
*/
|
||||
u16 addActiveObjectRaw(ServerActiveObject *object, bool set_changed, u32 dtime_s);
|
||||
|
||||
|
||||
/*
|
||||
Remove all objects that satisfy (m_removed && m_known_by_count==0)
|
||||
*/
|
||||
void removeRemovedObjects();
|
||||
|
||||
|
||||
/*
|
||||
Convert stored objects from block to active
|
||||
*/
|
||||
void activateObjects(MapBlock *block, u32 dtime_s);
|
||||
|
||||
|
||||
/*
|
||||
Convert objects that are not in active blocks to static.
|
||||
|
||||
@ -374,7 +374,7 @@ private:
|
||||
/*
|
||||
Member variables
|
||||
*/
|
||||
|
||||
|
||||
// The map
|
||||
ServerMap *m_map;
|
||||
// Lua state
|
||||
@ -433,8 +433,8 @@ struct ClientEnvEvent
|
||||
{
|
||||
ClientEnvEventType type;
|
||||
union {
|
||||
struct{
|
||||
} none;
|
||||
//struct{
|
||||
//} none;
|
||||
struct{
|
||||
u8 amount;
|
||||
bool send_to_server;
|
||||
@ -463,7 +463,7 @@ public:
|
||||
|
||||
virtual void addPlayer(Player *player);
|
||||
LocalPlayer * getLocalPlayer();
|
||||
|
||||
|
||||
/*
|
||||
ClientSimpleObjects
|
||||
*/
|
||||
@ -473,7 +473,7 @@ public:
|
||||
/*
|
||||
ActiveObjects
|
||||
*/
|
||||
|
||||
|
||||
ClientActiveObject* getActiveObject(u16 id);
|
||||
|
||||
/*
|
||||
@ -501,11 +501,11 @@ public:
|
||||
/*
|
||||
Client likes to call these
|
||||
*/
|
||||
|
||||
|
||||
// Get all nearby objects
|
||||
void getActiveObjects(v3f origin, f32 max_d,
|
||||
std::vector<DistanceSortedActiveObject> &dest);
|
||||
|
||||
|
||||
// Get event from queue. CEE_NONE is returned if queue is empty.
|
||||
ClientEnvEvent getClientEvent();
|
||||
|
||||
@ -521,7 +521,7 @@ public:
|
||||
{ m_camera_offset = camera_offset; }
|
||||
v3s16 getCameraOffset()
|
||||
{ return m_camera_offset; }
|
||||
|
||||
|
||||
private:
|
||||
ClientMap *m_map;
|
||||
scene::ISceneManager *m_smgr;
|
||||
|
@ -364,15 +364,14 @@ void GUIEngine::cloudPostProcess()
|
||||
{
|
||||
float fps_max = g_settings->getFloat("fps_max");
|
||||
// Time of frame without fps limit
|
||||
float busytime;
|
||||
u32 busytime_u32;
|
||||
|
||||
// not using getRealTime is necessary for wine
|
||||
u32 time = m_device->getTimer()->getTime();
|
||||
if(time > m_cloud.lasttime)
|
||||
busytime_u32 = time - m_cloud.lasttime;
|
||||
else
|
||||
busytime_u32 = 0;
|
||||
busytime = busytime_u32 / 1000.0;
|
||||
|
||||
// FPS limiter
|
||||
u32 frametime_min = 1000./fps_max;
|
||||
|
@ -146,10 +146,7 @@ bool JThread::IsSameThread()
|
||||
|
||||
void *JThread::TheThread(void *param)
|
||||
{
|
||||
JThread *jthread;
|
||||
void *ret;
|
||||
|
||||
jthread = (JThread *)param;
|
||||
JThread *jthread = (JThread *)param;
|
||||
|
||||
jthread->continuemutex2.Lock();
|
||||
jthread->running = true;
|
||||
@ -157,7 +154,7 @@ void *JThread::TheThread(void *param)
|
||||
jthread->continuemutex.Lock();
|
||||
jthread->continuemutex.Unlock();
|
||||
|
||||
ret = jthread->Thread();
|
||||
jthread->Thread();
|
||||
|
||||
jthread->running = false;
|
||||
|
||||
|
@ -74,8 +74,6 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
|
||||
v3f position = getPosition();
|
||||
|
||||
v3f old_speed = m_speed;
|
||||
|
||||
// Copy parent position if local player is attached
|
||||
if(isAttached)
|
||||
{
|
||||
@ -100,7 +98,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
/*
|
||||
Collision detection
|
||||
*/
|
||||
|
||||
|
||||
bool is_valid_position;
|
||||
MapNode node;
|
||||
v3s16 pp;
|
||||
@ -191,7 +189,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
v3f lwn_f = intToFloat(m_sneak_node, BS);
|
||||
position.X = rangelim(position.X, lwn_f.X-maxd, lwn_f.X+maxd);
|
||||
position.Z = rangelim(position.Z, lwn_f.Z-maxd, lwn_f.Z+maxd);
|
||||
|
||||
|
||||
if(!is_climbing)
|
||||
{
|
||||
f32 min_y = lwn_f.Y + 0.5*BS;
|
||||
@ -211,7 +209,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
#ifdef __ANDROID__
|
||||
player_stepheight += (0.5 * BS);
|
||||
#endif
|
||||
|
||||
|
||||
v3f accel_f = v3f(0,0,0);
|
||||
|
||||
collisionMoveResult result = collisionMoveSimple(env, m_gamedef,
|
||||
@ -226,7 +224,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
*/
|
||||
bool touching_ground_was = touching_ground;
|
||||
touching_ground = result.touching_ground;
|
||||
|
||||
|
||||
//bool standing_on_unloaded = result.standing_on_unloaded;
|
||||
|
||||
/*
|
||||
@ -277,7 +275,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
f32 max_axis_distance_f = MYMAX(
|
||||
fabs(player_p2df.X-node_p2df.X),
|
||||
fabs(player_p2df.Y-node_p2df.Y));
|
||||
|
||||
|
||||
if(distance_f > min_distance_f ||
|
||||
max_axis_distance_f > 0.5*BS + sneak_max + 0.1*BS)
|
||||
continue;
|
||||
@ -301,7 +299,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
min_distance_f = distance_f;
|
||||
new_sneak_node = p;
|
||||
}
|
||||
|
||||
|
||||
bool sneak_node_found = (min_distance_f < 100000.0*BS*0.9);
|
||||
|
||||
m_sneak_node = new_sneak_node;
|
||||
@ -314,12 +312,12 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
if(sneak_node_found && control.sneak)
|
||||
touching_ground = true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Set new position
|
||||
*/
|
||||
setPosition(position);
|
||||
|
||||
|
||||
/*
|
||||
Report collisions
|
||||
*/
|
||||
@ -367,7 +365,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
*/
|
||||
m_old_node_below = floatToInt(position - v3f(0,BS/2,0), BS);
|
||||
m_old_node_below_type = nodemgr->get(map->getNodeNoEx(m_old_node_below)).name;
|
||||
|
||||
|
||||
/*
|
||||
Check properties of the node on which the player is standing
|
||||
*/
|
||||
@ -400,10 +398,10 @@ void LocalPlayer::applyControl(float dtime)
|
||||
|
||||
v3f move_direction = v3f(0,0,1);
|
||||
move_direction.rotateXZBy(getYaw());
|
||||
|
||||
|
||||
v3f speedH = v3f(0,0,0); // Horizontal (X, Z)
|
||||
v3f speedV = v3f(0,0,0); // Vertical (Y)
|
||||
|
||||
|
||||
bool fly_allowed = m_gamedef->checkLocalPrivilege("fly");
|
||||
bool fast_allowed = m_gamedef->checkLocalPrivilege("fast");
|
||||
|
||||
@ -415,7 +413,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
|
||||
// Whether superspeed mode is used or not
|
||||
bool superspeed = false;
|
||||
|
||||
|
||||
if(g_settings->getBool("always_fly_fast") && free_move && fast_move)
|
||||
superspeed = true;
|
||||
|
||||
@ -425,7 +423,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
// If free movement and fast movement, always move fast
|
||||
if(free_move && fast_move)
|
||||
superspeed = true;
|
||||
|
||||
|
||||
// Auxiliary button 1 (E)
|
||||
if(control.aux1)
|
||||
{
|
||||
@ -548,7 +546,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
{
|
||||
speedJ.Y = movement_speed_jump * physics_override_jump;
|
||||
setSpeed(speedJ);
|
||||
|
||||
|
||||
MtEvent *e = new SimpleTriggerEvent("PlayerJump");
|
||||
m_gamedef->event()->put(e);
|
||||
}
|
||||
|
@ -3220,8 +3220,6 @@ bool ServerMap::loadSectorMeta(v2s16 p2d)
|
||||
{
|
||||
DSTACK(__FUNCTION_NAME);
|
||||
|
||||
MapSector *sector = NULL;
|
||||
|
||||
// The directory layout we're going to load from.
|
||||
// 1 - original sectors/xxxxzzzz/
|
||||
// 2 - new sectors2/xxx/zzz/
|
||||
@ -3241,7 +3239,7 @@ bool ServerMap::loadSectorMeta(v2s16 p2d)
|
||||
}
|
||||
|
||||
try{
|
||||
sector = loadSectorMeta(sectordir, loadlayout != 2);
|
||||
loadSectorMeta(sectordir, loadlayout != 2);
|
||||
}
|
||||
catch(InvalidFilenameException &e)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ MapBlock::MapBlock(Map *parent, v3s16 pos, IGameDef *gamedef, bool dummy):
|
||||
data = NULL;
|
||||
if(dummy == false)
|
||||
reallocate();
|
||||
|
||||
|
||||
#ifndef SERVER
|
||||
mesh = NULL;
|
||||
#endif
|
||||
@ -73,7 +73,7 @@ MapBlock::~MapBlock()
|
||||
#ifndef SERVER
|
||||
{
|
||||
//JMutexAutoLock lock(mesh_mutex);
|
||||
|
||||
|
||||
if(mesh)
|
||||
{
|
||||
delete mesh;
|
||||
@ -115,7 +115,7 @@ MapNode MapBlock::getNodeParent(v3s16 p, bool *is_valid_position)
|
||||
/*
|
||||
Propagates sunlight down through the block.
|
||||
Doesn't modify nodes that are not affected by sunlight.
|
||||
|
||||
|
||||
Returns false if sunlight at bottom block is invalid.
|
||||
Returns true if sunlight at bottom block is valid.
|
||||
Returns true if bottom block doesn't exist.
|
||||
@ -138,16 +138,16 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
||||
|
||||
// Whether the sunlight at the top of the bottom block is valid
|
||||
bool block_below_is_valid = true;
|
||||
|
||||
|
||||
v3s16 pos_relative = getPosRelative();
|
||||
|
||||
|
||||
for(s16 x=0; x<MAP_BLOCKSIZE; x++)
|
||||
{
|
||||
for(s16 z=0; z<MAP_BLOCKSIZE; z++)
|
||||
{
|
||||
#if 1
|
||||
bool no_sunlight = false;
|
||||
bool no_top_block = false;
|
||||
//bool no_top_block = false;
|
||||
|
||||
// Check if node above block has sunlight
|
||||
|
||||
@ -168,8 +168,8 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
||||
}
|
||||
else
|
||||
{
|
||||
no_top_block = true;
|
||||
|
||||
//no_top_block = true;
|
||||
|
||||
// NOTE: This makes over-ground roofed places sunlighted
|
||||
// Assume sunlight, unless is_underground==true
|
||||
if(is_underground)
|
||||
@ -211,19 +211,19 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
||||
<<", is_underground="<<is_underground
|
||||
<<", no_sunlight="<<no_sunlight
|
||||
<<std::endl;*/
|
||||
|
||||
|
||||
s16 y = MAP_BLOCKSIZE-1;
|
||||
|
||||
|
||||
// This makes difference to diminishing in water.
|
||||
bool stopped_to_solid_object = false;
|
||||
|
||||
|
||||
u8 current_light = no_sunlight ? 0 : LIGHT_SUN;
|
||||
|
||||
for(; y >= 0; y--)
|
||||
{
|
||||
v3s16 pos(x, y, z);
|
||||
MapNode &n = getNodeRef(pos);
|
||||
|
||||
|
||||
if(current_light == 0)
|
||||
{
|
||||
// Do nothing
|
||||
@ -236,7 +236,7 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
||||
{
|
||||
// A solid object is on the way.
|
||||
stopped_to_solid_object = true;
|
||||
|
||||
|
||||
// Light stops.
|
||||
current_light = 0;
|
||||
}
|
||||
@ -252,7 +252,7 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
||||
{
|
||||
n.setLight(LIGHTBANK_DAY, current_light, nodemgr);
|
||||
}
|
||||
|
||||
|
||||
if(diminish_light(current_light) != 0)
|
||||
{
|
||||
light_sources.insert(pos_relative + pos);
|
||||
@ -275,7 +275,7 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
||||
|
||||
Check if the node below the block has proper sunlight at top.
|
||||
If not, the block below is invalid.
|
||||
|
||||
|
||||
Ignore non-transparent nodes as they always have no light
|
||||
*/
|
||||
|
||||
@ -311,7 +311,7 @@ void MapBlock::copyTo(VoxelManipulator &dst)
|
||||
{
|
||||
v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
|
||||
VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));
|
||||
|
||||
|
||||
// Copy from data to VoxelManipulator
|
||||
dst.copyFrom(data, data_area, v3s16(0,0,0),
|
||||
getPosRelative(), data_size);
|
||||
@ -321,7 +321,7 @@ void MapBlock::copyFrom(VoxelManipulator &dst)
|
||||
{
|
||||
v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
|
||||
VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));
|
||||
|
||||
|
||||
// Copy from VoxelManipulator to data
|
||||
dst.copyTo(data, data_area, v3s16(0,0,0),
|
||||
getPosRelative(), data_size);
|
||||
@ -520,18 +520,18 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
|
||||
{
|
||||
if(!ser_ver_supported(version))
|
||||
throw VersionMismatchException("ERROR: MapBlock format not supported");
|
||||
|
||||
|
||||
if(data == NULL)
|
||||
{
|
||||
throw SerializationError("ERROR: Not writing dummy block.");
|
||||
}
|
||||
|
||||
|
||||
// Can't do this anymore; we have 16-bit dynamically allocated node IDs
|
||||
// in memory; conversion just won't work in this direction.
|
||||
if(version < 24)
|
||||
throw SerializationError("MapBlock::serialize: serialization to "
|
||||
"version < 24 not possible");
|
||||
|
||||
|
||||
// First byte
|
||||
u8 flags = 0;
|
||||
if(is_underground)
|
||||
@ -543,7 +543,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
|
||||
if(m_generated == false)
|
||||
flags |= 0x08;
|
||||
writeU8(os, flags);
|
||||
|
||||
|
||||
/*
|
||||
Bulk node data
|
||||
*/
|
||||
@ -573,7 +573,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
|
||||
MapNode::serializeBulk(os, version, data, nodecount,
|
||||
content_width, params_width, true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Node metadata
|
||||
*/
|
||||
@ -599,7 +599,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
|
||||
|
||||
// Write block-specific node definition id mapping
|
||||
nimap.serialize(os);
|
||||
|
||||
|
||||
if(version >= 25){
|
||||
// Node timers
|
||||
m_node_timers.serialize(os, version);
|
||||
@ -626,7 +626,7 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk)
|
||||
{
|
||||
if(!ser_ver_supported(version))
|
||||
throw VersionMismatchException("ERROR: MapBlock format not supported");
|
||||
|
||||
|
||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())<<std::endl);
|
||||
|
||||
m_day_night_differs_expired = false;
|
||||
@ -702,13 +702,13 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk)
|
||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
||||
<<": Static objects"<<std::endl);
|
||||
m_static_objects.deSerialize(is);
|
||||
|
||||
|
||||
// Timestamp
|
||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
||||
<<": Timestamp"<<std::endl);
|
||||
setTimestamp(readU32(is));
|
||||
m_disk_timestamp = m_timestamp;
|
||||
|
||||
|
||||
// Dynamically re-set ids based on node names
|
||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
||||
<<": NameIdMapping"<<std::endl);
|
||||
@ -722,7 +722,7 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk)
|
||||
m_node_timers.deSerialize(is, version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
||||
<<": Done."<<std::endl);
|
||||
}
|
||||
@ -809,7 +809,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
||||
databuf_nodelist[i*ser_length + 1] = s[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(version >= 10)
|
||||
{
|
||||
// Uncompress and set param2 data
|
||||
@ -852,7 +852,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
||||
databuf_nodelist[i*ser_length + 1] = s[i+nodecount];
|
||||
databuf_nodelist[i*ser_length + 2] = s[i+nodecount*2];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
NodeMetadata
|
||||
*/
|
||||
@ -989,12 +989,12 @@ std::string analyze_block(MapBlock *block)
|
||||
return "NULL";
|
||||
|
||||
std::ostringstream desc;
|
||||
|
||||
|
||||
v3s16 p = block->getPos();
|
||||
char spos[20];
|
||||
snprintf(spos, 20, "(%2d,%2d,%2d), ", p.X, p.Y, p.Z);
|
||||
desc<<spos;
|
||||
|
||||
|
||||
switch(block->getModified())
|
||||
{
|
||||
case MOD_STATE_CLEAN:
|
||||
@ -1051,21 +1051,21 @@ std::string analyze_block(MapBlock *block)
|
||||
else
|
||||
full_air = false;
|
||||
}
|
||||
|
||||
|
||||
desc<<"content {";
|
||||
|
||||
|
||||
std::ostringstream ss;
|
||||
|
||||
|
||||
if(full_ignore)
|
||||
ss<<"IGNORE (full), ";
|
||||
else if(some_ignore)
|
||||
ss<<"IGNORE, ";
|
||||
|
||||
|
||||
if(full_air)
|
||||
ss<<"AIR (full), ";
|
||||
else if(some_air)
|
||||
ss<<"AIR, ";
|
||||
|
||||
|
||||
if(ss.str().size()>=2)
|
||||
desc<<ss.str().substr(0, ss.str().size()-2);
|
||||
|
||||
|
@ -310,7 +310,6 @@ void Mapgen::spreadLight(v3s16 nmin, v3s16 nmax)
|
||||
{
|
||||
//TimeTaker t("spreadLight");
|
||||
VoxelArea a(nmin, nmax);
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
|
||||
for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) {
|
||||
for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) {
|
||||
|
@ -438,7 +438,6 @@ void MapgenV6::makeChunk(BlockMakeData *data)
|
||||
this->ndef = data->nodedef;
|
||||
|
||||
// Hack: use minimum block coords for old code that assumes a single block
|
||||
v3s16 blockpos = data->blockpos_requested;
|
||||
v3s16 blockpos_min = data->blockpos_min;
|
||||
v3s16 blockpos_max = data->blockpos_max;
|
||||
|
||||
|
@ -1025,10 +1025,6 @@ int ModApiMainMenu::l_download_file(lua_State *L)
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_get_video_drivers(lua_State *L)
|
||||
{
|
||||
unsigned int index = 1;
|
||||
lua_newtable(L);
|
||||
int top = lua_gettop(L);
|
||||
|
||||
std::vector<irr::video::E_DRIVER_TYPE> drivers
|
||||
= porting::getSupportedVideoDrivers();
|
||||
|
||||
|
@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "lua_api/l_base.h"
|
||||
|
||||
class INodeDefManager;
|
||||
class NodeResolveInfo;
|
||||
struct NodeResolveInfo;
|
||||
class DecoSimple;
|
||||
class DecoSchematic;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user