Commit a553086f authored by jan.koester's avatar jan.koester
Browse files

some optimations

parent 7ffb2373
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -5,19 +5,22 @@
int main(int argc, char *argv[]){
    try{
        HldsView hlds(argv[1], atoi(argv[2]));
        std::cout << "Gamename: " << hlds.getGameName() << std::endl;
        std::cout << "Servername: " << hlds.getServerName() << std::endl;
        std::cout << "Modname: " << hlds.getModName() << std::endl;
        std::cout << "Mapname: " << hlds.getMapName() << std::endl;

        HldsView::HldsData hldsdata;

        std::cout << "Gamename: " << hldsdata.GameName << std::endl;
        std::cout << "Servername: " << hldsdata.ServerName << std::endl;
        std::cout << "Modname: " << hldsdata.ModName << std::endl;
        std::cout << "Mapname: " << hldsdata.MapName << std::endl;
        std::cout << "pwprotected: ";
        if(hlds.pwProtected())
        if(hldsdata.pwProtected)
            std::cout << "yes";
        else
            std::cout << "no";
        std::cout << std::endl;
        std::cout << "Players: " << hlds.getPlayers()  << "("
                  << hlds.getBotsAmount() << ")" << "/"
                  << hlds.getMaxPlayers() << std::endl;
        std::cout << "Players: " << hldsdata.Players  << "("
                  << hldsdata.BotsAmount << ")" << "/"
                  << hldsdata.MaxPlayers << std::endl;
    }catch(char &e){
        std::cerr << e << std::endl;
    }
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ HldsView::~HldsView(){
}

void HldsView::refresh(HldsData &info){
    const std::lock_guard<std::mutex> lock(rlock);
    char buffer[1400];
    int rcv=0;
    try{
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*******************************************************************************/

#include <mutex>

#include <netplus/socket.h>

#include "gameinfoplus.h"
@@ -48,4 +50,6 @@ private:

    netplus::udp *clientSocket;
    netplus::udp *serverSocket;

    std::mutex rlock;
};