Attached Files |
-
various_fixes.patch (6,789 bytes) 2007-03-05 19:21
Index: rts/Game/PreGame.cpp
===================================================================
--- rts/Game/PreGame.cpp (revision 3456)
+++ rts/Game/PreGame.cpp (working copy)
@@ -109,6 +109,8 @@
CPreGame::~CPreGame()
{
+ delete infoConsole;
+ infoConsole = 0;
}
int CPreGame::KeyPressed(unsigned short k,bool isRepeat)
Index: rts/Rendering/glFont.cpp
===================================================================
--- rts/Rendering/glFont.cpp (revision 3456)
+++ rts/Rendering/glFont.cpp (working copy)
@@ -207,7 +207,7 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
glTexImage2D(GL_TEXTURE_2D,
- 0, GL_RGBA,
+ 0, 2,
texsize, texsize, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, tex);
charWidths[ch - charstart] = g->advance_x / 2 / texsize;
Index: rts/Sim/MoveTypes/groundmovetype.cpp
===================================================================
--- rts/Sim/MoveTypes/groundmovetype.cpp (revision 3456)
+++ rts/Sim/MoveTypes/groundmovetype.cpp (working copy)
@@ -107,7 +107,7 @@
const float MINIMUM_SPEED = 0.01f; //Minimum speed a unit may move in.
static const bool DEBUG_CONTROLLER=false;
-std::vector<int2> CGroundMoveType::lineTable[11][11];
+std::vector<int2> (*CGroundMoveType::lineTable)[11] = 0;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -1286,6 +1286,8 @@
//creates the tables used to see if we should advance to next pathfinding waypoint
void CGroundMoveType::CreateLineTable(void)
{
+ lineTable = new std::vector<int2>[11][11];
+
for(int yt=0;yt<11;++yt){
for(int xt=0;xt<11;++xt){
float3 start(0.5f,0,0.5f);
@@ -1343,6 +1345,12 @@
}
}
+void CGroundMoveType::DeleteLineTable(void)
+{
+ delete [] lineTable;
+ lineTable = 0;
+}
+
void CGroundMoveType::TestNewTerrainSquare(void)
{
int newMoveSquareX=(int)owner->pos.x / (SQUARE_SIZE*2); //first make sure we dont go into any terrain we cant get out of
Index: rts/Sim/MoveTypes/groundmovetype.h
===================================================================
--- rts/Sim/MoveTypes/groundmovetype.h (revision 3456)
+++ rts/Sim/MoveTypes/groundmovetype.h (working copy)
@@ -120,7 +120,7 @@
bool CheckColH(int x, int y1, int y2, float xmove, int squareTestX);
bool CheckColV(int y, int x1, int x2, float zmove, int squareTestY);
- static std::vector<int2> lineTable[11][11];
+ static std::vector<int2> (*lineTable)[11];
float3 mainHeadingPos;
bool useMainHeading;
@@ -128,6 +128,7 @@
public:
static void CreateLineTable(void);
+ static void DeleteLineTable(void);
void TestNewTerrainSquare(void);
bool CheckGoalFeasability(void);
virtual void LeaveTransport(void);
Index: rts/Sim/Path/PathEstimator.cpp
===================================================================
--- rts/Sim/Path/PathEstimator.cpp (revision 3456)
+++ rts/Sim/Path/PathEstimator.cpp (working copy)
@@ -701,7 +701,7 @@
char hashString[50];
sprintf(hashString,"%u",hash);
- string filename = string("maps/paths/") + stupidGlobalMapname.substr(0, stupidGlobalMapname.find('.') + 1) + hashString + "." + name + ".zip";
+ string filename = string("maps/paths/") + stupidGlobalMapname.substr(0, stupidGlobalMapname.find_last_of('.') + 1) + hashString + "." + name + ".zip";
zipFile file;
// open file for writing in a suitable location
Index: rts/Sim/Units/CommandAI/TransportCAI.cpp
===================================================================
--- rts/Sim/Units/CommandAI/TransportCAI.cpp (revision 3456)
+++ rts/Sim/Units/CommandAI/TransportCAI.cpp (working copy)
@@ -86,26 +86,18 @@
}
CUnit* unit=uh->units[(int)c.params[0]];
if(c.options & INTERNAL_ORDER) {
- if(unit->commandAI->commandQue.size() == 0 && !LoadStillValid(unit)){
+ if(!LoadStillValid(unit)){
FinishCommand();
return;
- } else {
- Command currentUnitCommand = unit->commandAI->commandQue[0];
- if(currentUnitCommand.id == CMD_LOAD_ONTO
- && currentUnitCommand.params.size() == 1
- && int(currentUnitCommand.params[0]) == owner->id)
- {
- if((unit->moveType->progressState == CMoveType::Failed)
- && (owner->moveType->progressState == CMoveType::Failed))
- {
+ }
+ if(!unit->commandAI->commandQue.empty()){
+ Command & currentUnitCommand = unit->commandAI->commandQue[0];
+ if(currentUnitCommand.id == CMD_LOAD_ONTO && currentUnitCommand.params.size() == 1 && int(currentUnitCommand.params[0]) == owner->id){
+ if((unit->moveType->progressState == CMoveType::Failed) && (owner->moveType->progressState == CMoveType::Failed)){
unit->commandAI->FinishCommand();
FinishCommand();
return;
}
- } else if(!LoadStillValid(unit))
- {
- FinishCommand();
- return;
}
}
}
Index: rts/Sim/Units/UnitLoader.cpp
===================================================================
--- rts/Sim/Units/UnitLoader.cpp (revision 3456)
+++ rts/Sim/Units/UnitLoader.cpp (working copy)
@@ -61,6 +61,7 @@
CUnitLoader::~CUnitLoader()
{
+ CGroundMoveType::DeleteLineTable();
}
CUnit* CUnitLoader::LoadUnit(const string& name, float3 pos, int side, bool build, int facing)
Index: rts/Sim/Units/UnitTracker.cpp
===================================================================
--- rts/Sim/Units/UnitTracker.cpp (revision 3456)
+++ rts/Sim/Units/UnitTracker.cpp (working copy)
@@ -37,7 +37,7 @@
oldCamDir(1,0,0)
{
for (int a = 0; a < 32; ++a) {
- oldUp[a]=UpVector;
+ oldUp[a]=float3(0,1,0);
}
}
Index: rts/System/float3.h
===================================================================
--- rts/System/float3.h (revision 3456)
+++ rts/System/float3.h (working copy)
@@ -335,14 +335,14 @@
}
/**
- * @brief distance2D between float3s (only x and y)
+ * @brief distance2D between float3s (only x and z)
* @param f float3 to compare against
* @return 2D distance between float3s
*
* Calculates the distance between this float3
* and another float3 2-dimensionally (that is,
- * only using the x and y components). Sums the
- * differences in the x and y components, square
+ * only using the x and z components). Sums the
+ * differences in the x and z components, square
* root for pythagorean theorem
*/
inline float distance2D(const float3 &f) const{
Index: rts/System/Object.cpp
===================================================================
--- rts/System/Object.cpp (revision 3456)
+++ rts/System/Object.cpp (working copy)
@@ -12,7 +12,7 @@
CR_MEMBER(listening),
CR_MEMBER(listeners)));
-CObject* CObject::syncedObjects;
+CObject* CObject::syncedObjects = 0;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
-
various_fixes_v2.patch (6,856 bytes) 2007-03-06 14:35
Index: rts/Game/PreGame.cpp
===================================================================
--- rts/Game/PreGame.cpp (revision 3456)
+++ rts/Game/PreGame.cpp (working copy)
@@ -109,6 +109,8 @@
CPreGame::~CPreGame()
{
+ delete infoConsole;
+ infoConsole = 0;
}
int CPreGame::KeyPressed(unsigned short k,bool isRepeat)
Index: rts/Rendering/glFont.cpp
===================================================================
--- rts/Rendering/glFont.cpp (revision 3456)
+++ rts/Rendering/glFont.cpp (working copy)
@@ -207,7 +207,7 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
glTexImage2D(GL_TEXTURE_2D,
- 0, GL_RGBA,
+ 0, 2,
texsize, texsize, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, tex);
charWidths[ch - charstart] = g->advance_x / 2 / texsize;
Index: rts/Sim/MoveTypes/groundmovetype.cpp
===================================================================
--- rts/Sim/MoveTypes/groundmovetype.cpp (revision 3456)
+++ rts/Sim/MoveTypes/groundmovetype.cpp (working copy)
@@ -107,7 +107,7 @@
const float MINIMUM_SPEED = 0.01f; //Minimum speed a unit may move in.
static const bool DEBUG_CONTROLLER=false;
-std::vector<int2> CGroundMoveType::lineTable[11][11];
+std::vector<int2> (*CGroundMoveType::lineTable)[11] = 0;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -1286,6 +1286,8 @@
//creates the tables used to see if we should advance to next pathfinding waypoint
void CGroundMoveType::CreateLineTable(void)
{
+ lineTable = new std::vector<int2>[11][11];
+
for(int yt=0;yt<11;++yt){
for(int xt=0;xt<11;++xt){
float3 start(0.5f,0,0.5f);
@@ -1343,6 +1345,12 @@
}
}
+void CGroundMoveType::DeleteLineTable(void)
+{
+ delete [] lineTable;
+ lineTable = 0;
+}
+
void CGroundMoveType::TestNewTerrainSquare(void)
{
int newMoveSquareX=(int)owner->pos.x / (SQUARE_SIZE*2); //first make sure we dont go into any terrain we cant get out of
Index: rts/Sim/MoveTypes/groundmovetype.h
===================================================================
--- rts/Sim/MoveTypes/groundmovetype.h (revision 3456)
+++ rts/Sim/MoveTypes/groundmovetype.h (working copy)
@@ -120,7 +120,7 @@
bool CheckColH(int x, int y1, int y2, float xmove, int squareTestX);
bool CheckColV(int y, int x1, int x2, float zmove, int squareTestY);
- static std::vector<int2> lineTable[11][11];
+ static std::vector<int2> (*lineTable)[11];
float3 mainHeadingPos;
bool useMainHeading;
@@ -128,6 +128,7 @@
public:
static void CreateLineTable(void);
+ static void DeleteLineTable(void);
void TestNewTerrainSquare(void);
bool CheckGoalFeasability(void);
virtual void LeaveTransport(void);
Index: rts/Sim/Path/PathEstimator.cpp
===================================================================
--- rts/Sim/Path/PathEstimator.cpp (revision 3456)
+++ rts/Sim/Path/PathEstimator.cpp (working copy)
@@ -701,7 +701,7 @@
char hashString[50];
sprintf(hashString,"%u",hash);
- string filename = string("maps/paths/") + stupidGlobalMapname.substr(0, stupidGlobalMapname.find('.') + 1) + hashString + "." + name + ".zip";
+ string filename = string("maps/paths/") + stupidGlobalMapname.substr(0, stupidGlobalMapname.find_last_of('.') + 1) + hashString + "." + name + ".zip";
zipFile file;
// open file for writing in a suitable location
Index: rts/Sim/Units/CommandAI/TransportCAI.cpp
===================================================================
--- rts/Sim/Units/CommandAI/TransportCAI.cpp (revision 3456)
+++ rts/Sim/Units/CommandAI/TransportCAI.cpp (working copy)
@@ -86,24 +86,20 @@
}
CUnit* unit=uh->units[(int)c.params[0]];
if(c.options & INTERNAL_ORDER) {
- if(unit->commandAI->commandQue.size() == 0 && !LoadStillValid(unit)){
- FinishCommand();
- return;
+ if(unit->commandAI->commandQue.empty()){
+ if(!LoadStillValid(unit)){
+ FinishCommand();
+ return;
+ }
} else {
- Command currentUnitCommand = unit->commandAI->commandQue[0];
- if(currentUnitCommand.id == CMD_LOAD_ONTO
- && currentUnitCommand.params.size() == 1
- && int(currentUnitCommand.params[0]) == owner->id)
- {
- if((unit->moveType->progressState == CMoveType::Failed)
- && (owner->moveType->progressState == CMoveType::Failed))
- {
+ Command & currentUnitCommand = unit->commandAI->commandQue[0];
+ if(currentUnitCommand.id == CMD_LOAD_ONTO && currentUnitCommand.params.size() == 1 && int(currentUnitCommand.params[0]) == owner->id){
+ if((unit->moveType->progressState == CMoveType::Failed) && (owner->moveType->progressState == CMoveType::Failed)){
unit->commandAI->FinishCommand();
FinishCommand();
return;
}
- } else if(!LoadStillValid(unit))
- {
+ } else if(!LoadStillValid(unit)) {
FinishCommand();
return;
}
Index: rts/Sim/Units/UnitLoader.cpp
===================================================================
--- rts/Sim/Units/UnitLoader.cpp (revision 3456)
+++ rts/Sim/Units/UnitLoader.cpp (working copy)
@@ -61,6 +61,7 @@
CUnitLoader::~CUnitLoader()
{
+ CGroundMoveType::DeleteLineTable();
}
CUnit* CUnitLoader::LoadUnit(const string& name, float3 pos, int side, bool build, int facing)
Index: rts/Sim/Units/UnitTracker.cpp
===================================================================
--- rts/Sim/Units/UnitTracker.cpp (revision 3456)
+++ rts/Sim/Units/UnitTracker.cpp (working copy)
@@ -37,7 +37,7 @@
oldCamDir(1,0,0)
{
for (int a = 0; a < 32; ++a) {
- oldUp[a]=UpVector;
+ oldUp[a]=float3(0,1,0);
}
}
Index: rts/System/float3.h
===================================================================
--- rts/System/float3.h (revision 3456)
+++ rts/System/float3.h (working copy)
@@ -335,14 +335,14 @@
}
/**
- * @brief distance2D between float3s (only x and y)
+ * @brief distance2D between float3s (only x and z)
* @param f float3 to compare against
* @return 2D distance between float3s
*
* Calculates the distance between this float3
* and another float3 2-dimensionally (that is,
- * only using the x and y components). Sums the
- * differences in the x and y components, square
+ * only using the x and z components). Sums the
+ * differences in the x and z components, square
* root for pythagorean theorem
*/
inline float distance2D(const float3 &f) const{
Index: rts/System/Object.cpp
===================================================================
--- rts/System/Object.cpp (revision 3456)
+++ rts/System/Object.cpp (working copy)
@@ -12,7 +12,7 @@
CR_MEMBER(listening),
CR_MEMBER(listeners)));
-CObject* CObject::syncedObjects;
+CObject* CObject::syncedObjects = 0;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
|
---|