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

new api

parent c2ac08c7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ const char* gameinfo::GameInfoException::what(){
    return msg.c_str();
}

gameinfo::GameInfoException& gameinfo::GameInfoException::append(const char *src){
gameinfo::GameInfoException& gameinfo::GameInfoException::append(const std::string &src){
    msg.append(src);
    return *this;   
}
@@ -61,7 +61,7 @@ gameinfo::GameInfoException& gameinfo::GameInfoException::operator[](int errtype
    return *this;
}

gameinfo::GameInfoException& gameinfo::GameInfoException::operator<<(const char *src){
gameinfo::GameInfoException& gameinfo::GameInfoException::operator<<(const std::string &src){
    return append(src);
};

+2 −2
Original line number Diff line number Diff line
@@ -57,9 +57,9 @@ namespace gameinfo {
        
        enum Type {Note,Warning,Error,Critical};
        
        GameInfoException& append(const char *src);
        GameInfoException& append(const std::string  &src);
        GameInfoException& operator[](int errtype);
        GameInfoException& operator<<(const char *src);
        GameInfoException& operator<<(const std::string &src);
        GameInfoException& operator<<(int src);
    private:
        int curCType;
+2 −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
*******************************************************************************/

#pragma once

#include <string>

namespace gameinfo {
+14 −11
Original line number Diff line number Diff line
@@ -78,28 +78,31 @@ void gameinfo::HldsView::refresh(HldsData &info){
    char buffer[1400];
    size_t rcv=0;
    try{
        uint8_t payload[A2S_INFO_PAYLOAD_LEN_WITH_CHALLENGE];
        memcpy(payload, payload_template, A2S_INFO_PAYLOAD_LEN_WITHOUT_CHALLENGE);
        netplus::buffer send(A2S_INFO_PAYLOAD_LEN_WITHOUT_CHALLENGE);
        memcpy(send.data.buf, payload_template, A2S_INFO_PAYLOAD_LEN_WITHOUT_CHALLENGE);

        clientSocket->sendData((void*)&payload,A2S_INFO_PAYLOAD_LEN_WITHOUT_CHALLENGE);

        char recv[9];
        rcv=clientSocket->recvData(&recv,sizeof(recv));
        clientSocket->sendData(send);

        if(recv[4] == 0x41){
            memcpy(challange,recv+5,4);
        netplus::buffer recv(1400);
        rcv=clientSocket->recvData(recv);

        if(recv.data.buf[4] == 0x41){
            memcpy(challange,recv.data.buf+5,4);
        }

        AGAIN:
        if(challange[0]!=0){
            memcpy(payload + A2S_INFO_PAYLOAD_CHALLENGE_OFFSET, &challange, sizeof (challange));
            clientSocket->sendData((void*)payload,A2S_INFO_PAYLOAD_LEN_WITH_CHALLENGE);
            memcpy(send.data.buf + A2S_INFO_PAYLOAD_CHALLENGE_OFFSET, &challange, sizeof (challange));
            send.size=A2S_INFO_PAYLOAD_LEN_WITH_CHALLENGE;
        }else{
            clientSocket->sendData((void*)payload,A2S_INFO_PAYLOAD_LEN_WITHOUT_CHALLENGE);
            send.size=A2S_INFO_PAYLOAD_LEN_WITHOUT_CHALLENGE;
        }

        clientSocket->sendData(send);


        rcv=clientSocket->recvData(buffer,1400);
        rcv=clientSocket->recvData(recv);

        if(rcv >4 && buffer[4] == 0x41){
            memcpy(challange,buffer+5,4);