| 2918 | } |
| 2919 | |
| 2920 | void welcomepacket(packetbuf &p, int n) |
| 2921 | { |
| 2922 | if(!sg->smapname[0]) maprot.next(false); |
| 2923 | |
| 2924 | client *c = valid_client(n) ? clients[n] : NULL; |
| 2925 | int numcl = numclients(); |
| 2926 | |
| 2927 | putint(p, SV_WELCOME); |
| 2928 | putint(p, sg->smapname[0] && !m_demo ? numcl : -1); |
| 2929 | if(sg->smapname[0] && !m_demo) |
| 2930 | { |
| 2931 | putint(p, SV_MAPCHANGE); |
| 2932 | sendstring(sg->smapname, p); |
| 2933 | putint(p, sg->smode); |
| 2934 | putint(p, sg->curmap && sg->curmap->isdistributable() ? sg->curmap->cgzlen : 0); |
| 2935 | putint(p, sg->curmap && sg->curmap->isdistributable() ? sg->curmap->maprevision : 0); |
| 2936 | putint(p, sg->srvgamesalt); |
| 2937 | if(sg->smode>1 || (sg->smode==0 && numnonlocalclients()>0)) |
| 2938 | { |
| 2939 | putint(p, SV_TIMEUP); |
| 2940 | putint(p, (sg->gamemillis>=sg->gamelimit || sg->forceintermission) ? sg->gamelimit : sg->gamemillis); |
| 2941 | putint(p, sg->gamelimit); |
| 2942 | //putint(p, sg->minremain*60); |
| 2943 | } |
| 2944 | send_item_list(p); // this includes the flags |
| 2945 | } |
| 2946 | savedscore *sc = NULL; |
| 2947 | if(c) |
| 2948 | { |
| 2949 | if(c->type == ST_TCPIP && serveroperator() != -1) sendserveropinfo(n); |
| 2950 | c->team = sg->mastermode == MM_MATCH && sc ? team_tospec(sc->team) : TEAM_SPECT; |
| 2951 | putint(p, SV_SETTEAM); |
| 2952 | putint(p, n); |
| 2953 | putint(p, c->team | (FTR_INFO << 4)); |
| 2954 | |
| 2955 | putint(p, SV_FORCEDEATH); |
| 2956 | putint(p, n); |
| 2957 | sendf(-1, 1, "ri2x", SV_FORCEDEATH, n, n); |
| 2958 | } |
| 2959 | if(!c || clients.length()>1) |
| 2960 | { |
| 2961 | putint(p, SV_RESUME); |
| 2962 | loopv(clients) |
| 2963 | { |
| 2964 | client &c = *clients[i]; |
| 2965 | if(c.type!=ST_TCPIP || c.clientnum==n) continue; |
| 2966 | putint(p, c.clientnum); |
| 2967 | putint(p, c.state.state); |
| 2968 | putint(p, c.state.lifesequence); |
| 2969 | putint(p, c.state.primary); |
| 2970 | putint(p, c.state.gunselect); |
| 2971 | putint(p, c.state.flagscore); |
| 2972 | putint(p, c.state.frags); |
| 2973 | putint(p, c.state.deaths); |
| 2974 | putint(p, c.state.health); |
| 2975 | putint(p, c.state.armour); |
| 2976 | putint(p, c.state.teamkills); |
| 2977 | loopi(NUMGUNS) putint(p, c.state.ammo[i]); |
no test coverage detected