Пример #1
0
////////////////
// GlobalParams:
// self
///////////////
void SpectatorDisconnect()
{
	gedict_t *p;

	if ( self->k_accepted )
	{
		for ( p = world; (p = ( match_in_progress == 2 && !cvar("k_ann") ) ? find_spc( p ) : find_client( p )); )	
			G_sprint( p, PRINT_HIGH, "Spectator %s left the game\n", self->s.v.netname );
	}

// s: added conditional function call here
	if( self->v.elect_type != etNone ) {

		if ( match_in_progress != 2 )
			G_bprint(2, "Election aborted\n");

		AbortElect();
	}

	if ( self->wizard ) {
		ent_remove( self->wizard );
		self->wizard = NULL;
	}

	if( self->k_kicking )
		ExitKick( self );

	self->s.v.classname = ""; // Cenobite, so we clear out any specs as they leave
	self->k_accepted  = 0;
	self->ct = ctNone;
}
Пример #2
0
        void add_ext_line(const std::string& name, const std::string& str, size_t pos)
        {
            while (pos != std::string::npos)
            {
                size_t npos=find_spc(str,pos);
                std::string extName=str.substr(pos, npos-pos);
                pos=find_al(str, npos);

                hash_t extNameHash = hash(extName);
                //std::cerr << "EXT [" << extName
                //	      << "] have name [" << name << "]"
                //		  << extNameHash <<std::endl;

                AVT::const_iterator i = dict.find(extNameHash);
                if (i != dict.end() &&
                    extName != i->second.first)
                {
                    std::cerr << "DetectMime: skip [" << extName
                    << "] collision with ["
                    << i->second.first << "] " << extNameHash << std::endl;
                    continue;
                }
                ExtPair pair(extName, name);
                dict.insert( std::make_pair(extNameHash,pair) );
            }
        }
Пример #3
0
void remove_specs_wizards ()
{
	gedict_t *p;

	for( p = world; (p = find_spc( p )); )
		if ( p->wizard ) {
			ent_remove( p->wizard );
			p->wizard = NULL;
		}
}
Пример #4
0
        void add_line(const std::string& str)
        {
            if(str.size() && str[0]!='#'){
                size_t pos = find_spc(str);
                if(pos != std::string::npos){
                    std::string nm=str.substr(0,pos);

                    pos=find_al(str,pos);	// beg of ext list
                    add_ext_line(nm, str, pos);
                }
            }
        }
Пример #5
0
void vote_check_nospecs ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_NOSPECS ) )
		return;

	veto = is_admins_vote( OV_NOSPECS );

	if( veto || !get_votes_req( OV_NOSPECS, true ) )
	{
		vote_clear( OV_NOSPECS );

		// set no specs mode
		cvar_fset("_k_nospecs", !cvar("_k_nospecs"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by admin veto", OnOff(cvar("_k_nospecs")))));
		else
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by majority vote", OnOff(cvar("_k_nospecs")))));

		// kick specs
		if ( cvar("_k_nospecs") )
		{
			gedict_t *spec;

			for ( spec = world; (spec = find_spc( spec )); )
			{
				if ( VIP( spec ) & ALLOWED_NOSPECS_VIPS )
					continue; // don't kick this VIP
    
				if ( is_real_adm(spec) )
					continue; // don't kick real admin
    
				stuffcmd(spec, "disconnect\n");  // FIXME: stupid way
			}
		}

		return;
	}
}
Пример #6
0
////////////////
// GlobalParams:
// time
// self
// params
///////////////
void SpectatorConnect()
{
	gedict_t *p;
	int diff = (int)(PROG_TO_EDICT(self->s.v.goalentity) - world);

	if ( !SpecCanConnect( self ) )
	{
		stuffcmd(self, "disconnect\n"); // FIXME: stupid way
		return;
	}

	SpecDecodeLevelParms();

	self->ct = ctSpec;
	self->s.v.classname = "spectator"; // Added this in for kick code
	self->k_accepted = 1; // spectator has no restriction to connect

	for ( p = world; (p = ( match_in_progress == 2 && !cvar("k_ann") ) ? find_spc( p ) : find_client( p )); )
		if ( p != self )  // does't show msg for self
			G_sprint( p, PRINT_HIGH, "Spectator %s entered the game\n", self->s.v.netname  );

	if ( diff < 0 || diff >= MAX_EDICTS ) // something wrong happen - fixing
		self->s.v.goalentity = EDICT_TO_PROG( world );

	VIP_ShowRights( self );
	CheckRate(self, "");

	if ( match_in_progress != 2 ) {
		self->wizard = spawn();
		self->wizard->s.v.classname = "spectator_wizard";
		self->wizard->s.v.think = ( func_t ) wizard_think;
		self->wizard->s.v.nextthink = g_globalvars.time + 0.1;
	}

	// Wait until you do stuffing
	MakeMOTD();
}