void sampinfo(u8 *data, int size) {
    int     info,
            namelen,
            modelen,
            maplen,
            pwd,
            pl,
            maxpl;
    u8      *name,
            *mode,
            *map,
            *p,
            *l;

    p = data;
    l = data + size;
    p += 4 + 4 + 2;
    p += getxx(p, &info,        8);
    if(info != 'i') {
        printf("\nAlert: no info packet received\n");
        return;
    }
    p += getxx(p, &pwd,         8);
    p += getxx(p, &pl,          16);
    p += getxx(p, &maxpl,       16);
    p += getxx(p, &namelen,     32);
    p += getmm(p, &name,        namelen);
    p += getxx(p, &modelen,     32);
    p += getmm(p, &mode,        modelen);
    p += getxx(p, &maplen,      32);
    p += getmm(p, &map,         maplen);
    printf(
        "\n"
        "  Name Server:      %.*s\n"
        "  GameMode:      %.*s\n"
        "  Map:       %.*s\n"
        "  Online:   %hu/%hu\n"
        "  Password:  %s\n"
        "\n",
        namelen, name,
        modelen, mode,
        maplen,  map,
        pl,      maxpl,
        pwd ? "yes" : "no");
}
Beispiel #2
0
void GetCommand(vector<size_t>& GetData, string command,multimap<size_t,data> &MapUser)
{
    for(int i = 0; i < 5; i++){
        cin >> command;
        GetData.push_back(atoi(command.c_str()));
        
    }
    
    getmm(MapUser,GetData);
}