Fix MSVC build broken by 34d32ce
authorSmallJoker <mk939@ymail.com>
Mon, 17 Apr 2017 11:49:48 +0000 (13:49 +0200)
committerSmallJoker <mk939@ymail.com>
Mon, 17 Apr 2017 12:02:26 +0000 (14:02 +0200)
`round` -> `myround`
Remove superflous `floor` calls

src/network/serverpackethandler.cpp
src/server.cpp
src/util/string.h

index 2e4c5b6be8cf54c94df7384fd5fdacf0f2a64957..174b827f0147cced12fa602ac9655075e7525f75 100644 (file)
@@ -726,7 +726,7 @@ void Server::handleCommand_ClientReady(NetworkPacket* pkt)
        if (m_shutdown_timer > 0.0f) {
                std::wstringstream ws;
                ws << L"*** Server shutting down in "
-                               << duration_to_string(round(m_shutdown_timer)).c_str() << ".";
+                               << duration_to_string(myround(m_shutdown_timer)).c_str() << ".";
                SendChatMessage(pkt->getPeerId(), ws.str());
        }
 }
index 5328b6897a703e33ff0cecff06afc574d16ce581..a9e5c3d08820f0e441ab2b6e1c09066feca34b52 100644 (file)
@@ -1047,7 +1047,7 @@ void Server::AsyncRunStep(bool initial_step)
                                        std::wstringstream ws;
 
                                        ws << L"*** Server shutting down in "
-                                               << duration_to_string(round(m_shutdown_timer - dtime)).c_str()
+                                               << duration_to_string(myround(m_shutdown_timer - dtime)).c_str()
                                                << ".";
 
                                        infostream << wide_to_utf8(ws.str()).c_str() << std::endl;
@@ -3502,7 +3502,7 @@ void Server::requestShutdown(const std::string &msg, bool reconnect, float delay
                std::wstringstream ws;
 
                ws << L"*** Server shutting down in "
-                               << duration_to_string(round(m_shutdown_timer)).c_str()
+                               << duration_to_string(myround(m_shutdown_timer)).c_str()
                                << ".";
 
                infostream << wide_to_utf8(ws.str()).c_str() << std::endl;
index c155d2f4adf336b78916460ac1e7b9aa41d27a32..1a0b9f60d2782513bfa283455ed42506170a04cd 100644 (file)
@@ -616,9 +616,9 @@ inline const char *bool_to_cstr(bool val)
 
 inline const std::string duration_to_string(int sec)
 {
-       int min = floor(sec / 60);
+       int min = sec / 60;
        sec %= 60;
-       int hour = floor(min / 60);
+       int hour = min / 60;
        min %= 60;
 
        std::stringstream ss;