This list is closed, nobody may subscribe to it.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(19) |
Aug
(4) |
Sep
(20) |
Oct
(42) |
Nov
(80) |
Dec
(19) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(29) |
Feb
(100) |
Mar
(297) |
Apr
(115) |
May
(66) |
Jun
(145) |
Jul
(139) |
Aug
(19) |
Sep
(45) |
Oct
(53) |
Nov
(46) |
Dec
(148) |
| 2003 |
Jan
(277) |
Feb
(91) |
Mar
(17) |
Apr
(20) |
May
(63) |
Jun
(786) |
Jul
(1737) |
Aug
(740) |
Sep
(635) |
Oct
(538) |
Nov
(345) |
Dec
(652) |
| 2004 |
Jan
(1101) |
Feb
(557) |
Mar
(460) |
Apr
(154) |
May
(366) |
Jun
(296) |
Jul
(457) |
Aug
(582) |
Sep
(682) |
Oct
(515) |
Nov
(482) |
Dec
(711) |
| 2005 |
Jan
(819) |
Feb
(215) |
Mar
(398) |
Apr
(183) |
May
(459) |
Jun
(226) |
Jul
(303) |
Aug
(509) |
Sep
(566) |
Oct
(766) |
Nov
(294) |
Dec
(149) |
| 2006 |
Jan
(330) |
Feb
(192) |
Mar
(155) |
Apr
(633) |
May
(207) |
Jun
(51) |
Jul
(197) |
Aug
(121) |
Sep
(18) |
Oct
(54) |
Nov
(159) |
Dec
(134) |
| 2007 |
Jan
(341) |
Feb
(179) |
Mar
(220) |
Apr
(221) |
May
(71) |
Jun
(194) |
Jul
(283) |
Aug
(872) |
Sep
(406) |
Oct
(154) |
Nov
(103) |
Dec
(118) |
| 2008 |
Jan
(82) |
Feb
(192) |
Mar
(232) |
Apr
(215) |
May
(248) |
Jun
(604) |
Jul
(305) |
Aug
(228) |
Sep
(188) |
Oct
(195) |
Nov
(129) |
Dec
(110) |
| 2009 |
Jan
(182) |
Feb
(120) |
Mar
(150) |
Apr
(195) |
May
(74) |
Jun
(190) |
Jul
(339) |
Aug
(212) |
Sep
(101) |
Oct
(6) |
Nov
(7) |
Dec
(15) |
| 2010 |
Jan
(49) |
Feb
(127) |
Mar
(100) |
Apr
(60) |
May
(165) |
Jun
(41) |
Jul
(9) |
Aug
(32) |
Sep
(40) |
Oct
|
Nov
(7) |
Dec
(9) |
| 2011 |
Jan
(8) |
Feb
(8) |
Mar
(1) |
Apr
(6) |
May
(389) |
Jun
(278) |
Jul
(65) |
Aug
(10) |
Sep
(23) |
Oct
(67) |
Nov
(22) |
Dec
(96) |
| 2012 |
Jan
(30) |
Feb
(33) |
Mar
(54) |
Apr
(32) |
May
(3) |
Jun
(16) |
Jul
(44) |
Aug
(8) |
Sep
(4) |
Oct
(3) |
Nov
(4) |
Dec
(25) |
| 2013 |
Jan
(72) |
Feb
(23) |
Mar
(53) |
Apr
(16) |
May
(51) |
Jun
(37) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(5) |
Dec
|
|
From: <bla...@us...> - 2014-11-29 02:37:11
|
Revision: 22835
http://sourceforge.net/p/bzflag/code/22835
Author: blast007
Date: 2014-11-29 02:37:03 +0000 (Sat, 29 Nov 2014)
Log Message:
-----------
Remove DEBUG, REGISTER, and CONFIRM actions.
Modified Paths:
--------------
trunk/web/bzfls/bzfls.php
Modified: trunk/web/bzfls/bzfls.php
===================================================================
--- trunk/web/bzfls/bzfls.php 2014-11-29 01:30:29 UTC (rev 22834)
+++ trunk/web/bzfls/bzfls.php 2014-11-29 02:37:03 UTC (rev 22835)
@@ -251,7 +251,6 @@
function testform($message) {
- global $action;
header('Content-type: text/html');
print('<html>
<head>
@@ -264,11 +263,8 @@
<form action="" method="POST">
action:<select name="action">
<option value="LIST" selected>LIST - list servers</option>
- <option value="DEBUG">DEBUG - developer interface</option>
<option value="ADD">ADD - add a server</option>
<option value="REMOVE">REMOVE - remove a server</option>
- <option value="REGISTER">REGISTER - new player</option>
- <option value="CONFIRM">CONFIRM - confirm registration</option>
<option value="CHECKTOKENS">CHECKTOKENS - verify player token from game server</option>
<option value="GETTOKEN">GETTOKEN - get player token</option>
<option value="UNKNOWN">UNKNOWN - test invalid request</option>
@@ -302,21 +298,7 @@
<input type="submit" value="Post entry">
<input type="reset" value="Clear form">
</form>
-</body>');
- if ($action == 'DEBUG') {
- # clear secure bits
- global $dbhost, $dbname, $bbdbname, $dbuname, $dbpass;
- $dbhost = 'HIDDEN';
- $dbname = 'HIDDEN';
- $bbdbname = 'HIDDEN';
- $dbuname = 'HIDDEN';
- $dbpass = 'HIDDEN';
-// print("<PRE>\n");
-// var_dump($GLOBALS);
-// print("</PRE>\n");
-// phpinfo();
- }
- print('</body>
+</body>
</html>');
}
@@ -879,81 +861,6 @@
print("REMOVE: $nameport\n");
}
-function action_register() {
- # -- REGISTER --
- # Registers a player onto the players database.
- global $link, $callsign, $email, $password;
- # see if there is an existing entry
- header('Content-type: text/plain');
- $result = mysql_query("SELECT * FROM players WHERE email = '$email'", $link)
- or die ('Invalid query: '. mysql_error());
- if ( mysql_num_rows($result) > 0 ) {
- print('Registration FAILED: ');
- print("A player has already registered with the email address: $email");
- exit;
- }
- $result = mysql_query("SELECT * FROM players WHERE callsign = '$callsign'", $link)
- or die ('Invalid query: '. mysql_error());
- if ( mysql_num_rows($result) > 0 ) {
- print('Registration FAILED: ');
- print("A player has already registered with the callsign: $callsign");
- exit;
- }
-
- # no existing entry found - proceed to complete the registration
- $alphanum = 'abcdefghijklmnopqrstuvwxyz0123456789';
- $randtext = '';
- srand(microtime() * 100000000);
- for ( $i = 0; $i < 8; $i++ )
- $randtext .= $alphanum{rand(0,35)};
- # FIXME remove `` etc from email
- $to = urldecode($email);
- mail($to, "BZFlag player registration",
- "You have just registered a BZFlag player account with\n" .
- " callsign: $callsign\n" .
- " password: $password\n" .
- "To activate this account, please go to the following URL:\n\n" .
- "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . "?action=CONFIRM&email=$email&password=$randtext\n")
- or die ("Could not send mail");
- $curtime = time();
- $result = mysql_query("INSERT INTO players "
- . "(email, callsign, password, created, randtext, lastmod) VALUES "
- . "('$email', '$callsign', '$password', '$curtime', "
- . "'$randtext', '$curtime')", $link)
- or die ("Invalid query: ". mysql_error());
- print("Registration SUCCESSFUL: ");
- print("You will receive an email informing you on how to complete your account registration\n");
- #print("While we are debugging, the link is posted here as well.:\n" .
- # "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . "?action=CONFIRM&email=$email&password=$randtext\n");
-}
-
-function action_confirm() {
- # -- CONFIRM --
- # Confirm a registration
- global $link, $email, $password;
- header('Content-type: text/html');
- print("<html><head><title>Confirm registration</title></head><body>\n");
- $result = mysql_query("SELECT randtext FROM players WHERE email='$email'", $link)
- or die ('Invalid query: ' . mysql_error());
- $row = mysql_fetch_row($result);
- $randtext = $row[0];
- if ( $randtext == NULL ) {
- print("The account $email has already been confirmed.<br>\n");
- } else {
- if ( $password != $randtext ) {
- print("Failed to confirm registration for $email since generated key did not match<br>\n");
- } else {
- $result = mysql_query("UPDATE players SET "
- . "randtext = NULL, "
- . "lastmod = '" . time() . "' "
- . "WHERE email='$email'", $link)
- or die ('Invalid query: ' . mysql_error());
- print("The account for $email has been successfully activated.<br>\n");
- }
- }
- print('See <a href="http://BZFlag.org">http://BZFlag.org</a></body></html>');
-}
-
# set up a list of addresses to check
$values = Array();
$values['ipaddress'][0] = $_SERVER['REMOTE_ADDR'];
@@ -1008,10 +915,6 @@
action_checktokens();
break;
}
- case 'DEBUG': {
- testform('');
- break;
- }
default: {
# TODO dump the default form here but still close the database connection
testform('Unknown command: \'' . $action . '\'');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bla...@us...> - 2014-11-29 01:30:32
|
Revision: 22834
http://sourceforge.net/p/bzflag/code/22834
Author: blast007
Date: 2014-11-29 01:30:29 +0000 (Sat, 29 Nov 2014)
Log Message:
-----------
Fix a couple instances of warnings about undefined variables, and eliminate the group lookup query if the player entered the wrong password.
Modified Paths:
--------------
trunk/web/bzfls/bzfls.php
Modified: trunk/web/bzfls/bzfls.php
===================================================================
--- trunk/web/bzfls/bzfls.php 2014-11-29 01:27:28 UTC (rev 22833)
+++ trunk/web/bzfls/bzfls.php 2014-11-29 01:30:29 UTC (rev 22834)
@@ -448,6 +448,7 @@
$playerid = $row[0];
if (!$playerid || !phpbb_check_hash($password, $row[1])) {
$listing['token'] = ""; // empty token is a bad token
+ $playerid = 0;
debug ("NOTOK", 2);
} else {
srand(microtime() * 100000000);
@@ -476,7 +477,7 @@
}
$advertList = "0"; // marker for phantom group 'EVERYONE'
- if ($playerid){
+ if (isset($playerid) && $playerid){
global $verifiedGroupID;
sqlQuery ("USE $bbdbname");
@@ -504,6 +505,8 @@
if ($version)
$qryv = "AND version='$version'";
+ else
+ $qryv = '';
$fields = "nameport,version,gameinfo,ipaddr,title";
$listing['fields'] = Array("addr", "version", "hexcode", "ipaddr", "title");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bla...@us...> - 2014-11-29 01:27:35
|
Revision: 22833
http://sourceforge.net/p/bzflag/code/22833
Author: blast007
Date: 2014-11-29 01:27:28 +0000 (Sat, 29 Nov 2014)
Log Message:
-----------
Never dump password information (hashed or otherwise) to the log.
Modified Paths:
--------------
trunk/web/bzfls/bzfls.php
Modified: trunk/web/bzfls/bzfls.php
===================================================================
--- trunk/web/bzfls/bzfls.php 2014-11-29 01:25:47 UTC (rev 22832)
+++ trunk/web/bzfls/bzfls.php 2014-11-29 01:27:28 UTC (rev 22833)
@@ -12,9 +12,6 @@
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
// WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-define ('MD5_PASSWORD', true);
-
define('IN_PHPBB', true);
$phpbb_root_path = '../../forums.bzflag.org/htdocs/';
$phpEx = 'php';
@@ -105,8 +102,8 @@
foreach ($a as $key => $val){
if (!strlen($msg))
$msg .= ', ';
- if (MD5_PASSWORD && strncasecmp ($key, "PASS", 4)==0)
- $val = md5($val);
+ if (strncasecmp ($key, "PASS", 4)==0)
+ $val = "**PASSWORD FILTERED**";
$msg .= "$key=$val";
}
return str_replace (array ("\r", "\n"), array ('<\r>', '<\n>'), $msg);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bla...@us...> - 2014-11-29 01:25:55
|
Revision: 22832
http://sourceforge.net/p/bzflag/code/22832
Author: blast007
Date: 2014-11-29 01:25:47 +0000 (Sat, 29 Nov 2014)
Log Message:
-----------
Eliminate senseless HTTP requests to look up owner information. Additionally, store the owner name with the server information to prevent needing additional database lookups.
Modified Paths:
--------------
trunk/web/bzfls/bzfls.php
Modified: trunk/web/bzfls/bzfls.php
===================================================================
--- trunk/web/bzfls/bzfls.php 2014-11-29 01:15:11 UTC (rev 22831)
+++ trunk/web/bzfls/bzfls.php 2014-11-29 01:25:47 UTC (rev 22832)
@@ -369,6 +369,7 @@
print "token = " . lua_quote($listing['token']) . ",\n";
}
print "fields = { 'version', 'hexcode', 'addr', 'ipaddr', 'title', 'owner' },\n";
+ //print "fields = { 'version', 'hexcode', 'addr', 'ipaddr', 'title', 'owner', 'ownername' },\n";
print "servers = {\n";
foreach ($listing['servers'] as $server) {
print "{"
@@ -377,7 +378,8 @@
. lua_quote($server[0]) . "," // addr
. lua_quote($server[3]) . "," // ipaddr
. lua_quote($server[4]) . "," // title
- . lua_quote($server[5]) . "},\n"; // owner
+ //. lua_quote($server[5]) . "," // owner
+ . lua_quote($server[6]) . "},\n"; // ownername
}
print "}\n"; // end the "servers" table
print "}\n";
@@ -391,6 +393,7 @@
print "token: " . json_quote($listing['token']) . ",\n";
}
print '"fields": ["version","hexcode","addr","ipaddr","title","owner"],' . "\n";
+ //print '"fields": ["version","hexcode","addr","ipaddr","title","owner","ownername"],' . "\n";
print '"servers": [';
$first = true;
foreach ($listing['servers'] as $server) {
@@ -405,7 +408,8 @@
. json_quote($server[0]) . "," // addr
. json_quote($server[3]) . "," // ipaddr
. json_quote($server[4]) . "," // title
- . json_quote($server[5]) . "]"; // owner
+ //. json_quote($server[5]) . "," // owner
+ . json_quote($server[6]) . "]"; // ownername
}
print "\n]\n";
print "}\n";
@@ -507,10 +511,10 @@
$fields = "nameport,version,gameinfo,ipaddr,title";
$listing['fields'] = Array("addr", "version", "hexcode", "ipaddr", "title");
- $needOwner = ($listformat == "lua") || ($listformat == "json");
- if ($needOwner) {
- $fields .= ",owner";
+ if ($listformat == "lua" || $listformat == "json") {
+ $fields .= ",owner,ownername";
$listing['fields'][] = "owner"; // append the owner field
+ $listing['fields'][] = "ownername"; // append the owner field
}
$result = sqlQuery("
@@ -521,19 +525,7 @@
$listing['servers'] = Array();
- while (true) {
- $row = mysql_fetch_row($result);
- if (!$row) {
- break;
- }
- if ($needOwner) {
- $owner = "";
- $ownerID = $row[5];
- if ($ownerID) {
- $owner = file_get_contents("http://my.bzflag.org/bzidtools.php?action=name&value=" . $ownerID);
- }
- $row[5] = $owner;
- }
+ while (($row = mysql_fetch_row($result)) !== FALSE) {
$listing['servers'][] = $row;
}
@@ -715,7 +707,7 @@
# -- ADD --
# Server either requests to be added to DB, or to issue a keep-alive so that it
# does not get dropped due to a timeout...
- global $link, $nameport, $version, $build, $gameinfo, $slashtitle, $checktokens, $groups, $debugNoIpCheck, $serverKey;
+ global $bbdbname, $dbname, $link, $nameport, $version, $build, $gameinfo, $slashtitle, $checktokens, $groups, $debugNoIpCheck, $serverKey;
header('Content-type: text/plain');
debug("Attempting to ADD $nameport $version $gameinfo " . stripslashes($slashtitle), 3);
@@ -744,13 +736,17 @@
}
// ok so the key is good, now to check the owner
- $owner = file_get_contents("http://my.bzflag.org/bzidtools.php?action=name&value=" . $ownerID);
-
- if (!$owner)
+ mysql_select_db($bbdbname);
+ $result = mysql_query("SELECT username_clean FROM bzbb3_users WHERE user_id='{$ownerID}'");
+ if (($row = mysql_fetch_row($result)) !== FALSE)
{
+ $owner = $row[0];
+ }
+ else {
print("ERROR: Owner lookup failure\n");
return;
}
+ mysql_select_db($dbname);
}
# Filter out badly formatted or buggy versions
@@ -796,6 +792,8 @@
fclose ($fp);
$curtime = time();
+
+ $ownerEsc = mysql_real_escape_string($owner);
$result = mysql_query("SELECT * FROM servers "
. "WHERE nameport = '".mysql_real_escape_string($nameport)."'", $link)
@@ -808,9 +806,9 @@
# Server does not already exist in DB so insert into DB
# FIXME escape title!
$result = mysql_query("INSERT INTO servers "
- . "(nameport, build, version, owner, gameinfo, ipaddr,"
+ . "(nameport, build, version, owner, ownername, gameinfo, ipaddr,"
. " title, lastmod) VALUES "
- . "('$nameport', '$build', '$version', '$ownerID',"
+ . "('$nameport', '$build', '$version', '$ownerID', '{$ownerEsc}', "
. " '$gameinfo', '$servip', '$slashtitle', $curtime)", $link)
or die ("Invalid query: ". mysql_error());
@@ -830,7 +828,8 @@
. "gameinfo = '$gameinfo', "
. "title = '$slashtitle', "
. "lastmod = $curtime, "
- . "owner = '$ownerID' "
+ . "owner = '$ownerID', "
+ . "ownername = '{$ownerEsc}' "
. "WHERE nameport = '$nameport'", $link)
or die ("Invalid query: ". mysql_error());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bla...@us...> - 2014-11-29 01:15:17
|
Revision: 22831
http://sourceforge.net/p/bzflag/code/22831
Author: blast007
Date: 2014-11-29 01:15:11 +0000 (Sat, 29 Nov 2014)
Log Message:
-----------
Require that the parsed URL has a valid host.
Modified Paths:
--------------
trunk/web/bzfls/weblogin.php
Modified: trunk/web/bzfls/weblogin.php
===================================================================
--- trunk/web/bzfls/weblogin.php 2013-10-16 07:17:18 UTC (rev 22830)
+++ trunk/web/bzfls/weblogin.php 2014-11-29 01:15:11 UTC (rev 22831)
@@ -81,6 +81,9 @@
$parsedURL = parse_url($URL);
+ if (!isset($parsedURL["host"]))
+ die ('ERROR, you must pass in a URL value');
+
$hostkey = md5($parsedURL["host"]);
$wlu = $hostkey.'wlu';
@@ -164,6 +167,9 @@
die ('ERROR, you must pass in a URL value');
$parsedURL = parse_url($URL);
+
+ if (!isset($parsedURL["host"]))
+ die ('ERROR, you must pass in a URL value');
if ( array_key_exists("username", $_REQUEST) )
$username = utf8_clean_string($_REQUEST['username']);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <al...@us...> - 2013-10-16 07:17:20
|
Revision: 22830
http://sourceforge.net/p/bzflag/code/22830
Author: allejo
Date: 2013-10-16 07:17:18 +0000 (Wed, 16 Oct 2013)
Log Message:
-----------
Added bz_isCountDownPaused() to the BZFS API
Modified Paths:
--------------
trunk/bzflag/include/bzfsAPI.h
trunk/bzflag/src/bzfs/bzfsAPI.cxx
Modified: trunk/bzflag/include/bzfsAPI.h
===================================================================
--- trunk/bzflag/include/bzfsAPI.h 2013-08-11 23:58:03 UTC (rev 22829)
+++ trunk/bzflag/include/bzfsAPI.h 2013-10-16 07:17:18 UTC (rev 22830)
@@ -1431,6 +1431,7 @@
// countdown
BZF_API bool bz_isCountDownActive( void );
BZF_API bool bz_isCountDownInProgress( void );
+BZF_API bool bz_isCountDownPaused( void );
// polls
BZF_API bool bz_pollVeto( void );
Modified: trunk/bzflag/src/bzfs/bzfsAPI.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfsAPI.cxx 2013-08-11 23:58:03 UTC (rev 22829)
+++ trunk/bzflag/src/bzfs/bzfsAPI.cxx 2013-10-16 07:17:18 UTC (rev 22830)
@@ -2236,6 +2236,11 @@
return countdownDelay > 0;
}
+BZF_API bool bz_isCountDownPaused( void )
+{
+ return clOptions->countdownPaused;
+}
+
BZF_API bool bz_pollVeto( void )
{
/* make sure that there is a poll arbiter */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-08-11 23:58:08
|
Revision: 22829
http://sourceforge.net/p/bzflag/code/22829
Author: bullet_catcher
Date: 2013-08-11 23:58:03 +0000 (Sun, 11 Aug 2013)
Log Message:
-----------
Use only 1 level of square bracket quotes for autoconf 2.63 compatibility.
Modified Paths:
--------------
trunk/bzflag/configure.ac
Modified: trunk/bzflag/configure.ac
===================================================================
--- trunk/bzflag/configure.ac 2013-07-05 17:03:30 UTC (rev 22828)
+++ trunk/bzflag/configure.ac 2013-08-11 23:58:03 UTC (rev 22829)
@@ -458,7 +458,7 @@
AC_CHECK_TYPES([std::shared_ptr<int>],
[# BZFlag expects std::shared_ptr support by default],
[AC_CHECK_TYPES([[std::tr1::shared_ptr<int>]],
- AC_DEFINE([[USE_TR1]], [[1]], [Define to 1 to use C++0X TR1]),
+ AC_DEFINE([USE_TR1], [1], [Define to 1 to use C++0X TR1]),
AC_MSG_ERROR([[The C++11 std::shared_ptr type is required to build BZFlag]]),
[[#include <tr1/memory>]])],
[#include <memory>])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-07-05 17:03:33
|
Revision: 22828
http://sourceforge.net/p/bzflag/code/22828
Author: bullet_catcher
Date: 2013-07-05 17:03:30 +0000 (Fri, 05 Jul 2013)
Log Message:
-----------
Undo r11261 to prevent a segfault at exit on Solaris, which apparently destroys class objects and function-local static variables in a different order at program exit than Linux.
Add checks to prevent dereferencing null pointer.
Revision Links:
--------------
http://sourceforge.net/p/bzflag/code/11261
Modified Paths:
--------------
trunk/bzflag/src/bzfs/ServerCommand.cxx
trunk/bzflag/src/bzfs/ServerCommand.h
trunk/bzflag/src/bzfs/commands.cxx
Modified: trunk/bzflag/src/bzfs/ServerCommand.cxx
===================================================================
--- trunk/bzflag/src/bzfs/ServerCommand.cxx 2013-07-01 06:22:12 UTC (rev 22827)
+++ trunk/bzflag/src/bzfs/ServerCommand.cxx 2013-07-05 17:03:30 UTC (rev 22828)
@@ -16,12 +16,16 @@
// system headers
#include <ctype.h>
+ServerCommand::MapOfCommands *ServerCommand::mapOfCommands = NULL;
+
// Use only lower case command name
ServerCommand::ServerCommand(std::string _commandName,
std::string _oneLineHelp)
: commandName(_commandName)
{
- (*getMapRef())[commandName] = this;
+ if (!mapOfCommands)
+ mapOfCommands = new MapOfCommands;
+ (*mapOfCommands)[commandName] = this;
oneLineHelp = commandName;
if (_oneLineHelp != "")
oneLineHelp += " " + _oneLineHelp;
@@ -29,21 +33,28 @@
ServerCommand::~ServerCommand()
{
- (*getMapRef()).erase(commandName);
+ if (mapOfCommands) {
+ mapOfCommands->erase(commandName);
+ if (mapOfCommands->empty()) {
+ delete mapOfCommands;
+ mapOfCommands = NULL;
+ }
+ }
}
bool ServerCommand::execute(const char *commandLine,
GameKeeper::Player *playerData)
{
- MapOfCommands &commandMap = *getMapRef();
+ if (!mapOfCommands)
+ return false;
int i;
for (i = 0; commandLine[i] && !isspace(commandLine[i]); i++)
;
std::string commandToken(commandLine, i);
MapOfCommands::iterator it
- = commandMap.find(TextUtils::tolower(commandToken));
- if (it == commandMap.end())
+ = mapOfCommands->find(TextUtils::tolower(commandToken));
+ if (it == mapOfCommands->end())
return false;
return (*(it->second))(commandLine, playerData);
}
@@ -53,13 +64,6 @@
return true;
}
-ServerCommand::MapOfCommands *ServerCommand::getMapRef()
-{
- static MapOfCommands mapOfCommands;
-
- return &mapOfCommands;
-}
-
std::string ServerCommand::getHelp()
{
return oneLineHelp;
Modified: trunk/bzflag/src/bzfs/ServerCommand.h
===================================================================
--- trunk/bzflag/src/bzfs/ServerCommand.h 2013-07-01 06:22:12 UTC (rev 22827)
+++ trunk/bzflag/src/bzfs/ServerCommand.h 2013-07-05 17:03:30 UTC (rev 22828)
@@ -45,7 +45,7 @@
typedef std::map<std::string, ServerCommand *> MapOfCommands;
- static MapOfCommands *getMapRef();
+ static MapOfCommands *mapOfCommands;
};
#endif
Modified: trunk/bzflag/src/bzfs/commands.cxx
===================================================================
--- trunk/bzflag/src/bzfs/commands.cxx 2013-07-01 06:22:12 UTC (rev 22827)
+++ trunk/bzflag/src/bzfs/commands.cxx 2013-07-05 17:03:30 UTC (rev 22828)
@@ -631,11 +631,15 @@
const int maxLineLen = 64;
const int playerId = playerData->getIndex();
+ if (!mapOfCommands) {
+ sendMessage(ServerPlayer, playerId,
+ "No server commands are defined"); // should not happen
+ return false;
+ }
+
// build a std::vector<> from the std::map<> of command names
std::vector<const std::string*> commands;
- MapOfCommands::iterator it;
- MapOfCommands& commandMap = *getMapRef();
- for (it = commandMap.begin(); it != commandMap.end(); ++it) {
+ for (MapOfCommands::iterator it = mapOfCommands->begin(); it != mapOfCommands->end(); ++it) {
const std::string& cmd = it->first;
if (cmd[0] != '/') {
continue; // ignore any fake entries (ex: CmdHelp)
@@ -684,6 +688,12 @@
bool CmdHelp::operator() (const char *message,
GameKeeper::Player *playerData)
{
+ const int t = playerData->getIndex();
+ if (!mapOfCommands) {
+ sendMessage(ServerPlayer, t,
+ "No server commands are defined"); // should not happen
+ return false;
+ }
int i;
for (i = 0; message[i] && !isspace(message[i]); i++)
@@ -703,10 +713,7 @@
bool none = true;
unsigned int matching = 0;
- int t = playerData->getIndex();
- MapOfCommands::iterator it;
- MapOfCommands &commandMap = *getMapRef();
- for (it = commandMap.begin(); it != commandMap.end(); ++it) {
+ for (MapOfCommands::iterator it = mapOfCommands->begin(); it != mapOfCommands->end(); ++it) {
std::string master = it->first;
master.resize(i);
if (master == commandToken) {
@@ -718,7 +725,7 @@
sendMessage(ServerPlayer, t,
("No command starting with " + commandToken).c_str());
else
- for (it = commandMap.begin(); it != commandMap.end(); ++it) {
+ for (MapOfCommands::iterator it = mapOfCommands->begin(); it != mapOfCommands->end(); ++it) {
std::string master = it->first;
master.resize(i);
if (master == commandToken) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-07-01 06:22:15
|
Revision: 22827
http://sourceforge.net/p/bzflag/code/22827
Author: bullet_catcher
Date: 2013-07-01 06:22:12 +0000 (Mon, 01 Jul 2013)
Log Message:
-----------
Remove the updateNumPlayers() subroutine, which does nothing useful.
Modified Paths:
--------------
trunk/bzflag/src/bzflag/playing.cxx
Modified: trunk/bzflag/src/bzflag/playing.cxx
===================================================================
--- trunk/bzflag/src/bzflag/playing.cxx 2013-06-29 22:15:30 UTC (rev 22826)
+++ trunk/bzflag/src/bzflag/playing.cxx 2013-07-01 06:22:12 UTC (rev 22827)
@@ -1152,18 +1152,6 @@
controlPanel->addMessage(fullMessage, mode);
}
-static void updateNumPlayers()
-{
- int i, numPlayers[NumTeams];
- for (i = 0; i < NumTeams; i++)
- numPlayers[i] = 0;
- for (i = 0; i < curMaxPlayers; i++)
- if (remotePlayers[i])
- numPlayers[remotePlayers[i]->getTeam()]++;
- if (myTank)
- numPlayers[myTank->getTeam()]++;
-}
-
static void updateHighScores()
{
/* check scores to see if my team and/or have the high score. change
@@ -1470,8 +1458,6 @@
}
World::getWorld()->setCurMaxPlayers(curMaxPlayers);
- updateNumPlayers();
-
return true;
}
@@ -2021,7 +2007,6 @@
enteringServer(msg);
} else {
addPlayer(id, msg, entered);
- updateNumPlayers();
checkScores = true;
// update the tank flags when in replay mode.
@@ -2070,7 +2055,6 @@
msg = nboUnpackUShort(msg, team);
msg = teams[int(team)].unpack(msg);
}
- updateNumPlayers();
checkScores = true;
break;
}
@@ -4612,7 +4596,6 @@
}
// initialize some other stuff
- updateNumPlayers();
updateFlag(Flags::Null);
updateHighScores();
hud->setHeading(myTank->getAngle());
@@ -7193,7 +7176,6 @@
scoreboard = hud->getScoreboard();
// initialize control panel and hud
- updateNumPlayers();
updateFlag(Flags::Null);
updateHighScores();
notifyBzfKeyMapChanged();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-06-29 22:15:33
|
Revision: 22826
http://sourceforge.net/p/bzflag/code/22826
Author: bullet_catcher
Date: 2013-06-29 22:15:30 +0000 (Sat, 29 Jun 2013)
Log Message:
-----------
Use std::string and TextUtils::format() when generating HUD strings instead of fixed size buffers and sprintf().
Modified Paths:
--------------
trunk/bzflag/src/bzflag/HUDRenderer.cxx
Modified: trunk/bzflag/src/bzflag/HUDRenderer.cxx
===================================================================
--- trunk/bzflag/src/bzflag/HUDRenderer.cxx 2013-06-29 22:11:44 UTC (rev 22825)
+++ trunk/bzflag/src/bzflag/HUDRenderer.cxx 2013-06-29 22:15:30 UTC (rev 22826)
@@ -92,11 +92,9 @@
// initialize heading and altitude labels
if (headingLabel[0].length() == 0) {
- char buf[10];
int i;
for (i = 0; i < 36; i++) {
- sprintf(buf, "%d", i * 10);
- headingLabel[i] = std::string(buf);
+ headingLabel[i] = TextUtils::format("%d", i * 10);
}
}
@@ -531,9 +529,7 @@
void HUDRenderer::setRestartKeyLabel(const std::string& label)
{
- char buffer[250];
- sprintf(buffer, BundleMgr::getCurrentBundle()->getLocalString(restartLabelFormat).c_str(), label.c_str());
- restartLabel = buffer;
+ restartLabel = TextUtils::format(BundleMgr::getCurrentBundle()->getLocalString(restartLabelFormat).c_str(), label.c_str());
FontManager &fm = FontManager::instance();
restartLabelWidth = fm.getStrLength(bigFontFace, bigFontSize, restartLabel);
}
@@ -823,7 +819,6 @@
FontManager &fm = FontManager::instance();
- char buffer[80];
const float h = fm.getStrHeight(majorFontFace, majorFontSize, " ");
float x = 0.25f * h;
float y = (float)window.getViewHeight() - h;
@@ -832,20 +827,20 @@
// print player name and score in upper left corner in team (radar) color
if (!roaming && (!playerHasHighScore || scoreClock.isOn())) {
- sprintf(buffer, "%s: %d", myTank->getCallSign(), myTank->getScore());
hudColor3fv(Team::getRadarColor(teamIndex));
- fm.drawString(x, y, 0, majorFontFace, majorFontSize, buffer);
+ fm.drawString(x, y, 0, majorFontFace, majorFontSize,
+ TextUtils::format("%s: %d", myTank->getCallSign(), myTank->getScore()));
}
// print flag if player has one in upper right
if (flag != Flags::Null) {
- sprintf(buffer, "%s", BundleMgr::getCurrentBundle()->getLocalString(flag->flagName).c_str());
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(majorFontFace, majorFontSize, buffer);
+ const std::string flagname = bdl->getLocalString(flag->flagName);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(majorFontFace, majorFontSize, flagname);
if (flag->endurance == FlagSticky)
hudColor3fv(warningColor);
else
hudColor3fv(messageColor);
- fm.drawString(x, y, 0, majorFontFace, majorFontSize, buffer);
+ fm.drawString(x, y, 0, majorFontFace, majorFontSize, flagname);
} else {
time_t timeNow;
struct tm userTime;
@@ -863,25 +858,24 @@
}
// print time or date
- if (dater)
- sprintf(buffer, "%4d.%02d.%02d", 1900 + userTime.tm_year, userTime.tm_mon + 1, userTime.tm_mday);
- else
- sprintf(buffer, "%2d:%2.2d", userTime.tm_hour, userTime.tm_min);
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(majorFontFace, majorFontSize, buffer);
+ const std::string datetime = (dater) ?
+ TextUtils::format("%4d.%02d.%02d", 1900 + userTime.tm_year, userTime.tm_mon + 1, userTime.tm_mday) :
+ TextUtils::format("%2d:%2.2d", userTime.tm_hour, userTime.tm_min);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(majorFontFace, majorFontSize, datetime);
hudColor3fv(messageColor);
- fm.drawString(x, y, 0, majorFontFace, majorFontSize, buffer);
+ fm.drawString(x, y, 0, majorFontFace, majorFontSize, datetime);
}
// print current position of tank
if (BZDB.isTrue("showCoordinates")) {
- Player *target = ROAM.getTargetTank();
- if(!target){
- sprintf(buffer, "[%d %d %d]", (int)myTank->getPosition()[0],
- (int)myTank->getPosition()[1], (int)myTank->getPosition()[2]);
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(majorFontFace, majorFontSize, buffer);
- fm.drawString(x, (y - h), 0, majorFontFace, majorFontSize, buffer);
- }
- }
+ Player *target = ROAM.getTargetTank();
+ if (!target) {
+ const std::string pos = TextUtils::format("[%d %d %d]", (int)myTank->getPosition()[0],
+ (int)myTank->getPosition()[1], (int)myTank->getPosition()[2]);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(majorFontFace, majorFontSize, pos);
+ fm.drawString(x, (y - h), 0, majorFontFace, majorFontSize, pos);
+ }
+ }
if (roaming && BZDB.isTrue("showVelocities"))
{
@@ -911,55 +905,57 @@
maxApparentLinTime = TimeKeeper::getTick();
}
- float smallZHeight = fm.getStrHeight(minorFontFace,minorFontSize,std::string("X"))*1.125f;
+ std::string msg = "X";
+ float smallZHeight = fm.getStrHeight(minorFontFace, minorFontSize, msg) * 1.125f;
float drawY = y - smallZHeight;
// draw header
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize, "Target Info");
- fm.drawString(x, drawY, 0, minorFontFace, minorFontSize, "Target Info");
+ msg = "Target Info";
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize, msg);
+ fm.drawString(x, drawY, 0, minorFontFace, minorFontSize, msg);
// draw the postion
- sprintf(buffer, "Position [%d %d %d]", (int)myTank->getPosition()[0], (int)myTank->getPosition()[1], (int)myTank->getPosition()[2]);
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize,buffer);
- fm.drawString(x,drawY-smallZHeight, 0, minorFontFace, minorFontSize, buffer);
+ msg = TextUtils::format("Position [%d %d %d]", (int)myTank->getPosition()[0], (int)myTank->getPosition()[1], (int)myTank->getPosition()[2]);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize, msg);
+ fm.drawString(x,drawY-smallZHeight, 0, minorFontFace, minorFontSize, msg);
- std::string label = "Linear Speed:";
+ msg = "Linear Speed:";
if ( linSpeed > target->getMaxSpeed() )
- label += "!";
+ msg += "!";
- sprintf(buffer,"%s%5.2f",label.c_str(),linSpeed);
+ msg += TextUtils::format("%5.2f", linSpeed);
if (BZDB.evalInt("showVelocities") > 1)
- sprintf(buffer,"%s%5.2f(%5.2f)",label.c_str(),linSpeed,apparentLinSpeed);
+ msg += TextUtils::format("(%5.2f)", apparentLinSpeed);
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize,buffer);
- fm.drawString(x,drawY-smallZHeight*2.0f, 0, minorFontFace, minorFontSize, buffer);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize, msg);
+ fm.drawString(x,drawY-smallZHeight*2.0f, 0, minorFontFace, minorFontSize, msg);
- sprintf(buffer,"Vertical Speed:%5.2f",vertSpeed);
+ msg = TextUtils::format("Vertical Speed:%5.2f", vertSpeed);
if (BZDB.evalInt("showVelocities") > 1)
- sprintf(buffer,"Vertical Speed:%5.2f(%5.2f)",vertSpeed,apparentVel[2]);
+ msg += TextUtils::format("(%5.2f)", apparentVel[2]);
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize,buffer);
- fm.drawString(x, drawY-smallZHeight*3.0f, 0, minorFontFace, minorFontSize, buffer);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize, msg);
+ fm.drawString(x, drawY-smallZHeight*3.0f, 0, minorFontFace, minorFontSize, msg);
- label = "Angular Speed:";
+ msg = "Angular Speed:";
if (rotSpeed > BZDB.eval(StateDatabase::BZDB_TANKANGVEL))
- label += "!";
- sprintf(buffer,"%s%5.2f",label.c_str(),rotSpeed);
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize,buffer);
- fm.drawString(x,drawY-smallZHeight*4.0f, 0, minorFontFace, minorFontSize, buffer);
+ msg += "!";
+ msg += TextUtils::format("%5.2f", rotSpeed);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize, msg);
+ fm.drawString(x,drawY-smallZHeight*4.0f, 0, minorFontFace, minorFontSize, msg);
float shotTime = (float)target->getShotStatistics()->getLastShotTimeDelta();
float shotDeviation = (float)target->getShotStatistics()->getLastShotDeviation();
- sprintf(buffer,"Last Shot Info Time:%6.4f Deviation:%6.3f", shotTime, shotDeviation);
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize,buffer);
- fm.drawString(x,drawY-smallZHeight*5.0f, 0, minorFontFace, minorFontSize, buffer);
+ msg = TextUtils::format("Last Shot Info Time:%6.4f Deviation:%6.3f", shotTime, shotDeviation);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize, msg);
+ fm.drawString(x,drawY-smallZHeight*5.0f, 0, minorFontFace, minorFontSize, msg);
float offset = 6.0f;
if (BZDB.evalInt("showVelocities") > 2) {
offset += 1.0f;
- sprintf(buffer,"ReportedHits %d ComputedHits %d ratio %f", target->reportedHits, target->computedHits,(float)target->reportedHits/(float)target->computedHits);
- x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize,buffer);
- fm.drawString(x,drawY-smallZHeight*offset, 0, minorFontFace, minorFontSize, buffer);
+ msg = TextUtils::format("ReportedHits %d ComputedHits %d ratio %f", target->reportedHits, target->computedHits, (float)target->reportedHits/(float)target->computedHits);
+ x = (float)window.getWidth() - 0.25f * h - fm.getStrLength(minorFontFace, minorFontSize, msg);
+ fm.drawString(x,drawY-smallZHeight*offset, 0, minorFontFace, minorFontSize, msg);
}
offset += 1.5f;
@@ -977,24 +973,25 @@
static const GLfloat yellowColor[3] = { 1.0f, 1.0f, 0.0f };
static const GLfloat greenColor[3] = { 0.0f, 1.0f, 0.0f };
const GLfloat* statusColor = warningColor;
+ std::string msg;
// TODO: the upper 4 values of timeLeft (~0u-3 to ~0u)
// are reserved for future use as timer flags (e.g. paused)
if ((timeLeft == 0) || (timeLeft >= (~0u - 3))) {
- strcpy(buffer, "");
+ msg = "";
} else {
int t = timeLeft - (int)(TimeKeeper::getTick() - timeSet);
if (t < 0) t = 0;
if (t >= 3600)
- sprintf(buffer, "%d:%02d:%02d ", t / 3600, (t / 60) % 60, t % 60);
+ msg = TextUtils::format("%d:%02d:%02d ", t / 3600, (t / 60) % 60, t % 60);
else if (t >= 60)
- sprintf(buffer, "%d:%02d ", t / 60, t % 60);
+ msg = TextUtils::format("%d:%02d ", t / 60, t % 60);
else
- sprintf(buffer, "0:%02d ", t);
+ msg = TextUtils::format("0:%02d ", t);
}
if (!roaming) {
switch (myTank->getFiringStatus()) {
case LocalPlayer::Deceased:
- strcat(buffer, bdl->getLocalString("Dead").c_str());
+ msg += bdl->getLocalString("Dead");
break;
case LocalPlayer::Ready:
@@ -1002,10 +999,10 @@
World::getWorld()->allowShakeTimeout()) {
/* have a bad flag -- show time left 'til we shake it */
statusColor = yellowColor;
- sprintf(buffer, bdl->getLocalString("%.1f").c_str(), myTank->getFlagShakingTime());
+ msg = TextUtils::format(bdl->getLocalString("%.1f").c_str(), myTank->getFlagShakingTime());
} else {
statusColor = greenColor;
- strcat(buffer, bdl->getLocalString("Ready").c_str());
+ msg += bdl->getLocalString("Ready");
}
break;
@@ -1013,29 +1010,29 @@
if (World::getWorld()->getMaxShots() != 0) {
statusColor = redColor;
- sprintf(buffer, bdl->getLocalString("Reloaded in %.1f").c_str(), myTank->getReloadTime());
+ msg = TextUtils::format(bdl->getLocalString("Reloaded in %.1f").c_str(), myTank->getReloadTime());
}
break;
case LocalPlayer::Sealed:
- strcat(buffer, bdl->getLocalString("Sealed").c_str());
+ msg += bdl->getLocalString("Sealed");
break;
case LocalPlayer::Zoned:
- strcat(buffer, bdl->getLocalString("Zoned").c_str());
+ msg += bdl->getLocalString("Zoned");
break;
}
}
if (roaming) {
statusColor = messageColor;
- if (dim) strcat(buffer, ColorStrings[DimColor].c_str());
- strcat(buffer, ROAM.getRoamingLabel().c_str());
+ if (dim) msg += ColorStrings[DimColor];
+ msg += ROAM.getRoamingLabel();
}
- x = 0.5f * ((float)window.getWidth() - fm.getStrLength(majorFontFace, majorFontSize, buffer));
+ x = 0.5f * ((float)window.getWidth() - fm.getStrLength(majorFontFace, majorFontSize, msg));
hudColor3fv(statusColor);
- fm.drawString(x, y, 0, majorFontFace, majorFontSize, buffer);
+ fm.drawString(x, y, 0, majorFontFace, majorFontSize, msg);
}
void HUDRenderer::renderTankLabels(SceneRenderer& renderer)
@@ -1059,7 +1056,7 @@
for (int i = 0; i < curMaxPlayers; i++) {
RemotePlayer *pl = World::getWorld()->getPlayer(i);
if (pl && pl->isAlive()) {
- const char *name = pl->getCallSign();
+ const std::string name = pl->getCallSign();
double x, y, z;
hudSColor3fv(Team::getRadarColor(pl->getTeam()));
gluProject(pl->getPosition()[0], pl->getPosition()[1],
@@ -1074,11 +1071,10 @@
std::string flagStr = "(";
flagStr += flag->endurance == FlagNormal ? flag->flagName : flag->flagAbbv;
flagStr += ")";
- const char *fname = flagStr.c_str();
- fm.drawString(float(x) - fm.getStrLength(labelsFontFace, labelsFontSize, fname) / 2.0f,
+ fm.drawString(float(x) - fm.getStrLength(labelsFontFace, labelsFontSize, flagStr) / 2.0f,
float(y) + offset -
- (2.0f * fm.getStrHeight(labelsFontFace, labelsFontSize, fname)),
- 0, labelsFontFace, labelsFontSize, fname);
+ (2.0f * fm.getStrHeight(labelsFontFace, labelsFontSize, flagStr)),
+ 0, labelsFontFace, labelsFontSize, flagStr);
}
if (roaming && BZDB.isTrue("showVelocities"))
@@ -1141,34 +1137,27 @@
// draw frames per second
if (fps > 0.0f) {
- char buf[20];
- sprintf(buf, "FPS: %d", int(fps));
hudColor3f(1.0f, 1.0f, 1.0f);
fm.drawString((float)(centerx - maxMotionSize), (float)centery + (float)maxMotionSize +
3.0f * fm.getStrHeight(headingFontFace, headingFontSize, "0"), 0,
- headingFontFace, headingFontSize, buf);
+ headingFontFace, headingFontSize, TextUtils::format("FPS: %d", int(fps)));
}
float triCountYOffset = 4.5f;
if (radarTriangleCount > 0) {
- char buf[20];
- sprintf(buf, "rtris: %i", radarTriangleCount);
hudColor3f(1.0f, 1.0f, 1.0f);
fm.drawString((float)(centerx - maxMotionSize), (float)centery + (float)maxMotionSize +
triCountYOffset * fm.getStrHeight(headingFontFace, headingFontSize, "0"), 0,
- headingFontFace, headingFontSize, buf);
+ headingFontFace, headingFontSize, TextUtils::format("rtris: %d", radarTriangleCount));
triCountYOffset += 1.5f;
}
if (triangleCount > 0) {
- char buf[20];
- sprintf(buf, "tris: %i", triangleCount);
hudColor3f(1.0f, 1.0f, 1.0f);
fm.drawString((float)(centerx - maxMotionSize), (float)centery + (float)maxMotionSize +
triCountYOffset * fm.getStrHeight(headingFontFace, headingFontSize, "0"), 0,
- headingFontFace, headingFontSize, buf);
+ headingFontFace, headingFontSize, TextUtils::format("tris: %d", triangleCount));
}
if (drawTime > 0.0f) {
- char buf[20];
- sprintf(buf, "time: %dms", (int)(drawTime * 1000.0f));
+ const std::string buf = TextUtils::format("time: %dms", int(drawTime * 1000.0f));
hudColor3f(1.0f, 1.0f, 1.0f);
fm.drawString((float)(centerx + maxMotionSize) - fm.getStrLength(headingFontFace, headingFontSize, buf),
(float)centery + (float)maxMotionSize +
@@ -1612,10 +1601,8 @@
y -= 0.5f;
hudColor4f(hudColor[0], hudColor[1], hudColor[2], basey - floorf(basey));
}
- char buf[10];
for (i = minMark; i <= maxMark; i++) {
- sprintf(buf, "%d", i * 5);
- fm.drawString(x, y, 0, headingFontFace, headingFontSize, std::string(buf));
+ fm.drawString(x, y, 0, headingFontFace, headingFontSize, TextUtils::format("%d", i * 5));
y += altitudeMarkSpacing;
}
if (smoothLabel) {
@@ -1624,8 +1611,7 @@
basey -= floorf(basey);
hudColor4f(hudColor[0], hudColor[1], hudColor[2], 1.0f - basey);
for (i = minMark; i <= maxMark; i++) {
- sprintf(buf, "%d", i * 5);
- fm.drawString(x, y, 0, headingFontFace, headingFontSize, std::string(buf));
+ fm.drawString(x, y, 0, headingFontFace, headingFontSize, TextUtils::format("%d", i * 5));
y += altitudeMarkSpacing;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-06-29 22:11:47
|
Revision: 22825
http://sourceforge.net/p/bzflag/code/22825
Author: bullet_catcher
Date: 2013-06-29 22:11:44 +0000 (Sat, 29 Jun 2013)
Log Message:
-----------
Use std::string instead of a fixed size buffer for non-Windows directory name manipulation.
Modified Paths:
--------------
trunk/bzflag/plugins/plugin_utils/plugin_files.cpp
Modified: trunk/bzflag/plugins/plugin_utils/plugin_files.cpp
===================================================================
--- trunk/bzflag/plugins/plugin_utils/plugin_files.cpp 2013-06-29 22:08:34 UTC (rev 22824)
+++ trunk/bzflag/plugins/plugin_utils/plugin_files.cpp 2013-06-29 22:11:44 UTC (rev 22825)
@@ -192,13 +192,12 @@
DIR *directory;
dirent *fileInfo;
struct stat statbuf;
- char searchstr[1024];
std::string FilePath;
- strcpy(searchstr, szPathName);
- if (searchstr[strlen(searchstr) - 1] != '/')
- strcat(searchstr, "/");
- directory = opendir(searchstr);
+ std::string searchstr = szPathName;
+ if (searchstr.empty() || *(searchstr.end()-1) != _DirDelim)
+ searchstr += _DirDelim;
+ directory = opendir(searchstr.c_str());
if (!directory)
return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-06-29 22:08:36
|
Revision: 22824
http://sourceforge.net/p/bzflag/code/22824
Author: bullet_catcher
Date: 2013-06-29 22:08:34 +0000 (Sat, 29 Jun 2013)
Log Message:
-----------
Use std::string for directory name manipulation on the Mac, too.
Modified Paths:
--------------
trunk/bzflag/src/game/DirectoryNames.cxx
Modified: trunk/bzflag/src/game/DirectoryNames.cxx
===================================================================
--- trunk/bzflag/src/game/DirectoryNames.cxx 2013-06-28 15:55:06 UTC (rev 22823)
+++ trunk/bzflag/src/game/DirectoryNames.cxx 2013-06-29 22:08:34 UTC (rev 22824)
@@ -101,12 +101,12 @@
char buff[1024];
err = ::FSRefMakePath(&libraryFolder, (UInt8*)buff, sizeof(buff));
if(err == ::noErr) {
- std::strcat(buff, "/BZFlag/");
+ name = buff;
+ name += "/BZFlag/";
if (versionName) {
- std::strcat(buff, versionName);
- std::strcat(buff, "/");
+ name += versionName;
+ name += "/";
}
- name = buff;
}
}
customConfigDir = name;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kon...@us...> - 2013-06-28 15:55:09
|
Revision: 22823
http://sourceforge.net/p/bzflag/code/22823
Author: kongr45gpen
Date: 2013-06-28 15:55:06 +0000 (Fri, 28 Jun 2013)
Log Message:
-----------
Rather than checking whether a user is an admin, test if they have the adminMessageReceive perm when sending a private message to inform about a successful mute
Modified Paths:
--------------
trunk/bzflag/src/bzfs/BanCommands.cxx
Modified: trunk/bzflag/src/bzfs/BanCommands.cxx
===================================================================
--- trunk/bzflag/src/bzfs/BanCommands.cxx 2013-06-28 15:29:14 UTC (rev 22822)
+++ trunk/bzflag/src/bzfs/BanCommands.cxx 2013-06-28 15:55:06 UTC (rev 22823)
@@ -254,7 +254,7 @@
snprintf(msg, MessageLen, "player id #%d \"%s\" has been muted by %s.", i,
muteData->player.getCallSign(), playerData->player.getCallSign());
sendMessage(ServerPlayer, AdminPlayers, msg);
- if (!playerData->accessInfo.isAdmin()) {
+ if (!playerData->accessInfo.hasPerm(PlayerAccessInfo::adminMessageReceive)) {
snprintf(msg, MessageLen, "player id #%d \"%s\" is now muted.", i,
muteData->player.getCallSign());
sendMessage(ServerPlayer, t, msg);
@@ -312,7 +312,7 @@
snprintf(msg, MessageLen, "player id #%d \"%s\" has been unmuted by %s.", i,
unmuteData->player.getCallSign(), playerData->player.getCallSign());
sendMessage(ServerPlayer, AdminPlayers, msg);
- if (!playerData->accessInfo.isAdmin()) {
+ if (!playerData->accessInfo.hasPerm(PlayerAccessInfo::adminMessageReceive)) {
snprintf(msg, MessageLen, "player id #%d \"%s\" is now unmuted.", i,
unmuteData->player.getCallSign());
sendMessage(ServerPlayer, t, msg);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kho...@us...> - 2013-06-28 15:29:17
|
Revision: 22822
http://sourceforge.net/p/bzflag/code/22822
Author: khonkhortisan
Date: 2013-06-28 15:29:14 +0000 (Fri, 28 Jun 2013)
Log Message:
-----------
Stop drawing FlashShotEffect when myTank doesn't exist when leaving game
Modified Paths:
--------------
trunk/bzflag/src/bzflag/effectsRenderer.cxx
Modified: trunk/bzflag/src/bzflag/effectsRenderer.cxx
===================================================================
--- trunk/bzflag/src/bzflag/effectsRenderer.cxx 2013-06-24 18:45:07 UTC (rev 22821)
+++ trunk/bzflag/src/bzflag/effectsRenderer.cxx 2013-06-28 15:29:14 UTC (rev 22822)
@@ -1002,6 +1002,11 @@
void FlashShotEffect::draw(const SceneRenderer &)
{
+ if (!LocalPlayer::getMyTank()) {
+ //just left the game
+ return;
+ }
+
glPushMatrix();
float pos[3];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <al...@us...> - 2013-06-24 18:45:12
|
Revision: 22821
http://sourceforge.net/p/bzflag/code/22821
Author: allejo
Date: 2013-06-24 18:45:07 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
Applied patch #572 and added allejo to authors file
Modified Paths:
--------------
trunk/bzflag/AUTHORS
trunk/bzflag/include/bzfsAPI.h
trunk/bzflag/src/bzfs/bzfs.cxx
trunk/bzflag/src/bzfs/bzfs.h
trunk/bzflag/src/bzfs/bzfsAPI.cxx
Modified: trunk/bzflag/AUTHORS
===================================================================
--- trunk/bzflag/AUTHORS 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/AUTHORS 2013-06-24 18:45:07 UTC (rev 22821)
@@ -225,6 +225,8 @@
Ryan Kavanagh (ryanakca)
Konstantinos Kanavouras (alezakos)
Lee Marshall (bizarrefish)
+-- 2013 --
+Vladimir Jimenez (allejo)
GOOGLE SUMMER OF CODE
---------------------
Modified: trunk/bzflag/include/bzfsAPI.h
===================================================================
--- trunk/bzflag/include/bzfsAPI.h 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/include/bzfsAPI.h 2013-06-24 18:45:07 UTC (rev 22821)
@@ -1064,7 +1064,7 @@
class BZF_API bz_GetPlayerMottoData_V2 : public bz_GetPlayerMottoData_V1
{
public:
- bz_GetPlayerMottoData_V2(const char* m)
+ bz_GetPlayerMottoData_V2(const char* m)
: bz_GetPlayerMottoData_V1(m)
{
}
@@ -1624,7 +1624,7 @@
virtual void URLDone ( const char* URL, const void * data, unsigned int size, bool complete ) = 0;
virtual void URLTimeout ( const char* /*URL*/, int /*errorCode*/ ){};
virtual void URLError ( const char* /*URL*/, int /*errorCode*/, const char * /*errorString*/ ){};
-
+
int version;
};
@@ -1684,6 +1684,8 @@
BZF_API void bz_startCountdown ( int delay, float limit, const char *byWho );
// server control
+BZF_API bool bz_getShotMismatch();
+BZF_API void bz_setShotMismatch(bool value);
BZF_API void bz_shutdown();
BZF_API void bz_superkill();
BZF_API void bz_gameOver(int playerID, bz_eTeamType team = eNoTeam);
Modified: trunk/bzflag/src/bzfs/bzfs.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfs.cxx 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/src/bzfs/bzfs.cxx 2013-06-24 18:45:07 UTC (rev 22821)
@@ -140,6 +140,7 @@
char worldSettings[4 + WorldSettingsSize];
float pluginWorldSize = -1;
float pluginWorldHeight = -1;
+bool checkShotMismatch = true;
Filter filter;
BasesList bases;
@@ -566,12 +567,12 @@
void sendPlayerScores(GameKeeper::Player ** players, int nPlayers) {
void *buf, *bufStart;
bufStart = getDirectMessageBuffer();
-
+
buf = nboPackUByte(bufStart, nPlayers);
-
+
for(int i = 0; i < nPlayers; i++) {
GameKeeper::Player *player = players[i];
-
+
buf = nboPackUByte(buf, player->getIndex());
buf = player->score.pack(buf);
}
@@ -685,21 +686,21 @@
// Players to notify of new scores
GameKeeper::Player **playersToUpdate = new GameKeeper::Player*[curMaxPlayers];
int nPlayersToUpdate = 0;
-
+
for (int i = 0; i < curMaxPlayers; i++) {
GameKeeper::Player *player;
-
+
player = GameKeeper::Player::getPlayerByIndex(i);
-
+
if(player) {
player->score.reset();
playersToUpdate[nPlayersToUpdate++] = player;
}
}
-
+
// Tell the players the new scores
sendPlayerScores(playersToUpdate, nPlayersToUpdate);
-
+
delete[] playersToUpdate;
}
@@ -1477,9 +1478,9 @@
}
msg = filtered;
-
+
}
-
+
// if the message is empty, stop.
if (strlen(msg) == 0)
{
@@ -2261,7 +2262,7 @@
{
// NOTE -- must not be called until world is defined
assert(world != NULL);
-
+
// first drop the flag if someone has it
if (flag.flag.status == FlagOnTank) {
int player = flag.player;
@@ -2367,7 +2368,7 @@
int player = flag.player;
sendDrop(flag);
-
+
// trigger the API event
bz_FlagDroppedEventData_V1 data;
data.playerID = player;
@@ -2508,7 +2509,7 @@
void flushKilledByCounts( int removeID )
{
- for (int i = 0; i < curMaxPlayers; i++)
+ for (int i = 0; i < curMaxPlayers; i++)
{
GameKeeper::Player *player = GameKeeper::Player::getPlayerByIndex(i);
if (player)
@@ -3037,7 +3038,7 @@
killerData->score.kill();
}
}
-
+
// send killer & victim
GameKeeper::Player *kAndV[] = {killerData, victimData};
sendPlayerScores(kAndV, 2);
@@ -3045,7 +3046,7 @@
// send victim
sendPlayerScores(&victimData, 1);
}
-
+
if (handicapAllowed()) {
bufStart = getDirectMessageBuffer();
if (killer) {
@@ -3214,7 +3215,7 @@
playerData->player.haveFlag() ||
(checkPos && flag.flag.status != FlagOnGround))
return;
-
+
const float* fpos = flag.flag.position;
if (checkPos) {
//last Pos might be lagged by TankSpeed so include in calculation
@@ -3224,7 +3225,7 @@
const float* tpos = playerData->lastState.pos;
const float delta = (tpos[0] - fpos[0]) * (tpos[0] - fpos[0]) +
(tpos[1] - fpos[1]) * (tpos[1] - fpos[1]);
-
+
if ((fabs(tpos[2] - fpos[2]) < 0.1f) && (delta > radius2)) {
logDebugMessage(2,"Player %s [%d] %f %f %f tried to grab distant flag %f %f %f: distance=%f\n",
playerData->player.getCallSign(), playerIndex,
@@ -3373,14 +3374,14 @@
// notify of new flag state
sendFlagUpdate(drpFlag);
-
+
// trigger the api event
bz_FlagDroppedEventData_V1 data;
data.playerID = player;
data.flagID = flagIndex;
data.flagType = drpFlag.flag.type->flagAbbv.c_str();
memcpy(data.pos, pos, sizeof(float)*3);
-
+
worldEventManager.callEvents(bz_eFlagDroppedEvent,&data);
}
@@ -3617,7 +3618,7 @@
}
// probably a cheater using wrong shots.. exception for thief since they steal someone elses
- if (firingInfo.flagType != Flags::Thief) {
+ if (firingInfo.flagType != Flags::Thief && checkShotMismatch) {
// bye bye supposed cheater
logDebugMessage(1,"Kicking Player %s [%d] Player using wrong shots\n", shooter.getCallSign(), playerIndex);
sendMessage(ServerPlayer, playerIndex, "Autokick: Your shots do not to match the expected shot type.");
@@ -3714,11 +3715,11 @@
shotEvent.pos[0] = shot.pos[0];
shotEvent.pos[1] = shot.pos[1];
shotEvent.pos[2] = shot.pos[2];
-
+
shotEvent.vel[0] = shot.vel[0];
shotEvent.vel[1] = shot.vel[1];
shotEvent.vel[2] = shot.vel[2];
-
+
shotEvent.playerID = shooter.getPlayerIndex();
shotEvent.type = firingInfo.flagType->flagAbbv;
@@ -4421,7 +4422,7 @@
buf = nboUnpackShort(buf, shot);
buf = nboUnpackUShort(buf, reason);
shotEnded(sourcePlayer, shot, reason);
-
+
break;
}
@@ -5295,8 +5296,8 @@
{
peer.netHandler->bufferedSend(NULL, 0);
return;
- }
-
+ }
+
if (peer.sendChunks.empty())
{
if (peer.deleteWhenDoneSending && peer.sent && !peer.netHandler->hasTcpOutbound())
@@ -6410,7 +6411,7 @@
// quietly reset team scores in case of a capture during the countdown
resetTeamScores();
-
+
// reset player scores
resetPlayerScores();
@@ -6709,7 +6710,7 @@
sendMessage(ServerPlayer, v, "You have been killed due to sufficient votes");
playerKilled(v, curMaxPlayers, 0, -1, Flags::Null, -1);
}
- }
+ }
else if (action == "set")
{
Modified: trunk/bzflag/src/bzfs/bzfs.h
===================================================================
--- trunk/bzflag/src/bzfs/bzfs.h 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/src/bzfs/bzfs.h 2013-06-24 18:45:07 UTC (rev 22821)
@@ -157,7 +157,7 @@
extern uint16_t maxRealPlayers;
extern float pluginWorldSize;
extern float pluginWorldHeight;
-
+extern bool checkShotMismatch;
extern bool publiclyDisconnected;
extern Shots::Manager ShotManager;
Modified: trunk/bzflag/src/bzfs/bzfsAPI.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfsAPI.cxx 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/src/bzfs/bzfsAPI.cxx 2013-06-24 18:45:07 UTC (rev 22821)
@@ -2760,7 +2760,7 @@
return false;
// if (playerID == BZ_SERVER || !soundName)
// return false;
-//
+//
// void *buf, *bufStart = getDirectMessageBuffer();
// buf = nboPackUShort(bufStart, LocalCustomSound);
// buf = nboPackUShort(buf, (unsigned short)strlen(soundName));
@@ -2769,7 +2769,7 @@
// broadcastMessage(MsgCustomSound, (char*)buf - (char*)bufStart, bufStart);
// else
// directMessage(playerID,MsgCustomSound, (char*)buf - (char*)bufStart, bufStart);
-//
+//
// return true;
}
@@ -3456,6 +3456,16 @@
// server control
+BZF_API bool bz_getShotMismatch( void )
+{
+ return checkShotMismatch;
+}
+
+BZF_API void bz_setShotMismatch ( bool value )
+{
+ checkShotMismatch = value;
+}
+
BZF_API void bz_shutdown ( void )
{
shutdownCommand(NULL,NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jef...@us...> - 2013-06-24 03:29:50
|
Revision: 22820
http://sourceforge.net/p/bzflag/code/22820
Author: jeffm2501
Date: 2013-06-24 03:29:46 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
if the returned flag type is "DELETE" from a shot event, don't broadcast the shot
Modified Paths:
--------------
trunk/bzflag/src/bzfs/bzfs.cxx
Modified: trunk/bzflag/src/bzfs/bzfs.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfs.cxx 2013-06-22 23:07:10 UTC (rev 22819)
+++ trunk/bzflag/src/bzfs/bzfs.cxx 2013-06-24 03:29:46 UTC (rev 22820)
@@ -3727,6 +3727,8 @@
if (shotEvent.changed)
{
+ if (shotEvent.type == "DELETE")
+ return;
firingInfo.flagType = Flag::getDescFromAbbreviation(shotEvent.type.c_str());
repack = true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-06-22 23:07:12
|
Revision: 22819
http://sourceforge.net/p/bzflag/code/22819
Author: bullet_catcher
Date: 2013-06-22 23:07:10 +0000 (Sat, 22 Jun 2013)
Log Message:
-----------
Rename 3ds2bzw.c to 3ds2bzw.cxx because it contains C++ style comments, and use automake facilities to generate its compilation rules.
Modified Paths:
--------------
trunk/bzflag/misc/Makefile.am
Added Paths:
-----------
trunk/bzflag/misc/3ds2bzw.cxx
Removed Paths:
-------------
trunk/bzflag/misc/3ds2bzw.c
Deleted: trunk/bzflag/misc/3ds2bzw.c
===================================================================
--- trunk/bzflag/misc/3ds2bzw.c 2013-06-22 22:33:03 UTC (rev 22818)
+++ trunk/bzflag/misc/3ds2bzw.c 2013-06-22 23:07:10 UTC (rev 22819)
@@ -1,229 +0,0 @@
-//
-// 3DS2BZW
-//
-// Author: Anonymous
-// Date: Aug 26, 2004
-//
-// Utility program to convert 3DS model
-// files into BZFlag 1.12 meshy goodness.
-//
-// To use the program, you might type this:
-//
-// ./3ds2bzw model.3ds > model.bzw
-//
-// NOTE: this program requires lib3ds to
-// compile. to compile the program,
-// use something like this:
-//
-// gcc -O3 -W -Wall -o 3ds2bzw 3ds2bzw.c -l3ds -lm
-//
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <lib3ds/file.h>
-#include <lib3ds/camera.h>
-#include <lib3ds/mesh.h>
-#include <lib3ds/node.h>
-#include <lib3ds/material.h>
-#include <lib3ds/matrix.h>
-#include <lib3ds/mesh.h>
-#include <lib3ds/vector.h>
-#include <lib3ds/light.h>
-
-
-static Lib3dsFile *File3DS = NULL;
-
-
-static int Invert = 0;
-static int ColorSwap = 0;
-static int Colors = 1;
-static int Ambient = 1;
-static int Diffuse = 1;
-static int Specular = 1;
-static int Shininess = 1;
-static int Normals = 1;
-static int Textures = 1;
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-int
-main (int argc, char **argv)
-{
- Lib3dsMesh *mesh;
- const char *execname = argv[0];
-
- // collect the options
- while (argc > 1) {
- if (strcmp ("-i", argv[1]) == 0) {
- Invert = 1;
- }
- else if (strcmp ("-cs", argv[1]) == 0) {
- ColorSwap = 1;
- }
- else if (strcmp ("-t", argv[1]) == 0) {
- Textures = 0;
- }
- else if (strcmp ("-n", argv[1]) == 0) {
- Normals = 0;
- }
- else if (strcmp ("-c", argv[1]) == 0) {
- Colors = 0;
- }
- else if (strcmp ("-a", argv[1]) == 0) {
- Ambient = 0;
- }
- else if (strcmp ("-d", argv[1]) == 0) {
- Diffuse = 0;
- }
- else if (strcmp ("-s", argv[1]) == 0) {
- Specular = 0;
- }
- else if (strcmp ("-sh", argv[1]) == 0) {
- Shininess = 0;
- }
- else {
- break;
- }
- argc--;
- argv++;
- }
-
- // print the help message
- if (argc != 2) {
- printf ("\n");
- printf ("usage: %s [opts] <filename>\n", execname);
- printf ("\n");
- printf (" -t disable textures\n");
- printf (" -n disable normals\n");
- printf (" -c disable all colors\n");
- printf (" -a disable ambient\n");
- printf (" -d disable diffuse\n");
- printf (" -s disable specular\n");
- printf (" -sh disable shininess\n");
- printf (" -i invert normals\n");
- printf (" -cs swap ambient and diffuse\n");
- printf ("\n");
- return 1;
- }
-
- // load the file
- File3DS = lib3ds_file_load (argv[1]);
- if (File3DS == NULL) {
- printf ("Problems loading file\n");
- return 1;
- }
-
- // evaluate the first frame
- lib3ds_file_eval (File3DS, 0.0f /* the frame time */ );
-
- // dump all of the meshes
- for (mesh = File3DS->meshes; mesh != NULL; mesh = mesh->next) {
- // FIXME - Lib3dsMatrix* matrix = &mesh->matrix;
- // comments on statistics
- unsigned int i;
- printf ("mesh # %s\n", mesh->name);
- printf ("# vertices: %i\n", (int) mesh->points);
- if (Normals) {
- printf ("# normals: %i\n", (int) mesh->faces * 3);
- }
- if (Textures) {
- printf ("# texcoords: %i\n", (int) mesh->texels);
- }
- printf ("# faces: %i\n", (int) mesh->faces);
-
- // vertices
- for (i = 0; i < mesh->points; i++) {
- Lib3dsPoint *point = &(mesh->pointL[i]);
- printf (" vertex %f %f %f # %i\n",
- point->pos[0], point->pos[1], point->pos[2], i);
- }
-
- // normals
- if (Normals) {
- Lib3dsVector *normals = (Lib3dsVector *)
- malloc (3 * mesh->faces * sizeof (Lib3dsVector));
- lib3ds_mesh_calculate_normals (mesh, normals);
- for (i = 0; i < (mesh->faces * 3); i++) {
- if (Invert) {
- printf (" normal %f %f %f # %i\n",
- -normals[i][0], -normals[i][1], -normals[i][2], i);
- }
- else {
- printf (" normal %f %f %f # %i\n",
- normals[i][0], normals[i][1], normals[i][2], i);
- }
- }
- free (normals);
- }
-
- // texcoords
- if (Textures) {
- for (i = 0; i < mesh->texels; i++) {
- Lib3dsTexel *texel = &(mesh->texelL[i]);
- printf (" texcoord %f %f # %i\n", (*texel)[0], (*texel)[1], i);
- }
- }
-
- // faces
- for (i = 0; i < mesh->faces; i++) {
- Lib3dsFace *face = &(mesh->faceL[i]);
- Lib3dsWord *points = face->points;
- printf (" face # material = %s\n", face->material);
- printf (" vertices %i %i %i\n", points[0], points[1], points[2]);
- if (Normals) {
- printf (" normals %i %i %i\n", (i * 3) + 0, (i * 3) + 1,
- (i * 3) + 2);
- }
- Lib3dsMaterial *mat =
- lib3ds_file_material_by_name (File3DS, face->material);
- if (mat) {
- if (Textures && (mesh->texels != 0)) {
- printf (" texture %s\n", mat->texture1_map.name);
- printf (" texcoords %i %i %i\n", points[0], points[1],
- points[2]);
-
- // BZ isn't ready for these, yet...
- // printf (" #texture %s\n", material->texture2_map.name);
- // printf (" #texture %s\n", material->texture1_mask.name);
- // printf (" #texture %s\n", material->texture2_mask.name);
- }
- if (Colors) {
- Lib3dsRgba *ambient = &mat->ambient;
- Lib3dsRgba *diffuse = &mat->diffuse;
- if (ColorSwap) {
- ambient = &mat->diffuse;
- diffuse = &mat->ambient;
- }
- if (Ambient) {
- printf (" ambient %f %f %f %f\n", (*ambient)[0],
- (*ambient)[1], (*ambient)[2], (*ambient)[3]);
- }
- if (Diffuse) {
- printf (" diffuse %f %f %f %f\n", (*diffuse)[0],
- (*diffuse)[1], (*diffuse)[2], (*diffuse)[3]);
- }
- if (Specular) {
- printf (" specular %f %f %f %f\n", mat->specular[0],
- mat->specular[1], mat->specular[2], mat->specular[3]);
- }
- if (Shininess) {
- printf (" shininess %f\n", mat->shininess);
- }
- }
- }
- printf (" endface\n");
- }
-
- printf ("end # %s\n\n", mesh->name);
- }
-
- lib3ds_file_free (File3DS);
-
- return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////////
Copied: trunk/bzflag/misc/3ds2bzw.cxx (from rev 22818, trunk/bzflag/misc/3ds2bzw.c)
===================================================================
--- trunk/bzflag/misc/3ds2bzw.cxx (rev 0)
+++ trunk/bzflag/misc/3ds2bzw.cxx 2013-06-22 23:07:10 UTC (rev 22819)
@@ -0,0 +1,229 @@
+//
+// 3DS2BZW
+//
+// Author: Anonymous
+// Date: Aug 26, 2004
+//
+// Utility program to convert 3DS model
+// files into BZFlag 1.12 meshy goodness.
+//
+// To use the program, you might type this:
+//
+// ./3ds2bzw model.3ds > model.bzw
+//
+// NOTE: this program requires lib3ds to
+// compile. to compile the program,
+// use something like this:
+//
+// gcc -O3 -W -Wall -o 3ds2bzw 3ds2bzw.c -l3ds -lm
+//
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <lib3ds/file.h>
+#include <lib3ds/camera.h>
+#include <lib3ds/mesh.h>
+#include <lib3ds/node.h>
+#include <lib3ds/material.h>
+#include <lib3ds/matrix.h>
+#include <lib3ds/mesh.h>
+#include <lib3ds/vector.h>
+#include <lib3ds/light.h>
+
+
+static Lib3dsFile *File3DS = NULL;
+
+
+static int Invert = 0;
+static int ColorSwap = 0;
+static int Colors = 1;
+static int Ambient = 1;
+static int Diffuse = 1;
+static int Specular = 1;
+static int Shininess = 1;
+static int Normals = 1;
+static int Textures = 1;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+int
+main (int argc, char **argv)
+{
+ Lib3dsMesh *mesh;
+ const char *execname = argv[0];
+
+ // collect the options
+ while (argc > 1) {
+ if (strcmp ("-i", argv[1]) == 0) {
+ Invert = 1;
+ }
+ else if (strcmp ("-cs", argv[1]) == 0) {
+ ColorSwap = 1;
+ }
+ else if (strcmp ("-t", argv[1]) == 0) {
+ Textures = 0;
+ }
+ else if (strcmp ("-n", argv[1]) == 0) {
+ Normals = 0;
+ }
+ else if (strcmp ("-c", argv[1]) == 0) {
+ Colors = 0;
+ }
+ else if (strcmp ("-a", argv[1]) == 0) {
+ Ambient = 0;
+ }
+ else if (strcmp ("-d", argv[1]) == 0) {
+ Diffuse = 0;
+ }
+ else if (strcmp ("-s", argv[1]) == 0) {
+ Specular = 0;
+ }
+ else if (strcmp ("-sh", argv[1]) == 0) {
+ Shininess = 0;
+ }
+ else {
+ break;
+ }
+ argc--;
+ argv++;
+ }
+
+ // print the help message
+ if (argc != 2) {
+ printf ("\n");
+ printf ("usage: %s [opts] <filename>\n", execname);
+ printf ("\n");
+ printf (" -t disable textures\n");
+ printf (" -n disable normals\n");
+ printf (" -c disable all colors\n");
+ printf (" -a disable ambient\n");
+ printf (" -d disable diffuse\n");
+ printf (" -s disable specular\n");
+ printf (" -sh disable shininess\n");
+ printf (" -i invert normals\n");
+ printf (" -cs swap ambient and diffuse\n");
+ printf ("\n");
+ return 1;
+ }
+
+ // load the file
+ File3DS = lib3ds_file_load (argv[1]);
+ if (File3DS == NULL) {
+ printf ("Problems loading file\n");
+ return 1;
+ }
+
+ // evaluate the first frame
+ lib3ds_file_eval (File3DS, 0.0f /* the frame time */ );
+
+ // dump all of the meshes
+ for (mesh = File3DS->meshes; mesh != NULL; mesh = mesh->next) {
+ // FIXME - Lib3dsMatrix* matrix = &mesh->matrix;
+ // comments on statistics
+ unsigned int i;
+ printf ("mesh # %s\n", mesh->name);
+ printf ("# vertices: %i\n", (int) mesh->points);
+ if (Normals) {
+ printf ("# normals: %i\n", (int) mesh->faces * 3);
+ }
+ if (Textures) {
+ printf ("# texcoords: %i\n", (int) mesh->texels);
+ }
+ printf ("# faces: %i\n", (int) mesh->faces);
+
+ // vertices
+ for (i = 0; i < mesh->points; i++) {
+ Lib3dsPoint *point = &(mesh->pointL[i]);
+ printf (" vertex %f %f %f # %i\n",
+ point->pos[0], point->pos[1], point->pos[2], i);
+ }
+
+ // normals
+ if (Normals) {
+ Lib3dsVector *normals = (Lib3dsVector *)
+ malloc (3 * mesh->faces * sizeof (Lib3dsVector));
+ lib3ds_mesh_calculate_normals (mesh, normals);
+ for (i = 0; i < (mesh->faces * 3); i++) {
+ if (Invert) {
+ printf (" normal %f %f %f # %i\n",
+ -normals[i][0], -normals[i][1], -normals[i][2], i);
+ }
+ else {
+ printf (" normal %f %f %f # %i\n",
+ normals[i][0], normals[i][1], normals[i][2], i);
+ }
+ }
+ free (normals);
+ }
+
+ // texcoords
+ if (Textures) {
+ for (i = 0; i < mesh->texels; i++) {
+ Lib3dsTexel *texel = &(mesh->texelL[i]);
+ printf (" texcoord %f %f # %i\n", (*texel)[0], (*texel)[1], i);
+ }
+ }
+
+ // faces
+ for (i = 0; i < mesh->faces; i++) {
+ Lib3dsFace *face = &(mesh->faceL[i]);
+ Lib3dsWord *points = face->points;
+ printf (" face # material = %s\n", face->material);
+ printf (" vertices %i %i %i\n", points[0], points[1], points[2]);
+ if (Normals) {
+ printf (" normals %i %i %i\n", (i * 3) + 0, (i * 3) + 1,
+ (i * 3) + 2);
+ }
+ Lib3dsMaterial *mat =
+ lib3ds_file_material_by_name (File3DS, face->material);
+ if (mat) {
+ if (Textures && (mesh->texels != 0)) {
+ printf (" texture %s\n", mat->texture1_map.name);
+ printf (" texcoords %i %i %i\n", points[0], points[1],
+ points[2]);
+
+ // BZ isn't ready for these, yet...
+ // printf (" #texture %s\n", material->texture2_map.name);
+ // printf (" #texture %s\n", material->texture1_mask.name);
+ // printf (" #texture %s\n", material->texture2_mask.name);
+ }
+ if (Colors) {
+ Lib3dsRgba *ambient = &mat->ambient;
+ Lib3dsRgba *diffuse = &mat->diffuse;
+ if (ColorSwap) {
+ ambient = &mat->diffuse;
+ diffuse = &mat->ambient;
+ }
+ if (Ambient) {
+ printf (" ambient %f %f %f %f\n", (*ambient)[0],
+ (*ambient)[1], (*ambient)[2], (*ambient)[3]);
+ }
+ if (Diffuse) {
+ printf (" diffuse %f %f %f %f\n", (*diffuse)[0],
+ (*diffuse)[1], (*diffuse)[2], (*diffuse)[3]);
+ }
+ if (Specular) {
+ printf (" specular %f %f %f %f\n", mat->specular[0],
+ mat->specular[1], mat->specular[2], mat->specular[3]);
+ }
+ if (Shininess) {
+ printf (" shininess %f\n", mat->shininess);
+ }
+ }
+ }
+ printf (" endface\n");
+ }
+
+ printf ("end # %s\n\n", mesh->name);
+ }
+
+ lib3ds_file_free (File3DS);
+
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
Property changes on: trunk/bzflag/misc/3ds2bzw.cxx
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/bzflag/misc/Makefile.am
===================================================================
--- trunk/bzflag/misc/Makefile.am 2013-06-22 22:33:03 UTC (rev 22818)
+++ trunk/bzflag/misc/Makefile.am 2013-06-22 23:07:10 UTC (rev 22819)
@@ -1,7 +1,6 @@
-EXTRA_PROGRAMS = rrlog
+EXTRA_PROGRAMS = 3ds2bzw rrlog
EXTRA_DIST = \
- 3ds2bzw.c \
art/bzicon-red.svg \
art/title.psd \
bzbz.pl \
@@ -77,6 +76,10 @@
missing \
mkinstalldirs
+AM_CPPFLAGS = $(CONF_CPPFLAGS)
+AM_CFLAGS = $(CONF_CFLAGS)
+AM_CXXFLAGS = $(CONF_CXXFLAGS)
+
rrlog_SOURCES = rrlog.cxx
rrlog_CPPFLAGS = -I$(top_srcdir)/src/bzfs
rrlog_LDADD = \
@@ -86,5 +89,5 @@
../src/common/libCommon.la \
$(X_EXTRA_LIBS)
-3ds2bzw: 3ds2bzw.c
- $(CC) $(CFLAGS) -o 3ds2bzw 3ds2bzw.c -l3ds -lm
+3ds2bzw_SOURCES = 3ds2bzw.cxx
+3ds2bzw_LDADD = -l3ds
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-06-22 22:33:06
|
Revision: 22818
http://sourceforge.net/p/bzflag/code/22818
Author: bullet_catcher
Date: 2013-06-22 22:33:03 +0000 (Sat, 22 Jun 2013)
Log Message:
-----------
Move some type definitions into RecordReplay.h so they don't have to be duplicated in RecordReplay.cxx and rrlog.cxx.
Adjust rrlog.cxx to work with minor differences in struct definition.
Modified Paths:
--------------
trunk/bzflag/misc/rrlog.cxx
trunk/bzflag/src/bzfs/RecordReplay.cxx
trunk/bzflag/src/bzfs/RecordReplay.h
Modified: trunk/bzflag/misc/rrlog.cxx
===================================================================
--- trunk/bzflag/misc/rrlog.cxx 2013-06-21 20:28:12 UTC (rev 22817)
+++ trunk/bzflag/misc/rrlog.cxx 2013-06-22 22:33:03 UTC (rev 22818)
@@ -27,15 +27,10 @@
#ifndef _WIN32
# include <sys/time.h>
# include <unistd.h>
-typedef int64_t s64;
-#else
-typedef __int64 s64;
#endif
// common headers
#include "common.h"
-#include "global.h"
-#include "Protocol.h"
#include "Pack.h"
#include "TextUtils.h"
#include "version.h"
@@ -47,56 +42,6 @@
#include "MsgStrings.h"
-// Type Definitions
-// ----------------
-
-static const int PACKET_SIZE_STUFFING = 8;
-static const int HEADER_SIZE_STUFFING = 0;
-
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef s64 RRtime;
-
-typedef struct RRpacket {
- struct RRpacket *next;
- struct RRpacket *prev;
- u16 mode;
- u16 code;
- u32 len;
- u32 nextFilePos;
- u32 prevFilePos;
- RRtime timestamp;
- char *data;
-} RRpacket;
-
-static const unsigned int RRpacketHdrSize =
- PACKET_SIZE_STUFFING +
- (2 * sizeof(u16)) + (3 * sizeof(u32)) + sizeof(RRtime);
-
-typedef struct {
- u32 magic; // record file type identifier
- u32 version; // record file version
- u32 offset; // length of the full header
- RRtime filetime; // amount of time in the file
- u32 player; // player that saved this record file
- u32 flagsSize; // size of the flags data
- u32 worldSize; // size of world database
- char callSign[CallSignLen]; // player's callsign
- char motto[MottoLen]; // player's motto
- char serverVersion[8]; // BZFS protocol version
- char appVersion[MessageLen]; // BZFS application version
- char realHash[64]; // hash of worldDatabase
- char worldSettings[4 + WorldSettingsSize]; // the game settings
- char *flags; // a list of the flags types
- char *world; // the world
-} ReplayHeader;
-
-static const unsigned int ReplayHeaderSize =
- HEADER_SIZE_STUFFING +
- (sizeof(u32) * 6) + sizeof(RRtime) +
- CallSignLen + MottoLen + 8 + MessageLen + 64 + 4 + WorldSettingsSize;
-
-
// Function Prototypes
// -------------------
@@ -215,7 +160,7 @@
printf("end: %s", ctime(&endTime));
printf("author: %s (%s)\n", header.callSign, header.motto);
printf("bzfs: bzfs-%s\n", header.appVersion);
- printf("protocol: %.8s\n", header.serverVersion);
+ printf("protocol: %.8s\n", header.ServerVersion);
printf("flagSize: %i\n", header.flagsSize);
printf("worldSize: %i\n", header.worldSize);
printf("worldHash: %s\n", header.realHash);
@@ -314,7 +259,7 @@
buf = nboUnpackUInt(buf, h->worldSize);
buf = nboUnpackString(buf, h->callSign, sizeof(h->callSign));
buf = nboUnpackString(buf, h->motto, sizeof(h->motto));
- buf = nboUnpackString(buf, h->serverVersion, sizeof(h->serverVersion));
+ buf = nboUnpackString(buf, h->ServerVersion, sizeof(h->ServerVersion));
buf = nboUnpackString(buf, h->appVersion, sizeof(h->appVersion));
buf = nboUnpackString(buf, h->realHash, sizeof(h->realHash));
@@ -373,12 +318,13 @@
p->data = NULL;
}
else {
- p->data = new char [p->len];
- if (fread(p->data, p->len, 1, f) <= 0) {
- delete[] p->data;
+ char *d = new char [p->len];
+ if (fread(d, p->len, 1, f) <= 0) {
+ delete[] d;
delete p;
return NULL;
}
+ p->data = d;
}
return p;
Modified: trunk/bzflag/src/bzfs/RecordReplay.cxx
===================================================================
--- trunk/bzflag/src/bzfs/RecordReplay.cxx 2013-06-21 20:28:12 UTC (rev 22817)
+++ trunk/bzflag/src/bzfs/RecordReplay.cxx 2013-06-22 22:33:03 UTC (rev 22818)
@@ -17,12 +17,6 @@
// for name matching (so that messages aren't sent to ghosts)
// - improve skipping
-
-// OOPS, get rid of these during the next protocol change
-static const int PACKET_SIZE_STUFFING = 8;
-static const int HEADER_SIZE_STUFFING = 0;
-
-
// interface header
#include "RecordReplay.h"
@@ -37,10 +31,8 @@
#ifndef _WIN32
# include <sys/time.h>
# include <unistd.h>
-typedef int64_t s64;
#else
# include <direct.h>
-typedef __int64 s64;
# ifndef S_ISDIR
# define S_ISDIR(m) ((m) & _S_IFDIR)
# endif
@@ -50,7 +42,6 @@
#endif
// common headers
-#include "global.h"
#include "bzglob.h"
#include "Pack.h"
#include "GameTime.h"
@@ -68,32 +59,6 @@
// Type Definitions
// ----------------
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef s64 RRtime; // should last a while
-
-enum RecordType {
- StraightToFile = 0,
- BufferedRecord = 1
-};
-
-typedef struct RRpacket {
- struct RRpacket *next;
- struct RRpacket *prev;
- u16 mode;
- u16 code;
- u32 len;
- u32 nextFilePos;
- u32 prevFilePos;
- RRtime timestamp;
- const char *data;
-} RRpacket;
-//static const unsigned int RRpacketHdrSize =
-// sizeof(RRpacket) - (2 * sizeof(RRpacket*) - sizeof(char*));
-static const unsigned int RRpacketHdrSize =
- PACKET_SIZE_STUFFING +
- (2 * sizeof(u16)) + (3 * sizeof(u32)) + sizeof(RRtime);
-
typedef struct {
u32 byteCount;
u32 packetCount;
@@ -103,30 +68,6 @@
} RRbuffer;
typedef struct {
- u32 magic; // record file type identifier
- u32 version; // record file version
- u32 offset; // length of the full header
- RRtime filetime; // amount of time in the file
- u32 player; // player that saved this record file
- u32 flagsSize; // size of the flags data
- u32 worldSize; // size of world database
- char callSign[CallSignLen]; // player's callsign
- char motto[MottoLen]; // player's motto
- char ServerVersion[8]; // BZFS protocol version
- char appVersion[MessageLen]; // BZFS application version
- char realHash[64]; // hash of worldDatabase
- char worldSettings[4 + WorldSettingsSize]; // the game settings
- char *flags; // a list of the flags types
- char *world; // the world
-} ReplayHeader;
-//static const unsigned int ReplayHeaderSize =
-// sizeof(ReplayHeader) - (2 * sizeof(char*));
-static const unsigned int ReplayHeaderSize =
- HEADER_SIZE_STUFFING +
- (sizeof(u32) * 6) + sizeof(RRtime) +
- CallSignLen + MottoLen + 8 + MessageLen + 64 + 4 + WorldSettingsSize;
-
-typedef struct {
std::string file;
float time;
int entryNum;
Modified: trunk/bzflag/src/bzfs/RecordReplay.h
===================================================================
--- trunk/bzflag/src/bzfs/RecordReplay.h 2013-06-21 20:28:12 UTC (rev 22817)
+++ trunk/bzflag/src/bzfs/RecordReplay.h 2013-06-22 22:33:03 UTC (rev 22818)
@@ -15,6 +15,8 @@
#include "common.h"
+#include "global.h"
+#include "Protocol.h"
const int ReplayObservers = 16;
@@ -79,6 +81,64 @@
};
}
+// OOPS, get rid of these during the next protocol change
+static const int PACKET_SIZE_STUFFING = 8;
+static const int HEADER_SIZE_STUFFING = 0;
+
+typedef uint16_t u16;
+typedef uint32_t u32;
+#ifndef _WIN32
+typedef int64_t RRtime; // should last a while
+#else
+typedef __int64 RRtime;
+#endif
+
+enum RecordType {
+ StraightToFile = 0,
+ BufferedRecord = 1
+};
+
+typedef struct RRpacket {
+ struct RRpacket *next;
+ struct RRpacket *prev;
+ u16 mode;
+ u16 code;
+ u32 len;
+ u32 nextFilePos;
+ u32 prevFilePos;
+ RRtime timestamp;
+ const char *data;
+} RRpacket;
+//static const unsigned int RRpacketHdrSize =
+// sizeof(RRpacket) - (2 * sizeof(RRpacket*) - sizeof(char*));
+static const unsigned int RRpacketHdrSize =
+ PACKET_SIZE_STUFFING +
+ (2 * sizeof(u16)) + (3 * sizeof(u32)) + sizeof(RRtime);
+
+typedef struct {
+ u32 magic; // record file type identifier
+ u32 version; // record file version
+ u32 offset; // length of the full header
+ RRtime filetime; // amount of time in the file
+ u32 player; // player that saved this record file
+ u32 flagsSize; // size of the flags data
+ u32 worldSize; // size of world database
+ char callSign[CallSignLen]; // player's callsign
+ char motto[MottoLen]; // player's motto
+ char ServerVersion[8]; // BZFS protocol version
+ char appVersion[MessageLen]; // BZFS application version
+ char realHash[64]; // hash of worldDatabase
+ char worldSettings[4 + WorldSettingsSize]; // the game settings
+ char *flags; // a list of the flags types
+ char *world; // the world
+} ReplayHeader;
+//static const unsigned int ReplayHeaderSize =
+// sizeof(ReplayHeader) - (2 * sizeof(char*));
+static const unsigned int ReplayHeaderSize =
+ HEADER_SIZE_STUFFING +
+ (sizeof(u32) * 6) + sizeof(RRtime) +
+ CallSignLen + MottoLen + 8 + MessageLen + 64 + 4 + WorldSettingsSize;
+
// Some notes:
//
// - Any packets that get broadcast are buffered. Look for the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-06-21 20:28:15
|
Revision: 22817
http://sourceforge.net/p/bzflag/code/22817
Author: bullet_catcher
Date: 2013-06-21 20:28:12 +0000 (Fri, 21 Jun 2013)
Log Message:
-----------
Store the map MD5 hash in a std::string instead of a fixed-size buffer.
Modified Paths:
--------------
trunk/bzflag/src/bzfs/RecordReplay.cxx
trunk/bzflag/src/bzfs/bzfs.cxx
trunk/bzflag/src/bzfs/bzfs.h
Modified: trunk/bzflag/src/bzfs/RecordReplay.cxx
===================================================================
--- trunk/bzflag/src/bzfs/RecordReplay.cxx 2013-06-21 20:24:03 UTC (rev 22816)
+++ trunk/bzflag/src/bzfs/RecordReplay.cxx 2013-06-21 20:28:12 UTC (rev 22817)
@@ -2042,7 +2042,7 @@
strncpy(hdr.motto, motto, sizeof(hdr.motto));
strncpy(hdr.ServerVersion, getServerVersion(), sizeof(hdr.ServerVersion));
strncpy(hdr.appVersion, getAppVersion(), sizeof(hdr.appVersion));
- strncpy(hdr.realHash, hexDigest, sizeof(hdr.realHash));
+ strncpy(hdr.realHash, hexDigest.c_str(), sizeof(hdr.realHash));
packFlagTypes(flagsBuf, &hdr.flagsSize);
hdr.flags = flagsBuf;
@@ -2323,9 +2323,8 @@
MD5 md5;
md5.update((unsigned char *)worldDatabase, worldDatabaseSize);
md5.finalize();
- std::string hash = md5.hexdigest();
- hexDigest[0] = h->realHash[0];
- strncpy(hexDigest + 1, hash.c_str(), sizeof(hexDigest) - 1);
+ hexDigest = h->realHash[0];
+ hexDigest += md5.hexdigest();
delete[] oldWorld;
return true; // the world was replaced
Modified: trunk/bzflag/src/bzfs/bzfs.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfs.cxx 2013-06-21 20:24:03 UTC (rev 22816)
+++ trunk/bzflag/src/bzfs/bzfs.cxx 2013-06-21 20:28:12 UTC (rev 22817)
@@ -121,7 +121,7 @@
static float maxWorldHeight = 0.0f;
static bool disableHeightChecks = false;
-char hexDigest[50];
+std::string hexDigest;
TimeKeeper gameStartTime;
TimeKeeper countdownPauseStart = TimeKeeper::getNullTime();
@@ -1111,16 +1111,11 @@
MD5 md5;
md5.update((unsigned char *)worldDatabase, worldDatabaseSize);
md5.finalize();
- if (clOptions->worldFile == "") {
- strcpy(hexDigest, "t");
- } else {
- strcpy(hexDigest, "p");
- }
- std::string digest = md5.hexdigest();
- strcat(hexDigest, digest.c_str());
+ hexDigest = (clOptions->worldFile == "") ? 't' : 'p';
+ hexDigest += md5.hexdigest();
TimeKeeper endTime = TimeKeeper::getCurrent();
logDebugMessage(3,"MD5 generation: %.3f seconds\n", endTime - startTime);
- logDebugMessage(3,"MD5 = %s\n", digest.c_str());
+ logDebugMessage(3,"MD5 = %s\n", hexDigest.c_str()+1);
// water levels probably require flags on buildings
const float waterLevel = world->getWaterLevel();
@@ -4273,7 +4268,7 @@
clOptions->cacheURL.size() + 1);
directMessage(t, MsgCacheURL, (char*)obuf-(char*)obufStart, obufStart);
}
- obuf = nboPackString(obufStart, hexDigest, strlen(hexDigest)+1);
+ obuf = nboPackString(obufStart, hexDigest.c_str(), hexDigest.size() + 1);
directMessage(t, MsgWantWHash, (char*)obuf-(char*)obufStart, obufStart);
break;
}
Modified: trunk/bzflag/src/bzfs/bzfs.h
===================================================================
--- trunk/bzflag/src/bzfs/bzfs.h 2013-06-21 20:24:03 UTC (rev 22816)
+++ trunk/bzflag/src/bzfs/bzfs.h 2013-06-21 20:28:12 UTC (rev 22817)
@@ -145,7 +145,7 @@
extern int countdownDelay;
extern TimeKeeper countdownPauseStart;
extern int countdownResumeDelay;
-extern char hexDigest[50];
+extern std::string hexDigest;
extern WorldInfo *world;
extern char *worldDatabase;
extern uint32_t worldDatabaseSize;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-06-21 20:24:06
|
Revision: 22816
http://sourceforge.net/p/bzflag/code/22816
Author: bullet_catcher
Date: 2013-06-21 20:24:03 +0000 (Fri, 21 Jun 2013)
Log Message:
-----------
Explicitly list each file in the misc/art directory.
Use automake facilities to generate compilation rules for rrlog program.
Remove the generated bzflag.desktop file with "make clean".
Modified Paths:
--------------
trunk/bzflag/misc/Makefile.am
Property Changed:
----------------
trunk/bzflag/misc/
Index: trunk/bzflag/misc
===================================================================
--- trunk/bzflag/misc 2013-06-21 20:19:08 UTC (rev 22815)
+++ trunk/bzflag/misc 2013-06-21 20:24:03 UTC (rev 22816)
Property changes on: trunk/bzflag/misc
___________________________________________________________________
Modified: svn:ignore
## -1,3 +1,4 ##
+.deps
3ds2bzw
COPYING.backup
INSTALL.backup
Modified: trunk/bzflag/misc/Makefile.am
===================================================================
--- trunk/bzflag/misc/Makefile.am 2013-06-21 20:19:08 UTC (rev 22815)
+++ trunk/bzflag/misc/Makefile.am 2013-06-21 20:24:03 UTC (rev 22816)
@@ -1,6 +1,9 @@
+EXTRA_PROGRAMS = rrlog
+
EXTRA_DIST = \
3ds2bzw.c \
- art \
+ art/bzicon-red.svg \
+ art/title.psd \
bzbz.pl \
bzflag.desktop.in \
bzfquery.php \
@@ -33,7 +36,6 @@
multilingualSwearList.txt \
pingtimes.sh \
rebuild-bzflag \
- rrlog.cxx \
ServerListFilter.txt \
serverstats.sh \
shtool \
@@ -58,6 +60,8 @@
desktopdir = $(datadir)/applications
desktop_DATA = bzflag.desktop
+CLEANFILES = $(EXTRA_PROGRAMS) bzflag.desktop
+
MAINTAINERCLEANFILES = \
Makefile.in \
aclocal.m4 \
@@ -73,14 +77,14 @@
missing \
mkinstalldirs
-Rrlog: rrlog.cxx
- $(CXX) $(CXXFLAGS) \
- -o rrlog rrlog.cxx \
- -I../include -I../src/bzfs \
- ../src/date/libDate.a \
- ../src/game/libGame.a \
- ../src/net/libNet.a \
- ../src/common/libCommon.a
+rrlog_SOURCES = rrlog.cxx
+rrlog_CPPFLAGS = -I$(top_srcdir)/src/bzfs
+rrlog_LDADD = \
+ ../src/date/libDate.la \
+ ../src/game/libGame.la \
+ ../src/net/libNet.la \
+ ../src/common/libCommon.la \
+ $(X_EXTRA_LIBS)
3ds2bzw: 3ds2bzw.c
$(CC) $(CFLAGS) -o 3ds2bzw 3ds2bzw.c -l3ds -lm
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bul...@us...> - 2013-06-21 20:19:11
|
Revision: 22815
http://sourceforge.net/p/bzflag/code/22815
Author: bullet_catcher
Date: 2013-06-21 20:19:08 +0000 (Fri, 21 Jun 2013)
Log Message:
-----------
Include string.h, preserve const quality, and use NULL instead of false so rrlog will compile successfully.
Copy correct header size calculations from RecordReplay.cxx, and don't dereference a null pointer.
Modified Paths:
--------------
trunk/bzflag/misc/rrlog.cxx
Modified: trunk/bzflag/misc/rrlog.cxx
===================================================================
--- trunk/bzflag/misc/rrlog.cxx 2013-06-21 11:57:05 UTC (rev 22814)
+++ trunk/bzflag/misc/rrlog.cxx 2013-06-21 20:19:08 UTC (rev 22815)
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <string.h>
#include <time.h>
#ifndef _WIN32
# include <sys/time.h>
@@ -49,6 +50,9 @@
// Type Definitions
// ----------------
+static const int PACKET_SIZE_STUFFING = 8;
+static const int HEADER_SIZE_STUFFING = 0;
+
typedef uint16_t u16;
typedef uint32_t u32;
typedef s64 RRtime;
@@ -65,8 +69,10 @@
char *data;
} RRpacket;
-static const int RRpacketHdrSize = sizeof(RRpacket) -
- (2 * sizeof(RRpacket*) - sizeof(char*));
+static const unsigned int RRpacketHdrSize =
+ PACKET_SIZE_STUFFING +
+ (2 * sizeof(u16)) + (3 * sizeof(u32)) + sizeof(RRtime);
+
typedef struct {
u32 magic; // record file type identifier
u32 version; // record file version
@@ -85,7 +91,10 @@
char *world; // the world
} ReplayHeader;
-static const int ReplayHeaderSize = sizeof(ReplayHeader) - (2 * sizeof(char*));
+static const unsigned int ReplayHeaderSize =
+ HEADER_SIZE_STUFFING +
+ (sizeof(u32) * 6) + sizeof(RRtime) +
+ CallSignLen + MottoLen + 8 + MessageLen + 64 + 4 + WorldSettingsSize;
// Function Prototypes
@@ -94,7 +103,7 @@
static void printHelp(const char* execName);
static bool loadHeader(ReplayHeader *h, FILE *f);
static RRpacket *loadPacket(FILE *f);
-static void *nboUnpackRRtime(void *buf, RRtime& value);
+static const void *nboUnpackRRtime(const void *buf, RRtime& value);
static std::string strRRtime(RRtime timestamp);
@@ -212,6 +221,11 @@
printf("worldHash: %s\n", header.realHash);
printf("\n");
+ if (!p) {
+ printf("Error in first packet\n");
+ fclose(file);
+ exit(1);
+ }
MsgStrings::init();
MsgStrings::colorize(useColor);
@@ -285,7 +299,7 @@
static bool loadHeader(ReplayHeader *h, FILE *f)
{
char buffer[ReplayHeaderSize];
- void *buf;
+ const void *buf;
if (fread(buffer, ReplayHeaderSize, 1, f) <= 0) {
return false;
@@ -330,10 +344,10 @@
{
RRpacket *p;
char bufStart[RRpacketHdrSize];
- void *buf;
+ const void *buf;
if (f == NULL) {
- return false;
+ return NULL;
}
p = new RRpacket;
@@ -372,7 +386,7 @@
/****************************************************************************/
-static void* nboUnpackRRtime(void *buf, RRtime& value)
+static const void* nboUnpackRRtime(const void *buf, RRtime& value)
{
u32 msb, lsb;
buf = nboUnpackUInt(buf, msb);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kon...@us...> - 2013-06-21 11:57:09
|
Revision: 22814
http://sourceforge.net/p/bzflag/code/22814
Author: kongr45gpen
Date: 2013-06-21 11:57:05 +0000 (Fri, 21 Jun 2013)
Log Message:
-----------
Refill the joystick axis list on the menu when a user switches a joystick device, without having to restart the client
Modified Paths:
--------------
trunk/bzflag/src/bzflag/InputMenu.cxx
Modified: trunk/bzflag/src/bzflag/InputMenu.cxx
===================================================================
--- trunk/bzflag/src/bzflag/InputMenu.cxx 2013-06-18 11:20:00 UTC (rev 22813)
+++ trunk/bzflag/src/bzflag/InputMenu.cxx 2013-06-21 11:57:05 UTC (rev 22814)
@@ -205,6 +205,7 @@
HUDuiList* listHUD = (HUDuiList*)w;
std::vector<std::string> *options = &listHUD->getList();
std::string selectedOption = (*options)[listHUD->getIndex()];
+ InputMenu *menu = (InputMenu *) HUDDialogStack::get()->top();
switch (((const char*)data)[0]) {
/* Joystick name */
@@ -212,7 +213,8 @@
BZDB.set("joystickname", selectedOption);
getMainWindow()->initJoystick(selectedOption);
// re-fill all of the joystick-specific options lists
- // fillJSOptions();
+ if (menu)
+ menu->fillJSOptions();
break;
/* Joystick x-axis */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kon...@us...> - 2013-06-18 11:20:04
|
Revision: 22813
http://sourceforge.net/p/bzflag/code/22813
Author: kongr45gpen
Date: 2013-06-18 11:20:00 +0000 (Tue, 18 Jun 2013)
Log Message:
-----------
Add maxScoreboardLines to the list of the default client BZDB variables
Modified Paths:
--------------
trunk/bzflag/src/bzflag/defaultBZDB.cxx
Modified: trunk/bzflag/src/bzflag/defaultBZDB.cxx
===================================================================
--- trunk/bzflag/src/bzflag/defaultBZDB.cxx 2013-06-17 21:02:10 UTC (rev 22812)
+++ trunk/bzflag/src/bzflag/defaultBZDB.cxx 2013-06-18 11:20:00 UTC (rev 22813)
@@ -187,6 +187,7 @@
{ "hideMottos", "0", true, StateDatabase::ReadWrite, NULL },
{ "mottoDispLen", "32", true, StateDatabase::ReadWrite, NULL },
{ "scoreboardSort", "0", true, StateDatabase::ReadWrite, NULL },
+ { "maxScoreboardLines", "0", true, StateDatabase::ReadWrite, NULL },
// listFilters
{ "listFilter", "", true, StateDatabase::ReadWrite, NULL },
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kon...@us...> - 2013-06-17 21:02:12
|
Revision: 22812
http://sourceforge.net/p/bzflag/code/22812
Author: kongr45gpen
Date: 2013-06-17 21:02:10 +0000 (Mon, 17 Jun 2013)
Log Message:
-----------
Track number of self-kills on the scoreboard
Modified Paths:
--------------
trunk/bzflag/src/bzflag/Player.cxx
trunk/bzflag/src/bzflag/Player.h
trunk/bzflag/src/bzflag/ScoreboardRenderer.cxx
trunk/bzflag/src/bzflag/playing.cxx
Modified: trunk/bzflag/src/bzflag/Player.cxx
===================================================================
--- trunk/bzflag/src/bzflag/Player.cxx 2013-06-17 20:30:27 UTC (rev 22811)
+++ trunk/bzflag/src/bzflag/Player.cxx 2013-06-17 21:02:10 UTC (rev 22812)
@@ -65,6 +65,7 @@
wins(0),
losses(0),
tks(0),
+ selfKills(0),
localWins(0),
localLosses(0),
localTks(0),
@@ -668,6 +669,10 @@
tks += deltaTeamKills;
}
+void Player::changeSelfKills(short delta)
+{
+ selfKills += delta;
+}
void Player::changeLocalScore(short dWins, short dLosses, short dTeamKills)
{
Modified: trunk/bzflag/src/bzflag/Player.h
===================================================================
--- trunk/bzflag/src/bzflag/Player.h 2013-06-17 20:30:27 UTC (rev 22811)
+++ trunk/bzflag/src/bzflag/Player.h 2013-06-17 21:02:10 UTC (rev 22812)
@@ -103,6 +103,7 @@
}
#endif
short getRabbitScore() const;
+ short getSelfKills() const;
short getLocalWins() const;
short getLocalLosses() const;
short getLocalTeamKills() const;
@@ -174,6 +175,7 @@
void changeTeam(TeamColor);
virtual void setFlag(FlagType*);
virtual void changeScore(short deltaWins, short deltaLosses, short deltaTeamKills);
+ void changeSelfKills(short delta);
void changeLocalScore(short deltaWins, short deltaLosses, short deltaTeamKills);
void setHandicap(float handicap);
void setStatus(short);
@@ -295,6 +297,7 @@
short wins; // number of kills
short losses; // number of deaths
short tks; // number of teamkills
+ short selfKills; // number of self-destructions
// score of local player against this player
short localWins; // local player won this many
@@ -453,6 +456,11 @@
return tks;
}
+inline short Player::getSelfKills() const
+{
+ return selfKills;
+}
+
inline short Player::getLocalWins() const
{
return localWins;
Modified: trunk/bzflag/src/bzflag/ScoreboardRenderer.cxx
===================================================================
--- trunk/bzflag/src/bzflag/ScoreboardRenderer.cxx 2013-06-17 20:30:27 UTC (rev 22811)
+++ trunk/bzflag/src/bzflag/ScoreboardRenderer.cxx 2013-06-17 21:02:10 UTC (rev 22812)
@@ -630,7 +630,7 @@
if (LocalPlayer::getMyTank() != player) {
sprintf(kills, "%3d~%-3d", player->getLocalWins(), player->getLocalLosses());
} else {
- kills[0] = '\0';
+ sprintf(kills, "%4d", player->getSelfKills());
}
Modified: trunk/bzflag/src/bzflag/playing.cxx
===================================================================
--- trunk/bzflag/src/bzflag/playing.cxx 2013-06-17 20:30:27 UTC (rev 22811)
+++ trunk/bzflag/src/bzflag/playing.cxx 2013-06-17 21:02:10 UTC (rev 22812)
@@ -2270,6 +2270,11 @@
}
}
+ // handle self-destructions
+ if (killerPlayer == victimPlayer && killerPlayer) {
+ killerPlayer->changeSelfKills(1);
+ }
+
// add message
if (human && victimPlayer) {
std::string message(ColorStrings[WhiteColor]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kon...@us...> - 2013-06-17 20:30:30
|
Revision: 22811
http://sourceforge.net/p/bzflag/code/22811
Author: kongr45gpen
Date: 2013-06-17 20:30:27 +0000 (Mon, 17 Jun 2013)
Log Message:
-----------
Add menu option to pause the console
Modified Paths:
--------------
trunk/bzflag/src/bzflag/ControlPanel.cxx
trunk/bzflag/src/bzflag/ControlPanel.h
trunk/bzflag/src/bzflag/GUIOptionsMenu.cxx
trunk/bzflag/src/bzflag/clientCommands.cxx
trunk/bzflag/src/bzflag/defaultBZDB.cxx
Modified: trunk/bzflag/src/bzflag/ControlPanel.cxx
===================================================================
--- trunk/bzflag/src/bzflag/ControlPanel.cxx 2013-06-15 19:05:39 UTC (rev 22810)
+++ trunk/bzflag/src/bzflag/ControlPanel.cxx 2013-06-17 20:30:27 UTC (rev 22811)
@@ -170,7 +170,8 @@
dimming(1.0f),
du(0),
dv(0),
- messageMode(MessageAll)
+ messageMode(MessageAll),
+ paused(false)
{
setControlColor();
@@ -842,7 +843,13 @@
// visible changes, force a console refresh
if (messageMode == tab) {
- invalidate();
+ // Don't scroll the messages unless we're at the bottom
+ if ((BZDB.isTrue("pauseConsole") && messagesOffset > 0 && messageMode >= 0) ||
+ paused) {
+ setMessagesOffset(1, 1 /* current */, false);
+ }
+
+ invalidate();
}
// mark the tab as unread (if viewing tabs)
Modified: trunk/bzflag/src/bzflag/ControlPanel.h
===================================================================
--- trunk/bzflag/src/bzflag/ControlPanel.h 2013-06-15 19:05:39 UTC (rev 22810)
+++ trunk/bzflag/src/bzflag/ControlPanel.h 2013-06-17 20:30:27 UTC (rev 22811)
@@ -64,6 +64,8 @@
void setRadarRenderer(RadarRenderer*);
void setDimming(float dimming);
+
+ void togglePaused();
void saveMessages(const std::string& filename,
bool stripAnsi) const;
@@ -116,6 +118,7 @@
float margin;
float lineHeight;
bool unRead[MessageModeCount];
+ bool paused;
};
@@ -125,7 +128,12 @@
dimming = (newDim > 1.0f) ? 1.0f : (newDim < 0.0f) ? 0.0f : newDim;
}
+inline void ControlPanel::togglePaused()
+{
+ paused = !paused;
+}
+
#endif // BZF_CONTROL_PANEL_H
// Local Variables: ***
Modified: trunk/bzflag/src/bzflag/GUIOptionsMenu.cxx
===================================================================
--- trunk/bzflag/src/bzflag/GUIOptionsMenu.cxx 2013-06-15 19:05:39 UTC (rev 22810)
+++ trunk/bzflag/src/bzflag/GUIOptionsMenu.cxx 2013-06-17 20:30:27 UTC (rev 22811)
@@ -235,6 +235,16 @@
options->push_back(std::string("Right"));
option->update();
listHUD.push_back(option);
+ // Automatic pausing of the console
+ option = new HUDuiList;
+ option->setFontFace(fontFace);
+ option->setLabel("Automatically pause the control panel:");
+ option->setCallback(callback, "o");
+ options = &option->getList();
+ options->push_back(std::string("Off"));
+ options->push_back(std::string("On"));
+ option->update();
+ listHUD.push_back(option);
// GUI coloring
option = new HUDuiList;
option->setFontFace(fontFace);
@@ -385,6 +395,7 @@
i++; // locale
((HUDuiList*)listHUD[i++])->setIndex(static_cast<int>(BZDB.eval
("showtabs")));
+ ((HUDuiList*)listHUD[i++])->setIndex(BZDB.isTrue("pauseConsole") ? 1 : 0);
((HUDuiList*)listHUD[i++])->setIndex(BZDB.isTrue("colorful") ? 1 : 0);
// underline color - find index of mode string in options
@@ -498,6 +509,12 @@
break;
}
+ case 'o':
+ {
+ BZDB.set("pauseConsole", list->getIndex() ? "1" : "0");
+ break;
+ }
+
case 'c':
{
BZDB.set("colorful", list->getIndex() ? "1" : "0");
Modified: trunk/bzflag/src/bzflag/clientCommands.cxx
===================================================================
--- trunk/bzflag/src/bzflag/clientCommands.cxx 2013-06-15 19:05:39 UTC (rev 22810)
+++ trunk/bzflag/src/bzflag/clientCommands.cxx 2013-06-17 20:30:27 UTC (rev 22811)
@@ -951,6 +951,8 @@
controlPanel->setMessagesOffset(123456789, 0 /* set */, false);
} else if (args[0] == "bottom") {
controlPanel->setMessagesOffset(0, 0 /* set */, false);
+ } else if (args[0] == "pause") {
+ controlPanel->togglePaused();
}
return std::string();
}
Modified: trunk/bzflag/src/bzflag/defaultBZDB.cxx
===================================================================
--- trunk/bzflag/src/bzflag/defaultBZDB.cxx 2013-06-15 19:05:39 UTC (rev 22810)
+++ trunk/bzflag/src/bzflag/defaultBZDB.cxx 2013-06-17 20:30:27 UTC (rev 22811)
@@ -107,6 +107,7 @@
{ "stencilShadows", "0", true, StateDatabase::ReadWrite, NULL },
{ "shadowAlpha", "0.5", true, StateDatabase::ReadWrite, NULL },
{ "aniso", "1", true, StateDatabase::ReadWrite, NULL },
+ { "pauseConsole", "1", true, StateDatabase::ReadWrite, NULL },
// roam smooth follow settings
{ "followDist", "32.0", true, StateDatabase::ReadWrite, NULL },
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|