Beispiel #1
0
/*
  Host_Map_f

  handle a
  map <servername>
  command from the console.  Active clients are kicked off.
*/
static void
Host_Map_f (void)
{
	char        name[MAX_QPATH];
	const char *expanded;
	QFile      *f;

	if (cmd_source != src_command)
		return;

	if (Cmd_Argc () > 2) {
		Sys_Printf ("map <levelname> : continue game on a new level\n");
		return;
	}
	if (Cmd_Argc () == 1) {
		Sys_Printf ("map is %s \"%s\" (%s)\n", sv.name,
					PR_GetString (&sv_pr_state, SVstring (sv.edicts, message)),
					nice_time (sv.time));
		return;
	}

	// check to make sure the level exists
	expanded = va ("maps/%s.bsp", Cmd_Argv (1));
	QFS_FOpenFile (expanded, &f);
	if (!f) {
		Sys_Printf ("Can't find %s\n", expanded);
		return;
	}
	Qclose (f);

	cls.demonum = -1;					// stop demo loop in case this fails

	CL_Disconnect ();
	Host_ShutdownServer (false);

	cl.loading = true;
	CL_UpdateScreen (cl.time);

	svs.serverflags = 0;				// haven't completed an episode yet
	strcpy (name, Cmd_Argv (1));
	SV_SpawnServer (name);
	if (!sv.active)
		return;

	if (cls.state != ca_dedicated) {
		Cmd_ExecuteString ("connect local", src_command);
	}
}
Beispiel #2
0
/*
	SV_Map_f

	handle a
	map <mapname>
	command from the console or progs.
*/
static void
SV_Map_f (void)
{
	const char *level;
	char       *expanded;
	QFile      *f;

	if (!curlevel)
		curlevel = dstring_newstr ();

	if (Cmd_Argc () > 2) {
		SV_Printf ("map <levelname> : continue game on a new level\n");
		return;
	}
	if (Cmd_Argc () == 1) {
		SV_Printf ("map is %s \"%s\" (%s)\n", curlevel->str,
				   PR_GetString (&sv_pr_state, SVstring (sv.edicts, message)),
				   nice_time (sv.time));
		return;
	}
	level = Cmd_Argv (1);

	// check to make sure the level exists
	expanded = nva ("maps/%s.bsp", level);
	f = QFS_FOpenFile (expanded);
	if (!f) {
		SV_Printf ("Can't find %s\n", expanded);
		free (expanded);
		return;
	}
	Qclose (f);
	free (expanded);

	if (sv.recording_demo)
		SV_Stop (0);

	SV_qtvChanging ();
	SV_BroadcastCommand ("changing\n");
	SV_SendMessagesToAll ();

	dstring_copystr (curlevel, level);
	SV_SpawnServer (level);

	SV_qtvReconnect ();
	SV_BroadcastCommand ("reconnect\n");
}
Beispiel #3
0
void ArticleToolTip::show_article_info(int article_id)
{
    if (article_id == _article_id)
    {
        if (isVisible())
            return;
        show();
        return;
    }

    _article_id = article_id;
    rc_ptr<Bundle> info = _db->get_article_info(article_id);
    if (info.is_null())
        return;

    QString s = info->get_value<QString>("CTime");
    _ui.ctime_lbl->setText(nice_time(s));

    s = info->get_value<QString>("MTime");
    _ui.mtime_lbl->setText(nice_time(s));

    s = info->get_value<QString>("ATime");
    _ui.atime_lbl->setText(nice_time(s));

    _ui.hits_lbl->setText(QString::number(info->get_value<int>("Hits")));

    const int directory_id = info->get_value<int>("DirectoryId");
    const QString path = _db->get_directory_path(directory_id);
    s = "<a href=\"locatePath\">";
    s += path;
    s += "</a>";
    _ui.path_lbl->setText(s);

    const QString url = info->get_value<QString>("Url").trimmed();
    if (url.length() == 0)
    {
        _ui.url_des_lbl->hide();
        _ui.url_lbl->hide();
        _ui.main_lyt->removeWidget(_ui.url_des_lbl);
        _ui.main_lyt->removeWidget(_ui.url_lbl);
    }
    else
    {
        _ui.url_des_lbl->show();
        _ui.url_lbl->show();
        _ui.main_lyt->addWidget(_ui.url_des_lbl, 3, 0, 1, 1);
        _ui.main_lyt->addWidget(_ui.url_lbl, 3, 1, 1, 3);

        s = "<a href=\"";
        s += url;
        s += "\">";
        s += url;
        s += "</a>";
        _ui.url_lbl->setText(s);
    }

    s = info->get_value<QString>("Keywords").trimmed();
    if (s.length() == 0)
    {
        _ui.kw_des_lbl->hide();
        _ui.kw_lbl->hide();
        _ui.main_lyt->removeWidget(_ui.kw_des_lbl);
        _ui.main_lyt->removeWidget(_ui.kw_lbl);
    }
    else
    {
        _ui.kw_des_lbl->show();
        _ui.kw_lbl->show();
        _ui.main_lyt->addWidget(_ui.kw_des_lbl, 4, 0, 1, 1);
        _ui.main_lyt->addWidget(_ui.kw_lbl, 4, 1, 1, 3);

        _ui.kw_lbl->setText(s);
    }

    adjustSize();
    show();

#if !defined(NDEBUG) && 0
    cout << "showArticle " << rect().topLeft().x() << " " << rect().topLeft().y() << endl;
#endif
}
Beispiel #4
0
void
SV_Status_f (void)
{
	int         i;
	client_t   *cl;
	float       cpu, avg, pak, demo = 0;
	const char *s;


	cpu = (svs.stats.latched_active + svs.stats.latched_idle);
	if (cpu) {
		demo = 100 * svs.stats.latched_demo / cpu;
		cpu = 100 * svs.stats.latched_active / cpu;
	}
	avg = 1000 * svs.stats.latched_active / STATFRAMES;
	pak = (float) svs.stats.latched_packets / STATFRAMES;

	SV_Printf ("net address      : %s\n", NET_AdrToString (net_local_adr));
	SV_Printf ("uptime           : %s\n", nice_time (Sys_DoubleTime ()));
	SV_Printf ("cpu utilization  : %3i%% (%3i%%)\n", (int) cpu, (int)demo);
	SV_Printf ("avg response time: %i ms\n", (int) avg);
	SV_Printf ("packets/frame    : %5.2f\n", pak);

	// min fps lat drp
	if (sv_redirected != RD_NONE && sv_redirected != RD_MOD) {
		// most remote clients are 40 columns
		//          0123456789012345678901234567890123456789
		SV_Printf ("name               userid frags\n");
		SV_Printf ("  address          rate ping drop\n");
		SV_Printf ("  ---------------- ---- ---- -----\n");
		for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
			if (!cl->state)
				continue;

			SV_Printf ("%-16.16s  ", cl->name);

			SV_Printf ("%6i %5i", cl->userid, (int) SVfloat (cl->edict, frags));
			if (cl->spectator)
				SV_Printf (" (s)\n");
			else
				SV_Printf ("\n");

			s = NET_BaseAdrToString (cl->netchan.remote_address);
			SV_Printf ("  %-16.16s", s);
			if (cl->state == cs_connected) {
				SV_Printf ("CONNECTING\n");
				continue;
			}
			if (cl->state == cs_zombie) {
				SV_Printf ("ZOMBIE\n");
				continue;
			}
			if (cl->state == cs_server) {
				SV_Printf ("SERVER %d\n", cl->ping);
				continue;
			}
			SV_Printf ("%4i %4i %5.2f\n",
					   (int) (1000 * cl->netchan.frame_rate),
					   (int) SV_CalcPing (cl),
					   100.0 * cl->netchan.drop_count /
							cl->netchan.incoming_sequence);
		}
	} else {
		SV_Printf ("frags userid address         name            rate ping "
				   "drop  qport\n");
		SV_Printf ("----- ------ --------------- --------------- ---- ---- "
				   "----- -----\n");
		for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
			if (!cl->state)
				continue;
			SV_Printf ("%5i %6i ", (int) SVfloat (cl->edict, frags),
					   cl->userid);

			s = NET_BaseAdrToString (cl->netchan.remote_address);

			SV_Printf ("%-15.15s ", s);

			SV_Printf ("%-15.15s ", cl->name);

			if (cl->state == cs_connected) {
				SV_Printf ("CONNECTING\n");
				continue;
			}
			if (cl->state == cs_zombie) {
				SV_Printf ("ZOMBIE\n");
				continue;
			}
			if (cl->state == cs_server) {
				SV_Printf ("SERVER %d\n", cl->ping);
				continue;
			}
			SV_Printf ("%4i %4i %3.1f %4i",
						(int) (1000 * cl->netchan.frame_rate),
						(int) SV_CalcPing (cl),
						100.0 * cl->netchan.drop_count /
						cl->netchan.incoming_sequence, cl->netchan.qport);
			if (cl->spectator)
				SV_Printf (" (s)\n");
			else
				SV_Printf ("\n");
		}
	}
	SV_Printf ("\n");
}