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
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(5) |
2
(8) |
|
3
(8) |
4
(12) |
5
(4) |
6
(1) |
7
(6) |
8
(3) |
9
(6) |
|
10
(7) |
11
(18) |
12
(12) |
13
(3) |
14
(8) |
15
(13) |
16
(22) |
|
17
(11) |
18
(28) |
19
(3) |
20
(1) |
21
(5) |
22
(3) |
23
(17) |
|
24
(11) |
25
(7) |
26
(1) |
27
|
28
(1) |
29
|
30
(4) |
|
31
|
|
|
|
|
|
|
|
From: <Jef...@us...> - 2008-08-30 18:20:17
|
Revision: 18483
http://bzflag.svn.sourceforge.net/bzflag/?rev=18483&view=rev
Author: JeffM2501
Date: 2008-08-30 18:20:28 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
revert 18482 since we have that as bz_getTeamPlayerLimit already
Modified Paths:
--------------
trunk/bzflag/include/bzfsAPI.h
trunk/bzflag/src/bzfs/bzfsAPI.cxx
Modified: trunk/bzflag/include/bzfsAPI.h
===================================================================
--- trunk/bzflag/include/bzfsAPI.h 2008-08-30 18:06:25 UTC (rev 18482)
+++ trunk/bzflag/include/bzfsAPI.h 2008-08-30 18:20:28 UTC (rev 18483)
@@ -1795,7 +1795,6 @@
// team info
BZF_API int bz_getTeamCount(bz_eTeamType team);
-BZF_API int bz_getTeamMaxPlayers (bz_eTeamType team);
BZF_API int bz_getTeamScore(bz_eTeamType team);
BZF_API int bz_getTeamWins(bz_eTeamType team);
BZF_API int bz_getTeamLosses(bz_eTeamType team);
Modified: trunk/bzflag/src/bzfs/bzfsAPI.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfsAPI.cxx 2008-08-30 18:06:25 UTC (rev 18482)
+++ trunk/bzflag/src/bzfs/bzfsAPI.cxx 2008-08-30 18:20:28 UTC (rev 18483)
@@ -3267,17 +3267,6 @@
return count;
}
-BZF_API int bz_getTeamMaxPlayers (bz_eTeamType _team)
-{
- int teamIndex=(int)convertTeam(_team);
-
- int count=0;
- if(teamIndex < 0 || teamIndex >= NumTeams)
- return 0;
-
- return clOptions->maxTeam[teamIndex];
-}
-
//-------------------------------------------------------------------------
BZF_API int bz_getTeamScore(bz_eTeamType _team)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2008-08-30 18:06:14
|
Revision: 18482
http://bzflag.svn.sourceforge.net/bzflag/?rev=18482&view=rev
Author: JeffM2501
Date: 2008-08-30 18:06:25 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
expose team player caps to the API via bz_getTeamMaxPlayers
Modified Paths:
--------------
trunk/bzflag/include/bzfsAPI.h
trunk/bzflag/src/bzfs/bzfsAPI.cxx
Modified: trunk/bzflag/include/bzfsAPI.h
===================================================================
--- trunk/bzflag/include/bzfsAPI.h 2008-08-30 17:52:44 UTC (rev 18481)
+++ trunk/bzflag/include/bzfsAPI.h 2008-08-30 18:06:25 UTC (rev 18482)
@@ -1795,6 +1795,7 @@
// team info
BZF_API int bz_getTeamCount(bz_eTeamType team);
+BZF_API int bz_getTeamMaxPlayers (bz_eTeamType team);
BZF_API int bz_getTeamScore(bz_eTeamType team);
BZF_API int bz_getTeamWins(bz_eTeamType team);
BZF_API int bz_getTeamLosses(bz_eTeamType team);
Modified: trunk/bzflag/src/bzfs/bzfsAPI.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfsAPI.cxx 2008-08-30 17:52:44 UTC (rev 18481)
+++ trunk/bzflag/src/bzfs/bzfsAPI.cxx 2008-08-30 18:06:25 UTC (rev 18482)
@@ -3267,6 +3267,17 @@
return count;
}
+BZF_API int bz_getTeamMaxPlayers (bz_eTeamType _team)
+{
+ int teamIndex=(int)convertTeam(_team);
+
+ int count=0;
+ if(teamIndex < 0 || teamIndex >= NumTeams)
+ return 0;
+
+ return clOptions->maxTeam[teamIndex];
+}
+
//-------------------------------------------------------------------------
BZF_API int bz_getTeamScore(bz_eTeamType _team)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2008-08-30 17:52:35
|
Revision: 18481
http://bzflag.svn.sourceforge.net/bzflag/?rev=18481&view=rev
Author: JeffM2501
Date: 2008-08-30 17:52:44 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
always set the event type on the data before we call the callbacks, just in case the caller was lazy and didn't set it.
Modified Paths:
--------------
trunk/bzflag/src/bzfs/WorldEventManager.cxx
Modified: trunk/bzflag/src/bzfs/WorldEventManager.cxx
===================================================================
--- trunk/bzflag/src/bzfs/WorldEventManager.cxx 2008-08-30 17:47:54 UTC (rev 18480)
+++ trunk/bzflag/src/bzfs/WorldEventManager.cxx 2008-08-30 17:52:44 UTC (rev 18481)
@@ -93,6 +93,7 @@
if (!eventData)
return;
+ eventData->eventType = eventType;
tvEventList eList = getEventList(eventType);
for (unsigned int i = 0; i < eList.size(); i++)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2008-08-30 17:47:45
|
Revision: 18480
http://bzflag.svn.sourceforge.net/bzflag/?rev=18480&view=rev
Author: JeffM2501
Date: 2008-08-30 17:47:54 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
always set the event type on the data before we call the callbacks, just in case the caller was lazy and didn't set it.
Modified Paths:
--------------
branches/v2_0branch/bzflag/src/bzfs/WorldEventManager.cxx
Modified: branches/v2_0branch/bzflag/src/bzfs/WorldEventManager.cxx
===================================================================
--- branches/v2_0branch/bzflag/src/bzfs/WorldEventManager.cxx 2008-08-28 16:59:46 UTC (rev 18479)
+++ branches/v2_0branch/bzflag/src/bzfs/WorldEventManager.cxx 2008-08-30 17:47:54 UTC (rev 18480)
@@ -91,6 +91,8 @@
if (!eventData || getEventCount(eventType)==0 )
return;
+ eventData->eventType = eventType;
+
tvEventList eList = getEventList(eventType);
for ( unsigned int i = 0; i < eList.size(); i++)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bla...@us...> - 2008-08-28 16:59:35
|
Revision: 18479
http://bzflag.svn.sourceforge.net/bzflag/?rev=18479&view=rev
Author: blast007
Date: 2008-08-28 16:59:46 +0000 (Thu, 28 Aug 2008)
Log Message:
-----------
Add a few extra content types to the HTTPServer (CSS, XML, and JSON).
Modified Paths:
--------------
trunk/bzflag/plugins/HTTPServer/HTTPServer.cpp
trunk/bzflag/plugins/plugin_utils/plugin_HTTP.h
Modified: trunk/bzflag/plugins/HTTPServer/HTTPServer.cpp
===================================================================
--- trunk/bzflag/plugins/HTTPServer/HTTPServer.cpp 2008-08-26 14:50:57 UTC (rev 18478)
+++ trunk/bzflag/plugins/HTTPServer/HTTPServer.cpp 2008-08-28 16:59:46 UTC (rev 18479)
@@ -785,6 +785,15 @@
case HTTPReply::eHTML:
return "text/html";
+ case HTTPReply::eCSS:
+ return "text/css";
+
+ case HTTPReply::eXML:
+ return "application/xml";
+
+ case HTTPReply::eJSON:
+ return "application/json";
+
default:
break;
}
Modified: trunk/bzflag/plugins/plugin_utils/plugin_HTTP.h
===================================================================
--- trunk/bzflag/plugins/plugin_utils/plugin_HTTP.h 2008-08-26 14:50:57 UTC (rev 18478)
+++ trunk/bzflag/plugins/plugin_utils/plugin_HTTP.h 2008-08-28 16:59:46 UTC (rev 18479)
@@ -174,6 +174,9 @@
eOctetStream,
eBinary,
eHTML,
+ eCSS,
+ eXML,
+ eJSON,
eOther
} DocumentType;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2008-08-26 14:50:47
|
Revision: 18478
http://bzflag.svn.sourceforge.net/bzflag/?rev=18478&view=rev
Author: kingofcamelot
Date: 2008-08-26 14:50:57 +0000 (Tue, 26 Aug 2008)
Log Message:
-----------
Added in the color coding and modes from the original ServerMenu to the new and improved one.
Modified Paths:
--------------
branches/gsoc_server_listing/src/bzflag/HUDuiServerList.cxx
branches/gsoc_server_listing/src/bzflag/HUDuiServerList.h
branches/gsoc_server_listing/src/bzflag/HUDuiServerListItem.cxx
branches/gsoc_server_listing/src/bzflag/HUDuiServerListItem.h
Modified: branches/gsoc_server_listing/src/bzflag/HUDuiServerList.cxx
===================================================================
--- branches/gsoc_server_listing/src/bzflag/HUDuiServerList.cxx 2008-08-25 13:16:58 UTC (rev 18477)
+++ branches/gsoc_server_listing/src/bzflag/HUDuiServerList.cxx 2008-08-26 14:50:57 UTC (rev 18478)
@@ -28,16 +28,18 @@
// HUDuiServerList
//
+float HUDuiServerList::MODES_PERCENTAGE = 0.125f;
float HUDuiServerList::DOMAIN_PERCENTAGE = 0.375f;
float HUDuiServerList::SERVER_PERCENTAGE = 0.375f;
-float HUDuiServerList::PLAYER_PERCENTAGE = 0.125f;
-float HUDuiServerList::PING_PERCENTAGE = 0.125f;
+float HUDuiServerList::PLAYER_PERCENTAGE = 0.0625f;
+float HUDuiServerList::PING_PERCENTAGE = 0.0625f;
HUDuiServerList::HUDuiServerList() : HUDuiScrollList(), filterOptions(0), filterPatterns(std::pair<std::string, std::string>("*", "*")), sortMode(NoSort), activeColumn(DomainName), reverseSort(false), devInfo(false), dataList(ServerList::instance())
{
+ columns[Modes] = std::pair<std::string, float*>("", &MODES_PERCENTAGE);
columns[DomainName] = std::pair<std::string, float*>("Address", &DOMAIN_PERCENTAGE);
columns[ServerName] = std::pair<std::string, float*>("Server Name", &SERVER_PERCENTAGE);
- columns[PlayerCount] = std::pair<std::string, float*>("Player Count", &PLAYER_PERCENTAGE);
+ columns[PlayerCount] = std::pair<std::string, float*>("Players", &PLAYER_PERCENTAGE);
columns[Ping] = std::pair<std::string, float*>("Ping", &PING_PERCENTAGE);
getNav().push_front(this);
}
@@ -202,7 +204,7 @@
void HUDuiServerList::addItem(ServerItem* item)
{
HUDuiServerListItem* newItem = new HUDuiServerListItem(item);
- newItem->setColumnSizes(DOMAIN_PERCENTAGE, SERVER_PERCENTAGE, PLAYER_PERCENTAGE, PING_PERCENTAGE);
+ newItem->setColumnSizes(MODES_PERCENTAGE, DOMAIN_PERCENTAGE, SERVER_PERCENTAGE, PLAYER_PERCENTAGE, PING_PERCENTAGE);
newItem->setFontFace(getFontFace());
newItem->setFontSize(getFontSize());
newItem->setSize(getWidth(), 10);
@@ -232,7 +234,7 @@
void HUDuiServerList::addItem(std::string key)
{
HUDuiServerListItem* newItem = new HUDuiServerListItem(key);
- newItem->setColumnSizes(DOMAIN_PERCENTAGE, SERVER_PERCENTAGE, PLAYER_PERCENTAGE, PING_PERCENTAGE);
+ newItem->setColumnSizes(MODES_PERCENTAGE, DOMAIN_PERCENTAGE, SERVER_PERCENTAGE, PLAYER_PERCENTAGE, PING_PERCENTAGE);
newItem->setFontFace(getFontFace());
newItem->setFontSize(getFontSize());
newItem->setSize(getWidth(), 10);
@@ -350,7 +352,7 @@
for (it=items.begin(); it != items.end(); it++)
{
- ((HUDuiServerListItem*)(*it))->setColumnSizes(DOMAIN_PERCENTAGE, SERVER_PERCENTAGE, PLAYER_PERCENTAGE, PING_PERCENTAGE);
+ ((HUDuiServerListItem*)(*it))->setColumnSizes(MODES_PERCENTAGE, DOMAIN_PERCENTAGE, SERVER_PERCENTAGE, PLAYER_PERCENTAGE, PING_PERCENTAGE);
}
}
@@ -384,7 +386,7 @@
std::string columnTitle = "";
- for (int i=DomainName; i != NoSort; i++)
+ for (int i=Modes; i != NoSort; i++)
{
if (sortMode == i)
if (reverseSort)
Modified: branches/gsoc_server_listing/src/bzflag/HUDuiServerList.h
===================================================================
--- branches/gsoc_server_listing/src/bzflag/HUDuiServerList.h 2008-08-25 13:16:58 UTC (rev 18477)
+++ branches/gsoc_server_listing/src/bzflag/HUDuiServerList.h 2008-08-26 14:50:57 UTC (rev 18478)
@@ -54,13 +54,15 @@
} FilterConstants;
typedef enum {
- DomainName = 0,
+ Modes = 0,
+ DomainName,
ServerName,
PlayerCount,
Ping,
NoSort
} SortConstants;
+ static float MODES_PERCENTAGE;
static float DOMAIN_PERCENTAGE;
static float SERVER_PERCENTAGE;
static float PLAYER_PERCENTAGE;
Modified: branches/gsoc_server_listing/src/bzflag/HUDuiServerListItem.cxx
===================================================================
--- branches/gsoc_server_listing/src/bzflag/HUDuiServerListItem.cxx 2008-08-25 13:16:58 UTC (rev 18477)
+++ branches/gsoc_server_listing/src/bzflag/HUDuiServerListItem.cxx 2008-08-26 14:50:57 UTC (rev 18478)
@@ -49,6 +49,7 @@
serverKey = key;
+ displayModes = modes = calculateModes();
displayDomain = domainName = calculateDomainName();
displayServer = serverName = calculateServerName();
displayPlayer = playerCount = calculatePlayers();
@@ -60,6 +61,63 @@
// do nothing
}
+std::string HUDuiServerListItem::calculateModes()
+{
+ ServerItem* server = serverList.lookupServer(serverKey);
+
+ if (server == NULL)
+ return "";
+
+ std::string modesText;
+ if (BZDB.isTrue("listIcons")) {
+ // game mode
+ if ((server->ping.observerMax == 16) && (server->ping.maxPlayers == 200))
+ modesText += ANSI_STR_FG_CYAN "* "; // replay
+ else if (server->ping.gameType == ClassicCTF)
+ modesText += ANSI_STR_FG_RED "* "; // ctf
+ else if (server->ping.gameType == RabbitChase)
+ modesText += ANSI_STR_FG_WHITE "* "; // white rabbit
+ else
+ modesText += ANSI_STR_FG_YELLOW "* "; // free-for-all
+
+ // jumping?
+ if (server->ping.gameOptions & JumpingGameStyle)
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_MAGENTA "J ";
+ else
+ modesText += ANSI_STR_DIM ANSI_STR_FG_WHITE "J ";
+
+ // superflags ?
+ if (server->ping.gameOptions & SuperFlagGameStyle)
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_BLUE "F ";
+ else
+ modesText += ANSI_STR_DIM ANSI_STR_FG_WHITE "F ";
+
+ // ricochet?
+ if (server->ping.gameOptions & RicochetGameStyle)
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_GREEN "R ";
+ else
+ modesText += ANSI_STR_DIM ANSI_STR_FG_WHITE "R ";
+
+ if (server->ping.pingTime <= 0)
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_BLACK "L";
+ else if (server->ping.pingTime < BZDB.eval("pingLow"))
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_GREEN "L";
+ else if (server->ping.pingTime < BZDB.eval("pingMed"))
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_YELLOW "L";
+ else if (server->ping.pingTime < BZDB.eval("pingHigh"))
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_ORANGE "L";
+ else if (server->ping.pingTime >= BZDB.eval("pingHigh") && server->ping.pingTime < INT_MAX)
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_RED "L";
+ else if (server->ping.pingTime >= BZDB.eval("pingHigh"))
+ modesText += ANSI_STR_PULSATING ANSI_STR_REVERSE ANSI_STR_FG_RED "L";
+ else
+ // shouldn't reach here
+ modesText += ANSI_STR_BRIGHT ANSI_STR_FG_BLACK "L";
+ }
+
+ return modesText;
+}
+
std::string HUDuiServerListItem::calculateDomainName()
{
ServerItem* server = serverList.lookupServer(serverKey);
@@ -139,8 +197,9 @@
resize();
}
-void HUDuiServerListItem::setColumnSizes(float domain, float server, float player, float ping)
+void HUDuiServerListItem::setColumnSizes(float modes_percent, float domain, float server, float player, float ping)
{
+ modes_percentage = modes_percent;
domain_percentage = domain;
server_percentage = server;
player_percentage = player;
@@ -156,6 +215,7 @@
spacerWidth = fm.getStringWidth(getFontFace()->getFMFace(), getFontSize(), "I");
+ displayModes = shorten(modes, (modes_percentage*getWidth())-2*spacerWidth);
displayDomain = shorten(domainName, (domain_percentage*getWidth())-2*spacerWidth);
displayServer = shorten(serverName, (server_percentage*getWidth())-2*spacerWidth);
displayPlayer = shorten(playerCount, (player_percentage*getWidth())-2*spacerWidth);
@@ -202,6 +262,7 @@
if ((domainName.compare(calculateDomainName()) == 0)||(serverName.compare(calculateServerName()) == 0)||
(playerCount.compare(calculatePlayers()) == 0)||(serverPing.compare(calculatePing()) == 0))
{
+ displayModes = modes = calculateModes();
displayDomain = domainName = calculateDomainName();
displayServer = serverName = calculateServerName();
displayPlayer = playerCount = calculatePlayers();
@@ -209,18 +270,48 @@
resize();
}
- float domainX = getX() + spacerWidth;
- float serverX = getX() + domain_percentage*getWidth() + spacerWidth;
- float playerX = getX() + domain_percentage*getWidth() + server_percentage*getWidth() + spacerWidth;
- float pingX = getX() + domain_percentage*getWidth() + server_percentage*getWidth() + player_percentage*getWidth() + spacerWidth;
+ float modesX = getX() + spacerWidth;
+ float domainX = getX() + modes_percentage*getWidth() + spacerWidth;
+ float serverX = getX() + modes_percentage*getWidth() + domain_percentage*getWidth() + spacerWidth;
+ float playerX = getX() + modes_percentage*getWidth() + domain_percentage*getWidth() + server_percentage*getWidth() + spacerWidth;
+ float pingX = getX() + modes_percentage*getWidth() + domain_percentage*getWidth() + server_percentage*getWidth() + player_percentage*getWidth() + spacerWidth;
int face = getFontFace()->getFMFace();
+ float color[3] = {1.0f, 1.0f, 1.0f};
+
+ // colorize server descriptions by shot counts
+ const int maxShots = server->ping.maxShots;
+ if (maxShots <= 0) {
+ color[0] = 0.4f;
+ color[1] = 0.0f;
+ color[2] = 0.6f;
+ } else if (maxShots == 1) {
+ color[0] = 0.25f;
+ color[1] = 0.25f;
+ color[2] = 1.0f;
+ } else if (maxShots == 2) {
+ color[0] = 0.25f;
+ color[1] = 1.0f;
+ color[2] = 0.25f;
+ } else if (maxShots == 3) {
+ color[0] = 1.0f;
+ color[1] = 1.0f;
+ color[2] = 0.25f;
+ } else {
+ // graded orange/red
+ const float shotScale = std::min(1.0f, log10f((float)(maxShots - 3)));
+ color[0] = 1.0f;
+ color[1] = 0.4f * (1.0f - shotScale);
+ color[2] = 0.25f * color[1];
+ }
+
fm.setDarkness(darkness);
- fm.drawString(domainX, getY(), 0, face, getFontSize(), displayDomain.c_str());
- fm.drawString(serverX, getY(), 0, face, getFontSize(), displayServer.c_str());
- fm.drawString(playerX, getY(), 0, face, getFontSize(), displayPlayer.c_str());
- fm.drawString(pingX, getY(), 0, face, getFontSize(), displayPing.c_str());
+ fm.drawString(modesX, getY(), 0, face, getFontSize(), displayModes.c_str());
+ fm.drawString(domainX, getY(), 0, face, getFontSize(), displayDomain.c_str(), color);
+ fm.drawString(serverX, getY(), 0, face, getFontSize(), displayServer.c_str(), color);
+ fm.drawString(playerX, getY(), 0, face, getFontSize(), displayPlayer.c_str(), color);
+ fm.drawString(pingX, getY(), 0, face, getFontSize(), displayPing.c_str(), color);
fm.setDarkness(1.0f);
}
Modified: branches/gsoc_server_listing/src/bzflag/HUDuiServerListItem.h
===================================================================
--- branches/gsoc_server_listing/src/bzflag/HUDuiServerListItem.h 2008-08-25 13:16:58 UTC (rev 18477)
+++ branches/gsoc_server_listing/src/bzflag/HUDuiServerListItem.h 2008-08-26 14:50:57 UTC (rev 18478)
@@ -39,13 +39,14 @@
void setFontSize(float size);
void setFontFace(const LocalFontFace *face);
- void setColumnSizes(float domain, float server, float player, float ping);
+ void setColumnSizes(float modes_percent, float domain, float server, float player, float ping);
std::string getDomainName() { return domainName; }
std::string getServerName() { return serverName; }
std::string getPlayerCount() { return playerCount; }
std::string getServerPing() { return serverPing; }
+ std::string calculateModes();
std::string calculateDomainName();
std::string calculateServerName();
std::string calculatePlayers();
@@ -63,16 +64,19 @@
ServerList &serverList;
std::string serverKey;
+ std::string modes;
std::string domainName;
std::string serverName;
std::string playerCount;
std::string serverPing;
+ std::string displayModes;
std::string displayDomain;
std::string displayServer;
std::string displayPlayer;
std::string displayPing;
+ float modes_percentage;
float domain_percentage;
float server_percentage;
float player_percentage;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bth...@us...> - 2008-08-25 13:16:48
|
Revision: 18477
http://bzflag.svn.sourceforge.net/bzflag/?rev=18477&view=rev
Author: bthansen
Date: 2008-08-25 13:16:58 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
Add newline at end of file
Modified Paths:
--------------
trunk/bzflag/include/bzfsAPI.h
Modified: trunk/bzflag/include/bzfsAPI.h
===================================================================
--- trunk/bzflag/include/bzfsAPI.h 2008-08-25 05:30:07 UTC (rev 18476)
+++ trunk/bzflag/include/bzfsAPI.h 2008-08-25 13:16:58 UTC (rev 18477)
@@ -2151,4 +2151,4 @@
// c-basic-offset: 2 ***
// indent-tabs-mode: t ***
// End: ***
-// ex: shiftwidth=2 tabstop=8
\ No newline at end of file
+// ex: shiftwidth=2 tabstop=8
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jw...@us...> - 2008-08-25 05:29:57
|
Revision: 18476
http://bzflag.svn.sourceforge.net/bzflag/?rev=18476&view=rev
Author: jwmelto
Date: 2008-08-25 05:30:07 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
Fix memory management (delete[] vs delete, unnecessary allocations).
Some whitespace (lots more is needed)
Modified Paths:
--------------
trunk/bzwgen/inc/Generator.h
trunk/bzwgen/inc/GridGenerator.h
trunk/bzwgen/inc/Logger.h
trunk/bzwgen/inc/MultiFace.h
trunk/bzwgen/src/BZWGenerator.cxx
trunk/bzwgen/src/BZWGeneratorPlugin.cxx
trunk/bzwgen/src/BuildZone.cxx
trunk/bzwgen/src/Mesh.cxx
trunk/bzwgen/src/MultiFace.cxx
trunk/bzwgen/src/Operation.cxx
trunk/bzwgen/src/bzwgen.cxx
Modified: trunk/bzwgen/inc/Generator.h
===================================================================
--- trunk/bzwgen/inc/Generator.h 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/inc/Generator.h 2008-08-25 05:30:07 UTC (rev 18476)
@@ -112,8 +112,7 @@
* Destructor, frees the materials, the zones, but not the ruleset.
*/
virtual ~Generator( ) {
- for ( ZoneVectIter itr = zones.begin(); itr!= zones.end(); ++itr )
- delete ( *itr );
+ deletePointerVector( zones );
}
};
Modified: trunk/bzwgen/inc/GridGenerator.h
===================================================================
--- trunk/bzwgen/inc/GridGenerator.h 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/inc/GridGenerator.h 2008-08-25 05:30:07 UTC (rev 18476)
@@ -53,7 +53,7 @@
* Destructor, frees the allocated map.
*/
virtual ~GridGenerator( ) {
- delete map;
+ delete[] map;
}
private:
/** Type of cell on the grid */
Modified: trunk/bzwgen/inc/Logger.h
===================================================================
--- trunk/bzwgen/inc/Logger.h 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/inc/Logger.h 2008-08-25 05:30:07 UTC (rev 18476)
@@ -99,7 +99,7 @@
if (!fileStream) fileStream = new std::ofstream("log.txt");
}
~LoggerSingleton() {
- if (fileStream) delete fileStream;
+ delete fileStream;
}
private:
/**
Modified: trunk/bzwgen/inc/MultiFace.h
===================================================================
--- trunk/bzwgen/inc/MultiFace.h 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/inc/MultiFace.h 2008-08-25 05:30:07 UTC (rev 18476)
@@ -19,6 +19,9 @@
#define __MULTIFACE_H__
#include "globals.h"
+
+#include <memory>
+
#include "Output.h"
#include "Face.h"
#include "Mesh.h"
@@ -34,7 +37,7 @@
/**
* Vector of component face pointers. Managed and deleted by the class.
*/
- FaceVector* comps;
+ std::auto_ptr<FaceVector> comps;
/**
* As MultiFace has many complex operations, it needs a pointer to the
* underlying mesh, to access vertex data.
@@ -45,10 +48,14 @@
* Standard constructor, takes the underlying mesh as an argument.
* Initializes the underlying component face vector.
*/
- MultiFace( Mesh* _mesh ) : Face( ), mesh( _mesh ) {
- comps = new FaceVector;
+ MultiFace( Mesh* _mesh ) : Face( ), comps(new FaceVector), mesh( _mesh )
+ {
}
/**
+ * Standard destructor, disposes of the component vector.
+ */
+ virtual ~MultiFace() { }
+ /**
* Detaches a face from the MultiFace. The id here is the internal index
* in the component vector. Returns a list of Mesh face ID's of the faces
* that are left after the detaching.
@@ -72,10 +79,6 @@
int componentCount() {
return comps->size();
}
- /**
- * Standard destructor, disposes of the component vector.
- */
- virtual ~MultiFace() { delete comps; }
private:
/**
* Updates the Z-coordinate of all stored faces. Called right before
Modified: trunk/bzwgen/src/BZWGenerator.cxx
===================================================================
--- trunk/bzwgen/src/BZWGenerator.cxx 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/src/BZWGenerator.cxx 2008-08-25 05:30:07 UTC (rev 18476)
@@ -177,11 +177,11 @@
void BZWGenerator::generate( OutStream* outstream ) {
Logger.log( 1, "BZWGenerator : initializing... " );
- Generator* gen;
+ std::auto_ptr<Generator> gen;
if ( experimental )
- gen = new FaceGenerator( ruleset );
+ gen.reset(new FaceGenerator( ruleset ));
else
- gen = new GridGenerator( ruleset );
+ gen.reset(new GridGenerator( ruleset ));
Logger.log( 1, "BZWGenerator : parsing options... " );
gen->parseOptions( &cmd );
@@ -196,7 +196,6 @@
os.footer( );
Logger.log( 1, "BZWGenerator : generation done. ");
- delete gen;
}
// Local Variables: ***
Modified: trunk/bzwgen/src/BZWGeneratorPlugin.cxx
===================================================================
--- trunk/bzwgen/src/BZWGeneratorPlugin.cxx 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/src/BZWGeneratorPlugin.cxx 2008-08-25 05:30:07 UTC (rev 18476)
@@ -18,7 +18,10 @@
void BZWGeneratorPlugin::process(bz_EventData *eventData) {
if (eventData->eventType == bz_eWorldFinalized) {
- delete cstr;
+ // This bothers me because this pointer has been given
+ // out. Potential pointer into freed memory...
+ delete[] cstr;
+ cstr = 0;
return;
}
@@ -35,14 +38,15 @@
return;
}
- OutStringStream* outstream = new OutStringStream(OutStringStream::out);
- generate(outstream);
+ OutStringStream outstream(OutStringStream::out);
+ generate(&outstream);
bz_GetWorldEventData_V1 *getWorldData = (bz_GetWorldEventData_V1 *) eventData;
// The following code is so ugly that I barely can look at it.
- cstr = new char [((OutStringStream*)(outstream))->str().size()+1];
- strcpy (cstr, ((OutStringStream*)(outstream))->str().c_str());
+ delete[] cstr;
+ cstr = new char [outstream.str().size()+1];
+ strcpy (cstr, outstream.str().c_str());
getWorldData->worldBlob = cstr;
getWorldData->generated = true;
worldGenerated = true;
Modified: trunk/bzwgen/src/BuildZone.cxx
===================================================================
--- trunk/bzwgen/src/BuildZone.cxx 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/src/BuildZone.cxx 2008-08-25 05:30:07 UTC (rev 18476)
@@ -29,6 +29,7 @@
Logger.log( 4, "BuildZone : running ruleset 'start' rule..." );
String rulename = String("start");
+ // Possible memory leak here?
meshes = generator->getRuleSet()->run( mesh, baseFaceID, rulename );
Logger.log( 4, "BuildZone : complete" );
}
@@ -40,10 +41,7 @@
}
BuildZone::~BuildZone( ) {
- if ( meshes == NULL ) return;
- for ( MeshVectIter itr = meshes->begin(); itr!= meshes->end(); ++itr )
- delete (*itr);
- delete meshes;
+ deletePointerVector( meshes );
}
// Local Variables: ***
Modified: trunk/bzwgen/src/Mesh.cxx
===================================================================
--- trunk/bzwgen/src/Mesh.cxx 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/src/Mesh.cxx 2008-08-25 05:30:07 UTC (rev 18476)
@@ -123,7 +123,7 @@
for ( int i = 0; i < size; i++ ) {
v[ f[faceID]->getVertex( i ) ] = nv[i];
}
- delete nv;
+ delete[] nv;
}
void Mesh::weldVertices( int a, int b ) {
@@ -277,7 +277,7 @@
}
Vertex stepA, stepB;
- DoubleVector* sdata = new DoubleVector(splitData->size());
+ DoubleVector sdata(splitData->size());
int splits = splitData->size()-1;
double length = horizontal ? faceH(fid) : faceV(fid);
@@ -285,14 +285,14 @@
double lsum = 0.0;
for (int i = 0; i < splits+1; i++) {
double value = splitData->at(i);
- (*sdata)[i] = value;
+ sdata[i] = value;
if (value >= 0.0) lsum += value; else relsum += -value;
}
if (relsum > 0) {
double relperunit = ( length-lsum ) / relsum;
for (int i = 0; i < splits+1; i++) {
- double value = sdata->at(i);
- if (value < 0.0) (*sdata)[i] = -value*relperunit;
+ double value = sdata.at(i);
+ if (value < 0.0) sdata[i] = -value*relperunit;
}
}
@@ -329,8 +329,8 @@
Vertex b = v[bs];
for (int i = 0; i < splits; i++) {
- a = a + stepA*sdata->at(i);
- b = b + stepB*sdata->at(i);
+ a = a + stepA*sdata.at(i);
+ b = b + stepB*sdata.at(i);
if (ssnap > EPSILON) {
Vertex A = a-v[as];
@@ -389,7 +389,6 @@
f[fid]->addVertex( idx3 );
}
- delete sdata;
return result;
}
@@ -497,8 +496,7 @@
Mesh::~Mesh() {
- for ( FaceVectIter itr = f.begin(); itr!= f.end(); ++itr )
- delete (*itr);
+ deletePointerVector( f );
}
Modified: trunk/bzwgen/src/MultiFace.cxx
===================================================================
--- trunk/bzwgen/src/MultiFace.cxx 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/src/MultiFace.cxx 2008-08-25 05:30:07 UTC (rev 18476)
@@ -47,12 +47,12 @@
if (id >= int(comps->size())) return NULL;
updateFaces(mesh->getVertex(getVertex(0)).z);
- IntVector* result = new IntVector();
- IntVector* visited = new IntVector();
+ IntVector* result = new IntVector;
+ IntVector visited;
Face* f = comps->at(id);
- int index = pickRemovalIndex(comps->at(id),visited);
+ int index = pickRemovalIndex(comps->at(id),&visited);
while (index >= 0) {
printf("Element iteration...\n");
@@ -71,7 +71,7 @@
Face* oface = getOtherFaceWithVertex(f,vid);
oindex = (oface == NULL) ? -1 : oface->getVertexIndex(vid);
- visited->push_back(vid);
+ visited.push_back(vid);
nvtx.push_back(vid);
if (oindex < 0 ) {
@@ -102,11 +102,10 @@
nface->setMaterial( getMaterial() );
nface->setVertices( nvtx );
result->push_back(mesh->addFace(nface));
- index = pickRemovalIndex(comps->at(id),visited);
+ index = pickRemovalIndex(comps->at(id),&visited);
}
printf("Cleaning up\n");
- delete visited;
comps->erase(comps->begin() + id);
Modified: trunk/bzwgen/src/Operation.cxx
===================================================================
--- trunk/bzwgen/src/Operation.cxx 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/src/Operation.cxx 2008-08-25 05:30:07 UTC (rev 18476)
@@ -47,16 +47,18 @@
}
OperationMultifaces::OperationMultifaces( RuleSet* _ruleset, Expression* _exp, StringVector* _facerules )
-: OperationSingle( _ruleset, _exp ), facerules( _facerules ), allsame( false ) {
+ : OperationSingle( _ruleset, _exp ), facerules( _facerules ), allsame( false )
+{
if ( facerules != NULL ) {
if ( facerules->size() == 0 ) {
delete facerules;
facerules = NULL;
- } else
+ } else {
if ( facerules->size() == 1 && facerules->at(0)[0] == '@' ) {
allsame = true;
facerules->at( 0 ).erase( 0, 1 );
}
+ }
}
}
@@ -66,10 +68,9 @@
return face;
}
flatten( mesh,face );
- IntVector* faces = ( (MultiFace*)mesh->getFace( face ) )->detachFace( math::roundToInt( value[0] ) );
- if ( faces != NULL ) {
- OperationMultifaces::runMesh( mesh, face, faces );
- delete faces;
+ std::auto_ptr<IntVector> faces(( (MultiFace*)mesh->getFace( face ) )->detachFace( math::roundToInt(value[0]) ));
+ if ( faces.get() != NULL ) {
+ OperationMultifaces::runMesh( mesh, face, faces.get() );
}
return face;
}
@@ -93,36 +94,36 @@
}
-int OperationExtrude::runMesh( Mesh* mesh, int face ) {
+int OperationExtrude::runMesh( Mesh* mesh, int face )
+{
if ( mesh == NULL ) return 0;
flatten( mesh, face );
if ( facerules != NULL ) {
- IntVector* faces = new IntVector;
- mesh->extrudeFace( face, value[0], mesh->getFace( face )->getMaterial(), faces );
- OperationMultifaces::runMesh( mesh, face, faces );
- delete faces;
+ IntVector faces;
+ mesh->extrudeFace( face, value[0], mesh->getFace( face )->getMaterial(), &faces );
+ OperationMultifaces::runMesh( mesh, face, &faces );
} else {
mesh->extrudeFace( face, value[0], mesh->getFace( face )->getMaterial() );
}
return face;
}
-int OperationExtrudeT::runMesh( Mesh* mesh, int face ) {
+int OperationExtrudeT::runMesh( Mesh* mesh, int face )
+{
if (mesh == NULL) return 0;
flatten( mesh, face );
- IntVector* faces = new IntVector;
- mesh->extrudeFace( face, value[0], mesh->getFace( face )->getMaterial(), faces );
+ IntVector faces;
+ mesh->extrudeFace( face, value[0], mesh->getFace( face )->getMaterial(), &faces );
double snap = ruleset->getAttr( "SNAP" );
double textile = ruleset->getAttr( "TEXTILE" );
- for ( size_t i = 0; i < faces->size(); i++ ) {
- mesh->textureFace( faces->at(i), snap, textile );
+ for ( size_t i = 0; i < faces.size(); i++ ) {
+ mesh->textureFace( faces.at(i), snap, textile );
}
if ( facerules != NULL ) {
- OperationMultifaces::runMesh( mesh, face, faces );
+ OperationMultifaces::runMesh( mesh, face, &faces );
}
- delete faces;
return face;
}
@@ -135,31 +136,28 @@
int OperationSplitFace::runMesh( Mesh* mesh,int face ) {
if ( mesh == NULL ) return 0;
- DoubleVector* dv = new DoubleVector( splits->size() );
+ DoubleVector dv( splits->size() );
for ( size_t i = 0; i < splits->size(); i++ )
- (*dv)[i] = splits->at(i)->calculate( mesh, face );
+ dv[i] = splits->at(i)->calculate( mesh, face );
- IntVector* faces;
- if (exp[0] != NULL)
- faces = mesh->splitFace( face, dv, horiz, exp[0]->calculate(mesh,face) );
- else
- faces = mesh->splitFace( face, dv, horiz );
+ double ssnap(0.0);
+ if (exp[0] != NULL) ssnap = exp[0]->calculate(mesh, face);
+ std::auto_ptr<IntVector> faces(mesh->splitFace( face, &dv, horiz, ssnap ));
+
if (facerules != NULL) {
- OperationMultifaces::runMesh( mesh, face, faces );
+ OperationMultifaces::runMesh( mesh, face, faces.get() );
}
- delete faces;
- delete dv;
return face;
}
-int OperationRepeat::runMesh( Mesh* mesh,int face ) {
+int OperationRepeat::runMesh( Mesh* mesh,int face )
+{
if (mesh == NULL) return 0;
flatten( mesh, face );
- IntVector* faces = mesh->repeatSubdivdeFace( face, value[0], horiz );
+ std::auto_ptr<IntVector> faces(mesh->repeatSubdivdeFace( face, value[0], horiz ));
if (facerules != NULL) {
- OperationMultifaces::runMesh( mesh, face, faces );
+ OperationMultifaces::runMesh( mesh, face, faces.get() );
}
- delete faces;
return face;
}
Modified: trunk/bzwgen/src/bzwgen.cxx
===================================================================
--- trunk/bzwgen/src/bzwgen.cxx 2008-08-25 05:23:25 UTC (rev 18475)
+++ trunk/bzwgen/src/bzwgen.cxx 2008-08-25 05:30:07 UTC (rev 18476)
@@ -57,9 +57,8 @@
int main (int argc, char* argv[]) {
if (BZWGen.parseCommandLine(argc,argv)) return 0;
if (BZWGen.setup()) return 1;
- OutFileStream* outstream = new OutFileStream(BZWGen.outname.c_str());
- BZWGen.generate(outstream);
- delete outstream;
+ OutFileStream outstream(BZWGen.outname.c_str());
+ BZWGen.generate(&outstream);
}
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jw...@us...> - 2008-08-25 05:23:18
|
Revision: 18475
http://bzflag.svn.sourceforge.net/bzflag/?rev=18475&view=rev
Author: jwmelto
Date: 2008-08-25 05:23:25 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
Mostly whitespace. Changed to use new/delete instead of malloc
Modified Paths:
--------------
trunk/bzwgen/inc/OSFile.h
trunk/bzwgen/src/OSFile.cxx
Modified: trunk/bzwgen/inc/OSFile.h
===================================================================
--- trunk/bzwgen/inc/OSFile.h 2008-08-25 01:54:46 UTC (rev 18474)
+++ trunk/bzwgen/inc/OSFile.h 2008-08-25 05:23:25 UTC (rev 18475)
@@ -36,98 +36,98 @@
#include <stdio.h>
typedef enum
-{
- eFileStart,
- eCurentPos,
- eFileEnd
-}teFilePos;
+ {
+ eFileStart,
+ eCurentPos,
+ eFileEnd
+ } teFilePos;
void SetOSFileBaseDir ( const char *szDir );
class COSFile
{
-public:
- COSFile ();
- COSFile ( const COSFile &r);
- COSFile& operator = (const COSFile &r);
+ public:
+ COSFile ();
+ COSFile ( const COSFile &r);
+ COSFile& operator = (const COSFile &r);
- COSFile ( const char *szName );
- COSFile ( const char *szName, const char *szMode );
- ~COSFile();
+ COSFile ( const char *szName );
+ COSFile ( const char *szName, const char *szMode );
+ ~COSFile();
- bool Open ( const char *szName, const char *szMode );
- bool Open ( const char *szMode );
- bool Close ( void );
+ bool Open ( const char *szName, const char *szMode );
+ bool Open ( const char *szMode );
+ bool Close ( void );
- void StdName ( const char *szName );
- void OSName ( const char *szName );
+ void StdName ( const char *szName );
+ void OSName ( const char *szName );
- FILE* GetFile ( void );
+ FILE* GetFile ( void );
- const char* GetStdName ( void );
- const char* GetOSName ( void );
+ const char* GetStdName ( void );
+ const char* GetOSName ( void );
- const char* GetFileTitle ( void );
+ const char* GetFileTitle ( void );
- const char* GetExtension ( void );
+ const char* GetExtension ( void );
- const char* GetFullOSPath ( void );
+ const char* GetFullOSPath ( void );
- bool IsOpen ( void );
+ bool IsOpen ( void );
- int Read ( void* data, int size, int count = 1 );
- unsigned char ReadChar ( void );
- int ScanChar ( unsigned char *pChar );
- const char* ScanStr ( void );
- const char* ReadLine ( void );
- int Write ( const void* data, int size );
- void Write ( const char* data );
- void Write ( std::string data );
- void Flush ( void );
+ int Read ( void* data, int size, int count = 1 );
+ unsigned char ReadChar ( void );
+ int ScanChar ( unsigned char *pChar );
+ const char* ScanStr ( void );
+ const char* ReadLine ( void );
+ int Write ( const void* data, int size );
+ void Write ( const char* data );
+ void Write ( std::string data );
+ void Flush ( void );
- std::vector<std::string> ParseFile ( std::string delim );
+ std::vector<std::string> ParseFile ( std::string delim );
- int Seek ( teFilePos ePos, int iOffset );
- unsigned int Size ( void );
- unsigned int Tell ( void );
+ int Seek ( teFilePos ePos, int iOffset );
+ unsigned int Size ( void );
+ unsigned int Tell ( void );
- bool GetFileText ( std::string &text );
+ bool GetFileText ( std::string &text );
- void SetUseGlobalPath ( bool use = false );
-protected:
- class COSFileInfo;
- COSFileInfo *info;
+ void SetUseGlobalPath ( bool use = false );
+ protected:
+ class COSFileInfo;
+ COSFileInfo *info;
};
class COSDir
{
-public:
- COSDir();
- COSDir( const COSDir &r);
- COSDir& operator = (const COSDir &r);
- explicit COSDir( const char* szDirName );
- ~COSDir();
+ public:
+ COSDir();
+ COSDir( const COSDir &r);
+ COSDir& operator = (const COSDir &r);
+ explicit COSDir( const char* szDirName );
+ ~COSDir();
- void SetStdDir ( const char* szDirName );
- void SetOSDir ( const char* szDirName );
+ void SetStdDir ( const char* szDirName );
+ void SetOSDir ( const char* szDirName );
- void MakeStdDir ( const char* szDirName );
- void MakeOSDir ( const char* szDirName );
+ void MakeStdDir ( const char* szDirName );
+ void MakeOSDir ( const char* szDirName );
- bool GetNextFile ( COSFile &oFile, bool bRecursive );
- bool GetNextFile ( COSFile &oFile, const char* fileMask, bool bRecursive );
+ bool GetNextFile ( COSFile &oFile, bool bRecursive );
+ bool GetNextFile ( COSFile &oFile, const char* fileMask, bool bRecursive );
- const char* GetStdName ( void );
- const char* GetOSName ( void );
- const char* GetFullOSPath ( void );
+ const char* GetStdName ( void );
+ const char* GetOSName ( void );
+ const char* GetFullOSPath ( void );
-protected:
- class COSDirInfo;
- COSDirInfo *info;
+ protected:
+ class COSDirInfo;
+ COSDirInfo *info;
- bool WindowsAddFileStack ( const char *szPathName, const char* fileMask , bool bRecursive );
- bool LinuxAddFileStack( const char *szPathName, const char* fileMask , bool bRecursive);
+ bool WindowsAddFileStack ( const char *szPathName, const char* fileMask , bool bRecursive );
+ bool LinuxAddFileStack( const char *szPathName, const char* fileMask , bool bRecursive);
};
Modified: trunk/bzwgen/src/OSFile.cxx
===================================================================
--- trunk/bzwgen/src/OSFile.cxx 2008-08-25 01:54:46 UTC (rev 18474)
+++ trunk/bzwgen/src/OSFile.cxx 2008-08-25 05:23:25 UTC (rev 18475)
@@ -26,15 +26,15 @@
#include <stddef.h>
#endif
-void GetUperName ( char *szData )
+void GetUperName ( char* szData )
{
#ifdef _WIN32
- strupr(szData);
+ strupr(szData);
#else
- while(*szData) {
- *szData = toupper(*szData);
- szData++;
- }
+ while(*szData) {
+ *szData = toupper(*szData);
+ szData++;
+ }
#endif
}
@@ -46,84 +46,74 @@
// this is one place you need to add conversions to/from your OS
// util functions
-void OSFileStdToOSDir ( char *dir )
+void OSFileStdToOSDir ( char* dir )
{
#ifndef _WIN32
- return;
+ return;
#else
- char *p = dir;
+ char* p = dir;
- while ( *p != NULL )
- {
- if (*p == '/')
- *p = '\\';
-
- p++;
- }
+ while ( *p != NULL ) {
+ if (*p == '/') *p = '\\';
+ p++;
+ }
#endif//WIN32
}
-void OSFileOSToStdDir ( char *dir )
+void OSFileOSToStdDir ( char* dir )
{
#ifndef _WIN32
- return;
+ return;
#else
- char *p = dir;
+ char *p = dir;
- while ( *p != NULL )
- {
- if (*p == '\\')
- *p= '/';
-
- p++;
- }
+ while ( *p != NULL ) {
+ if (*p == '\\') *p= '/';
+ p++;
+ }
#endif//WIN32
}
// windows specific make path
#ifdef _WIN32
-void WindowsMakePath(const char * path)
+void WindowsMakePath(const char* path)
{
- // scan the folder path and make it
- const char *pos = strchr (path,'\\');
+ // scan the folder path and make it
+ const char* pos = strchr (path,'\\');
- if (!pos) // dono maybe the screwed up
- {
- std::string str = "\\";
- str += path;
- mkdir(str.c_str());
- return;
- }
+ if (!pos) { // dono maybe the screwed up
+ std::string str = "\\";
+ str += path;
+ mkdir(str.c_str());
+ return;
+ }
- while (pos)
- {
- std::string str = path;
- str.resize(pos-path);
- mkdir(str.c_str());
- pos = strchr (pos+1,'\\');
- }
+ while (pos) {
+ std::string str = path;
+ str.resize(pos-path);
+ mkdir(str.c_str());
+ pos = strchr (pos+1,'\\');
+ }
}
#else
-void nixMakePath(const char * path)
+void nixMakePath(const char* path)
{
- // scan the folder path and make it
- char *pos = strchr (path,'/');
+ // scan the folder path and make it
+ char *pos = strchr (path,'/');
- if (!pos) // dono maybe the screwed up
- {
- std::string str = "//";
- str += path;
- mkdir(str.c_str(), 0777);
- return;
- }
+ if (!pos) { // dono maybe the screwed up
+ std::string str = "//";
+ str += path;
+ mkdir(str.c_str(), 0777);
+ return;
+ }
- while (pos)
- {
- std::string str = path;
- str.resize(pos-path);
- mkdir(str.c_str(), 0777);
- pos = strchr (pos+1,'/');
- }
+ while (pos) {
+ std::string str = path;
+ str.resize(pos-path);
+ mkdir(str.c_str(), 0777);
+ pos = strchr (pos+1,'/');
+ }
}
#endif // windows
@@ -132,9 +122,9 @@
void OSMakePath(const char * path)
{
#ifdef _WIN32
- WindowsMakePath(path);
+ WindowsMakePath(path);
#else
- nixMakePath(path);
+ nixMakePath(path);
#endif // win32
}
@@ -145,633 +135,597 @@
void SetOSFileBaseDir ( const char *dir )
{
- stdBaseDir = dir;
- if (!dir)
- osBaseDir.empty();
- else
- {
- osBaseDir = stdBaseDir;
- OSFileStdToOSDir((char*)osBaseDir.c_str());
- }
+ stdBaseDir = dir;
+ if (!dir) {
+ osBaseDir.empty();
+ } else {
+ osBaseDir = stdBaseDir;
+ OSFileStdToOSDir((char*)osBaseDir.c_str());
+ }
}
// OSFileClass
class COSFile::COSFileInfo
{
- public:
- COSFileInfo();
- COSFileInfo( const COSFile::COSFileInfo &r);
- std::string stdName;
- std::string osName;
- std::string title;
- bool useGlobalPath;
- FILE *fp;
+public:
+ COSFileInfo();
+ COSFileInfo( const COSFile::COSFileInfo &r);
+ std::string stdName;
+ std::string osName;
+ std::string title;
+ bool useGlobalPath;
+ FILE *fp;
};
COSFile::COSFileInfo::COSFileInfo ( void )
+ : useGlobalPath(true), fp(NULL)
{
- fp = NULL;
- osName = "";
- stdName = "";
- title = "";
- useGlobalPath = true;
}
COSFile::COSFileInfo::COSFileInfo( const COSFile::COSFileInfo &r)
+ : stdName(r.stdName)
+ , osName(r.osName)
+ , title(r.title)
+ , useGlobalPath(r.useGlobalPath)
+ , fp(NULL) // never copy the file
{
- // never copy the file
- fp = NULL;
- osName = r.osName;
- stdName = r.stdName;
- title = r.title;
- useGlobalPath = r.useGlobalPath;
}
void COSFile::SetUseGlobalPath ( bool use )
{
- info->useGlobalPath = use;
+ info->useGlobalPath = use;
}
COSFile::COSFile ()
+ : info(new COSFileInfo)
{
- info = new COSFileInfo;
}
COSFile::COSFile ( const char *name )
+ : info(new COSFileInfo)
{
- info = new COSFileInfo;
- StdName(name);
+ StdName(name);
}
COSFile::COSFile ( const COSFile &r)
{
- if (this == &r)
- return;
+ if (this == &r)
+ return;
- info = new COSFileInfo(*r.info);
+ info = new COSFileInfo(*r.info);
}
COSFile& COSFile::operator = (const COSFile &r)
{
- if (this == &r)
- return *this;
+ if (this == &r)
+ return *this;
- if (info)
- delete (info);
-
- info = new COSFileInfo(*r.info);
- return *this;
+ delete info;
+ info = new COSFileInfo(*r.info);
+ return *this;
}
COSFile::COSFile ( const char *name, const char *mode )
+ : info(new COSFileInfo)
{
- info = new COSFileInfo;
- Open(name,mode);
+ Open(name,mode);
}
COSFile::~COSFile()
{
- Close();
- if (info)
- delete (info);
+ Close();
+ delete info;
}
bool COSFile::Open ( const char *name, const char *mode )
{
- Close();
+ Close();
- StdName(name);
+ StdName(name);
- return Open(mode);
+ return Open(mode);
}
bool COSFile::Open ( const char *mode )
{
- Close();
+ Close();
- char modeToUse[32];
+ char modeToUse[32];
- if (!mode)
- sprintf(modeToUse,"rb");
- else
- strcpy(modeToUse,mode);
+ if (!mode)
+ sprintf(modeToUse,"rb");
+ else
+ strcpy(modeToUse,mode);
- std::string fileName;
+ std::string fileName;
- if (info->useGlobalPath)
- fileName = osBaseDir;
- fileName += info->osName;
+ if (info->useGlobalPath)
+ fileName = osBaseDir;
+ fileName += info->osName;
- info->fp = fopen(fileName.c_str(),mode);
+ info->fp = fopen(fileName.c_str(),mode);
- // we may need to make the file path to the file, if we are writing then lets get on with it.
- if (!info->fp && strchr(mode,'w'))
- {
- OSMakePath(fileName.c_str());
- info->fp = fopen(fileName.c_str(),mode);
- }
+ // we may need to make the file path to the file, if we are writing
+ // then lets get on with it.
+ if (!info->fp && strchr(mode,'w')) {
+ OSMakePath(fileName.c_str());
+ info->fp = fopen(fileName.c_str(),mode);
+ }
- return IsOpen();
+ return IsOpen();
}
bool COSFile::Close ( void )
{
- if (info->fp)
- fclose(info->fp);
+ if (info->fp)
+ fclose(info->fp);
- info->fp = NULL;
+ info->fp = NULL;
- return (!IsOpen());
+ return (!IsOpen());
}
int COSFile::Read ( void* data, int size, int count )
{
- if (!IsOpen())
- return 0;
+ if (!IsOpen())
+ return 0;
- return (int)fread(data,size,count,info->fp);
+ return (int)fread(data,size,count,info->fp);
}
unsigned char COSFile::ReadChar ( void )
{
- if (!IsOpen())
- return 0;
+ if (!IsOpen())
+ return 0;
- char c = 0;
+ char c = 0;
- if (fscanf(info->fp,"%c",&c) != 1)
- return 0;
- return c;
+ if (fscanf(info->fp,"%c",&c) != 1)
+ return 0;
+ return c;
}
const char* COSFile::ReadLine ( void )
{
- static std::string line;
+ static std::string line;
- line = "";
- char c = ReadChar();
- while (c != 0 && c != '\n' && c != 10)
- {
- line += c;
- c = ReadChar();
- }
- return line.c_str();
+ line = "";
+ char c = ReadChar();
+ while (c != 0 && c != '\n' && c != 10)
+ {
+ line += c;
+ c = ReadChar();
+ }
+ return line.c_str();
}
int COSFile::ScanChar ( unsigned char *pChar )
{
- if (!pChar || !IsOpen())
- return 0;
+ if (!pChar || !IsOpen())
+ return 0;
- return fscanf(info->fp,"%c",pChar);
+ return fscanf(info->fp,"%c",pChar);
}
const char* COSFile::ScanStr ( void )
{
- if (!IsOpen())
- return 0;
+ if (!IsOpen())
+ return 0;
- static char temp[1024] = {0};
- if (fscanf(info->fp,"%s",temp)!=1)
- return NULL;
- return temp;
+ static char temp[1024] = {0};
+ if (fscanf(info->fp,"%s",temp)!=1)
+ return NULL;
+ return temp;
}
int COSFile::Write ( const void* data, int size )
{
- if (!IsOpen())
- return 0;
+ if (!IsOpen())
+ return 0;
- return (int)fwrite(data,size,1,info->fp);
+ return (int)fwrite(data,size,1,info->fp);
}
void COSFile::Write ( const char* data )
{
- if (!IsOpen())
- return;
+ if (!IsOpen())
+ return;
- fprintf(info->fp,"%s",data);
+ fprintf(info->fp,"%s",data);
}
void COSFile::Write ( std::string data )
{
- Write(data.c_str(),(int)data.size());
+ Write(data.c_str(),(int)data.size());
}
void COSFile::Flush ( void )
{
- fflush(info->fp);
+ fflush(info->fp);
}
std::vector<std::string> COSFile::ParseFile ( std::string delim )
{
- std::vector<std::string> fileSegments;
- if (!IsOpen())
- return fileSegments;
+ std::vector<std::string> fileSegments;
+ if (!IsOpen())
+ return fileSegments;
- int pos = Tell();
- int size = Size();
- char *data = (char*)malloc(size+1);
- data[size] = 0;
- Read(data,size);
- Seek(eFileStart,pos);
+ int pos = Tell();
+ int size = Size();
+ char *data = new char [size+1];
+ data[size] = 0;
+ Read(data,size);
+ Seek(eFileStart,pos);
- std::string dataStr = data;
- free(data);
+ std::string dataStr = data;
+ delete[] data;
- fileSegments = TextUtils::tokenize(dataStr,delim,0,true);
- return fileSegments;
+ fileSegments = TextUtils::tokenize(dataStr,delim,0,true);
+ return fileSegments;
}
int COSFile::Seek ( teFilePos ePos, int iOffset )
{
- if (!IsOpen())
- return 0;
+ if (!IsOpen())
+ return 0;
- long iMode;
- switch(ePos)
- {
- case eFileStart:
- iMode = SEEK_SET;
- break;
+ long iMode;
+ switch(ePos) {
+ case eFileStart:
+ iMode = SEEK_SET;
+ break;
- case eFileEnd:
- iMode = SEEK_END ;
- break;
+ case eFileEnd:
+ iMode = SEEK_END ;
+ break;
- case eCurentPos:
- default:
- iMode = SEEK_CUR ;
- break;
- }
+ case eCurentPos:
+ default:
+ iMode = SEEK_CUR ;
+ break;
+ }
- return fseek(info->fp,iOffset,iMode);
+ return fseek(info->fp,iOffset,iMode);
}
unsigned int COSFile::Size ( void )
{
- if (!IsOpen())
- return 0;
+ if (!IsOpen())
+ return 0;
- unsigned int pos = ftell(info->fp);
- fseek(info->fp,0,SEEK_END);
- unsigned int len = ftell(info->fp);
- fseek(info->fp,pos, SEEK_SET);
+ unsigned int pos = ftell(info->fp);
+ fseek(info->fp,0,SEEK_END);
+ unsigned int len = ftell(info->fp);
+ fseek(info->fp,pos, SEEK_SET);
- return len;
+ return len;
}
unsigned int COSFile::Tell ( void )
{
- if (!IsOpen())
- return 0;
- return ftell(info->fp);
+ if (!IsOpen())
+ return 0;
+ return ftell(info->fp);
}
bool COSFile::GetFileText ( std::string &text )
{
- bool opened = false;
+ bool opened = false;
- if ( !IsOpen() )
- {
- if (!Open("r"))
- return false;
- opened = true;
- }
+ if ( !IsOpen() ) {
+ if (!Open("r"))
+ return false;
+ opened = true;
+ }
- unsigned int pos = Tell();
- Seek(eFileStart,0);
- unsigned int size = Size();
- unsigned char *p = (unsigned char *)malloc(size+1);
- Read(p,size,1);
- p[size] = 0;
- text = (char*)p;
- free(p);
+ unsigned int pos = Tell();
+ Seek(eFileStart,0);
+ unsigned int size = Size();
+ unsigned char *p = new unsigned char [size+1];
+ Read(p,size,1);
+ p[size] = 0;
+ text = (char*)p;
+ delete[] p;
- if ( !opened )
- Seek(eFileStart,pos);
- else
- Close();
+ if ( !opened )
+ Seek(eFileStart,pos);
+ else
+ Close();
- return true;
+ return true;
}
void COSFile::StdName ( const char *name )
{
- info->stdName = name;
- info->osName = name;
- OSFileStdToOSDir((char*)info->osName.c_str());
+ info->stdName = name;
+ info->osName = name;
+ OSFileStdToOSDir((char*)info->osName.c_str());
}
void COSFile::OSName ( const char *name )
{
- info->stdName = name;
- info->osName = name;
- OSFileOSToStdDir((char*)info->stdName.c_str());
+ info->stdName = name;
+ info->osName = name;
+ OSFileOSToStdDir((char*)info->stdName.c_str());
}
const char* COSFile::GetFileTitle ( void )
{
- if (info->stdName.size()== 0)
- return NULL;
+ if (info->stdName.size()== 0)
+ return NULL;
- // yes I know this part is horible, put it in the pimple
- static std::string title;
- const char *path = strrchr(info->stdName.c_str(),'/');
+ // yes I know this part is horible, put it in the pimple
+ static std::string title;
+ const char *path = strrchr(info->stdName.c_str(),'/');
- if (path)
- path++;
- else
- path = (char*)info->stdName.c_str();
+ if (path)
+ path++;
+ else
+ path = (char*)info->stdName.c_str();
- title = path;
+ title = path;
- // if no ext then we just give them the raw, as it may not have an extension
- const char *ext = GetExtension();
- if (ext)
- title.resize(title.size() - strlen(ext) - 1);
+ // if no ext then we just give them the raw, as it may not have an extension
+ const char *ext = GetExtension();
+ if (ext)
+ title.resize(title.size() - strlen(ext) - 1);
- return title.c_str();
+ return title.c_str();
}
// this CAN return null, cus the file may not have an extenstion, if it just happens to end in a '.' then well, your really wierd Mr. File.
const char* COSFile::GetExtension ( void )
{
- if (info->stdName.size()== 0)
- return NULL;
+ if (info->stdName.size()== 0)
+ return NULL;
- const char *pEnd = strrchr(info->stdName.c_str(),'.');
+ const char *pEnd = strrchr(info->stdName.c_str(),'.');
- if (pEnd)
- pEnd++;
+ if (pEnd)
+ pEnd++;
- return pEnd;
+ return pEnd;
}
const char* COSFile::GetFullOSPath ( void )
{
- static std::string szPath;
+ static std::string szPath;
- szPath.empty();
- szPath = osBaseDir;
- szPath += info->osName;
- return szPath.c_str();
+ szPath.empty();
+ szPath = osBaseDir;
+ szPath += info->osName;
+ return szPath.c_str();
}
FILE* COSFile::GetFile ( void )
{
- return info->fp;
+ return info->fp;
}
const char* COSFile::GetStdName ( void )
{
- return info->stdName.c_str();
+ return info->stdName.c_str();
}
const char* COSFile::GetOSName ( void )
{
- return info->osName.c_str();
+ return info->osName.c_str();
}
bool COSFile::IsOpen ( void )
{
- return info->fp != NULL;
+ return info->fp != NULL;
}
// OS Dir classes
class COSDir::COSDirInfo
{
public:
- COSDirInfo();
- COSDirInfo(const COSDir::COSDirInfo &r);
+ COSDirInfo();
- std::string baseStdDir;
- std::string baseOSDir;
- tvFileNameList nameList;
- unsigned int namePos;
+ std::string baseStdDir;
+ std::string baseOSDir;
+ tvFileNameList nameList;
+ unsigned int namePos;
};
COSDir::COSDirInfo::COSDirInfo ( void )
+ : namePos(0xFFFFFFFF)
{
- namePos = 0xFFFFFFFF;
}
-COSDir::COSDirInfo::COSDirInfo ( const COSDir::COSDirInfo &r )
-{
- if (this == &r)
- return;
-
- baseStdDir = r.baseStdDir;
- baseOSDir = r.baseOSDir;
- nameList = r.nameList;
- namePos = r.namePos;
-}
-
COSDir::COSDir()
+ : info(new COSDirInfo)
{
- info = new COSDirInfo;
}
COSDir::COSDir( const COSDir& r)
{
- info = new COSDirInfo(*r.info);
+ if (this == &r)
+ return;
+
+ info = new COSDirInfo(*r.info);
}
COSDir& COSDir::operator = (const COSDir& r)
{
- if (this == &r)
- return *this;
+ if (this == &r)
+ return *this;
- if (info)
- delete(info);
+ delete(info);
+ info = new COSDirInfo(*r.info);
- info = new COSDirInfo(*r.info);
-
- return *this;
+ return *this;
}
COSDir::COSDir( const char* szDirName )
+ : info(new COSDirInfo)
{
- info = new COSDirInfo;
- SetStdDir(szDirName);
+ SetStdDir(szDirName);
}
COSDir::~COSDir()
{
- if (info)
- {
- info->nameList.clear();
- delete(info);
- }
- info = NULL;
+ delete(info);
}
void COSDir::SetStdDir ( const char* szDirName )
{
- info->baseStdDir = szDirName;
- info->baseOSDir = szDirName;
- OSFileStdToOSDir((char*)info->baseOSDir.c_str());
+ info->baseStdDir = szDirName;
+ info->baseOSDir = szDirName;
+ OSFileStdToOSDir((char*)info->baseOSDir.c_str());
}
void COSDir::SetOSDir ( const char* szDirName )
{
- info->baseStdDir = szDirName;
- info->baseOSDir = szDirName;
- OSFileOSToStdDir((char*)info->baseStdDir.c_str());
+ info->baseStdDir = szDirName;
+ info->baseOSDir = szDirName;
+ OSFileOSToStdDir((char*)info->baseStdDir.c_str());
}
void COSDir::MakeStdDir ( const char* szDirName )
{
- SetStdDir(szDirName);
+ SetStdDir(szDirName);
#ifdef _WIN32
- mkdir(info->baseOSDir.c_str());
+ mkdir(info->baseOSDir.c_str());
#else
- mkdir(info->baseOSDir.c_str(), 0777);
+ mkdir(info->baseOSDir.c_str(), 0777);
#endif
}
void COSDir::MakeOSDir ( const char* szDirName )
{
- SetOSDir(szDirName);
+ SetOSDir(szDirName);
#ifdef _WIN32
- mkdir(info->baseOSDir.c_str());
+ mkdir(info->baseOSDir.c_str());
#else
- mkdir(info->baseOSDir.c_str(), 0777);
+ mkdir(info->baseOSDir.c_str(), 0777);
#endif
}
const char* COSDir::GetStdName ( void )
{
- return info->baseStdDir.c_str();
+ return info->baseStdDir.c_str();
}
const char* COSDir::GetOSName ( void )
{
- return info->baseOSDir.c_str();
+ return info->baseOSDir.c_str();
}
const char* COSDir::GetFullOSPath ( void )
{
- static std::string szFilePath;
+ static std::string szFilePath;
- szFilePath.empty();
- szFilePath = osBaseDir;
+ szFilePath.empty();
+ szFilePath = osBaseDir;
- szFilePath += info->baseOSDir;
- return szFilePath.c_str();
+ szFilePath += info->baseOSDir;
+ return szFilePath.c_str();
}
bool COSDir::GetNextFile ( COSFile &oFile, bool bRecursive )
{
- return GetNextFile(oFile,NULL,bRecursive);
+ return GetNextFile(oFile,NULL,bRecursive);
}
bool COSDir::GetNextFile ( COSFile &oFile, const char* fileMask, bool bRecursive )
{
#ifdef _WIN32
- std::string realMask = "*.*"; //FIXME -- could this also be just '*' ?
+ std::string realMask = "*.*"; //FIXME -- could this also be just '*' ?
#else
- std::string realMask = "*";
+ std::string realMask = "*";
#endif
- if (fileMask)
- realMask = fileMask;
+ if (fileMask)
+ realMask = fileMask;
- GetUperName((char*)realMask.c_str());
+ GetUperName((char*)realMask.c_str());
- std::string theFileExt;
- if (info->namePos == 0xFFFFFFFF)
- {
- info->nameList.clear();
- //FIXME -- just do the #ifdef'ing here?
- WindowsAddFileStack(GetFullOSPath(),realMask.c_str(),bRecursive);
- LinuxAddFileStack(GetFullOSPath(),realMask.c_str(),bRecursive);
+ std::string theFileExt;
+ if (info->namePos == 0xFFFFFFFF) {
+ info->nameList.clear();
+ //FIXME -- just do the #ifdef'ing here?
+ WindowsAddFileStack(GetFullOSPath(),realMask.c_str(),bRecursive);
+ LinuxAddFileStack(GetFullOSPath(),realMask.c_str(),bRecursive);
- info->namePos = 0;
- }
+ info->namePos = 0;
+ }
- unsigned int size = (int)info->nameList.size();
- if (info->namePos >= size)
- {
- info->namePos = 0xFFFFFFFF;
- return false;
- }
+ unsigned int size = (int)info->nameList.size();
+ if (info->namePos >= size) {
+ info->namePos = 0xFFFFFFFF;
+ return false;
+ }
- std::string fileName = info->nameList[info->namePos];
+ std::string fileName = info->nameList[info->namePos];
- if (osBaseDir.size()>1)
- {
- std::string temp = &(fileName.c_str()[osBaseDir.size()]);
- fileName = temp;
- }
+ if (osBaseDir.size()>1) {
+ std::string temp = &(fileName.c_str()[osBaseDir.size()]);
+ fileName = temp;
+ }
- oFile.OSName(fileName.c_str());
- info->namePos++;
+ oFile.OSName(fileName.c_str());
+ info->namePos++;
- return true;
+ return true;
}
bool COSDir::WindowsAddFileStack ( const char *szPathName, const char* fileMask, bool bRecursive )
{
#ifdef _WIN32
- struct _finddata_t fileInfo;
+ struct _finddata_t fileInfo;
- long hFile;
- std::string searchstr;
+ long hFile;
+ std::string searchstr;
- std::string FilePath;
+ std::string FilePath;
- bool bDone = false;
+ bool bDone = false;
- searchstr = szPathName;
- searchstr += "\\";
- if (bRecursive)
- searchstr += "*.*";
- else if (fileMask)
- searchstr += fileMask;
- else
- searchstr += "*.*";
+ searchstr = szPathName;
+ searchstr += "\\";
+ if (bRecursive)
+ searchstr += "*.*";
+ else if (fileMask)
+ searchstr += fileMask;
+ else
+ searchstr += "*.*";
- std::string extenstionSearch;
+ std::string extenstionSearch;
- if ( fileMask && strchr(fileMask,'.'))
- extenstionSearch = strchr(fileMask,'.')+1;
+ if ( fileMask && strchr(fileMask,'.'))
+ extenstionSearch = strchr(fileMask,'.')+1;
- hFile = (long)_findfirst(searchstr.c_str(),&fileInfo);
+ hFile = (long)_findfirst(searchstr.c_str(),&fileInfo);
- if (hFile != -1)
- {
- while (!bDone)
- {
- if ((strlen(fileInfo.name) >0) && (strcmp(fileInfo.name,".") != 0) &&
- (strcmp(fileInfo.name,"..") != 0))
- {
- FilePath = szPathName;
- FilePath += "\\";
- FilePath += fileInfo.name;
+ if (hFile != -1) {
+ while (!bDone) {
+ if ((strlen(fileInfo.name) >0) && (strcmp(fileInfo.name,".") != 0) &&
+ (strcmp(fileInfo.name,"..") != 0)) {
+ FilePath = szPathName;
+ FilePath += "\\";
+ FilePath += fileInfo.name;
- if ( (fileInfo.attrib & _A_SUBDIR ) && bRecursive)
- WindowsAddFileStack(FilePath.c_str(),fileMask,bRecursive);
- else if (!(fileInfo.attrib & _A_SUBDIR) )
- {
- if (bRecursive && fileMask) // if we are recusive we need to check extension manualy, so we get dirs and stuf
- {
- if (strrchr(FilePath.c_str(),'.'))
- {
- if ( stricmp(strrchr(FilePath.c_str(),'.')+1, extenstionSearch.c_str() ) == 0 )
- info->nameList.push_back(FilePath);
- }
- }
- else
- info->nameList.push_back(FilePath);
- }
- }
- if (_findnext(hFile,&fileInfo) == -1)
- bDone = true;
- }
+ if ( (fileInfo.attrib & _A_SUBDIR ) && bRecursive) {
+ WindowsAddFileStack(FilePath.c_str(),fileMask,bRecursive);
+ } else if (!(fileInfo.attrib & _A_SUBDIR) ) {
+ if (bRecursive && fileMask) { // if we are recusive we need to check extension manualy, so we get dirs and stuf
+ if (strrchr(FilePath.c_str(),'.')) {
+ if ( stricmp(strrchr(FilePath.c_str(),'.')+1, extenstionSearch.c_str() ) == 0 )
+ info->nameList.push_back(FilePath);
+ }
+ } else {
+ info->nameList.push_back(FilePath);
+ }
}
- return true;
+ }
+ if (_findnext(hFile,&fileInfo) == -1)
+ bDone = true;
+ }
+ }
+ return true;
#else
- return false;
+ return false;
#endif
}
@@ -780,140 +734,133 @@
#ifndef _WIN32
static int match_multi (const char **mask, const char **string)
{
- const char *msk;
- const char *str;
- const char *msktop;
- const char *strtop;
+ const char *msk;
+ const char *str;
+ const char *msktop;
+ const char *strtop;
- msk = *mask;
- str = *string;
+ msk = *mask;
+ str = *string;
- while ((*msk != '\0') && (*msk == '*'))
- msk++; /* get rid of multiple '*'s */
+ while ((*msk != '\0') && (*msk == '*'))
+ msk++; /* get rid of multiple '*'s */
- if (*msk == '\0') /* '*' was last, auto-match */
- return +1;
+ if (*msk == '\0') /* '*' was last, auto-match */
+ return +1;
- msktop = msk;
- strtop = str;
+ msktop = msk;
+ strtop = str;
- while (*msk != '\0')
- {
- if (*msk == '*')
- {
- *mask = msk;
- *string = str;
- return 0; /* matched this segment */
- }
- else if (*str == '\0')
- return -1; /* can't match */
- else
- {
- if ((*msk == '?') || (*msk == *str))
- {
- msk++;
- str++;
- if ((*msk == '\0') && (*str != '\0')) /* advanced check */
- {
- str++;
- strtop++;
- str = strtop;
- msk = msktop;
- }
- }
- else
- {
- str++;
- strtop++;
- str = strtop;
- msk = msktop;
- }
- }
+ while (*msk != '\0') {
+ if (*msk == '*') {
+ *mask = msk;
+ *string = str;
+ return 0; /* matched this segment */
+ } else if (*str == '\0') {
+ return -1; /* can't match */
+ } else {
+ if ((*msk == '?') || (*msk == *str)) {
+ msk++;
+ str++;
+ if ((*msk == '\0') && (*str != '\0')) { /* advanced check */
+ str++;
+ strtop++;
+ str = strtop;
+ msk = msktop;
}
+ } else {
+ str++;
+ strtop++;
+ str = strtop;
+ msk = msktop;
+ }
+ }
+ }
- *mask = msk;
- *string = str;
- return +1; /* full match */
+ *mask = msk;
+ *string = str;
+ return +1; /* full match */
}
static int match_mask (const char *mask, const char *string)
{
- if (mask == NULL)
- return 0;
+ if (mask == NULL)
+ return 0;
- if (string == NULL)
- return 0;
+ if (string == NULL)
+ return 0;
- if ((mask[0] == '*') && (mask[1] == '\0'))
- return 1; /* instant match */
+ if ((mask[0] == '*') && (mask[1] == '\0'))
+ return 1; /* instant match */
- while (*mask != '\0')
- {
- if (*mask == '*')
- {
- mask++;
- switch (match_multi (&mask, &string))
- {
- case +1:
- return 1;
- case -1:
- return 0;
- }
- }
- else if (*string == '\0')
- return 0;
- else if ((*mask == '?') || (*mask == *string))
- {
- mask++;
- string++;
- }
- else
- return 0;
- }
+ while (*mask != '\0') {
+ if (*mask == '*') {
+ mask++;
+ switch (match_multi (&mask, &string)) {
+ case +1:
+ return 1;
+ case -1:
+ return 0;
+ }
+ } else if (*string == '\0') {
+ return 0;
+ } else if ((*mask == '?') || (*mask == *string)) {
+ mask++;
+ string++;
+ } else {
+ return 0;
+ }
+ }
- if (*string == '\0')
- return 1;
- else
- return 0;
+ if (*string == '\0')
+ return 1;
+ else
+ return 0;
}
#endif
bool COSDir::LinuxAddFileStack ( const char *szPathName, const char* fileMask, bool bRecursive )
{
#ifdef _WIN32
- return false;//WIN32
+ return false;//WIN32
#else
- DIR *directory;
- dirent *fileInfo;
- struct stat statbuf;
- char searchstr[1024];
- std::string FilePath;
+ 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);
- if (!directory)
- return false;
+ strcpy(searchstr, szPathName);
+ if (searchstr[strlen(searchstr) - 1] != '/')
+ strcat(searchstr, "/");
+ directory = opendir(searchstr);
+ if (!directory)
+ return false;
- // TODO: make it use the filemask
- while ((fileInfo = readdir(directory)))
- {
- if (!((strcmp(fileInfo->d_name, ".") == 0) || (strcmp(fileInfo->d_name, "..") == 0)))
- {
- FilePath = searchstr;
- FilePath += fileInfo->d_name;
- GetUperName(fileInfo->d_name);
+ // TODO: make it use the filemask
+ while ((fileInfo = readdir(directory))) {
+ if (!((strcmp(fileInfo->d_name, ".") == 0) || (strcmp(fileInfo->d_name, "..") == 0))) {
+ FilePath = searchstr;
+ FilePath += fileInfo->d_name;
+ GetUperName(fileInfo->d_name);
- stat(FilePath.c_str(), &statbuf);
+ stat(FilePath.c_str(), &statbuf);
- if (S_ISDIR(statbuf.st_mode) && bRecursive)
- LinuxAddFileStack(FilePath.c_str(),fileMask,bRecursive);
- else if (match_mask (fileMask, fileInfo->d_name))
- info->nameList.push_back(FilePath);
- }
- }
- closedir(directory);
- return true;
+ if (S_ISDIR(statbuf.st_mode) && bRecursive)
+ LinuxAddFileStack(FilePath.c_str(),fileMask,bRecursive);
+ else if (match_mask (fileMask, fileInfo->d_name))
+ info->nameList.push_back(FilePath);
+ }
+ }
+ closedir(directory);
+ return true;
#endif// !Win32
}
+
+// Local Variables: ***
+// mode:C++ ***
+// tab-width: 8 ***
+// c-basic-offset: 2 ***
+// indent-tabs-mode: t ***
+// End: ***
+// ex: shiftwidth=2 tabstop=8
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jw...@us...> - 2008-08-25 01:54:36
|
Revision: 18474
http://bzflag.svn.sourceforge.net/bzflag/?rev=18474&view=rev
Author: jwmelto
Date: 2008-08-25 01:54:46 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
write one deletePointerVector in terms of the other
Modified Paths:
--------------
trunk/bzwgen/inc/globals.h
Modified: trunk/bzwgen/inc/globals.h
===================================================================
--- trunk/bzwgen/inc/globals.h 2008-08-25 00:42:03 UTC (rev 18473)
+++ trunk/bzwgen/inc/globals.h 2008-08-25 01:54:46 UTC (rev 18474)
@@ -52,9 +52,7 @@
template< class T >
inline void deletePointerVector( std::vector<T>*& v ) {
if ( v == NULL ) return;
- typename std::vector<T>::iterator iter = v->begin();
- for ( ; iter != v->end(); ++iter )
- if ( *iter ) delete ( *iter );
+ deletePointerVector(*v);
delete v;
v = NULL;
}
@@ -63,7 +61,7 @@
inline void deletePointerVector( std::vector<T>& v ) {
typename std::vector<T>::iterator iter = v.begin();
for ( ; iter != v.end(); ++iter )
- if ( *iter ) delete ( *iter );
+ delete ( *iter );
}
template< class T >
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cha...@us...> - 2008-08-25 00:41:53
|
Revision: 18473
http://bzflag.svn.sourceforge.net/bzflag/?rev=18473&view=rev
Author: chaos-dev
Date: 2008-08-25 00:42:03 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
* Rule doxycomments
* Rule style cleanup
* Rule Log messages
* deletePointerVector safety check for NULL
Modified Paths:
--------------
trunk/bzwgen/inc/Rule.h
trunk/bzwgen/inc/globals.h
trunk/bzwgen/src/Rule.cxx
Modified: trunk/bzwgen/inc/Rule.h
===================================================================
--- trunk/bzwgen/inc/Rule.h 2008-08-25 00:34:36 UTC (rev 18472)
+++ trunk/bzwgen/inc/Rule.h 2008-08-25 00:42:03 UTC (rev 18473)
@@ -9,6 +9,11 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+/**
+ * @file Rule.h
+ * @author Kornel Kisielewicz kor...@gm...
+ * @brief Grammar Rule class for BZWGen.
+ */
#ifndef __RULE_H__
#define __RULE_H__
@@ -17,15 +22,53 @@
#include "Product.h"
#include "Mesh.h"
+/**
+ * @class Rule
+ * @brief Class representing a BZWGen grammar rule.
+ *
+ * Rules constitute of products, products constitute of Operations.
+ * A rule may be just a single product, or it may constitue of several ones
+ * with different conditions and rarieties.
+ */
class Rule {
+ /**
+ * Name of the rule, by which it is executed.
+ */
String name;
+ /**
+ * A vector of Product pointers, that this rule is made of.
+ */
ProductVector* products;
public:
- Rule(const String& _name, ProductVector* _products) : name(_name), products(_products) {};
- Product* getProduct(Mesh* mesh, int face);
- int runMesh(Mesh* mesh, int face);
- String& getName() { return name; }
- ~Rule();
+ /**
+ * Standard constructor, only sets up members.
+ */
+ Rule( const String& _name, ProductVector* _products )
+ : name( _name ), products( _products ) { };
+ /**
+ * Runs the rule on the passed mesh, on the passed face.
+ */
+ int runMesh( Mesh* mesh, int face );
+ /**
+ * Returns the name of the rule.
+ */
+ String& getName() {
+ return name;
+ }
+ /**
+ * Standard destructor, deallocates all the stored products, and the
+ * product vector itself.
+ */
+ ~Rule() {
+ deletePointerVector( products );
+ };
+private:
+ /**
+ * Returns a product for the given mesh/face. The choice of product
+ * is dependent on the rule, and may be based on a random pick, and/or
+ * on conditions to the passed mesh/face.
+ */
+ Product* getProduct( Mesh* mesh, int face );
};
typedef std::map <String, Rule*> RuleMap;
Modified: trunk/bzwgen/inc/globals.h
===================================================================
--- trunk/bzwgen/inc/globals.h 2008-08-25 00:34:36 UTC (rev 18472)
+++ trunk/bzwgen/inc/globals.h 2008-08-25 00:42:03 UTC (rev 18473)
@@ -54,7 +54,7 @@
if ( v == NULL ) return;
typename std::vector<T>::iterator iter = v->begin();
for ( ; iter != v->end(); ++iter )
- delete ( *iter );
+ if ( *iter ) delete ( *iter );
delete v;
v = NULL;
}
@@ -63,7 +63,7 @@
inline void deletePointerVector( std::vector<T>& v ) {
typename std::vector<T>::iterator iter = v.begin();
for ( ; iter != v.end(); ++iter )
- delete ( *iter );
+ if ( *iter ) delete ( *iter );
}
template< class T >
Modified: trunk/bzwgen/src/Rule.cxx
===================================================================
--- trunk/bzwgen/src/Rule.cxx 2008-08-25 00:34:36 UTC (rev 18472)
+++ trunk/bzwgen/src/Rule.cxx 2008-08-25 00:42:03 UTC (rev 18473)
@@ -11,36 +11,31 @@
*/
#include "Rule.h"
-#include "Random.h"
+#include "Random.h"
-Product* Rule::getProduct(Mesh* mesh, int face) {
+Product* Rule::getProduct( Mesh* mesh, int face ) {
int size = products->size();
- if (size == 0) return NULL;
+ if ( size == 0 ) return NULL;
ProductVectIter itr = products->begin();
double roll = Random::double01();
do {
- if ((*itr)->conditionsMet(mesh,face)) {
+ if ( (*itr)->conditionsMet( mesh, face ) ) {
double rarity = (*itr)->getRarity();
- if (rarity >= roll) return (*itr);
+ if ( rarity >= roll ) return (*itr);
roll -= rarity;
}
++itr;
- } while (itr!= products->end());
- Logger.log( 1, "Warning : Rule '%s' returned no product!\n", name.c_str() );
+ } while ( itr != products->end() );
+ Logger.log( 1, "Warning : Rule '%s' returned no product!", name.c_str() );
return NULL;
}
-int Rule::runMesh(Mesh* mesh, int face) {
- Product* product = getProduct(mesh,face);
- return product == NULL ? -1 : product->runMesh(mesh,face);
+int Rule::runMesh( Mesh* mesh, int face ) {
+ Logger.log( 4, "Rule : rule '%s' getting product...", name.c_str() );
+ Product* product = getProduct( mesh, face );
+ Logger.log( 4, "Rule : running product...", name.c_str() );
+ return product == NULL ? -1 : product->runMesh( mesh, face );
}
-Rule::~Rule() {
- ProductVectIter itr;
- for (itr = products->begin(); itr!= products->end(); ++itr) delete (*itr);
- delete products;
-}
-
-
// Local Variables: ***
// mode:C++ ***
// tab-width: 8 ***
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jw...@us...> - 2008-08-25 00:34:28
|
Revision: 18472
http://bzflag.svn.sourceforge.net/bzflag/?rev=18472&view=rev
Author: jwmelto
Date: 2008-08-25 00:34:36 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
Add line wrapping
Modified Paths:
--------------
trunk/bzwgen/doc/grammar.txt
Modified: trunk/bzwgen/doc/grammar.txt
===================================================================
--- trunk/bzwgen/doc/grammar.txt 2008-08-25 00:17:58 UTC (rev 18471)
+++ trunk/bzwgen/doc/grammar.txt 2008-08-25 00:34:36 UTC (rev 18472)
@@ -2,9 +2,14 @@
(to be expanded into a full documentation)
------------------------------------------------------
-The language is based around rules, that are in files in the "rules" folder. The rule files currently use the same namespace, so they basically could be treated as one big file. The language is case-semsitive, whitespace is ignored.
+The language is based around rules, that are in files in the "rules"
+folder. The rule files currently use the same namespace, so they
+basically could be treated as one big file. The language is
+case-semsitive, whitespace is ignored.
-The rule files are loaded at startup, and specific rules are executed as needed by the generator. As for now rules operate on a single face, passing it through all the operations and passing them to other rules.
+The rule files are loaded at startup, and specific rules are executed
+as needed by the generator. As for now rules operate on a single face,
+passing it through all the operations and passing them to other rules.
Rules
@@ -14,7 +19,9 @@
rule (one or more products) ;
-(note the semicolon at the end). If a rule has more then one product it must also include a probability value between 0.0 and 1.0, which is added before the ":" sign. Example:
+(note the semicolon at the end). If a rule has more then one product
+it must also include a probability value between 0.0 and 1.0, which is
+added before the ":" sign. Example:
rule
-> 0.2 : product1
@@ -22,7 +29,9 @@
-> 0.2 : product3
;
-Probability should add up to 1.0. Note that there is just one semicolon at the end. When the generator executes a rule, it picks only ONE of the products at random with the given probability.
+Probability should add up to 1.0. Note that there is just one
+semicolon at the end. When the generator executes a rule, it picks
+only ONE of the products at random with the given probability.
Instead of a probablility a condition may be added (see Expressions). Example:
@@ -31,33 +40,54 @@
-> product2
;
-This will choose product1 if the face horizontal length is greater than 5, product2 otherwise. It's a good idea to provide a rule with no conditions even if epmty so the compiler doesn't cry that a rule returned NULL. It is also possible to combine probability with conditionals. In this case the sum of probability should be one considering ONLY those products that are always true, or have a non-probability tagged product at the end.
+This will choose product1 if the face horizontal length is greater
+than 5, product2 otherwise. It's a good idea to provide a rule with no
+conditions even if epmty so the compiler doesn't cry that a rule
+returned NULL. It is also possible to combine probability with
+conditionals. In this case the sum of probability should be one
+considering ONLY those products that are always true, or have a
+non-probability tagged product at the end.
initialize
-----------
-The language has currently one special rule : "initialize", this one usualy is in the init.set file, and is executed once, right after all the rules have been read. DO NOT include any geometry code because it will crash badly. This rule is mainly for initalizeing constant values (currently initializes material constants).
+The language has currently one special rule : "initialize", this one
+usualy is in the init.set file, and is executed once, right after all
+the rules have been read. DO NOT include any geometry code because it
+will crash badly. This rule is mainly for initalizeing constant values
+(currently initializes material constants).
start
------
-This is the entry point into the grammar. For each building lot, the generator creates a face and calls the rule "start" passing that initial face to it.
+This is the entry point into the grammar. For each building lot, the
+generator creates a face and calls the rule "start" passing that
+initial face to it.
Products
=========
-Products are sets of operations and calls to other rules. They operations are linear, and executed in order, with the input face being passed along to each next operation. Calls to other rules are made by their pure name, hence the names should not conflict with the operation names.
+Products are sets of operations and calls to other rules. They
+operations are linear, and executed in order, with the input face
+being passed along to each next operation. Calls to other rules are
+made by their pure name, hence the names should not conflict with the
+operation names.
Operations
===========
-Operations are usualy geometric operations done on the passed to them face. Some of them are "branching" -- meaning that the operation passes the original face further, but produces other faces that can be "delegated" to other rules. The syntax of a operation is usualy:
+Operations are usualy geometric operations done on the passed to them
+face. Some of them are "branching" -- meaning that the operation
+passes the original face further, but produces other faces that can be
+"delegated" to other rules. The syntax of a operation is usualy:
operation_name ( paramters ) [ branch_rules ]
-Parameters are seperated by commas (,) branch rules by spaces. Parameters are either a constant number (float) or an Expression (see below).
+Parameters are seperated by commas (,) branch rules by
+spaces. Parameters are either a constant number (float) or an
+Expression (see below).
A parameter may be also a split rule. These are expressions seperated by spaces.
@@ -65,63 +95,105 @@
Branch rules
-------------
-Branch rules list a sequence of rulenames. Branch rules are always optional. They are matched in sequence with the faces that the given operation produces. Additionaly the last face produced is "returned".
+Branch rules list a sequence of rulenames. Branch rules are always
+optional. They are matched in sequence with the faces that the given
+operation produces. Additionaly the last face produced is "returned".
-Example : we run "splith(1r 1r 1r)" then we will have 3 faces (the last one is additionaly passed back into the grammar), so we can write "splith(1r 1r 1r) [ rule1 rule2 ] rule3" which will direct the first face to rule1, the second to rule2 and the third to rule3. This is however the same as "splith(1r 1r 1r) [ rule1 rule2 rule3 ]"
+Example : we run "splith(1r 1r 1r)" then we will have 3 faces (the
+last one is additionaly passed back into the grammar), so we can write
+"splith(1r 1r 1r) [ rule1 rule2 ] rule3" which will direct the first
+face to rule1, the second to rule2 and the third to rule3. This is
+however the same as "splith(1r 1r 1r) [ rule1 rule2 rule3 ]"
-If we don't care about a particular face, we can write "*" instead, it then will be skipped, but the order will be preserved.
+If we don't care about a particular face, we can write "*" instead, it
+then will be skipped, but the order will be preserved.
-Example : "splith(1r 1r 1r) [ * door ] " means that we only care about the central face of subdivision - ignore the first, send the second to "door" and ignore the rest.
+Example : "splith(1r 1r 1r) [ * door ] " means that we only care about
+the central face of subdivision - ignore the first, send the second to
+"door" and ignore the rest.
-If we want ALL of the faces to follow the same rule then we pass the rulename with a "@" sign before it.
+If we want ALL of the faces to follow the same rule then we pass the
+rulename with a "@" sign before it.
Split rules
------------
-Split rules are used by splitv and splith to define the subdivision of a face. They constitute of a sequence of numbers, that are subsequent lengths of splitted faces. Numbers may also be appended fith a "r" indicating that they are relative values. Relative values are calculated by substracting non-relative lenghts from overall length and dividing the rest by the value of the relative number.
+Split rules are used by splitv and splith to define the subdivision of
+a face. They constitute of a sequence of numbers, that are subsequent
+lengths of splitted faces. Numbers may also be appended fith a "r"
+indicating that they are relative values. Relative values are
+calculated by substracting non-relative lenghts from overall length
+and dividing the rest by the value of the relative number.
-Example : "splith( 1r 4.0 2r )" will divide the given face into three, with the middle one having size 4 horizontaly, the first one having one third of the rest, and the second one two-thirds. So, assuming that the face had length 22.0, we will have three faces, of horizontal lengths 6.0, 4.0 and 12.0 respectively.
+Example : "splith( 1r 4.0 2r )" will divide the given face into three,
+with the middle one having size 4 horizontaly, the first one having
+one third of the rest, and the second one two-thirds. So, assuming
+that the face had length 22.0, we will have three faces, of horizontal
+lengths 6.0, 4.0 and 12.0 respectively.
Expressions
============
-Currently the language supports a small set of expressions. They all are evaluated to a float number. If a given operation needs a integer it will be rounded from the float. If it needs a boolean, the float will be checked wether it's negative (false) or positive (true). Technically 0.0 is also false, but don't rely on that. All current boolean expressions resolve to -1.0 or 1.0.
+Currently the language supports a small set of expressions. They all
+are evaluated to a float number. If a given operation needs a integer
+it will be rounded from the float. If it needs a boolean, the float
+will be checked wether it's negative (false) or positive
+(true). Technically 0.0 is also false, but don't rely on that. All
+current boolean expressions resolve to -1.0 or 1.0.
Expressions may be one of the following:
Constants
----------
-The grammar accepts both whole numbers and floating point (only in the x.y notation). Negative numbers are supported, though care should be taken to make them stick to the number and not anything else (the parser is buggy in this case currently, so 2-3 will *not* be parsed correctly).
+The grammar accepts both whole numbers and floating point (only in the
+x.y notation). Negative numbers are supported, though care should be
+taken to make them stick to the number and not anything else (the
+parser is buggy in this case currently, so 2-3 will *not* be parsed
+correctly).
Attributes
-----------
-These are evaluated at RUNTIME, so they may be changed between executions. Attributes are created using the assign() command, and start with a $ sign. It is a good practice to write them uppercase to avoid confusion with rules and operations. Attributes may be used in expressions.
+These are evaluated at RUNTIME, so they may be changed between
+executions. Attributes are created using the assign() command, and
+start with a $ sign. It is a good practice to write them uppercase to
+avoid confusion with rules and operations. Attributes may be used in
+expressions.
Arithmetic ops
---------------
-The parser supports +, -, /, * operations and grouping with (). Care should be taken with the '-' sign -- see Constants above.
+The parser supports +, -, /, * operations and grouping with (). Care
+should be taken with the '-' sign -- see Constants above.
Comparision ops
----------------
-Currently just two comparision operations are supported: < and >. They are currently only used for the assert Operation.
+Currently just two comparision operations are supported: < and >. They
+are currently only used for the assert Operation.
Boolean ops
----------------
-AND and OR are supported by using the & and | signs. They have lowest priority so grouping the expressions with () is usualy not needed.
+AND and OR are supported by using the & and | signs. They have lowest
+priority so grouping the expressions with () is usualy not needed.
Functions
----------
-Functions are evaluated dynamically. Currently the following functions are supported:
+Functions are evaluated dynamically. Currently the following functions
+are supported:
-random(min,max,step) -- returns a random floating point number between min and max, in steps of "step" (eg. random(1.0,5.0,1.5) may return one of : 1.0,2.5,4.0)
+random(min,max,step) -- returns a random floating point number between
+min and max, in steps of "step" (eg. random(1.0,5.0,1.5) may return
+one of : 1.0,2.5,4.0)
-face(attr) -- returns an attribute of the current face. 'attr' must be one of the following : x,y,z,h,v,s -- these are x,y,z coordinates of the face's center point, horizontal length for a quad, vertical length for a quad, and size of the quad. h, v and s are not supported currently for non-quads!
+face(attr) -- returns an attribute of the current face. 'attr' must be
+one of the following : x,y,z,h,v,s -- these are x,y,z coordinates of
+the face's center point, horizontal length for a quad, vertical length
+for a quad, and size of the quad. h, v and s are not supported
+currently for non-quads!
neg(attr) -- temporary "negation" function instead of the precedesing '-' sign.
@@ -134,35 +206,68 @@
Geometric
----------
-expand ( amount ) -- does a linear expansion of the face. Linear meaning that the distance between the expanded edge and the original edge is constant for all sides and equal to 'amount'.
+expand ( amount ) -- does a linear expansion of the face. Linear
+meaning that the distance between the expanded edge and the original
+edge is constant for all sides and equal to 'amount'.
-taper ( amount ) -- taperizes the face. Contrary to expand it is not linear. Also 'amount' is a floating point value between 1.0 and 0.0, describing the amount of taperization. 1.0 is unchanged, 0.0 reduces the face to almost a single point.
+taper ( amount ) -- taperizes the face. Contrary to expand it is not
+linear. Also 'amount' is a floating point value between 1.0 and 0.0,
+describing the amount of taperization. 1.0 is unchanged, 0.0 reduces
+the face to almost a single point.
-scale ( amount x, amount y ) -- taperizes the face with different values depending on the axis. 'amount x' and 'amount y' is a floating point value between 1.0 and 0.0, describing the amount of taperization on the given axis. 1.0 is unchanged, 0.0 reduces the face to almost a single point.
+scale ( amount x, amount y ) -- taperizes the face with different
+values depending on the axis. 'amount x' and 'amount y' is a floating
+point value between 1.0 and 0.0, describing the amount of taperization
+on the given axis. 1.0 is unchanged, 0.0 reduces the face to almost a
+single point.
-translate ( x, y, z ) -- translates the face using the given coordinates. Note that all the face's vertices are translated!
+translate ( x, y, z ) -- translates the face using the given
+coordinates. Note that all the face's vertices are translated!
-translater ( x, y, z ) -- same as above but uses relative values for x and y (relative to face height and width).
+translater ( x, y, z ) -- same as above but uses relative values for x
+and y (relative to face height and width).
-chamfer ( amount ) -- chamfer substitutes all vertices of the face with two, and performes a chamfer on them, meaning that the new points will be in distance 'amount' from the original one, along the face edges. Warning: this operation should be only applied to a new, not yet connected face, for it doesn't refine the rest of the geometry.
+chamfer ( amount ) -- chamfer substitutes all vertices of the face
+with two, and performes a chamfer on them, meaning that the new points
+will be in distance 'amount' from the original one, along the face
+edges. Warning: this operation should be only applied to a new, not
+yet connected face, for it doesn't refine the rest of the geometry.
-unchamfer ( ) -- operation to undo the previous one. It welds pairs of vertices in the face.
+unchamfer ( ) -- operation to undo the previous one. It welds pairs of
+vertices in the face.
Generative
-----------
-Note : "snap" argument is always optional, and allows the divisions to snap to nearest snap line as defined by the argument. The argument is refined to the closest value that fills the lenght perfectly.
+Note : "snap" argument is always optional, and allows the divisions to
+snap to nearest snap line as defined by the argument. The argument is
+refined to the closest value that fills the lenght perfectly.
-extrude ( amount ) [ list ] -- probably the most important operation. Extrudes the face by 'amount' in the direction of it's normal, producing a amount of additional faces equal to the amount of face sides. The faces are returned in the branch list. The original extruded face is returned.
+extrude ( amount ) [ list ] -- probably the most important
+operation. Extrudes the face by 'amount' in the direction of it's
+normal, producing a amount of additional faces equal to the amount of
+face sides. The faces are returned in the branch list. The original
+extruded face is returned.
-extrudet ( amount ) [ list ] -- the same as above, but also runs snap based texturing on all the faces.
+extrudet ( amount ) [ list ] -- the same as above, but also runs snap
+based texturing on all the faces.
-repeath ( snap ) [ list ] -- subdivides the current face into a number of segments horizontaly. The number of segments is the amount that can fill the face horizontally with segments of length snap. The segments are returned in the branch list, the last one is also returned as result.
+repeath ( snap ) [ list ] -- subdivides the current face into a number
+of segments horizontaly. The number of segments is the amount that can
+fill the face horizontally with segments of length snap. The segments
+are returned in the branch list, the last one is also returned as
+result.
repeatv ( snap ) [ list ] -- the same as repeath, only verticaly.
-splith ( splitrules , snap ) [ list ] -- Divides the current face into several faces horizontaly, using 'splitrules' to determinate split position. The faces are returned in the branch list, the last one is also returned as result. Snap parameter is optional, and allows the divisions to snap to nearest snap line as defined by the argument. The argument is refined to the closest value that fills the lenght perfectly.
+splith ( splitrules , snap ) [ list ] -- Divides the current face into
+several faces horizontaly, using 'splitrules' to determinate split
+position. The faces are returned in the branch list, the last one is
+also returned as result. Snap parameter is optional, and allows the
+divisions to snap to nearest snap line as defined by the argument. The
+argument is refined to the closest value that fills the lenght
+perfectly.
splitv ( splitrules , snap ) [ list ] -- the same as splith only verticaly.
@@ -170,24 +275,32 @@
Control
--------
-assertion ( condition ) -- checks wether condition is true, if it is, continues, if not, immidately breaks the generation of the model at this stage.
+assertion ( condition ) -- checks wether condition is true, if it is,
+continues, if not, immidately breaks the generation of the model at
+this stage.
assign ( name = value ) -- assigns attribute 'name' with the 'value'.
-material ( number ) -- assignes the current and future faces produced from this point on material with the id 'number'.
+material ( number ) -- assignes the current and future faces produced
+from this point on material with the id 'number'.
-loadmaterial ( name , file ) -- loads a texture for further use. Name is the attribute name it will be assigned, and file is the filename (in the media folder, and without the .png extension).
+loadmaterial ( name , file ) -- loads a texture for further use. Name
+is the attribute name it will be assigned, and file is the filename
+(in the media folder, and without the .png extension).
-spawn ( rulename ) -- duplicates the current face, and uses it as a base to produce a NEW mesh, starting with the rule 'rulename'.
+spawn ( rulename ) -- duplicates the current face, and uses it as a
+base to produce a NEW mesh, starting with the rule 'rulename'.
Texture
--------
-texture ( ) -- does default texturing of the face based on the SNAP and TEXTILE values
+texture ( ) -- does default texturing of the face based on the SNAP
+and TEXTILE values
texturefull () -- textures the face fully using 1 and 0 values
-texturequad ( au, av, bu, bv ) -- textures the quad using the provided float values
+texturequad ( au, av, bu, bv ) -- textures the quad using the provided
+float values
textureclear () -- clears the texcoords on the given face
@@ -195,18 +308,32 @@
Multi-face
-----------
-addface ( rulename ) -- this operation can be done only on multifaces. It runs rule "rulename" and adds the resulting shape to the current multiface. As it modifies the underlying face, this operation should be only done at ground level, before any generation is done. Also, "rulename" should generate a pure face, no geometry.
+addface ( rulename ) -- this operation can be done only on
+multifaces. It runs rule "rulename" and adds the resulting shape to
+the current multiface. As it modifies the underlying face, this
+operation should be only done at ground level, before any generation
+is done. Also, "rulename" should generate a pure face, no geometry.
-detachface ( id ) -- this operation can be done only on multifaces. It substracts the face from the multiface, and returns the substracted parts in the branch list. Note that the substraction happens only at those parts that are unique to the detached face.
+detachface ( id ) -- this operation can be done only on multifaces. It
+substracts the face from the multiface, and returns the substracted
+parts in the branch list. Note that the substraction happens only at
+those parts that are unique to the detached face.
-multiface ( ) -- marks the current face as multiface. As it destroys the underlying face, this operation should be only done at ground level, before any generation is done.
+multiface ( ) -- marks the current face as multiface. As it destroys
+the underlying face, this operation should be only done at ground
+level, before any generation is done.
Other
------
-ngon ( sides , size ) -- creates an n-sided polygon in the center of the given face. This one renders the face it was created upon INVALID, so it should be only used at the start of generation work. Optional size parameter may be used to specify it's radius, otherwise a maximum radius within the borders of the given face is used.
+ngon ( sides , size ) -- creates an n-sided polygon in the center of
+the given face. This one renders the face it was created upon INVALID,
+so it should be only used at the start of generation work. Optional
+size parameter may be used to specify it's radius, otherwise a maximum
+radius within the borders of the given face is used.
remove ( ) -- removes the face, or more precisely renders it "invisible".
-free ( ) -- removes the face completely and marks all vertices used by it for reusage.
\ No newline at end of file
+free ( ) -- removes the face completely and marks all vertices used by
+it for reusage.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cha...@us...> - 2008-08-25 00:17:48
|
Revision: 18471
http://bzflag.svn.sourceforge.net/bzflag/?rev=18471&view=rev
Author: chaos-dev
Date: 2008-08-25 00:17:58 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
* Expression.h/cxx style fixup
* ExpressionTemplate for multi-expression expressions
* Code cleanup
Modified Paths:
--------------
trunk/bzwgen/inc/Expression.h
trunk/bzwgen/src/Expression.cxx
Modified: trunk/bzwgen/inc/Expression.h
===================================================================
--- trunk/bzwgen/inc/Expression.h 2008-08-24 23:23:37 UTC (rev 18470)
+++ trunk/bzwgen/inc/Expression.h 2008-08-25 00:17:58 UTC (rev 18471)
@@ -22,127 +22,171 @@
class Expression {
public:
- virtual double calculate(Mesh*,int) = 0;
+ virtual double calculate( Mesh*, int ) = 0;
virtual ~Expression() {};
};
typedef std::vector<Expression*> ExpressionVector;
+template < int SIZE >
+class ExpressionTemplate : public Expression {
+protected:
+ typedef Expression* ExpressionPtr;
+ ExpressionPtr exp[SIZE];
+ double value[SIZE];
+public:
+ virtual double calc() = 0;
+ double calculate( Mesh* mesh, int face ) {
+ for ( int i = 0; i < SIZE; ++i )
+ if ( exp[i] )
+ value[i] = exp[i]->calculate( mesh, face );
+ return calc();
+ }
+ ~ExpressionTemplate() {
+ for ( int i = 0; i < SIZE; ++i )
+ deletePointer( exp[i] );
+ }
+};
+
+class ExpressionSingle : public ExpressionTemplate<1> {
+public:
+ ExpressionSingle( Expression* exp0 ) {
+ exp[0] = exp0;
+ };
+};
+
+class ExpressionDouble : public ExpressionTemplate<2> {
+public:
+ ExpressionDouble( Expression* exp0, Expression* exp1 ) {
+ exp[0] = exp0;
+ exp[1] = exp1;
+ };
+};
+
+class ExpressionTriple : public ExpressionTemplate<3> {
+public:
+ ExpressionTriple( Expression* exp0, Expression* exp1, Expression* exp2 ) {
+ exp[0] = exp0;
+ exp[1] = exp1;
+ exp[2] = exp2;
+ };
+};
+
class ExpressionConst : public Expression {
double value;
public:
- ExpressionConst(double _value) : value(_value) {};
- double calculate(Mesh*,int) { return value; };
+ ExpressionConst( double _value ) : value( _value ) {};
+ double calculate( Mesh*, int ) { return value; };
};
class ExpressionAttribute : public Expression {
RuleSet* ruleset;
String attrname;
public:
- ExpressionAttribute(RuleSet* _ruleset, const char* _attrname) : ruleset(_ruleset), attrname(_attrname) {};
- double calculate(Mesh*,int);
+ ExpressionAttribute( RuleSet* _ruleset, const char* _attrname )
+ : ruleset( _ruleset ), attrname( _attrname ) {};
+ double calculate( Mesh*, int );
};
class ExpressionFaceAttribute : public Expression {
String attrname;
public:
- ExpressionFaceAttribute(const char* _attrname) : attrname(_attrname) {
- std::transform(attrname.begin(), attrname.end(), attrname.begin(), tolower);
+ ExpressionFaceAttribute( const char* _attrname ) : attrname( _attrname ) {
+ std::transform( attrname.begin(), attrname.end(), attrname.begin(), tolower );
};
- double calculate(Mesh* mesh,int face);
+ double calculate( Mesh* mesh, int face );
};
-class ExpressionRandom : public Expression {
- Expression* vmin;
- Expression* vmax;
- Expression* step;
+class ExpressionRandom : public ExpressionTriple {
public:
- ExpressionRandom(Expression* _min, Expression* _max, Expression* _step) : vmin(_min), vmax(_max), step(_step) { };
- double calculate(Mesh* mesh,int face) {
- double stepc = step->calculate(mesh,face);
- if (fabs(stepc) < 0.0001f) return Random::doubleRange(vmin->calculate(mesh,face),vmax->calculate(mesh,face));
- return Random::doubleRangeStep(vmin->calculate(mesh,face),vmax->calculate(mesh,face),stepc);
+ ExpressionRandom( Expression* min, Expression* max, Expression* step)
+ : ExpressionTriple( min, max, step ) { };
+ double calc() {
+ if (fabs( value[2] ) < 0.0001f)
+ return Random::doubleRange( value[0], value[1] );
+ return Random::doubleRangeStep( value[0], value[1], value[2] );
};
- ~ExpressionRandom() {
- delete vmin;
- delete vmax;
- delete step;
- }
};
-class ExpressionNeg : public Expression {
- Expression* a;
+class ExpressionNeg : public ExpressionSingle {
public:
- ExpressionNeg(Expression* _a) : a(_a) {};
- double calculate(Mesh* mesh,int face) {
- return -a->calculate(mesh,face);
+ ExpressionNeg( Expression* _a ) : ExpressionSingle( _a ) { };
+ double calc() {
+ return -value[0];
}
};
-class ExpressionRound : public Expression {
- Expression* a;
+class ExpressionRound : public ExpressionSingle {
public:
- ExpressionRound(Expression* _a) : a(_a) {};
- double calculate(Mesh* mesh,int face) {
- return math::roundToInt(a->calculate(mesh,face));
+ ExpressionRound( Expression* _a ) : ExpressionSingle( _a ) { };
+ double calc() {
+ return math::roundToInt( value[0] );
}
};
-class ExpressionDouble : public Expression {
- Expression* a;
- Expression* b;
-public:
- ExpressionDouble(Expression* _a, Expression* _b) : a(_a), b(_b) {};
- virtual double calc(double av, double bv) = 0;
- double calculate(Mesh* mesh,int face) {
- double av = a->calculate(mesh,face);
- double bv = b->calculate(mesh,face);
- return calc(av,bv);
- }
-};
+/*
+// The following classes could also be generated using this macro :P
+#define DOUBLEEXPRESSION(name,operation) \
+ class Expression##name : public ExpressionDouble { \
+ public: \
+ Expression##name ( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { } \
+ double calc() { return (operation); } \
+ };
+
+DOUBLEEXPRESSION( Add, value[0] + value[1] )
+DOUBLEEXPRESSION( Sub, value[0] - value[1] )
+DOUBLEEXPRESSION( Div, value[0] / value[1] )
+DOUBLEEXPRESSION( Mult, value[0] * value[1] )
+DOUBLEEXPRESSION( Greater, value[0] > value[1] ? 1.0 : -1.0 )
+DOUBLEEXPRESSION( Equal, math::abs( value[0] - value[1] ) < 0.001f ? 1.0 : -1.0 )
+DOUBLEEXPRESSION( And, ( value[0] >= 0.0 && value[1] >= 0.0 ) ? 1.0 : -1.0 )
+DOUBLEEXPRESSION( Or, ( value[0] >= 0.0 && value[1] >= 0.0 ) ? 1.0 : -1.0 )
+*/
+
class ExpressionAdd : public ExpressionDouble {
public:
- ExpressionAdd(Expression* _a, Expression* _b) : ExpressionDouble(_a,_b) {}
- double calc(double av, double bv) { return av + bv; }
+ ExpressionAdd( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { }
+ double calc() { return value[0] + value[1]; }
};
class ExpressionSub : public ExpressionDouble {
public:
- ExpressionSub(Expression* _a, Expression* _b) : ExpressionDouble(_a,_b) {}
- double calc(double av, double bv) { return av - bv; }
+ ExpressionSub( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { }
+ double calc() { return value[0] - value[1]; }
};
class ExpressionDiv : public ExpressionDouble {
public:
- ExpressionDiv(Expression* _a, Expression* _b) : ExpressionDouble(_a,_b) {}
- double calc(double av, double bv) { return av / bv; }
+ ExpressionDiv( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { }
+ double calc() { return value[0] / value[1]; }
};
class ExpressionMult : public ExpressionDouble {
public:
- ExpressionMult(Expression* _a, Expression* _b) : ExpressionDouble(_a,_b) {}
- double calc(double av, double bv) { return av * bv; }
+ ExpressionMult( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { }
+ double calc() { return value[0] * value[1]; }
};
+
class ExpressionGreater : public ExpressionDouble {
public:
- ExpressionGreater(Expression* _a, Expression* _b) : ExpressionDouble(_a,_b) {}
- double calc(double av, double bv) { if(av > bv) return 1.0; else return -1.0; }
+ ExpressionGreater( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { }
+ double calc() { return value[0] > value[1] ? 1.0 : -1.0; }
};
class ExpressionEqual : public ExpressionDouble {
public:
- ExpressionEqual(Expression* _a, Expression* _b) : ExpressionDouble(_a,_b) {}
- double calc(double av, double bv) { if (fabs(av - bv) < 0.001f) return 1.0; else return -1.0; }
+ ExpressionEqual( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { }
+ double calc() { return math::abs( value[0] - value[1] ) < 0.001f ? 1.0 : -1.0; }
};
class ExpressionAnd : public ExpressionDouble {
public:
- ExpressionAnd(Expression* _a, Expression* _b) : ExpressionDouble(_a,_b) {}
- double calc(double av, double bv) { if (av >= 0.0 && bv >= 0.0) return 1.0; else return -1.0; }
+ ExpressionAnd( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { }
+ double calc() { return ( value[0] >= 0.0 && value[1] >= 0.0 ) ? 1.0 : -1.0; }
};
class ExpressionOr : public ExpressionDouble {
public:
- ExpressionOr(Expression* _a, Expression* _b) : ExpressionDouble(_a,_b) {}
- double calc(double av, double bv) { if (av >= 0.0 || bv >= 0.0)return 1.0; else return -1.0; }
+ ExpressionOr( Expression* exp0, Expression* exp1 ) : ExpressionDouble( exp0, exp1 ) { }
+ double calc() { return ( value[0] >= 0.0 || value[1] >= 0.0 ) ? 1.0 : -1.0; }
};
#endif /* __EXPRESSION_H__ */
Modified: trunk/bzwgen/src/Expression.cxx
===================================================================
--- trunk/bzwgen/src/Expression.cxx 2008-08-24 23:23:37 UTC (rev 18470)
+++ trunk/bzwgen/src/Expression.cxx 2008-08-25 00:17:58 UTC (rev 18471)
@@ -13,21 +13,21 @@
#include "Expression.h"
#include "RuleSet.h"
-double ExpressionAttribute::calculate(Mesh*,int) {
- return ruleset->getAttr(attrname);
+double ExpressionAttribute::calculate( Mesh*, int ) {
+ return ruleset->getAttr( attrname );
}
-double ExpressionFaceAttribute::calculate(Mesh* mesh,int face) {
- if (attrname == "x") return mesh->faceCenter(face).x;
- if (attrname == "y") return mesh->faceCenter(face).y;
- if (attrname == "z") return mesh->faceCenter(face).z;
- if (attrname == "h") return mesh->faceH(face);
- if (attrname == "v") return mesh->faceV(face);
- if (attrname == "s") return mesh->faceH(face) * mesh->faceV(face);
- if (attrname == "n") return double(mesh->getFace(face)->size());
- if (attrname == "c") {
- if (mesh->getFace(face)->isMultiFace()) {
- return double(((MultiFace*)mesh->getFace(face))->componentCount());
+double ExpressionFaceAttribute::calculate( Mesh* mesh, int face ) {
+ if ( attrname == "x" ) return mesh->faceCenter( face ).x;
+ if ( attrname == "y" ) return mesh->faceCenter( face ).y;
+ if ( attrname == "z" ) return mesh->faceCenter( face ).z;
+ if ( attrname == "h" ) return mesh->faceH( face );
+ if ( attrname == "v" ) return mesh->faceV( face );
+ if ( attrname == "s" ) return mesh->faceH( face ) * mesh->faceV( face );
+ if ( attrname == "n" ) return double( mesh->getFace( face )->size() );
+ if ( attrname == "c" ) {
+ if (mesh->getFace( face )->isMultiFace()) {
+ return double( ( ( MultiFace* ) mesh->getFace( face ) )->componentCount() );
} else {
Logger.log( 2, "Warning : face(c) called with non-MultiFace!");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cha...@us...> - 2008-08-24 23:23:27
|
Revision: 18470
http://bzflag.svn.sourceforge.net/bzflag/?rev=18470&view=rev
Author: chaos-dev
Date: 2008-08-24 23:23:37 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
* Operation classes -- proper disposal
* Operation.h/cxx style cleanup
* OperationTemplate template for multi-expression templates
Modified Paths:
--------------
trunk/bzwgen/inc/Operation.h
trunk/bzwgen/inc/Product.h
trunk/bzwgen/src/Operation.cxx
Modified: trunk/bzwgen/inc/Operation.h
===================================================================
--- trunk/bzwgen/inc/Operation.h 2008-08-24 21:56:28 UTC (rev 18469)
+++ trunk/bzwgen/inc/Operation.h 2008-08-24 23:23:37 UTC (rev 18470)
@@ -24,19 +24,81 @@
protected:
RuleSet* ruleset;
public:
- Operation(RuleSet* _ruleset) : ruleset(_ruleset) {}
- virtual int runMesh(Mesh*,int) = 0;
+ Operation( RuleSet* _ruleset ) : ruleset( _ruleset ) {}
+ virtual int runMesh( Mesh*, int ) = 0;
virtual ~Operation() {}
};
typedef std::vector <Operation*> OperationVector;
typedef OperationVector::iterator OperationVectIter;
+template < int SIZE >
+class OperationTemplate : public Operation {
+protected:
+ typedef Expression* ExpressionPtr;
+ ExpressionPtr exp[SIZE];
+ double value[SIZE];
+public:
+ OperationTemplate( RuleSet* _ruleset )
+ : Operation( _ruleset ) {
+ for ( int i = 0; i < SIZE; ++i )
+ exp[i] = NULL;
+ }
+ void flatten( Mesh* mesh, int face ) {
+ for ( int i = 0; i < SIZE; ++i )
+ if ( exp[i] )
+ value[i] = exp[i]->calculate( mesh, face );
+ }
+ virtual ~OperationTemplate() {
+ for ( int i = 0; i < SIZE; ++i )
+ deletePointer( exp[i] );
+ }
+};
+
+class OperationSingle : public OperationTemplate<1> {
+public:
+ OperationSingle( RuleSet* _ruleset, Expression* exp0 )
+ : OperationTemplate<1>( _ruleset ) {
+ exp[0] = exp0;
+ }
+};
+
+class OperationDouble : public OperationTemplate<2> {
+public:
+ OperationDouble( RuleSet* _ruleset, Expression* exp0, Expression* exp1 )
+ : OperationTemplate<2>( _ruleset ) {
+ exp[0] = exp0;
+ exp[1] = exp1;
+ }
+};
+
+class OperationTriple : public OperationTemplate<3> {
+public:
+ OperationTriple( RuleSet* _ruleset, Expression* exp0, Expression* exp1, Expression* exp2 )
+ : OperationTemplate<3>( _ruleset ) {
+ exp[0] = exp0;
+ exp[1] = exp1;
+ exp[2] = exp2;
+ }
+};
+
+class OperationQuad : public OperationTemplate<4> {
+public:
+ OperationQuad( RuleSet* _ruleset, Expression* exp0, Expression* exp1, Expression* exp2, Expression* exp3 )
+ : OperationTemplate<4>( _ruleset ) {
+ exp[0] = exp0;
+ exp[1] = exp1;
+ exp[2] = exp2;
+ exp[3] = exp3;
+ }
+};
+
class OperationNonterminal : public Operation {
String ref;
public:
- OperationNonterminal(RuleSet* _ruleset, const char* _ref) : Operation(_ruleset), ref(_ref) { };
- int runMesh(Mesh* mesh, int face);
+ OperationNonterminal( RuleSet* _ruleset, const char* _ref )
+ : Operation( _ruleset ), ref( _ref ) { };
+ int runMesh( Mesh* mesh, int face );
};
class OperationLoadMaterial : public Operation {
@@ -44,37 +106,43 @@
String filename;
bool noradar;
public:
- OperationLoadMaterial(RuleSet* _ruleset, const char* _id, const char* _filename, bool _noradar ) : Operation(_ruleset), id(_id), filename(_filename), noradar(_noradar) { };
- int runMesh(Mesh* mesh, int face);
+ OperationLoadMaterial( RuleSet* _ruleset, const char* _id, const char* _filename, bool _noradar )
+ : Operation( _ruleset ), id( _id ), filename( _filename ), noradar( _noradar ) { };
+ int runMesh( Mesh* mesh, int face );
};
class OperationAddFace : public Operation {
String ref;
public:
- OperationAddFace(RuleSet* _ruleset, const char* _ref) : Operation(_ruleset), ref(_ref) { };
- int runMesh(Mesh* mesh, int face);
+ OperationAddFace( RuleSet* _ruleset, const char* _ref )
+ : Operation( _ruleset ), ref( _ref ) { };
+ int runMesh( Mesh* mesh, int face );
};
class OperationMultiFace : public Operation {
public:
- OperationMultiFace(RuleSet* _ruleset) : Operation(_ruleset) { };
- int runMesh(Mesh* mesh, int face);
+ OperationMultiFace( RuleSet* _ruleset ) : Operation( _ruleset ) { };
+ int runMesh( Mesh* mesh, int face );
};
class OperationSpawn : public Operation {
String ref;
public:
- OperationSpawn(RuleSet* _ruleset, const char* _ref) : Operation(_ruleset), ref(_ref) { };
- int runMesh(Mesh* mesh, int face);
+ OperationSpawn( RuleSet* _ruleset, const char* _ref )
+ : Operation( _ruleset ), ref( _ref ) { };
+ int runMesh( Mesh* mesh, int face );
};
class OperationUnchamfer : public Operation {
public:
- OperationUnchamfer(RuleSet* _ruleset) : Operation(_ruleset) { };
- int runMesh(Mesh* mesh, int face) {
+ OperationUnchamfer( RuleSet* _ruleset ) : Operation( _ruleset ) { };
+ int runMesh( Mesh* mesh, int face ) {
size_t size = mesh->getFace(face)->size();
- for ( size_t i = 0; i < size_t(size / 2); i++ ) {
- mesh->weldVertices( mesh->getFace(face)->getVertex( i ), mesh->getFace(face)->getVertex( i+1 ) );
+ for ( size_t i = 0; i < size_t( size / 2 ); i++ ) {
+ mesh->weldVertices(
+ mesh->getFace( face )->getVertex( i ),
+ mesh->getFace( face )->getVertex( i+1 )
+ );
}
return face;
}
@@ -82,17 +150,17 @@
class OperationFree : public Operation {
public:
- OperationFree(RuleSet* _ruleset) : Operation(_ruleset) { };
- int runMesh(Mesh* mesh, int face) {
- mesh->freeFace(face);
+ OperationFree( RuleSet* _ruleset ) : Operation( _ruleset ) { };
+ int runMesh( Mesh* mesh, int face ) {
+ mesh->freeFace( face );
return face;
}
};
class OperationDriveThrough : public Operation {
public:
- OperationDriveThrough(RuleSet* _ruleset) : Operation(_ruleset) { };
- int runMesh(Mesh* mesh, int face) {
+ OperationDriveThrough( RuleSet* _ruleset ) : Operation( _ruleset ) { };
+ int runMesh( Mesh* mesh, int face ) {
mesh->setPassable();
return face;
}
@@ -100,122 +168,112 @@
class OperationRemove : public Operation {
public:
- OperationRemove(RuleSet* _ruleset) : Operation(_ruleset) { };
- int runMesh(Mesh* mesh, int face) {
- mesh->getFace(face)->setOutput(false);
+ OperationRemove( RuleSet* _ruleset ) : Operation( _ruleset ) { };
+ int runMesh( Mesh* mesh, int face ) {
+ mesh->getFace( face )->setOutput( false );
return face;
}
};
class OperationTextureFull : public Operation {
public:
- OperationTextureFull(RuleSet* _ruleset) : Operation(_ruleset) { };
- int runMesh(Mesh* mesh, int face) {
- mesh->textureFaceFull(face);
+ OperationTextureFull( RuleSet* _ruleset ) : Operation( _ruleset ) { };
+ int runMesh( Mesh* mesh, int face ) {
+ mesh->textureFaceFull( face );
return face;
}
};
class OperationTextureClear : public Operation {
public:
- OperationTextureClear(RuleSet* _ruleset) : Operation(_ruleset) { };
- int runMesh(Mesh* mesh, int face) {
- mesh->getFace(face)->clearTexCoords();
+ OperationTextureClear( RuleSet* _ruleset ) : Operation( _ruleset ) { };
+ int runMesh( Mesh* mesh, int face ) {
+ mesh->getFace( face )->clearTexCoords();
return face;
}
};
class OperationTexture : public Operation {
public:
- OperationTexture(RuleSet* _ruleset) : Operation(_ruleset) { };
- int runMesh(Mesh* mesh, int face);
+ OperationTexture( RuleSet* _ruleset ) : Operation( _ruleset ) { };
+ int runMesh( Mesh* mesh, int face );
};
-class OperationTextureQuad : public Operation {
- Expression* a;
- Expression* b;
- Expression* c;
- Expression* d;
+class OperationTextureQuad : public OperationQuad {
public:
- OperationTextureQuad(RuleSet* _ruleset, Expression* _a, Expression* _b, Expression* _c, Expression* _d) : Operation(_ruleset), a(_a), b(_b), c(_c), d(_d) { };
- int runMesh(Mesh* mesh, int face) {
- mesh->textureFaceQuad(face,a->calculate(mesh,face),b->calculate(mesh,face),c->calculate(mesh,face),d->calculate(mesh,face));
+ OperationTextureQuad( RuleSet* _ruleset, Expression* exp0, Expression* exp1, Expression* exp2, Expression* exp3 )
+ : OperationQuad( _ruleset, exp0, exp1, exp2, exp3 ) { };
+ int runMesh( Mesh* mesh, int face ) {
+ flatten( mesh, face );
+ mesh->textureFaceQuad( face, value[0], value[1], value[2], value[3] );
return face;
}
};
-class OperationScale : public Operation {
- Expression* x;
- Expression* y;
+class OperationScale : public OperationDouble {
public:
- OperationScale(RuleSet* _ruleset, Expression* _x, Expression* _y) : Operation(_ruleset), x(_x), y(_y) { };
- int runMesh(Mesh* mesh, int face) {
+ OperationScale(RuleSet* _ruleset, Expression* x, Expression* y)
+ : OperationDouble(_ruleset, x, y ) { };
+ int runMesh( Mesh* mesh, int face ) {
if (mesh == NULL) return 0;
- mesh->scaleFace(face,x->calculate(mesh,face),y->calculate(mesh,face));
- return face;
+ flatten( mesh, face );
+ mesh->scaleFace( face, value[0], value[1] );
+ return face;
}
};
-class OperationTranslate : public Operation {
- Expression* x;
- Expression* y;
- Expression* z;
+class OperationTranslate : public OperationTriple {
public:
- OperationTranslate(RuleSet* _ruleset, Expression* _x, Expression* _y, Expression* _z) : Operation(_ruleset), x(_x), y(_y), z(_z) { };
- int runMesh(Mesh* mesh, int face) {
+ OperationTranslate(RuleSet* _ruleset, Expression* x, Expression* y, Expression* z)
+ : OperationTriple( _ruleset, x, y, z ) { };
+ int runMesh( Mesh* mesh, int face ) {
if (mesh == NULL) return 0;
- mesh->translateFace(face,x->calculate(mesh,face),y->calculate(mesh,face),z->calculate(mesh,face));
- return face;
+ flatten( mesh, face );
+ mesh->translateFace( face, value[0], value[1], value[2] );
+ return face;
}
};
-class OperationTranslateR : public Operation {
- Expression* x;
- Expression* y;
- Expression* z;
+class OperationTranslateR : public OperationTriple {
public:
- OperationTranslateR(RuleSet* _ruleset, Expression* _x, Expression* _y, Expression* _z) : Operation(_ruleset), x(_x), y(_y), z(_z) { };
- int runMesh(Mesh* mesh, int face) {
+ OperationTranslateR(RuleSet* _ruleset, Expression* x, Expression* y, Expression* z)
+ : OperationTriple( _ruleset, x, y, z ) { };
+ int runMesh( Mesh* mesh, int face ) {
if (mesh == NULL) return 0;
- mesh->translateFace(face,x->calculate(mesh,face)*mesh->faceH(face),y->calculate(mesh,face)*mesh->faceV(face),z->calculate(mesh,face)*mesh->faceCenter(face).z);
- return face;
+ mesh->translateFace( face, value[0]*mesh->faceH(face),
+ value[1]*mesh->faceV(face),
+ value[2]*mesh->faceCenter(face).z);
+ return face;
}
};
-class OperationSingle : public Operation {
-protected:
- Expression *exp;
- double value;
-public:
- OperationSingle(RuleSet* _ruleset, Expression* _exp) : Operation(_ruleset), exp(_exp) { };
- void flatten(Mesh* mesh,int face) { value = exp->calculate(mesh,face); }
- ~OperationSingle() {
- delete exp;
- }
-};
-class OperationNGon : public OperationSingle {
- Expression* nsize;
+class OperationNGon : public OperationDouble {
public:
- OperationNGon(RuleSet* _ruleset, Expression* _exp, Expression* _nsize = NULL) : OperationSingle(_ruleset,_exp), nsize(_nsize) {}
- int runMesh(Mesh* mesh,int face) {
- flatten(mesh,face);
+ OperationNGon(RuleSet* _ruleset, Expression* _exp, Expression* _nsize = NULL)
+ : OperationDouble( _ruleset, _exp, _nsize ) {}
+ int runMesh( Mesh* mesh,int face) {
+ flatten( mesh, face );
mesh->freeFace(face);
- if (nsize != NULL) {
- face = mesh->createNGon(mesh->faceCenter(face),nsize->calculate(mesh,face),math::roundToInt(value));
- } else {
- face = mesh->createNGon(mesh->faceCenter(face),math::min(mesh->faceH(face),mesh->faceV(face))/2,math::roundToInt(value));
+
+ int sides = math::roundToInt( value[0] );
+ double radius = value[1];
+ if ( exp[1] == NULL ) {
+ radius = math::min( mesh->faceH(face), mesh->faceV(face) ) / 2;
}
+ face = mesh->createNGon( mesh->faceCenter(face), radius, sides );
+
return face;
}
};
class OperationAssert : public OperationSingle {
public:
- OperationAssert(RuleSet* _ruleset, Expression* _exp) : OperationSingle(_ruleset,_exp) {}
- int runMesh(Mesh* mesh,int face) {
- flatten(mesh,face);
- if (value >= 0.0) return face; else return -1;
+ OperationAssert( RuleSet* _ruleset, Expression* _exp )
+ : OperationSingle( _ruleset, _exp ) { }
+ int runMesh( Mesh* mesh, int face ) {
+ flatten( mesh, face );
+ return value[0] >= 0.0 ? face : -1;
}
};
@@ -223,52 +281,57 @@
protected:
String attrname;
public:
- OperationAssign(RuleSet* _ruleset, Expression* _exp, const char* _attrname ) : OperationSingle(_ruleset,_exp), attrname(_attrname) {}
- int runMesh(Mesh*,int face);
+ OperationAssign( RuleSet* _ruleset, Expression* _exp, const char* _attrname )
+ : OperationSingle( _ruleset, _exp ), attrname( _attrname ) { }
+ int runMesh( Mesh*, int face );
};
class OperationMaterial : public OperationSingle {
public:
- OperationMaterial(RuleSet* _ruleset, Expression* _exp) : OperationSingle(_ruleset,_exp) {}
- int runMesh(Mesh* mesh,int face) {
- if (mesh == NULL) return 0;
- flatten(mesh,face);
- mesh->getFace(face)->setMaterial( math::roundToInt(value) );
- return face;
+ OperationMaterial( RuleSet* _ruleset, Expression* _exp )
+ : OperationSingle( _ruleset, _exp ) { }
+ int runMesh( Mesh* mesh, int face ) {
+ if ( mesh == NULL ) return 0;
+ flatten( mesh, face );
+ mesh->getFace( face )->setMaterial( math::roundToInt( value[0] ) );
+ return face;
};
};
class OperationExpand : public OperationSingle {
public:
- OperationExpand(RuleSet* _ruleset, Expression* _exp) : OperationSingle(_ruleset,_exp) {}
- int runMesh(Mesh* mesh,int face) {
- if (mesh == NULL) return 0;
- flatten(mesh,face);
- mesh->expandFace(face,value);
- return face;
+ OperationExpand( RuleSet* _ruleset, Expression* _exp )
+ : OperationSingle( _ruleset, _exp ) { }
+ int runMesh( Mesh* mesh,int face ) {
+ if ( mesh == NULL ) return 0;
+ flatten( mesh, face );
+ mesh->expandFace( face, value[0] );
+ return face;
};
};
class OperationTaper : public OperationSingle {
public:
- OperationTaper(RuleSet* _ruleset, Expression* _exp) : OperationSingle(_ruleset,_exp) {}
- int runMesh(Mesh* mesh,int face) {
- if (mesh == NULL) return 0;
- flatten(mesh,face);
- mesh->taperFace(face,value);
- return face;
+ OperationTaper( RuleSet* _ruleset, Expression* _exp )
+ : OperationSingle( _ruleset, _exp ) { }
+ int runMesh(Mesh* mesh,int face) {
+ if ( mesh == NULL ) return 0;
+ flatten( mesh, face );
+ mesh->taperFace( face, value[0] );
+ return face;
};
};
class OperationChamfer : public OperationSingle {
public:
- OperationChamfer(RuleSet* _ruleset, Expression* _exp) : OperationSingle(_ruleset,_exp) {}
- int runMesh(Mesh* mesh,int face) {
- if (mesh == NULL) return 0;
- flatten(mesh,face);
- mesh->chamferFace(face,value);
- return face;
+ OperationChamfer( RuleSet* _ruleset, Expression* _exp )
+ : OperationSingle( _ruleset, _exp ) { }
+ int runMesh( Mesh* mesh, int face ) {
+ if ( mesh == NULL ) return 0;
+ flatten( mesh, face );
+ mesh->chamferFace( face, value[0] );
+ return face;
};
};
@@ -277,45 +340,53 @@
StringVector* facerules;
bool allsame;
public:
- OperationMultifaces(RuleSet* _ruleset, Expression* _exp, StringVector* _facerules);
- int runMesh(Mesh* mesh,int, IntVector* faces);
+ OperationMultifaces( RuleSet* _ruleset, Expression* _exp, StringVector* _facerules );
+ int runMesh( Mesh* mesh, int, IntVector* faces );
~OperationMultifaces() {
- if (facerules != NULL) delete facerules;
- }
+ deletePointer( facerules );
+ }
};
class OperationDetachFace : public OperationMultifaces {
public:
- OperationDetachFace(RuleSet* _ruleset, Expression* _exp, StringVector* _facerules) : OperationMultifaces(_ruleset,_exp,_facerules) {}
- int runMesh(Mesh* mesh,int face);
+ OperationDetachFace( RuleSet* _ruleset, Expression* _exp, StringVector* _facerules )
+ : OperationMultifaces( _ruleset, _exp, _facerules ) { }
+ int runMesh( Mesh* mesh, int face );
};
class OperationExtrude : public OperationMultifaces {
public:
- OperationExtrude(RuleSet* _ruleset, Expression* _exp, StringVector* facerules) : OperationMultifaces(_ruleset,_exp,facerules) {}
- int runMesh(Mesh* mesh,int face);
+ OperationExtrude( RuleSet* _ruleset, Expression* _exp, StringVector* facerules )
+ : OperationMultifaces( _ruleset, _exp, facerules ) { }
+ int runMesh( Mesh* mesh, int face );
};
class OperationExtrudeT : public OperationMultifaces {
public:
- OperationExtrudeT(RuleSet* _ruleset, Expression* _exp, StringVector* facerules) : OperationMultifaces(_ruleset,_exp,facerules) {}
- int runMesh(Mesh* mesh,int face);
+ OperationExtrudeT( RuleSet* _ruleset, Expression* _exp, StringVector* facerules )
+ : OperationMultifaces( _ruleset, _exp, facerules ) { }
+ int runMesh( Mesh* mesh, int face );
};
class OperationSplitFace : public OperationMultifaces {
bool horiz;
ExpressionVector* splits;
public:
- OperationSplitFace(RuleSet* _ruleset, bool _horiz, StringVector* facerules, ExpressionVector* _splits, Expression* _esnap = NULL) : OperationMultifaces(_ruleset,_esnap,facerules), horiz(_horiz), splits(_splits) {}
- int runMesh(Mesh* mesh,int face);
+ OperationSplitFace( RuleSet* _ruleset, bool _horiz, StringVector* facerules, ExpressionVector* _splits, Expression* _esnap = NULL)
+ : OperationMultifaces( _ruleset, _esnap, facerules ), horiz( _horiz ), splits( _splits ) {}
+ int runMesh( Mesh* mesh, int face );
+ ~OperationSplitFace() {
+ deletePointerVector( splits );
+ }
};
class OperationRepeat : public OperationMultifaces {
bool horiz;
public:
- OperationRepeat(RuleSet* _ruleset, Expression* _exp, bool _horiz, StringVector* facerules) : OperationMultifaces(_ruleset,_exp,facerules), horiz(_horiz) {}
- int runMesh(Mesh* mesh,int face);
+ OperationRepeat( RuleSet* _ruleset, Expression* _exp, bool _horiz, StringVector* facerules )
+ : OperationMultifaces( _ruleset, _exp, facerules ), horiz( _horiz ) {}
+ int runMesh( Mesh* mesh, int face );
};
Modified: trunk/bzwgen/inc/Product.h
===================================================================
--- trunk/bzwgen/inc/Product.h 2008-08-24 21:56:28 UTC (rev 18469)
+++ trunk/bzwgen/inc/Product.h 2008-08-24 23:23:37 UTC (rev 18470)
@@ -83,12 +83,6 @@
~Product() {
deletePointerVector( operations );
deletePointer( condition );
- OperationVectIter itr;
-// for ( itr = ops->begin(); itr!= ops->end(); ++itr)
-// delete ( *itr );
-// delete ops;
-// if ( cond != NULL )
-// delete cond;
}
private:
/**
Modified: trunk/bzwgen/src/Operation.cxx
===================================================================
--- trunk/bzwgen/src/Operation.cxx 2008-08-24 21:56:28 UTC (rev 18469)
+++ trunk/bzwgen/src/Operation.cxx 2008-08-24 23:23:37 UTC (rev 18470)
@@ -14,151 +14,153 @@
#include "RuleSet.h"
#include "MultiFace.h"
-int OperationNonterminal::runMesh(Mesh* mesh, int face) {
- return ruleset->runMesh(mesh,face,ref);
+int OperationNonterminal::runMesh( Mesh* mesh, int face ) {
+ return ruleset->runMesh( mesh, face, ref );
}
-int OperationLoadMaterial::runMesh(Mesh*, int face) {
- ruleset->loadMaterial(id,filename,noradar);
+int OperationLoadMaterial::runMesh( Mesh*, int face ) {
+ ruleset->loadMaterial( id, filename, noradar );
return face;
}
-int OperationAddFace::runMesh(Mesh* mesh, int face) {
- if (!mesh->getFace(face)->isMultiFace()) {
- printf("Error: addface passed on a non-MultiFace face!");
+int OperationAddFace::runMesh( Mesh* mesh, int face ) {
+ if (!mesh->getFace( face )->isMultiFace()) {
+ Logger.log( "OperationAddFace: Error! addface passed on a non-MultiFace face!" );
return face;
}
int newface = mesh->rePushBase();
- newface = ruleset->runMesh(mesh,newface,ref);
- ((MultiFace*)mesh->getFace(face))->addFace(mesh->getFace(newface));
+ newface = ruleset->runMesh( mesh, newface, ref );
+ ( (MultiFace*) mesh->getFace( face ) )->addFace( mesh->getFace( newface ) );
return face;
}
-int OperationSpawn::runMesh(Mesh* mesh, int face) {
- ruleset->runNewMesh(mesh,face,ref);
+int OperationSpawn::runMesh( Mesh* mesh, int face ) {
+ ruleset->runNewMesh( mesh, face, ref );
return face;
}
-int OperationAssign::runMesh(Mesh* mesh, int face) {
- flatten(mesh,face);
- ruleset->addAttr(attrname,value);
- return face;
+int OperationAssign::runMesh( Mesh* mesh, int face ) {
+ flatten( mesh, face );
+ ruleset->addAttr( attrname, value[0] );
+ return face;
}
-OperationMultifaces::OperationMultifaces(RuleSet* _ruleset, Expression* _exp, StringVector* _facerules)
-: OperationSingle(_ruleset, _exp), facerules(_facerules), allsame(false) {
- if (facerules != NULL) {
- if (facerules->size() == 0) {
- delete facerules;
+OperationMultifaces::OperationMultifaces( RuleSet* _ruleset, Expression* _exp, StringVector* _facerules )
+: OperationSingle( _ruleset, _exp ), facerules( _facerules ), allsame( false ) {
+ if ( facerules != NULL ) {
+ if ( facerules->size() == 0 ) {
+ delete facerules;
facerules = NULL;
} else
- if (facerules->size() == 1 && facerules->at(0)[0] == '@') {
+ if ( facerules->size() == 1 && facerules->at(0)[0] == '@' ) {
allsame = true;
- facerules->at(0).erase(0,1);
+ facerules->at( 0 ).erase( 0, 1 );
}
}
}
int OperationDetachFace::runMesh(Mesh* mesh,int face) {
- if (!mesh->getFace(face)->isMultiFace()) {
- printf("Error: detachface passed on a non-MultiFace face!");
+ if ( !mesh->getFace( face)->isMultiFace() ) {
+ Logger.log( "OperationDetachFace: Error! detachface passed on a non-MultiFace face!" );
return face;
}
- flatten(mesh,face);
- IntVector* faces = ((MultiFace*)mesh->getFace(face))->detachFace(math::roundToInt(value));
- if (faces != NULL) {
- OperationMultifaces::runMesh(mesh,face,faces);
+ flatten( mesh,face );
+ IntVector* faces = ( (MultiFace*)mesh->getFace( face ) )->detachFace( math::roundToInt( value[0] ) );
+ if ( faces != NULL ) {
+ OperationMultifaces::runMesh( mesh, face, faces );
delete faces;
}
return face;
}
-int OperationMultifaces::runMesh(Mesh* mesh,int,IntVector* faces) {
- if (mesh == NULL) return 0;
- if (allsame) {
- for (size_t i = 0; i < faces->size(); i++)
- ruleset->runMesh(mesh,faces->at(i),facerules->at(0));
+int OperationMultifaces::runMesh( Mesh* mesh, int, IntVector* faces ) {
+ if ( mesh == NULL ) return 0;
+ if ( allsame ) {
+ for ( size_t i = 0; i < faces->size(); i++ )
+ ruleset->runMesh( mesh, faces->at(i), facerules->at(0) );
return 0;
}
- if (facerules != NULL) {
- for (size_t i = 0; i < facerules->size(); i++) {
- if (facerules->at(i).empty()) continue;
- if (i >= faces->size()) break;
- ruleset->runMesh(mesh,faces->at(i),facerules->at(i));
+ if ( facerules != NULL ) {
+ for ( size_t i = 0; i < facerules->size(); i++ ) {
+ if ( facerules->at(i).empty() ) continue;
+ if ( i >= faces->size() ) break;
+ ruleset->runMesh( mesh, faces->at(i), facerules->at(i) );
}
}
return 0;
}
-int OperationExtrude::runMesh(Mesh* mesh,int face) {
- if (mesh == NULL) return 0;
- flatten(mesh,face);
- if (facerules != NULL) {
+int OperationExtrude::runMesh( Mesh* mesh, int face ) {
+ if ( mesh == NULL ) return 0;
+ flatten( mesh, face );
+ if ( facerules != NULL ) {
IntVector* faces = new IntVector;
- mesh->extrudeFace(face,value,mesh->getFace(face)->getMaterial(),faces);
- OperationMultifaces::runMesh(mesh,face,faces);
+ mesh->extrudeFace( face, value[0], mesh->getFace( face )->getMaterial(), faces );
+ OperationMultifaces::runMesh( mesh, face, faces );
delete faces;
} else {
- mesh->extrudeFace(face,value,mesh->getFace(face)->getMaterial());
+ mesh->extrudeFace( face, value[0], mesh->getFace( face )->getMaterial() );
}
- return face;
+ return face;
}
-int OperationExtrudeT::runMesh(Mesh* mesh,int face) {
+int OperationExtrudeT::runMesh( Mesh* mesh, int face ) {
if (mesh == NULL) return 0;
- flatten(mesh,face);
+ flatten( mesh, face );
IntVector* faces = new IntVector;
- mesh->extrudeFace(face,value,mesh->getFace(face)->getMaterial(), faces);
- double snap = ruleset->getAttr("SNAP");
- double textile = ruleset->getAttr("TEXTILE");
- for (size_t i = 0; i < faces->size(); i++) {
- mesh->textureFace(faces->at(i),snap,textile);
+ mesh->extrudeFace( face, value[0], mesh->getFace( face )->getMaterial(), faces );
+
+ double snap = ruleset->getAttr( "SNAP" );
+ double textile = ruleset->getAttr( "TEXTILE" );
+
+ for ( size_t i = 0; i < faces->size(); i++ ) {
+ mesh->textureFace( faces->at(i), snap, textile );
}
- if (facerules != NULL) {
- OperationMultifaces::runMesh(mesh,face,faces);
+ if ( facerules != NULL ) {
+ OperationMultifaces::runMesh( mesh, face, faces );
}
delete faces;
- return face;
+ return face;
}
-int OperationTexture::runMesh(Mesh* mesh, int face) {
- mesh->textureFace(face,ruleset->getAttr("SNAP"),ruleset->getAttr("TEXTILE"));
+int OperationTexture::runMesh( Mesh* mesh, int face ) {
+ mesh->textureFace( face, ruleset->getAttr( "SNAP" ), ruleset->getAttr( "TEXTILE" ) );
return face;
}
-int OperationSplitFace::runMesh(Mesh* mesh,int face) {
- if (mesh == NULL) return 0;
+int OperationSplitFace::runMesh( Mesh* mesh,int face ) {
+ if ( mesh == NULL ) return 0;
- DoubleVector* dv = new DoubleVector(splits->size());
- for (size_t i = 0; i < splits->size(); i++)
- (*dv)[i] = splits->at(i)->calculate(mesh,face);
+ DoubleVector* dv = new DoubleVector( splits->size() );
+ for ( size_t i = 0; i < splits->size(); i++ )
+ (*dv)[i] = splits->at(i)->calculate( mesh, face );
IntVector* faces;
- if (exp != NULL)
- faces = mesh->splitFace(face,dv,horiz,exp->calculate(mesh,face));
+ if (exp[0] != NULL)
+ faces = mesh->splitFace( face, dv, horiz, exp[0]->calculate(mesh,face) );
else
- faces = mesh->splitFace(face,dv,horiz);
+ faces = mesh->splitFace( face, dv, horiz );
if (facerules != NULL) {
- OperationMultifaces::runMesh(mesh,face,faces);
+ OperationMultifaces::runMesh( mesh, face, faces );
}
delete faces;
delete dv;
- return face;
+ return face;
}
-int OperationRepeat::runMesh(Mesh* mesh,int face) {
+int OperationRepeat::runMesh( Mesh* mesh,int face ) {
if (mesh == NULL) return 0;
- flatten(mesh,face);
- IntVector* faces = mesh->repeatSubdivdeFace(face,value,horiz);
+ flatten( mesh, face );
+ IntVector* faces = mesh->repeatSubdivdeFace( face, value[0], horiz );
if (facerules != NULL) {
- OperationMultifaces::runMesh(mesh,face,faces);
+ OperationMultifaces::runMesh( mesh, face, faces );
}
delete faces;
- return face;
+ return face;
}
int OperationMultiFace::runMesh(Mesh* mesh, int face) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cha...@us...> - 2008-08-24 21:56:20
|
Revision: 18469
http://bzflag.svn.sourceforge.net/bzflag/?rev=18469&view=rev
Author: chaos-dev
Date: 2008-08-24 21:56:28 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
* Product.h file commented
* cleanup of Product class
* globals.h : introduced deletePointer, deletePointerVector safety templates
Modified Paths:
--------------
trunk/bzwgen/inc/Product.h
trunk/bzwgen/inc/globals.h
Modified: trunk/bzwgen/inc/Product.h
===================================================================
--- trunk/bzwgen/inc/Product.h 2008-08-24 19:55:41 UTC (rev 18468)
+++ trunk/bzwgen/inc/Product.h 2008-08-24 21:56:28 UTC (rev 18469)
@@ -9,7 +9,11 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+/**
+ * @file Product.h
+ * @author Kornel Kisielewicz kor...@gm...
+ * @brief Grammar Product class for BZWGen.
+ */
#ifndef __PRODUCT_H__
#define __PRODUCT_H__
@@ -17,29 +21,86 @@
#include "Expression.h"
#include "Mesh.h"
+/**
+ * @class Product
+ * @brief Class representing a BZWGen grammar product.
+ *
+ * Rules constitute of products, products constitute of Operations.
+ * A rule may be just a single product, or it may constitue of several ones
+ * with different conditions and rarieties.
+ */
class Product {
- OperationVector* ops;
+ /**
+ * A vector of operations for the given product, that are to be executed
+ * sequentially.
+ */
+ OperationVector* operations;
+ /**
+ * Rarity of the given product. The rarities of all the products in a
+ * given rule should sum up to 1.0.
+ */
double rarity;
- Expression* cond;
+ /**
+ * The condition under which the product may be executed. Checked with
+ * each invocation at run-time.
+ */
+ Expression* condition;
public:
- Product(OperationVector* _ops, double _rarity, Expression* _cond = NULL) : ops(_ops), rarity(_rarity), cond(_cond) {};
- int runMesh(Mesh* mesh, int face) {
- for (size_t i = 0; i < ops->size(); i++) {
- face = ops->at(i)->runMesh(mesh,face);
- if (face == -1) return -1;
+ /**
+ * Constructor, to be called by the parser. Takes the vector of operations,
+ * a rarity and condition. Initializes data, does nothing.
+ */
+ Product( OperationVector* _operations, double _rarity, Expression* _condition = NULL )
+ : operations( _operations ), rarity( _rarity ), condition( _condition ) {};
+ /**
+ * Run the sequence of operations on the given mesh and the given face.
+ * returns the face ID of the last result, or -1 if an error is encountered.
+ */
+ int runMesh( Mesh* mesh, int face ) {
+ for ( size_t i = 0; i < operations->size(); i++ ) {
+ face = operations->at( i )->runMesh( mesh, face );
+ if ( face == -1 ) return -1;
}
return face;
}
- bool conditionsMet(Mesh* mesh, int face) {
- return cond == NULL ? true : (cond->calculate(mesh,face) >= 0.0);
+ /**
+ * Checks wether the conditions that were assigned to this product are
+ * met. If no conditions are assigned, returns true.
+ */
+ bool conditionsMet( Mesh* mesh, int face ) {
+ return condition == NULL ? true : ( condition->calculate( mesh,face ) >= 0.0 );
}
- double getRarity() { return rarity; }
+ /**
+ * Rarity value accessor.
+ */
+ double getRarity() {
+ return rarity;
+ }
+ /**
+ * Destructor, frees all operations, and disposes of the operation
+ * vector. Frees condition if present.
+ */
~Product() {
- OperationVectIter itr;
- for (itr = ops->begin(); itr!= ops->end(); ++itr) delete (*itr);
- delete ops;
- if (cond != NULL) delete cond;
+ deletePointerVector( operations );
+ deletePointer( condition );
+ OperationVectIter itr;
+// for ( itr = ops->begin(); itr!= ops->end(); ++itr)
+// delete ( *itr );
+// delete ops;
+// if ( cond != NULL )
+// delete cond;
}
+private:
+ /**
+ * Blocked default constructor. Product may only be instantiated by the
+ * grammar.
+ */
+ Product( ) {}
+ /**
+ * Blocked copy constructor. Product has pointers, so it's unsafe for
+ * copy.
+ */
+ Product( const Product& ) {}
};
typedef std::vector <Product*> ProductVector;
Modified: trunk/bzwgen/inc/globals.h
===================================================================
--- trunk/bzwgen/inc/globals.h 2008-08-24 19:55:41 UTC (rev 18468)
+++ trunk/bzwgen/inc/globals.h 2008-08-24 21:56:28 UTC (rev 18469)
@@ -49,6 +49,31 @@
#include "Vector2D.h"
#include "Vector3D.h"
+template< class T >
+inline void deletePointerVector( std::vector<T>*& v ) {
+ if ( v == NULL ) return;
+ typename std::vector<T>::iterator iter = v->begin();
+ for ( ; iter != v->end(); ++iter )
+ delete ( *iter );
+ delete v;
+ v = NULL;
+}
+
+template< class T >
+inline void deletePointerVector( std::vector<T>& v ) {
+ typename std::vector<T>::iterator iter = v.begin();
+ for ( ; iter != v.end(); ++iter )
+ delete ( *iter );
+}
+
+template< class T >
+inline void deletePointer( T*& p ) {
+ if ( p == NULL ) return;
+ delete p;
+ p = NULL;
+}
+
+
typedef Vector3D<double> Vertex;
typedef Vector2D<double> TexCoord;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cha...@us...> - 2008-08-24 19:55:32
|
Revision: 18468
http://bzflag.svn.sourceforge.net/bzflag/?rev=18468&view=rev
Author: chaos-dev
Date: 2008-08-24 19:55:41 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
* further logging info and style fixup
Modified Paths:
--------------
trunk/bzwgen/src/RuleSet.cxx
Modified: trunk/bzwgen/src/RuleSet.cxx
===================================================================
--- trunk/bzwgen/src/RuleSet.cxx 2008-08-24 19:37:15 UTC (rev 18467)
+++ trunk/bzwgen/src/RuleSet.cxx 2008-08-24 19:55:41 UTC (rev 18468)
@@ -44,7 +44,9 @@
Logger.log( "RuleSet : Warning : rule '%s' not found!", rulename.c_str() );
return -1;
}
+ Logger.log( 4, "RuleSet : runMesh, rule '%s', recursion level %d, running rule...", rulename.c_str(), recursion );
int result = itr->second->runMesh( mesh, face );
+ Logger.log( 4, "RuleSet : runMesh, rule '%s', recursion level %d, rule ran, result = %d...", rulename.c_str(), recursion, result );
recursion--;
return result;
@@ -67,33 +69,36 @@
return meshes;
}
-int RuleSet::runNewMesh(Mesh* old_mesh, int old_face, String& rulename) {
+int RuleSet::runNewMesh( Mesh* old_mesh, int old_face, String& rulename ) {
+ Logger.log( 4, "RuleSet : runNewMesh, rule '%s'...", rulename.c_str() );
Mesh* newmesh = new Mesh();
Face* newface = new Face();
- size_t size = old_mesh->getFace(old_face)->size();
+ size_t size = old_mesh->getFace( old_face )->size();
for ( size_t i = 0; i < size; i++ ) {
newface->addVertex( i );
newmesh->addVertex( old_mesh->getFaceVertex( old_face, i ) );
}
- int newfaceid = newmesh->addFace(newface);
- newmesh->pushBase(newfaceid);
- meshes->push_back(newmesh);
- newmesh->addInsideVertex(newmesh->faceCenter(newfaceid)+newmesh->faceNormal(newfaceid)*0.05f);
- return runMesh(newmesh,newfaceid,rulename);
+ int newfaceid = newmesh->addFace( newface );
+ newmesh->pushBase( newfaceid );
+ meshes->push_back( newmesh );
+ newmesh->addInsideVertex( newmesh->faceCenter( newfaceid ) + newmesh->faceNormal( newfaceid ) * 0.05f );
+ return runMesh( newmesh, newfaceid, rulename );
}
-void RuleSet::loadMaterial(String& id, String& name, bool noradar) {
+void RuleSet::loadMaterial( String& id, String& name, bool noradar ) {
int matid = materials.size();
- addAttr(id,double(matid));
- materials.push_back( Material(matid,name,noradar) );
+ addAttr( id, double( matid ) );
+ materials.push_back( Material( matid, name, noradar ) );
}
-void RuleSet::output(Output& out ) {
- for (MaterialVectIter itr = materials.begin(); itr!= materials.end(); ++itr) (*itr).output(out);
+void RuleSet::output( Output& out ) {
+ for ( MaterialVectIter itr = materials.begin(); itr!= materials.end(); ++itr )
+ (*itr).output( out );
}
RuleSet::~RuleSet() {
- for (RuleMapIter itr = rules.begin();itr != rules.end(); ++itr) delete itr->second;
+ for ( RuleMapIter itr = rules.begin();itr != rules.end(); ++itr )
+ delete itr->second;
}
// Local Variables: ***
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cha...@us...> - 2008-08-24 19:37:07
|
Revision: 18467
http://bzflag.svn.sourceforge.net/bzflag/?rev=18467&view=rev
Author: chaos-dev
Date: 2008-08-24 19:37:15 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
* added a lot more logging info, mainly for BuildZone and RuleSet
* style cleanup of the files
Modified Paths:
--------------
trunk/bzwgen/inc/graph/PlanarGraph.h
trunk/bzwgen/src/BuildZone.cxx
trunk/bzwgen/src/RuleSet.cxx
trunk/bzwgen/src/graph/PlanarGraph.cxx
Modified: trunk/bzwgen/inc/graph/PlanarGraph.h
===================================================================
--- trunk/bzwgen/inc/graph/PlanarGraph.h 2008-08-24 19:07:11 UTC (rev 18466)
+++ trunk/bzwgen/inc/graph/PlanarGraph.h 2008-08-24 19:37:15 UTC (rev 18467)
@@ -283,6 +283,8 @@
* is done via y coordinate.
*/
static bool compareNodesX ( const Node* a, const Node* b ) {
+ assert( a );
+ assert( b );
return (a->vector().x < b->vector().x || a->vector().y < b->vector().y );
}
/**
Modified: trunk/bzwgen/src/BuildZone.cxx
===================================================================
--- trunk/bzwgen/src/BuildZone.cxx 2008-08-24 19:07:11 UTC (rev 18466)
+++ trunk/bzwgen/src/BuildZone.cxx 2008-08-24 19:37:15 UTC (rev 18467)
@@ -19,27 +19,29 @@
graph::NodeVector nodes = face->getNodes();
- Face* swface = new Face();
- swface->setMaterial( 0 );
- for (size_t i = 0; i < nodes.size(); i++) {
- swface->addVertex(mesh->addVertex(Vertex(nodes[i]->vector().x,nodes[i]->vector().y,0.0f)));
+ Face* baseFace = new Face();
+ baseFace->setMaterial( 0 );
+ for ( size_t i = 0; i < nodes.size(); i++ ) {
+ baseFace->addVertex( mesh->addVertex( Vertex( nodes[i]->vector().x, nodes[i]->vector().y, 0.0f ) ) );
}
- int base = mesh->addFace(swface);
+ int baseFaceID = mesh->addFace( baseFace );
+ Logger.log( 4, "BuildZone : running ruleset 'start' rule..." );
String rulename = String("start");
- meshes = generator->getRuleSet()->run(mesh,base,rulename);
+ meshes = generator->getRuleSet()->run( mesh, baseFaceID, rulename );
+ Logger.log( 4, "BuildZone : complete" );
}
void BuildZone::output( Output& out ) {
if (meshes == NULL) return;
- for (MeshVectIter itr = meshes->begin(); itr!= meshes->end(); ++itr)
- (*itr)->output(out,generator->getRuleSet()->materialsCount());
+ for ( MeshVectIter itr = meshes->begin(); itr!= meshes->end(); ++itr )
+ (*itr)->output( out, generator->getRuleSet()->materialsCount() );
}
BuildZone::~BuildZone( ) {
- if (meshes == NULL) return;
- for (MeshVectIter itr = meshes->begin(); itr!= meshes->end(); ++itr)
+ if ( meshes == NULL ) return;
+ for ( MeshVectIter itr = meshes->begin(); itr!= meshes->end(); ++itr )
delete (*itr);
delete meshes;
}
Modified: trunk/bzwgen/src/RuleSet.cxx
===================================================================
--- trunk/bzwgen/src/RuleSet.cxx 2008-08-24 19:07:11 UTC (rev 18466)
+++ trunk/bzwgen/src/RuleSet.cxx 2008-08-24 19:37:15 UTC (rev 18467)
@@ -13,14 +13,14 @@
#include "RuleSet.h"
#include "globals.h"
-void RuleSet::addRule(String& name, Rule* rule) {
+void RuleSet::addRule( String& name, Rule* rule ) {
Logger.log( 3, "RuleSet : added rule '%s'.", rule->getName().c_str() );
rules[name] = rule;
}
-double RuleSet::getAttr(String& name) {
- AttributeMap::iterator itr = attrmap.find(name);
- if (itr == attrmap.end()) {
+double RuleSet::getAttr( String& name ) {
+ AttributeMap::iterator itr = attrmap.find( name );
+ if ( itr == attrmap.end() ) {
Logger.log( "RuleSet : Warning : attribute '%s' not found!", name.c_str() );
return 0.0;
}
@@ -30,31 +30,39 @@
int RuleSet::runMesh(Mesh* mesh, int face, String& rulename) {
- if (recursion == -1) return -1;
+ Logger.log( 4, "RuleSet : runMesh, rule '%s', recursion level %d", rulename.c_str(), recursion );
+ if ( recursion == -1 ) return -1;
recursion++;
- if (recursion == MAX_RECURSION) {
+ if ( recursion == MAX_RECURSION ) {
recursion = -1;
Logger.log( "RuleSet : Warning : Recursion level 1000 reached! Are you sure you have no infinite loops?");
return -1;
}
- RuleMapIter itr = rules.find(rulename);
- if (itr == rules.end()) {
+ RuleMapIter itr = rules.find( rulename );
+ if ( itr == rules.end() ) {
Logger.log( "RuleSet : Warning : rule '%s' not found!", rulename.c_str() );
return -1;
}
- int result = itr->second->runMesh(mesh,face);
+ int result = itr->second->runMesh( mesh, face );
recursion--;
return result;
}
-MeshVector* RuleSet::run(Mesh* initial_mesh, int initial_face, String& rulename) {
+MeshVector* RuleSet::run( Mesh* initial_mesh, int initial_face, String& rulename ) {
+ assert( initial_mesh );
+ Logger.log( 4, "RuleSet : running rule '%s'", rulename.c_str() );
+ Vertex normal = initial_mesh->faceNormal( initial_face );
+ if ( normal.z <= 0.0 ) {
+ Logger.log( "RuleSet : run passed a face with bad normal : %s", normal.toString().c_str() );
+ return NULL;
+ }
meshes = new MeshVector();
- meshes->push_back(initial_mesh);
- initial_mesh->pushBase(initial_face);
- initial_mesh->addInsideVertex(initial_mesh->faceCenter(initial_face)+initial_mesh->faceNormal(initial_face)*0.05f);
- if (runMesh(initial_mesh,initial_face,rulename) == -1)
+ meshes->push_back( initial_mesh );
+ initial_mesh->pushBase( initial_face );
+ initial_mesh->addInsideVertex( initial_mesh->faceCenter( initial_face ) + normal * 0.05f );
+ if ( runMesh( initial_mesh, initial_face, rulename ) == -1 )
Logger.log( "RuleSet : run failed with start rule '%s!'", rulename.c_str() );
return meshes;
}
Modified: trunk/bzwgen/src/graph/PlanarGraph.cxx
===================================================================
--- trunk/bzwgen/src/graph/PlanarGraph.cxx 2008-08-24 19:07:11 UTC (rev 18466)
+++ trunk/bzwgen/src/graph/PlanarGraph.cxx 2008-08-24 19:37:15 UTC (rev 18467)
@@ -18,8 +18,10 @@
namespace graph {
void PlanarGraph::readFaces() {
+ Logger.log( 4, "PlanarGraph : readFaces" );
// Create a sorted list of Nodes by the x coordinate.
NodeVector xnodes = nodeList.getCopy();
+ Logger.log( 4, "PlanarGraph : readFaces, sorting %d nodes...", xnodes.size() );
std::sort( xnodes.begin(), xnodes.end(), compareNodesX );
// Perform a sweep while reading faces
Logger.log( 4, "PlanarGraph : reading faces from %d nodes", xnodes.size() );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2008-08-24 19:07:02
|
Revision: 18466
http://bzflag.svn.sourceforge.net/bzflag/?rev=18466&view=rev
Author: JeffM2501
Date: 2008-08-24 19:07:11 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
add the client version to the API player record.
Modified Paths:
--------------
trunk/bzflag/include/bzfsAPI.h
trunk/bzflag/src/bzfs/bzfsAPI.cxx
Modified: trunk/bzflag/include/bzfsAPI.h
===================================================================
--- trunk/bzflag/include/bzfsAPI.h 2008-08-24 19:06:26 UTC (rev 18465)
+++ trunk/bzflag/include/bzfsAPI.h 2008-08-24 19:07:11 UTC (rev 18466)
@@ -1392,9 +1392,6 @@
bz_eTeamType team;
- float lastUpdateTime;
- bz_PlayerUpdateState lastKnownState;
- bz_PlayerUpdateState currentState;
bz_ApiString ipAddress;
@@ -1402,6 +1399,11 @@
bz_ApiString currentFlag;
bz_APIStringList flagHistory;
+ float lastUpdateTime;
+ bz_PlayerUpdateState lastKnownState;
+ bz_PlayerUpdateState currentState;
+
+ bz_ApiString clientVersion;
bool spawned;
bool verified;
bool globalUser;
@@ -2149,4 +2151,4 @@
// c-basic-offset: 2 ***
// indent-tabs-mode: t ***
// End: ***
-// ex: shiftwidth=2 tabstop=8
+// ex: shiftwidth=2 tabstop=8
\ No newline at end of file
Modified: trunk/bzflag/src/bzfs/bzfsAPI.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfsAPI.cxx 2008-08-24 19:06:26 UTC (rev 18465)
+++ trunk/bzflag/src/bzfs/bzfsAPI.cxx 2008-08-24 19:07:11 UTC (rev 18466)
@@ -1189,6 +1189,9 @@
playerRecord->verified=player->accessInfo.isVerified();
playerRecord->globalUser=player->authentication.isGlobal();
+
+ playerRecord->clientVersion = player->player.getClientVersion();
+
if(player->netHandler)
playerRecord->ipAddress=player->netHandler->getTargetIP();
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cha...@us...> - 2008-08-24 19:06:17
|
Revision: 18465
http://bzflag.svn.sourceforge.net/bzflag/?rev=18465&view=rev
Author: chaos-dev
Date: 2008-08-24 19:06:26 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
* common code for primary and secondary road network cleaned up and extracted to growRoadNetwork
* bug with dead end extraction fixed.
* one segfault case fixed
Modified Paths:
--------------
trunk/bzwgen/inc/FaceGenerator.h
trunk/bzwgen/src/FaceGenerator.cxx
Modified: trunk/bzwgen/inc/FaceGenerator.h
===================================================================
--- trunk/bzwgen/inc/FaceGenerator.h 2008-08-24 18:47:55 UTC (rev 18464)
+++ trunk/bzwgen/inc/FaceGenerator.h 2008-08-24 19:06:26 UTC (rev 18465)
@@ -75,6 +75,12 @@
*/
void pushZones( );
/**
+ * Grow a road network on the passed graph. This method is the start
+ * point for the recursive growRoads method. See growRoads for parameter
+ * description.
+ */
+ void growRoadNetwork( graph::PlanarGraph* graph, size_t branching, float segmentLength, float noise, float threshold );
+ /**
* Creates the layout of the major roads. Stores them in the graph.
* Generation is controlled by already stored options.
*/
Modified: trunk/bzwgen/src/FaceGenerator.cxx
===================================================================
--- trunk/bzwgen/src/FaceGenerator.cxx 2008-08-24 18:47:55 UTC (rev 18464)
+++ trunk/bzwgen/src/FaceGenerator.cxx 2008-08-24 19:06:26 UTC (rev 18465)
@@ -45,39 +45,39 @@
graph.addConnection( n4, n1 );
}
-void FaceGenerator::runPrimaryRoadGeneration( ) {
- Logger.log( 2, "FaceGenerator : primary road generation..." );
- createInitialGraph( );
+void FaceGenerator::growRoadNetwork( graph::PlanarGraph* sgraph, size_t branching, float segmentLength, float noise, float threshold ) {
+ // Maybe use random edge instead?
+ graph::Node* splitNode = sgraph->splitEdge( sgraph->longestEdge( ) );
+ Logger.log( 4, "FaceGenerator : splitnode %s", splitNode->toString( ).c_str() );
- // Split the graph into more or less regular zones (use subdivide face?)
- // ...
+ // Create initial growing point targeting to the center from
+ // the newly created Node at the split edge
+ Vector2Df toCenter = ( sgraph->getCenter( ) - splitNode->vector( ) ).norm( );
+ Vector2Df newCoord = splitNode->vector( ) + ( toCenter * segmentLength );
-////////////////////////////////////////
- graph::Node* splitNode = graph.splitEdge( graph.longestEdge( ) );
- Logger.log( 4, "FaceGenerator : splitnode %s", splitNode->toString( ).c_str() );
+ graph::Node* newNode = sgraph->addNode( new graph::Node( sgraph, newCoord ) );
+ sgraph->addConnection( splitNode, newNode );
- // This should be parameters, their value is somewhat meaningless now.
- size_t branching = 3;
- float segmentLength = 400.0f;
- float noiseValue = 0.1f;
- float roadThreshold = 300.0f;
+ Logger.log( 3, "FaceGenerator : growing roads..." );
+ // Now run the recursive road growing on it.
+ growRoads( newNode, branching, segmentLength, noise, threshold );
+ Logger.log( 3, "FaceGenerator : growing roads complete, %d nodes and %d edges ", sgraph->nodeCount(), sgraph->edgeCount() );
- // Create initial growing point targeting to the center from
- // the newly created Node at the split edge
- Vector2Df toCenter = ( graph.getCenter( ) - splitNode->vector( ) ).norm( );
- Vector2Df newCoord = splitNode->vector( ) + ( toCenter * segmentLength );
+ size_t rem = sgraph->removeDeadEnds( );
+ Logger.log( 3, "FaceGenerator : removed %d dead ends.", rem );
+}
- graph::Node* newNode = graph.addNode( new graph::Node( &graph, newCoord ) );
- graph.addConnection( splitNode, newNode );
- Logger.log( 3, "FaceGenerator : primary road generation growing roads..." );
- // Now run the recursive road growing on it.
- growRoads( newNode, branching, segmentLength, noiseValue, roadThreshold );
+void FaceGenerator::runPrimaryRoadGeneration( ) {
+ Logger.log( 2, "FaceGenerator : primary road generation..." );
+ createInitialGraph( );
- size_t rem = graph.removeDeadEnds( );
- Logger.log( 3, "FaceGenerator : removed %d dead ends.", rem );
+ size_t branching = 3;
+ float segmentLength = 400.0f;
+ float noiseValue = 0.1f;
+ float roadThreshold = 300.0f;
-///////////////////////////////////////
+ growRoadNetwork( &graph, branching, segmentLength, noiseValue, roadThreshold );
Logger.log( 2, "FaceGenerator : reading primary faces..." );
graph.readFaces( );
@@ -92,35 +92,19 @@
Logger.log( 4, "FaceGenerator : face %s...", faces[i]->toString( ).c_str() );
graph::PlanarGraph* sgraph = faces[i]->initializeSubgraph( );
- // Maybe use random edge instead?
- graph::Node* splitNode = sgraph->splitEdge( sgraph->longestEdge( ) );
- Logger.log( 4, "FaceGenerator : splitnode %s", splitNode->toString( ).c_str() );
-
// This should be parameters, their value is somewhat meaningless now.
size_t branching = 3;
float segmentLength = 70.0f;
float noiseValue = 0.06f;
float roadThreshold = 30.0f;
- float subdivisionThreshold = 10.0f;
- float faceThreshold = 100.0f;
+// float subdivisionThreshold = 10.0f;
+// float faceThreshold = 100.0f;
- // Create initial growing point targeting to the center from
- // the newly created Node at the split edge
- Vector2Df toCenter = ( sgraph->getCenter( ) - splitNode->vector( ) ).norm( );
- Vector2Df newCoord = splitNode->vector( ) + ( toCenter * segmentLength );
+ growRoadNetwork( sgraph, branching, segmentLength, noiseValue, roadThreshold );
- graph::Node* newNode = sgraph->addNode( new graph::Node( sgraph, newCoord ) );
- sgraph->addConnection( splitNode, newNode );
-
- Logger.log( 3, "FaceGenerator : secondary road generation growing roads..." );
- // Now run the recursive road growing on it.
- growRoads( newNode, branching, segmentLength, noiseValue, roadThreshold );
- Logger.log( 3, "FaceGenerator : secondary growing roads complete, %d nodes and %d edges ", sgraph->nodeCount(), sgraph->edgeCount() );
sgraph->readFaces( );
Logger.log( 2, "FaceGenerator : secondary run, face #%d - subdivided to %d faces",i,sgraph->faceCount( ));
- size_t rem = sgraph->removeDeadEnds( );
- Logger.log( 3, "FaceGenerator : removed %d dead ends.", rem );
// pass the faces to subdivision
graph::FaceVector sfaces = sgraph->getFaces();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2008-08-24 18:47:46
|
Revision: 18464
http://bzflag.svn.sourceforge.net/bzflag/?rev=18464&view=rev
Author: JeffM2501
Date: 2008-08-24 18:47:55 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
add the client version to the API player record.
Modified Paths:
--------------
branches/v2_99_shot_branch/include/bzfsAPI.h
branches/v2_99_shot_branch/src/bzfs/bzfsAPI.cxx
Modified: branches/v2_99_shot_branch/include/bzfsAPI.h
===================================================================
--- branches/v2_99_shot_branch/include/bzfsAPI.h 2008-08-24 18:36:57 UTC (rev 18463)
+++ branches/v2_99_shot_branch/include/bzfsAPI.h 2008-08-24 18:47:55 UTC (rev 18464)
@@ -1440,7 +1440,7 @@
bz_eTeamType team;
- float lastUpdateTime;
+ float lastUpdateTime;
bz_PlayerUpdateState lastKnownState;
bz_PlayerUpdateState currentState;
@@ -1450,6 +1450,7 @@
bz_ApiString currentFlag;
bz_APIStringList flagHistory;
+ bz_ApiString clientVersion;
bool spawned;
bool verified;
bool globalUser;
Modified: branches/v2_99_shot_branch/src/bzfs/bzfsAPI.cxx
===================================================================
--- branches/v2_99_shot_branch/src/bzfs/bzfsAPI.cxx 2008-08-24 18:36:57 UTC (rev 18463)
+++ branches/v2_99_shot_branch/src/bzfs/bzfsAPI.cxx 2008-08-24 18:47:55 UTC (rev 18464)
@@ -1142,6 +1142,7 @@
playerRecord->verified=player->accessInfo.isVerified();
playerRecord->globalUser=player->authentication.isGlobal();
+ playerRecord->clientVersion = player->player.getClientVersion();
playerRecord->ipAddress=player->netHandler->getTargetIP();
playerRecord->update();
return playerRecord;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tr...@us...> - 2008-08-24 18:36:47
|
Revision: 18463
http://bzflag.svn.sourceforge.net/bzflag/?rev=18463&view=rev
Author: trepan
Date: 2008-08-24 18:36:57 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
* added the custom LUA_CALLINSINDEX table
Modified Paths:
--------------
branches/trepan/src/other/lua/README_BZFLAG
branches/trepan/src/other/lua/src/lapi.cxx
branches/trepan/src/other/lua/src/ldblib.cxx
branches/trepan/src/other/lua/src/lgc.cxx
branches/trepan/src/other/lua/src/lstate.cxx
branches/trepan/src/other/lua/src/lstate.h
branches/trepan/src/other/lua/src/lua.h
branches/trepan/src/other/lua/src/luaconf.h
Modified: branches/trepan/src/other/lua/README_BZFLAG
===================================================================
--- branches/trepan/src/other/lua/README_BZFLAG 2008-08-24 04:11:35 UTC (rev 18462)
+++ branches/trepan/src/other/lua/README_BZFLAG 2008-08-24 18:36:57 UTC (rev 18463)
@@ -34,6 +34,8 @@
LUA_COMPAT_GFIND
LUA_COMPAT_OPENLIB
+ 7. Added the custom LUA_CALLINSINDEX table (also look for 'callins')
+
* 10. Added the following to lua.h (and associated code)
lua_set_fopen()
lua_set_popen()
Modified: branches/trepan/src/other/lua/src/lapi.cxx
===================================================================
--- branches/trepan/src/other/lua/src/lapi.cxx 2008-08-24 04:11:35 UTC (rev 18462)
+++ branches/trepan/src/other/lua/src/lapi.cxx 2008-08-24 18:36:57 UTC (rev 18463)
@@ -59,6 +59,7 @@
}
else switch (idx) { /* pseudo-indices */
case LUA_REGISTRYINDEX: return registry(L);
+ case LUA_CALLINSINDEX: return callins(L);
case LUA_ENVIRONINDEX: {
Closure *func = curr_func(L);
sethvalue(L, &L->env, func->c.env);
Modified: branches/trepan/src/other/lua/src/ldblib.cxx
===================================================================
--- branches/trepan/src/other/lua/src/ldblib.cxx 2008-08-24 04:11:35 UTC (rev 18462)
+++ branches/trepan/src/other/lua/src/ldblib.cxx 2008-08-24 18:36:57 UTC (rev 18463)
@@ -25,6 +25,12 @@
}
+static int db_getcallins (lua_State *L) {
+ lua_pushvalue(L, LUA_CALLINSINDEX);
+ return 1;
+}
+
+
static int db_getmetatable (lua_State *L) {
luaL_checkany(L, 1);
if (!lua_getmetatable(L, 1)) {
@@ -378,6 +384,7 @@
{"getinfo", db_getinfo},
{"getlocal", db_getlocal},
{"getregistry", db_getregistry},
+ {"getcallins", db_getcallins},
{"getmetatable", db_getmetatable},
{"getupvalue", db_getupvalue},
{"setfenv", db_setfenv},
Modified: branches/trepan/src/other/lua/src/lgc.cxx
===================================================================
--- branches/trepan/src/other/lua/src/lgc.cxx 2008-08-24 04:11:35 UTC (rev 18462)
+++ branches/trepan/src/other/lua/src/lgc.cxx 2008-08-24 18:36:57 UTC (rev 18463)
@@ -507,6 +507,7 @@
/* make global table be traversed before main stack */
markvalue(g, gt(g->mainthread));
markvalue(g, registry(L));
+ markvalue(g, callins(L));
markmt(g);
g->gcstate = GCSpropagate;
}
Modified: branches/trepan/src/other/lua/src/lstate.cxx
===================================================================
--- branches/trepan/src/other/lua/src/lstate.cxx 2008-08-24 04:11:35 UTC (rev 18462)
+++ branches/trepan/src/other/lua/src/lstate.cxx 2008-08-24 18:36:57 UTC (rev 18463)
@@ -71,8 +71,9 @@
global_State *g = G(L);
UNUSED(ud);
stack_init(L, L); /* init stack */
- sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */
+ sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */
sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */
+ sethvalue(L, callins(L), luaH_new(L, 0, 2)); /* callins */
luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */
luaT_init(L);
luaX_init(L);
@@ -164,6 +165,7 @@
g->strt.nuse = 0;
g->strt.hash = NULL;
setnilvalue(registry(L));
+ setnilvalue(callins(L));
luaZ_initbuffer(L, &g->buff);
g->panic = NULL;
g->gcstate = GCSpause;
Modified: branches/trepan/src/other/lua/src/lstate.h
===================================================================
--- branches/trepan/src/other/lua/src/lstate.h 2008-08-24 04:11:35 UTC (rev 18462)
+++ branches/trepan/src/other/lua/src/lstate.h 2008-08-24 18:36:57 UTC (rev 18463)
@@ -24,7 +24,10 @@
/* registry */
#define registry(L) (&G(L)->l_registry)
+/* callins */
+#define callins(L) (&G(L)->l_callins)
+
/* extra stack space to handle TM calls and some other extras */
#define EXTRA_STACK 5
@@ -87,6 +90,7 @@
int gcstepmul; /* GC `granularity' */
lua_CFunction panic; /* to be called in unprotected errors */
TValue l_registry;
+ TValue l_callins;
struct lua_State *mainthread;
UpVal uvhead; /* head of double-linked list of all open upvalues */
struct Table *mt[NUM_TAGS]; /* metatables for basic types */
Modified: branches/trepan/src/other/lua/src/lua.h
===================================================================
--- branches/trepan/src/other/lua/src/lua.h 2008-08-24 04:11:35 UTC (rev 18462)
+++ branches/trepan/src/other/lua/src/lua.h 2008-08-24 18:36:57 UTC (rev 18463)
@@ -34,8 +34,9 @@
** pseudo-indices
*/
#define LUA_REGISTRYINDEX (-10000)
-#define LUA_ENVIRONINDEX (-10001)
-#define LUA_GLOBALSINDEX (-10002)
+#define LUA_CALLINSINDEX (-10001)
+#define LUA_ENVIRONINDEX (-10002)
+#define LUA_GLOBALSINDEX (-10003)
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
Modified: branches/trepan/src/other/lua/src/luaconf.h
===================================================================
--- branches/trepan/src/other/lua/src/luaconf.h 2008-08-24 04:11:35 UTC (rev 18462)
+++ branches/trepan/src/other/lua/src/luaconf.h 2008-08-24 18:36:57 UTC (rev 18463)
@@ -720,7 +720,8 @@
** CHANGE (define) this if you really need that. This value must be
** a multiple of the maximum alignment required for your machine.
*/
-#define LUAI_EXTRASPACE 0
+//BZ#define LUAI_EXTRASPACE 0
+#define LUAI_EXTRASPACE 64
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2008-08-24 04:11:27
|
Revision: 18462
http://bzflag.svn.sourceforge.net/bzflag/?rev=18462&view=rev
Author: JeffM2501
Date: 2008-08-24 04:11:35 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
add a todo with suggested steps for the launcher.
Added Paths:
-----------
trunk/bzflag/tools/BZFSLauncher/Todo.txt
Added: trunk/bzflag/tools/BZFSLauncher/Todo.txt
===================================================================
--- trunk/bzflag/tools/BZFSLauncher/Todo.txt (rev 0)
+++ trunk/bzflag/tools/BZFSLauncher/Todo.txt 2008-08-24 04:11:35 UTC (rev 18462)
@@ -0,0 +1,12 @@
+things to do
+
+1) add a button to bring a simple options page.
+2) add an advanced button to bring up more pages.
+3) call the config maker? port the config maker?
+4) have the option to save the current setup as a config, or batch/sh
+5) have bzfs and bzflag write out the exe locations each time they run, so we know what the last run set of apps are.
+ then if the lancher has no custom paths in it's prefs try to use the last run paths. If only the client has been
+ run, infer the server location from the client and see if it exists.
+
+6) have the option to specify a config.
+7) add the option for a server password
Property changes on: trunk/bzflag/tools/BZFSLauncher/Todo.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2008-08-24 04:04:05
|
Revision: 18461
http://bzflag.svn.sourceforge.net/bzflag/?rev=18461&view=rev
Author: JeffM2501
Date: 2008-08-24 04:04:12 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
welcome to VC8 and .net 2.0. it's cool
Modified Paths:
--------------
trunk/bzflag/tools/BZFSLauncher/BZFSLauncher.csproj
trunk/bzflag/tools/BZFSLauncher/BZFSLauncher.sln
Modified: trunk/bzflag/tools/BZFSLauncher/BZFSLauncher.csproj
===================================================================
--- trunk/bzflag/tools/BZFSLauncher/BZFSLauncher.csproj 2008-08-24 03:08:36 UTC (rev 18460)
+++ trunk/bzflag/tools/BZFSLauncher/BZFSLauncher.csproj 2008-08-24 04:04:12 UTC (rev 18461)
@@ -1,124 +1,114 @@
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.10.3077"
- SchemaVersion = "2.0"
- ProjectGuid = "{44ED819B-A2CA-4C49-A640-15DF6321E137}"
- >
- <Build>
- <Settings
- ApplicationIcon = "App.ico"
- AssemblyKeyContainerName = ""
- AssemblyName = "BZFSLauncher"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "WinExe"
- PreBuildEvent = ""
- PostBuildEvent = ""
- RootNamespace = "BZFSLauncher"
- RunPostBuildEvent = "OnBuildSuccess"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = ""
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "false"
- OutputPath = "bin\Debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "true"
- OutputPath = "bin\Release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
- />
- <Reference
- Name = "System.Drawing"
- AssemblyName = "System.Drawing"
- HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
- />
- <Reference
- Name = "System.Windows.Forms"
- AssemblyName = "System.Windows.Forms"
- HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "App.ico"
- BuildAction = "Content"
- />
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "BZFSPoller.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "frmMain.cs"
- SubType = "Form"
- BuildAction = "Compile"
- />
- <File
- RelPath = "frmMain.resx"
- DependentUpon = "frmMain.cs"
- BuildAction = "EmbeddedResource"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{44ED819B-A2CA-4C49-A640-15DF6321E137}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>App.ico</ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>BZFSLauncher</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>WinExe</OutputType>
+ <RootNamespace>BZFSLauncher</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>bin\Debug\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>bin\Release\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Drawing">
+ <Name>System.Drawing</Name>
+ </Reference>
+ <Reference Include="System.Windows.Forms">
+ <Name>System.Windows.Forms</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="App.ico" />
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="BZFSPoller.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="frmMain.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <EmbeddedResource Include="frmMain.resx">
+ <DependentUpon>frmMain.cs</DependentUpon>
+ </EmbeddedResource>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Modified: trunk/bzflag/tools/BZFSLauncher/BZFSLauncher.sln
===================================================================
--- trunk/bzflag/tools/BZFSLauncher/BZFSLauncher.sln 2008-08-24 03:08:36 UTC (rev 18460)
+++ trunk/bzflag/tools/BZFSLauncher/BZFSLauncher.sln 2008-08-24 04:04:12 UTC (rev 18461)
@@ -1,21 +1,19 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BZFSLauncher", "BZFSLauncher.csproj", "{44ED819B-A2CA-4C49-A640-15DF6321E137}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
EndProject
Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {44ED819B-A2CA-4C49-A640-15DF6321E137}.Debug.ActiveCfg = Debug|.NET
- {44ED819B-A2CA-4C49-A640-15DF6321E137}.Debug.Build.0 = Debug|.NET
- {44ED819B-A2CA-4C49-A640-15DF6321E137}.Release.ActiveCfg = Release|.NET
- {44ED819B-A2CA-4C49-A640-15DF6321E137}.Release.Build.0 = Release|.NET
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {44ED819B-A2CA-4C49-A640-15DF6321E137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {44ED819B-A2CA-4C49-A640-15DF6321E137}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {44ED819B-A2CA-4C49-A640-15DF6321E137}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {44ED819B-A2CA-4C49-A640-15DF6321E137}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
EndGlobal
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tr...@us...> - 2008-08-24 03:08:33
|
Revision: 18460
http://bzflag.svn.sourceforge.net/bzflag/?rev=18460&view=rev
Author: trepan
Date: 2008-08-24 03:08:36 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
* did some gzipping, added some svn:eol-style properties
Modified Paths:
--------------
branches/trepan/src/other/lua/README_BZFLAG
Added Paths:
-----------
branches/trepan/src/other/lua/doc/amazon.gif.gz
branches/trepan/src/other/lua/doc/contents.html.gz
branches/trepan/src/other/lua/doc/cover.png.gz
branches/trepan/src/other/lua/doc/logo.gif.gz
branches/trepan/src/other/lua/doc/lua.1.gz
branches/trepan/src/other/lua/doc/lua.css.gz
branches/trepan/src/other/lua/doc/lua.html.gz
branches/trepan/src/other/lua/doc/luac.1.gz
branches/trepan/src/other/lua/doc/luac.html.gz
branches/trepan/src/other/lua/doc/manual.css.gz
branches/trepan/src/other/lua/doc/manual.html.gz
branches/trepan/src/other/lua/doc/readme.html.gz
branches/trepan/src/other/lua/etc/Makefile.gz
branches/trepan/src/other/lua/etc/README.gz
branches/trepan/src/other/lua/etc/all.c.gz
branches/trepan/src/other/lua/etc/lua.hpp.gz
branches/trepan/src/other/lua/etc/lua.ico.gz
branches/trepan/src/other/lua/etc/lua.pc.gz
branches/trepan/src/other/lua/etc/luavs.bat.gz
branches/trepan/src/other/lua/etc/min.c.gz
branches/trepan/src/other/lua/etc/noparser.c.gz
branches/trepan/src/other/lua/etc/strict.lua.gz
branches/trepan/src/other/lua/src/lua.c.gz
branches/trepan/src/other/lua/src/luac.c.gz
branches/trepan/src/other/lua/test/README.gz
branches/trepan/src/other/lua/test/bisect.lua.gz
branches/trepan/src/other/lua/test/cf.lua.gz
branches/trepan/src/other/lua/test/echo.lua.gz
branches/trepan/src/other/lua/test/env.lua.gz
branches/trepan/src/other/lua/test/factorial.lua.gz
branches/trepan/src/other/lua/test/fib.lua.gz
branches/trepan/src/other/lua/test/fibfor.lua.gz
branches/trepan/src/other/lua/test/globals.lua.gz
branches/trepan/src/other/lua/test/hello.lua.gz
branches/trepan/src/other/lua/test/life.lua.gz
branches/trepan/src/other/lua/test/luac.lua.gz
branches/trepan/src/other/lua/test/printf.lua.gz
branches/trepan/src/other/lua/test/readonly.lua.gz
branches/trepan/src/other/lua/test/sieve.lua.gz
branches/trepan/src/other/lua/test/sort.lua.gz
branches/trepan/src/other/lua/test/table.lua.gz
branches/trepan/src/other/lua/test/trace-calls.lua.gz
branches/trepan/src/other/lua/test/trace-globals.lua.gz
branches/trepan/src/other/lua/test/xd.lua.gz
Removed Paths:
-------------
branches/trepan/src/other/lua/doc/amazon.gif
branches/trepan/src/other/lua/doc/contents.html
branches/trepan/src/other/lua/doc/cover.png
branches/trepan/src/other/lua/doc/logo.gif
branches/trepan/src/other/lua/doc/lua.1
branches/trepan/src/other/lua/doc/lua.css
branches/trepan/src/other/lua/doc/lua.html
branches/trepan/src/other/lua/doc/luac.1
branches/trepan/src/other/lua/doc/luac.html
branches/trepan/src/other/lua/doc/manual.css
branches/trepan/src/other/lua/doc/manual.html
branches/trepan/src/other/lua/doc/readme.html
branches/trepan/src/other/lua/etc/Makefile
branches/trepan/src/other/lua/etc/README
branches/trepan/src/other/lua/etc/all.c
branches/trepan/src/other/lua/etc/lua.hpp
branches/trepan/src/other/lua/etc/lua.ico
branches/trepan/src/other/lua/etc/lua.pc
branches/trepan/src/other/lua/etc/luavs.bat
branches/trepan/src/other/lua/etc/min.c
branches/trepan/src/other/lua/etc/noparser.c
branches/trepan/src/other/lua/etc/strict.lua
branches/trepan/src/other/lua/src/lua.c
branches/trepan/src/other/lua/src/luac.c
branches/trepan/src/other/lua/test/README
branches/trepan/src/other/lua/test/bisect.lua
branches/trepan/src/other/lua/test/cf.lua
branches/trepan/src/other/lua/test/echo.lua
branches/trepan/src/other/lua/test/env.lua
branches/trepan/src/other/lua/test/factorial.lua
branches/trepan/src/other/lua/test/fib.lua
branches/trepan/src/other/lua/test/fibfor.lua
branches/trepan/src/other/lua/test/globals.lua
branches/trepan/src/other/lua/test/hello.lua
branches/trepan/src/other/lua/test/life.lua
branches/trepan/src/other/lua/test/luac.lua
branches/trepan/src/other/lua/test/printf.lua
branches/trepan/src/other/lua/test/readonly.lua
branches/trepan/src/other/lua/test/sieve.lua
branches/trepan/src/other/lua/test/sort.lua
branches/trepan/src/other/lua/test/table.lua
branches/trepan/src/other/lua/test/trace-calls.lua
branches/trepan/src/other/lua/test/trace-globals.lua
branches/trepan/src/other/lua/test/xd.lua
Property Changed:
----------------
branches/trepan/src/other/lua/src/lapi.cxx
branches/trepan/src/other/lua/src/lapi.h
branches/trepan/src/other/lua/src/lauxlib.cxx
branches/trepan/src/other/lua/src/lauxlib.h
branches/trepan/src/other/lua/src/lbaselib.cxx
branches/trepan/src/other/lua/src/lcode.cxx
branches/trepan/src/other/lua/src/lcode.h
branches/trepan/src/other/lua/src/ldblib.cxx
branches/trepan/src/other/lua/src/ldebug.cxx
branches/trepan/src/other/lua/src/ldebug.h
branches/trepan/src/other/lua/src/ldo.cxx
branches/trepan/src/other/lua/src/ldo.h
branches/trepan/src/other/lua/src/ldump.cxx
branches/trepan/src/other/lua/src/lfunc.cxx
branches/trepan/src/other/lua/src/lfunc.h
branches/trepan/src/other/lua/src/lgc.cxx
branches/trepan/src/other/lua/src/lgc.h
branches/trepan/src/other/lua/src/linit.cxx
branches/trepan/src/other/lua/src/liolib.cxx
branches/trepan/src/other/lua/src/llex.cxx
branches/trepan/src/other/lua/src/llex.h
branches/trepan/src/other/lua/src/llimits.h
branches/trepan/src/other/lua/src/lmathlib.cxx
branches/trepan/src/other/lua/src/lmem.cxx
branches/trepan/src/other/lua/src/lmem.h
branches/trepan/src/other/lua/src/loadlib.cxx
branches/trepan/src/other/lua/src/lobject.cxx
branches/trepan/src/other/lua/src/lobject.h
branches/trepan/src/other/lua/src/lopcodes.cxx
branches/trepan/src/other/lua/src/lopcodes.h
branches/trepan/src/other/lua/src/loslib.cxx
branches/trepan/src/other/lua/src/lparser.cxx
branches/trepan/src/other/lua/src/lparser.h
branches/trepan/src/other/lua/src/lstate.cxx
branches/trepan/src/other/lua/src/lstate.h
branches/trepan/src/other/lua/src/lstring.cxx
branches/trepan/src/other/lua/src/lstring.h
branches/trepan/src/other/lua/src/lstrlib.cxx
branches/trepan/src/other/lua/src/ltable.cxx
branches/trepan/src/other/lua/src/ltable.h
branches/trepan/src/other/lua/src/ltablib.cxx
branches/trepan/src/other/lua/src/ltm.cxx
branches/trepan/src/other/lua/src/ltm.h
branches/trepan/src/other/lua/src/lua.h
branches/trepan/src/other/lua/src/luaconf.h
branches/trepan/src/other/lua/src/lualib.h
branches/trepan/src/other/lua/src/lundump.cxx
branches/trepan/src/other/lua/src/lundump.h
branches/trepan/src/other/lua/src/lvm.cxx
branches/trepan/src/other/lua/src/lvm.h
branches/trepan/src/other/lua/src/lzio.cxx
branches/trepan/src/other/lua/src/lzio.h
branches/trepan/src/other/lua/src/print.cxx
Modified: branches/trepan/src/other/lua/README_BZFLAG
===================================================================
--- branches/trepan/src/other/lua/README_BZFLAG 2008-08-23 21:50:07 UTC (rev 18459)
+++ branches/trepan/src/other/lua/README_BZFLAG 2008-08-24 03:08:36 UTC (rev 18460)
@@ -14,20 +14,20 @@
//BZ#define LUA_NUMBER_SCAN "%lf"
#define LUA_NUMBER_SCAN "%f"
- 3. Moved the *.c files to *.cxx for C++ compilation
- (except for lua.c and luac.c)
-
-* 6. GZIP'ed the following files:
+ 3. GZIP'ed the following files:
doc/*
etc/*
test/*
src/lua.c
src/luac.c
+ 4. Moved the *.c files to *.cxx for C++ compilation
+ (except for lua.c and luac.c)
+
5. Changed the return type of lua_toboolean from int to bool to prevent
compiler performance warnings on Visual Studio 2005.
- 9. Undefined (in luaconf.h):
+ 6. Undefined (in luaconf.h):
LUA_COMPAT_VARARG
LUA_COMPAT_MOD
LUA_COMPAT_LSTR
Property changes on: branches/trepan/src/other/lua/doc/amazon.gif.gz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:mergeinfo
+
Deleted: branches/trepan/src/other/lua/doc/contents.html
===================================================================
--- branches/trepan/src/other/lua/doc/contents.html 2008-08-23 21:50:07 UTC (rev 18459)
+++ branches/trepan/src/other/lua/doc/contents.html 2008-08-24 03:08:36 UTC (rev 18460)
@@ -1,499 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<HTML>
-<HEAD>
-<TITLE>Lua 5.1 Reference Manual - contents</TITLE>
-<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
-<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1">
-<STYLE TYPE="text/css">
-ul {
- list-style-type: none ;
- list-style-position: outside ;
-}
-</STYLE>
-</HEAD>
-
-<BODY>
-
-<HR>
-<H1>
-<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="" BORDER=0></A>
-Lua 5.1 Reference Manual
-</H1>
-
-This is an online version of
-<BLOCKQUOTE>
-<A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">
-<IMG SRC="cover.png" ALT="" TITLE="buy from Amazon" BORDER=1 ALIGN="left" HSPACE=12>
-</A>
-<B>Lua 5.1 Reference Manual</B>
-<BR>by R. Ierusalimschy, L. H. de Figueiredo, W. Celes
-<BR>Lua.org, August 2006
-<BR>ISBN 85-903798-3-3
-<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">
-<IMG SRC="amazon.gif" ALT="[Buy from Amazon]" BORDER=0></A>
-<BR CLEAR="all">
-</BLOCKQUOTE>
-<P>
-
-Buy a copy of this book and
-<A HREF="http://www.lua.org/donations.html">help to support</A>
-the Lua project.
-<P>
-
-The reference manual is the official definition of the Lua language.
-For a complete introduction to Lua programming, see the book
-<A HREF="http://www.lua.org/docs.html#books">Programming in Lua</A>.
-<P>
-
-<A HREF="manual.html">start</A>
-·
-<A HREF="#contents">contents</A>
-·
-<A HREF="#index">index</A>
-·
-<A HREF="http://www.lua.org/manual/5.1/pt/">portugu\xEAs</A>
-·
-<A HREF="http://www.lua.org/manual/5.1/es/">espa\xF1ol</A>
-<HR>
-<SMALL>
-Copyright © 2006-2008 Lua.org, PUC-Rio.
-Freely available under the terms of the
-<a href="http://www.lua.org/license.html#5">Lua license</a>.
-</SMALL>
-<P>
-
-<H2><A NAME="contents">Contents</A></H2>
-<UL style="padding: 0">
-<LI><A HREF="manual.html">1 - Introduction</A>
-<P>
-<LI><A HREF="manual.html#2">2 - The Language</A>
-<UL>
-<LI><A HREF="manual.html#2.1">2.1 - Lexical Conventions</A>
-<LI><A HREF="manual.html#2.2">2.2 - Values and Types</A>
-<UL>
-<LI><A HREF="manual.html#2.2.1">2.2.1 - Coercion</A>
-</UL>
-<LI><A HREF="manual.html#2.3">2.3 - Variables</A>
-<LI><A HREF="manual.html#2.4">2.4 - Statements</A>
-<UL>
-<LI><A HREF="manual.html#2.4.1">2.4.1 - Chunks</A>
-<LI><A HREF="manual.html#2.4.2">2.4.2 - Blocks</A>
-<LI><A HREF="manual.html#2.4.3">2.4.3 - Assignment</A>
-<LI><A HREF="manual.html#2.4.4">2.4.4 - Control Structures</A>
-<LI><A HREF="manual.html#2.4.5">2.4.5 - For Statement</A>
-<LI><A HREF="manual.html#2.4.6">2.4.6 - Function Calls as Statements</A>
-<LI><A HREF="manual.html#2.4.7">2.4.7 - Local Declarations</A>
-</UL>
-<LI><A HREF="manual.html#2.5">2.5 - Expressions</A>
-<UL>
-<LI><A HREF="manual.html#2.5.1">2.5.1 - Arithmetic Operators</A>
-<LI><A HREF="manual.html#2.5.2">2.5.2 - Relational Operators</A>
-<LI><A HREF="manual.html#2.5.3">2.5.3 - Logical Operators</A>
-<LI><A HREF="manual.html#2.5.4">2.5.4 - Concatenation</A>
-<LI><A HREF="manual.html#2.5.5">2.5.5 - The Length Operator</A>
-<LI><A HREF="manual.html#2.5.6">2.5.6 - Precedence</A>
-<LI><A HREF="manual.html#2.5.7">2.5.7 - Table Constructors</A>
-<LI><A HREF="manual.html#2.5.8">2.5.8 - Function Calls</A>
-<LI><A HREF="manual.html#2.5.9">2.5.9 - Function Definitions</A>
-</UL>
-<LI><A HREF="manual.html#2.6">2.6 - Visibility Rules</A>
-<LI><A HREF="manual.html#2.7">2.7 - Error Handling</A>
-<LI><A HREF="manual.html#2.8">2.8 - Metatables</A>
-<LI><A HREF="manual.html#2.9">2.9 - Environments</A>
-<LI><A HREF="manual.html#2.10">2.10 - Garbage Collection</A>
-<UL>
-<LI><A HREF="manual.html#2.10.1">2.10.1 - Garbage-Collection Metamethods</A>
-<LI><A HREF="manual.html#2.10.2">2.10.2 - Weak Tables</A>
-</UL>
-<LI><A HREF="manual.html#2.11">2.11 - Coroutines</A>
-</UL>
-<P>
-<LI><A HREF="manual.html#3">3 - The Application Program Interface</A>
-<UL>
-<LI><A HREF="manual.html#3.1">3.1 - The Stack</A>
-<LI><A HREF="manual.html#3.2">3.2 - Stack Size</A>
-<LI><A HREF="manual.html#3.3">3.3 - Pseudo-Indices</A>
-<LI><A HREF="manual.html#3.4">3.4 - C Closures</A>
-<LI><A HREF="manual.html#3.5">3.5 - Registry</A>
-<LI><A HREF="manual.html#3.6">3.6 - Error Handling in C</A>
-<LI><A HREF="manual.html#3.7">3.7 - Functions and Types</A>
-<LI><A HREF="manual.html#3.8">3.8 - The Debug Interface</A>
-</UL>
-<P>
-<LI><A HREF="manual.html#4">4 - The Auxiliary Library</A>
-<UL>
-<LI><A HREF="manual.html#4.1">4.1 - Functions and Types</A>
-</UL>
-<P>
-<LI><A HREF="manual.html#5">5 - Standard Libraries</A>
-<UL>
-<LI><A HREF="manual.html#5.1">5.1 - Basic Functions</A>
-<LI><A HREF="manual.html#5.2">5.2 - Coroutine Manipulation</A>
-<LI><A HREF="manual.html#5.3">5.3 - Modules</A>
-<LI><A HREF="manual.html#5.4">5.4 - String Manipulation</A>
-<UL>
-<LI><A HREF="manual.html#5.4.1">5.4.1 - Patterns</A>
-</UL>
-<LI><A HREF="manual.html#5.5">5.5 - Table Manipulation</A>
-<LI><A HREF="manual.html#5.6">5.6 - Mathematical Functions</A>
-<LI><A HREF="manual.html#5.7">5.7 - Input and Output Facilities</A>
-<LI><A HREF="manual.html#5.8">5.8 - Operating System Facilities</A>
-<LI><A HREF="manual.html#5.9">5.9 - The Debug Library</A>
-</UL>
-<P>
-<LI><A HREF="manual.html#6">6 - Lua Stand-alone</A>
-<P>
-<LI><A HREF="manual.html#7">7 - Incompatibilities with the Previous Version</A>
-<UL>
-<LI><A HREF="manual.html#7.1">7.1 - Changes in the Language</A>
-<LI><A HREF="manual.html#7.2">7.2 - Changes in the Libraries</A>
-<LI><A HREF="manual.html#7.3">7.3 - Changes in the API</A>
-</UL>
-<P>
-<LI><A HREF="manual.html#8">8 - The Complete Syntax of Lua</A>
-</UL>
-
-<H2><A NAME="index">Index</A></H2>
-<TABLE WIDTH="100%">
-<TR VALIGN="top">
-<TD>
-<H3><A NAME="functions">Lua functions</A></H3>
-<A HREF="manual.html#pdf-_G">_G</A><BR>
-<A HREF="manual.html#pdf-_VERSION">_VERSION</A><BR>
-<A HREF="manual.html#pdf-assert">assert</A><BR>
-<A HREF="manual.html#pdf-collectgarbage">collectgarbage</A><BR>
-<A HREF="manual.html#pdf-dofile">dofile</A><BR>
-<A HREF="manual.html#pdf-error">error</A><BR>
-<A HREF="manual.html#pdf-getfenv">getfenv</A><BR>
-<A HREF="manual.html#pdf-getmetatable">getmetatable</A><BR>
-<A HREF="manual.html#pdf-ipairs">ipairs</A><BR>
-<A HREF="manual.html#pdf-load">load</A><BR>
-<A HREF="manual.html#pdf-loadfile">loadfile</A><BR>
-<A HREF="manual.html#pdf-loadstring">loadstring</A><BR>
-<A HREF="manual.html#pdf-module">module</A><BR>
-<A HREF="manual.html#pdf-next">next</A><BR>
-<A HREF="manual.html#pdf-pairs">pairs</A><BR>
-<A HREF="manual.html#pdf-pcall">pcall</A><BR>
-<A HREF="manual.html#pdf-print">print</A><BR>
-<A HREF="manual.html#pdf-rawequal">rawequal</A><BR>
-<A HREF="manual.html#pdf-rawget">rawget</A><BR>
-<A HREF="manual.html#pdf-rawset">rawset</A><BR>
-<A HREF="manual.html#pdf-require">require</A><BR>
-<A HREF="manual.html#pdf-select">select</A><BR>
-<A HREF="manual.html#pdf-setfenv">setfenv</A><BR>
-<A HREF="manual.html#pdf-setmetatable">setmetatable</A><BR>
-<A HREF="manual.html#pdf-tonumber">tonumber</A><BR>
-<A HREF="manual.html#pdf-tostring">tostring</A><BR>
-<A HREF="manual.html#pdf-type">type</A><BR>
-<A HREF="manual.html#pdf-unpack">unpack</A><BR>
-<A HREF="manual.html#pdf-xpcall">xpcall</A><BR>
-<P>
-
-<A HREF="manual.html#pdf-coroutine.create">coroutine.create</A><BR>
-<A HREF="manual.html#pdf-coroutine.resume">coroutine.resume</A><BR>
-<A HREF="manual.html#pdf-coroutine.running">coroutine.running</A><BR>
-<A HREF="manual.html#pdf-coroutine.status">coroutine.status</A><BR>
-<A HREF="manual.html#pdf-coroutine.wrap">coroutine.wrap</A><BR>
-<A HREF="manual.html#pdf-coroutine.yield">coroutine.yield</A><BR>
-<P>
-
-<A HREF="manual.html#pdf-debug.debug">debug.debug</A><BR>
-<A HREF="manual.html#pdf-debug.getfenv">debug.getfenv</A><BR>
-<A HREF="manual.html#pdf-debug.gethook">debug.gethook</A><BR>
-<A HREF="manual.html#pdf-debug.getinfo">debug.getinfo</A><BR>
-<A HREF="manual.html#pdf-debug.getlocal">debug.getlocal</A><BR>
-<A HREF="manual.html#pdf-debug.getmetatable">debug.getmetatable</A><BR>
-<A HREF="manual.html#pdf-debug.getregistry">debug.getregistry</A><BR>
-<A HREF="manual.html#pdf-debug.getupvalue">debug.getupvalue</A><BR>
-<A HREF="manual.html#pdf-debug.setfenv">debug.setfenv</A><BR>
-<A HREF="manual.html#pdf-debug.sethook">debug.sethook</A><BR>
-<A HREF="manual.html#pdf-debug.setlocal">debug.setlocal</A><BR>
-<A HREF="manual.html#pdf-debug.setmetatable">debug.setmetatable</A><BR>
-<A HREF="manual.html#pdf-debug.setupvalue">debug.setupvalue</A><BR>
-<A HREF="manual.html#pdf-debug.traceback">debug.traceback</A><BR>
-
-</TD>
-<TD>
-<H3> </H3>
-<A HREF="manual.html#pdf-file:close">file:close</A><BR>
-<A HREF="manual.html#pdf-file:flush">file:flush</A><BR>
-<A HREF="manual.html#pdf-file:lines">file:lines</A><BR>
-<A HREF="manual.html#pdf-file:read">file:read</A><BR>
-<A HREF="manual.html#pdf-file:seek">file:seek</A><BR>
-<A HREF="manual.html#pdf-file:setvbuf">file:setvbuf</A><BR>
-<A HREF="manual.html#pdf-file:write">file:write</A><BR>
-<P>
-
-<A HREF="manual.html#pdf-io.close">io.close</A><BR>
-<A HREF="manual.html#pdf-io.flush">io.flush</A><BR>
-<A HREF="manual.html#pdf-io.input">io.input</A><BR>
-<A HREF="manual.html#pdf-io.lines">io.lines</A><BR>
-<A HREF="manual.html#pdf-io.open">io.open</A><BR>
-<A HREF="manual.html#pdf-io.output">io.output</A><BR>
-<A HREF="manual.html#pdf-io.popen">io.popen</A><BR>
-<A HREF="manual.html#pdf-io.read">io.read</A><BR>
-<A HREF="manual.html#pdf-io.stderr">io.stderr</A><BR>
-<A HREF="manual.html#pdf-io.stdin">io.stdin</A><BR>
-<A HREF="manual.html#pdf-io.stdout">io.stdout</A><BR>
-<A HREF="manual.html#pdf-io.tmpfile">io.tmpfile</A><BR>
-<A HREF="manual.html#pdf-io.type">io.type</A><BR>
-<A HREF="manual.html#pdf-io.write">io.write</A><BR>
-<P>
-
-<A HREF="manual.html#pdf-math.abs">math.abs</A><BR>
-<A HREF="manual.html#pdf-math.acos">math.acos</A><BR>
-<A HREF="manual.html#pdf-math.asin">math.asin</A><BR>
-<A HREF="manual.html#pdf-math.atan">math.atan</A><BR>
-<A HREF="manual.html#pdf-math.atan2">math.atan2</A><BR>
-<A HREF="manual.html#pdf-math.ceil">math.ceil</A><BR>
-<A HREF="manual.html#pdf-math.cos">math.cos</A><BR>
-<A HREF="manual.html#pdf-math.cosh">math.cosh</A><BR>
-<A HREF="manual.html#pdf-math.deg">math.deg</A><BR>
-<A HREF="manual.html#pdf-math.exp">math.exp</A><BR>
-<A HREF="manual.html#pdf-math.floor">math.floor</A><BR>
-<A HREF="manual.html#pdf-math.fmod">math.fmod</A><BR>
-<A HREF="manual.html#pdf-math.frexp">math.frexp</A><BR>
-<A HREF="manual.html#pdf-math.huge">math.huge</A><BR>
-<A HREF="manual.html#pdf-math.ldexp">math.ldexp</A><BR>
-<A HREF="manual.html#pdf-math.log">math.log</A><BR>
-<A HREF="manual.html#pdf-math.log10">math.log10</A><BR>
-<A HREF="manual.html#pdf-math.max">math.max</A><BR>
-<A HREF="manual.html#pdf-math.min">math.min</A><BR>
-<A HREF="manual.html#pdf-math.modf">math.modf</A><BR>
-<A HREF="manual.html#pdf-math.pi">math.pi</A><BR>
-<A HREF="manual.html#pdf-math.pow">math.pow</A><BR>
-<A HREF="manual.html#pdf-math.rad">math.rad</A><BR>
-<A HREF="manual.html#pdf-math.random">math.random</A><BR>
-<A HREF="manual.html#pdf-math.randomseed">math.randomseed</A><BR>
-<A HREF="manual.html#pdf-math.sin">math.sin</A><BR>
-<A HREF="manual.html#pdf-math.sinh">math.sinh</A><BR>
-<A HREF="manual.html#pdf-math.sqrt">math.sqrt</A><BR>
-<A HREF="manual.html#pdf-math.tan">math.tan</A><BR>
-<A HREF="manual.html#pdf-math.tanh">math.tanh</A><BR>
-<P>
-
-<A HREF="manual.html#pdf-os.clock">os.clock</A><BR>
-<A HREF="manual.html#pdf-os.date">os.date</A><BR>
-<A HREF="manual.html#pdf-os.difftime">os.difftime</A><BR>
-<A HREF="manual.html#pdf-os.execute">os.execute</A><BR>
-<A HREF="manual.html#pdf-os.exit">os.exit</A><BR>
-<A HREF="manual.html#pdf-os.getenv">os.getenv</A><BR>
-<A HREF="manual.html#pdf-os.remove">os.remove</A><BR>
-<A HREF="manual.html#pdf-os.rename">os.rename</A><BR>
-<A HREF="manual.html#pdf-os.setlocale">os.setlocale</A><BR>
-<A HREF="manual.html#pdf-os.time">os.time</A><BR>
-<A HREF="manual.html#pdf-os.tmpname">os.tmpname</A><BR>
-<P>
-
-<A HREF="manual.html#pdf-package.cpath">package.cpath</A><BR>
-<A HREF="manual.html#pdf-package.loaded">package.loaded</A><BR>
-<A HREF="manual.html#pdf-package.loaders">package.loaders</A><BR>
-<A HREF="manual.html#pdf-package.loadlib">package.loadlib</A><BR>
-<A HREF="manual.html#pdf-package.path">package.path</A><BR>
-<A HREF="manual.html#pdf-package.preload">package.preload</A><BR>
-<A HREF="manual.html#pdf-package.seeall">package.seeall</A><BR>
-<P>
-
-<A HREF="manual.html#pdf-string.byte">string.byte</A><BR>
-<A HREF="manual.html#pdf-string.char">string.char</A><BR>
-<A HREF="manual.html#pdf-string.dump">string.dump</A><BR>
-<A HREF="manual.html#pdf-string.find">string.find</A><BR>
-<A HREF="manual.html#pdf-string.format">string.format</A><BR>
-<A HREF="manual.html#pdf-string.gmatch">string.gmatch</A><BR>
-<A HREF="manual.html#pdf-string.gsub">string.gsub</A><BR>
-<A HREF="manual.html#pdf-string.len">string.len</A><BR>
-<A HREF="manual.html#pdf-string.lower">string.lower</A><BR>
-<A HREF="manual.html#pdf-string.match">string.match</A><BR>
-<A HREF="manual.html#pdf-string.rep">string.rep</A><BR>
-<A HREF="manual.html#pdf-string.reverse">string.reverse</A><BR>
-<A HREF="manual.html#pdf-string.sub">string.sub</A><BR>
-<A HREF="manual.html#pdf-string.upper">string.upper</A><BR>
-<P>
-
-<A HREF="manual.html#pdf-table.concat">table.concat</A><BR>
-<A HREF="manual.html#pdf-table.insert">table.insert</A><BR>
-<A HREF="manual.html#pdf-table.maxn">table.maxn</A><BR>
-<A HREF="manual.html#pdf-table.remove">table.remove</A><BR>
-<A HREF="manual.html#pdf-table.sort">table.sort</A><BR>
-
-</TD>
-<TD>
-<H3>C API</H3>
-<A HREF="manual.html#lua_Alloc">lua_Alloc</A><BR>
-<A HREF="manual.html#lua_CFunction">lua_CFunction</A><BR>
-<A HREF="manual.html#lua_Debug">lua_Debug</A><BR>
-<A HREF="manual.html#lua_Hook">lua_Hook</A><BR>
-<A HREF="manual.html#lua_Integer">lua_Integer</A><BR>
-<A HREF="manual.html#lua_Number">lua_Number</A><BR>
-<A HREF="manual.html#lua_Reader">lua_Reader</A><BR>
-<A HREF="manual.html#lua_State">lua_State</A><BR>
-<A HREF="manual.html#lua_Writer">lua_Writer</A><BR>
-<P>
-
-<A HREF="manual.html#lua_atpanic">lua_atpanic</A><BR>
-<A HREF="manual.html#lua_call">lua_call</A><BR>
-<A HREF="manual.html#lua_checkstack">lua_checkstack</A><BR>
-<A HREF="manual.html#lua_close">lua_close</A><BR>
-<A HREF="manual.html#lua_concat">lua_concat</A><BR>
-<A HREF="manual.html#lua_cpcall">lua_cpcall</A><BR>
-<A HREF="manual.html#lua_createtable">lua_createtable</A><BR>
-<A HREF="manual.html#lua_dump">lua_dump</A><BR>
-<A HREF="manual.html#lua_equal">lua_equal</A><BR>
-<A HREF="manual.html#lua_error">lua_error</A><BR>
-<A HREF="manual.html#lua_gc">lua_gc</A><BR>
-<A HREF="manual.html#lua_getallocf">lua_getallocf</A><BR>
-<A HREF="manual.html#lua_getfenv">lua_getfenv</A><BR>
-<A HREF="manual.html#lua_getfield">lua_getfield</A><BR>
-<A HREF="manual.html#lua_getglobal">lua_getglobal</A><BR>
-<A HREF="manual.html#lua_gethook">lua_gethook</A><BR>
-<A HREF="manual.html#lua_gethookcount">lua_gethookcount</A><BR>
-<A HREF="manual.html#lua_gethookmask">lua_gethookmask</A><BR>
-<A HREF="manual.html#lua_getinfo">lua_getinfo</A><BR>
-<A HREF="manual.html#lua_getlocal">lua_getlocal</A><BR>
-<A HREF="manual.html#lua_getmetatable">lua_getmetatable</A><BR>
-<A HREF="manual.html#lua_getstack">lua_getstack</A><BR>
-<A HREF="manual.html#lua_gettable">lua_gettable</A><BR>
-<A HREF="manual.html#lua_gettop">lua_gettop</A><BR>
-<A HREF="manual.html#lua_getupvalue">lua_getupvalue</A><BR>
-<A HREF="manual.html#lua_insert">lua_insert</A><BR>
-<A HREF="manual.html#lua_isboolean">lua_isboolean</A><BR>
-<A HREF="manual.html#lua_iscfunction">lua_iscfunction</A><BR>
-<A HREF="manual.html#lua_isfunction">lua_isfunction</A><BR>
-<A HREF="manual.html#lua_islightuserdata">lua_islightuserdata</A><BR>
-<A HREF="manual.html#lua_isnil">lua_isnil</A><BR>
-<A HREF="manual.html#lua_isnone">lua_isnone</A><BR>
-<A HREF="manual.html#lua_isnoneornil">lua_isnoneornil</A><BR>
-<A HREF="manual.html#lua_isnumber">lua_isnumber</A><BR>
-<A HREF="manual.html#lua_isstring">lua_isstring</A><BR>
-<A HREF="manual.html#lua_istable">lua_istable</A><BR>
-<A HREF="manual.html#lua_isthread">lua_isthread</A><BR>
-<A HREF="manual.html#lua_isuserdata">lua_isuserdata</A><BR>
-<A HREF="manual.html#lua_lessthan">lua_lessthan</A><BR>
-<A HREF="manual.html#lua_load">lua_load</A><BR>
-<A HREF="manual.html#lua_newstate">lua_newstate</A><BR>
-<A HREF="manual.html#lua_newtable">lua_newtable</A><BR>
-<A HREF="manual.html#lua_newthread">lua_newthread</A><BR>
-<A HREF="manual.html#lua_newuserdata">lua_newuserdata</A><BR>
-<A HREF="manual.html#lua_next">lua_next</A><BR>
-<A HREF="manual.html#lua_objlen">lua_objlen</A><BR>
-<A HREF="manual.html#lua_pcall">lua_pcall</A><BR>
-<A HREF="manual.html#lua_pop">lua_pop</A><BR>
-<A HREF="manual.html#lua_pushboolean">lua_pushboolean</A><BR>
-<A HREF="manual.html#lua_pushcclosure">lua_pushcclosure</A><BR>
-<A HREF="manual.html#lua_pushcfunction">lua_pushcfunction</A><BR>
-<A HREF="manual.html#lua_pushfstring">lua_pushfstring</A><BR>
-<A HREF="manual.html#lua_pushinteger">lua_pushinteger</A><BR>
-<A HREF="manual.html#lua_pushlightuserdata">lua_pushlightuserdata</A><BR>
-<A HREF="manual.html#lua_pushliteral">lua_pushliteral</A><BR>
-<A HREF="manual.html#lua_pushlstring">lua_pushlstring</A><BR>
-<A HREF="manual.html#lua_pushnil">lua_pushnil</A><BR>
-<A HREF="manual.html#lua_pushnumber">lua_pushnumber</A><BR>
-<A HREF="manual.html#lua_pushstring">lua_pushstring</A><BR>
-<A HREF="manual.html#lua_pushthread">lua_pushthread</A><BR>
-<A HREF="manual.html#lua_pushvalue">lua_pushvalue</A><BR>
-<A HREF="manual.html#lua_pushvfstring">lua_pushvfstring</A><BR>
-<A HREF="manual.html#lua_rawequal">lua_rawequal</A><BR>
-<A HREF="manual.html#lua_rawget">lua_rawget</A><BR>
-<A HREF="manual.html#lua_rawgeti">lua_rawgeti</A><BR>
-<A HREF="manual.html#lua_rawset">lua_rawset</A><BR>
-<A HREF="manual.html#lua_rawseti">lua_rawseti</A><BR>
-<A HREF="manual.html#lua_register">lua_register</A><BR>
-<A HREF="manual.html#lua_remove">lua_remove</A><BR>
-<A HREF="manual.html#lua_replace">lua_replace</A><BR>
-<A HREF="manual.html#lua_resume">lua_resume</A><BR>
-<A HREF="manual.html#lua_setallocf">lua_setallocf</A><BR>
-<A HREF="manual.html#lua_setfenv">lua_setfenv</A><BR>
-<A HREF="manual.html#lua_setfield">lua_setfield</A><BR>
-<A HREF="manual.html#lua_setglobal">lua_setglobal</A><BR>
-<A HREF="manual.html#lua_sethook">lua_sethook</A><BR>
-<A HREF="manual.html#lua_setlocal">lua_setlocal</A><BR>
-<A HREF="manual.html#lua_setmetatable">lua_setmetatable</A><BR>
-<A HREF="manual.html#lua_settable">lua_settable</A><BR>
-<A HREF="manual.html#lua_settop">lua_settop</A><BR>
-<A HREF="manual.html#lua_setupvalue">lua_setupvalue</A><BR>
-<A HREF="manual.html#lua_status">lua_status</A><BR>
-<A HREF="manual.html#lua_toboolean">lua_toboolean</A><BR>
-<A HREF="manual.html#lua_tocfunction">lua_tocfunction</A><BR>
-<A HREF="manual.html#lua_tointeger">lua_tointeger</A><BR>
-<A HREF="manual.html#lua_tolstring">lua_tolstring</A><BR>
-<A HREF="manual.html#lua_tonumber">lua_tonumber</A><BR>
-<A HREF="manual.html#lua_topointer">lua_topointer</A><BR>
-<A HREF="manual.html#lua_tostring">lua_tostring</A><BR>
-<A HREF="manual.html#lua_tothread">lua_tothread</A><BR>
-<A HREF="manual.html#lua_touserdata">lua_touserdata</A><BR>
-<A HREF="manual.html#lua_type">lua_type</A><BR>
-<A HREF="manual.html#lua_typename">lua_typename</A><BR>
-<A HREF="manual.html#lua_upvalueindex">lua_upvalueindex</A><BR>
-<A HREF="manual.html#lua_xmove">lua_xmove</A><BR>
-<A HREF="manual.html#lua_yield">lua_yield</A><BR>
-
-</TD>
-<TD>
-<H3>auxiliary library</H3>
-<A HREF="manual.html#luaL_Buffer">luaL_Buffer</A><BR>
-<A HREF="manual.html#luaL_Reg">luaL_Reg</A><BR>
-<P>
-
-<A HREF="manual.html#luaL_addchar">luaL_addchar</A><BR>
-<A HREF="manual.html#luaL_addlstring">luaL_addlstring</A><BR>
-<A HREF="manual.html#luaL_addsize">luaL_addsize</A><BR>
-<A HREF="manual.html#luaL_addstring">luaL_addstring</A><BR>
-<A HREF="manual.html#luaL_addvalue">luaL_addvalue</A><BR>
-<A HREF="manual.html#luaL_argcheck">luaL_argcheck</A><BR>
-<A HREF="manual.html#luaL_argerror">luaL_argerror</A><BR>
-<A HREF="manual.html#luaL_buffinit">luaL_buffinit</A><BR>
-<A HREF="manual.html#luaL_callmeta">luaL_callmeta</A><BR>
-<A HREF="manual.html#luaL_checkany">luaL_checkany</A><BR>
-<A HREF="manual.html#luaL_checkint">luaL_checkint</A><BR>
-<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR>
-<A HREF="manual.html#luaL_checklong">luaL_checklong</A><BR>
-<A HREF="manual.html#luaL_checklstring">luaL_checklstring</A><BR>
-<A HREF="manual.html#luaL_checknumber">luaL_checknumber</A><BR>
-<A HREF="manual.html#luaL_checkoption">luaL_checkoption</A><BR>
-<A HREF="manual.html#luaL_checkstack">luaL_checkstack</A><BR>
-<A HREF="manual.html#luaL_checkstring">luaL_checkstring</A><BR>
-<A HREF="manual.html#luaL_checktype">luaL_checktype</A><BR>
-<A HREF="manual.html#luaL_checkudata">luaL_checkudata</A><BR>
-<A HREF="manual.html#luaL_dofile">luaL_dofile</A><BR>
-<A HREF="manual.html#luaL_dostring">luaL_dostring</A><BR>
-<A HREF="manual.html#luaL_error">luaL_error</A><BR>
-<A HREF="manual.html#luaL_getmetafield">luaL_getmetafield</A><BR>
-<A HREF="manual.html#luaL_getmetatable">luaL_getmetatable</A><BR>
-<A HREF="manual.html#luaL_gsub">luaL_gsub</A><BR>
-<A HREF="manual.html#luaL_loadbuffer">luaL_loadbuffer</A><BR>
-<A HREF="manual.html#luaL_loadfile">luaL_loadfile</A><BR>
-<A HREF="manual.html#luaL_loadstring">luaL_loadstring</A><BR>
-<A HREF="manual.html#luaL_newmetatable">luaL_newmetatable</A><BR>
-<A HREF="manual.html#luaL_newstate">luaL_newstate</A><BR>
-<A HREF="manual.html#luaL_openlibs">luaL_openlibs</A><BR>
-<A HREF="manual.html#luaL_optint">luaL_optint</A><BR>
-<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR>
-<A HREF="manual.html#luaL_optlong">luaL_optlong</A><BR>
-<A HREF="manual.html#luaL_optlstring">luaL_optlstring</A><BR>
-<A HREF="manual.html#luaL_optnumber">luaL_optnumber</A><BR>
-<A HREF="manual.html#luaL_optstring">luaL_optstring</A><BR>
-<A HREF="manual.html#luaL_prepbuffer">luaL_prepbuffer</A><BR>
-<A HREF="manual.html#luaL_pushresult">luaL_pushresult</A><BR>
-<A HREF="manual.html#luaL_ref">luaL_ref</A><BR>
-<A HREF="manual.html#luaL_register">luaL_register</A><BR>
-<A HREF="manual.html#luaL_typename">luaL_typename</A><BR>
-<A HREF="manual.html#luaL_typerror">luaL_typerror</A><BR>
-<A HREF="manual.html#luaL_unref">luaL_unref</A><BR>
-<A HREF="manual.html#luaL_where">luaL_where</A><BR>
-
-</TD>
-</TR>
-</TABLE>
-<P>
-
-<HR>
-<SMALL>
-Last update:
-Sat Jan 19 13:24:29 BRST 2008
-</SMALL>
-<!--
-Last change: revised for Lua 5.1.3
--->
-
-</BODY>
-</HTML>
Copied: branches/trepan/src/other/lua/doc/contents.html.gz (from rev 18449, branches/trepan/src/other/lua/doc/contents.html)
===================================================================
--- branches/trepan/src/other/lua/doc/contents.html.gz (rev 0)
+++ branches/trepan/src/other/lua/doc/contents.html.gz 2008-08-24 03:08:36 UTC (rev 18460)
@@ -0,0 +1,34 @@
+\x8B\xA4ͰHcontents.html |
|
From: <tr...@us...> - 2008-08-23 21:49:57
|
Revision: 18459
http://bzflag.svn.sourceforge.net/bzflag/?rev=18459&view=rev
Author: trepan
Date: 2008-08-23 21:50:07 +0000 (Sat, 23 Aug 2008)
Log Message:
-----------
* only initialize roaming mode when required
Modified Paths:
--------------
branches/trepan/src/bzflag/Roaming.cxx
branches/trepan/src/bzflag/playing.cxx
Modified: branches/trepan/src/bzflag/Roaming.cxx
===================================================================
--- branches/trepan/src/bzflag/Roaming.cxx 2008-08-23 20:00:05 UTC (rev 18458)
+++ branches/trepan/src/bzflag/Roaming.cxx 2008-08-23 21:50:07 UTC (rev 18459)
@@ -24,10 +24,12 @@
template <>
Roaming* Singleton<Roaming>::_instance = (Roaming*)0;
-Roaming::Roaming() : view(roamViewDisabled),
- targetManual(-1),
- targetWinner(-1),
- targetFlag(-1) {
+Roaming::Roaming()
+: view(roamViewDisabled)
+, targetManual(-1)
+, targetWinner(-1)
+, targetFlag(-1)
+{
resetCamera();
}
Modified: branches/trepan/src/bzflag/playing.cxx
===================================================================
--- branches/trepan/src/bzflag/playing.cxx 2008-08-23 20:00:05 UTC (rev 18458)
+++ branches/trepan/src/bzflag/playing.cxx 2008-08-23 21:50:07 UTC (rev 18459)
@@ -4718,11 +4718,14 @@
controlPanel->setControlColor(borderColor);
radar->setControlColor(borderColor);
- if ((myTank->getTeam() == ObserverTeam) || devDriving)
- ROAM.setMode(Roaming::roamViewFP);
- // ROAM.resetCamera();
- else
+ if ((myTank->getTeam() == ObserverTeam) || devDriving) {
+ if (ROAM.getMode() == Roaming::roamViewDisabled) {
+ ROAM.setMode(Roaming::roamViewFP);
+ }
+ }
+ else {
ROAM.setMode(Roaming::roamViewDisabled);
+ }
setTankFlags();
@@ -4762,10 +4765,10 @@
fireButton = false;
firstLife = true;
- BZDB.setBool("displayMainFlags", true);
+ BZDB.setBool("displayMainFlags", true);
BZDB.setBool("displayRadarFlags", true);
- BZDB.setBool("displayRadar", true);
- BZDB.setBool("displayConsole", true);
+ BZDB.setBool("displayRadar", true);
+ BZDB.setBool("displayConsole", true);
entered = true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|