Lots of gcc -Wall fixes. The common ones:

- switch() statements don't handle all values in an enum
- missing \n at end of file
- non-virtual destructors in classes containing virtual functions
- order of initializers in constructor initializer lists
... some other stuff (signedness, nested comments, unused variables) as
well.

This was SVN commit r2864.
This commit is contained in:
prefect 2005-10-07 15:24:29 +00:00
parent 8529426fa8
commit 04650efe7a
49 changed files with 121 additions and 66 deletions

View File

@ -57,8 +57,8 @@ CGameView::CGameView(CGame *pGame):
m_ViewZoomSensitivity(256.0f), m_ViewZoomSensitivity(256.0f),
m_ViewZoomSmoothness(0.02f), m_ViewZoomSmoothness(0.02f),
m_ViewSnapSmoothness(0.02f), m_ViewSnapSmoothness(0.02f),
m_CameraPivot(),
m_CameraDelta(), m_CameraDelta(),
m_CameraPivot(),
m_ZoomDelta(0) m_ZoomDelta(0)
{ {
SViewPort vp; SViewPort vp;
@ -626,12 +626,12 @@ Just commented out to make it more obvious it's not in use.
if (g_mouse_y <= 3) if (g_mouse_y <= 3)
m_Camera.m_Orientation.Translate(Up*-1); m_Camera.m_Orientation.Translate(Up*-1);
/*
janwas: grr, plotted the zoom vector on paper twice, but it appears // janwas: grr, plotted the zoom vector on paper twice, but it appears
to be completely wrong. sticking with the FOV hack for now. // to be completely wrong. sticking with the FOV hack for now.
if anyone sees what's wrong, or knows how to correctly implement zoom, // if anyone sees what's wrong, or knows how to correctly implement zoom,
please put this code out of its misery :) // please put this code out of its misery :)
*//*
// RC - added ScEd style zoom in and out (actually moving camera, rather than fudging fov) // RC - added ScEd style zoom in and out (actually moving camera, rather than fudging fov)
float dir=0; float dir=0;

View File

@ -127,7 +127,7 @@ int CMapReader::UnpackTerrain()
// unpack map size // unpack map size
unpacker.UnpackRaw(&m_MapSize, sizeof(m_MapSize)); unpacker.UnpackRaw(&m_MapSize, sizeof(m_MapSize));
// unpack heightmap [600µs] // unpack heightmap [600s]
u32 verticesPerSide = m_MapSize*PATCH_SIZE+1; u32 verticesPerSide = m_MapSize*PATCH_SIZE+1;
m_Heightmap.resize(SQR(verticesPerSide)); m_Heightmap.resize(SQR(verticesPerSide));
unpacker.UnpackRaw(&m_Heightmap[0], SQR(verticesPerSide)*sizeof(u16)); unpacker.UnpackRaw(&m_Heightmap[0], SQR(verticesPerSide)*sizeof(u16));
@ -178,8 +178,8 @@ int CMapReader::ApplyData()
STileDesc* tileptr = &m_Tiles[0]; STileDesc* tileptr = &m_Tiles[0];
for (u32 j=0; j<m_MapSize; j++) { for (u32 j=0; j<m_MapSize; j++) {
for (u32 i=0; i<m_MapSize; i++) { for (u32 i=0; i<m_MapSize; i++) {
for (u32 m=0; m<PATCH_SIZE; m++) { for (u32 m=0; m<(u32)PATCH_SIZE; m++) {
for (u32 k=0; k<PATCH_SIZE; k++) { for (u32 k=0; k<(u32)PATCH_SIZE; k++) {
CMiniPatch& mp = pTerrain->GetPatch(i,j)->m_MiniPatches[m][k]; CMiniPatch& mp = pTerrain->GetPatch(i,j)->m_MiniPatches[m][k];
mp.Tex1 = m_TerrainTextures[tileptr->m_Tex1Index]; mp.Tex1 = m_TerrainTextures[tileptr->m_Tex1Index];

View File

@ -79,8 +79,8 @@ void CMapWriter::EnumTerrainTextures(CTerrain *pTerrain,
u32 mapsize=pTerrain->GetPatchesPerSide(); u32 mapsize=pTerrain->GetPatchesPerSide();
for (u32 j=0;j<mapsize;j++) { for (u32 j=0;j<mapsize;j++) {
for (u32 i=0;i<mapsize;i++) { for (u32 i=0;i<mapsize;i++) {
for (u32 m=0;m<PATCH_SIZE;m++) { for (u32 m=0;m<(u32)PATCH_SIZE;m++) {
for (u32 k=0;k<PATCH_SIZE;k++) { for (u32 k=0;k<(u32)PATCH_SIZE;k++) {
CMiniPatch& mp=pTerrain->GetPatch(i,j)->m_MiniPatches[m][k]; CMiniPatch& mp=pTerrain->GetPatch(i,j)->m_MiniPatches[m][k];
u16 index=u16(GetHandleIndex(mp.Tex1,handles)); u16 index=u16(GetHandleIndex(mp.Tex1,handles));
if (index==0xffff) { if (index==0xffff) {

View File

@ -90,6 +90,7 @@ static bool ParseUsage(CStr temp)
return false; return false;
} }
#if 0 // unused
static GLenum ParseAlphaFunc(CStr temp) static GLenum ParseAlphaFunc(CStr temp)
{ {
temp = temp.LCase().Trim(PS_TRIM_BOTH); temp = temp.LCase().Trim(PS_TRIM_BOTH);
@ -147,6 +148,7 @@ static GLenum ParseBlendFunc(CStr temp)
return GL_NONE; return GL_NONE;
} }
#endif
CMaterialManager::CMaterialManager() CMaterialManager::CMaterialManager()
{ {
@ -190,7 +192,7 @@ CMaterial &CMaterialManager::LoadMaterial(const char *file)
AT(diffuse); AT(diffuse);
AT(ambient); AT(ambient);
AT(specular); AT(specular);
AT(emissive); //AT(emissive);
AT(specularpower); AT(specularpower);
EL(alpha); EL(alpha);

View File

@ -27,7 +27,7 @@
// Constructor // Constructor
CModel::CModel() CModel::CModel()
: m_Flags(0), m_Anim(0), m_AnimTime(0), : m_Flags(0), m_Anim(0), m_AnimTime(0),
m_BoneMatrices(0), m_InvBoneMatrices(0), m_BoneMatricesValid(false), m_BoneMatricesValid(false), m_BoneMatrices(0), m_InvBoneMatrices(0),
m_ShadingColor(1,1,1,1) m_ShadingColor(1,1,1,1)
{ {
} }

View File

@ -15,7 +15,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// CModelDef Constructor // CModelDef Constructor
CModelDef::CModelDef() CModelDef::CModelDef()
: m_pVertices(0), m_NumVertices(0), m_pFaces(0), m_NumFaces(0), m_Bones(0), m_NumBones(0), : m_NumVertices(0), m_pVertices(0), m_NumFaces(0), m_pFaces(0), m_NumBones(0), m_Bones(0),
m_NumPropPoints(0), m_PropPoints(0), m_RenderData(0) m_NumPropPoints(0), m_PropPoints(0), m_RenderData(0)
{ {
} }

View File

@ -34,7 +34,7 @@ bool CObjectBase::Load(const char* filename)
#define EL(x) int el_##x = XeroFile.getElementID(#x) #define EL(x) int el_##x = XeroFile.getElementID(#x)
#define AT(x) int at_##x = XeroFile.getAttributeID(#x) #define AT(x) int at_##x = XeroFile.getAttributeID(#x)
EL(actor); EL(actor);
EL(castshadow); //EL(castshadow);
EL(material); EL(material);
EL(group); EL(group);
EL(variant); EL(variant);

View File

@ -22,8 +22,8 @@
#define LOG_CATEGORY "graphics" #define LOG_CATEGORY "graphics"
CObjectEntry::CObjectEntry(int type, CObjectBase* base) CObjectEntry::CObjectEntry(int type, CObjectBase* base)
: m_Model(NULL), m_Type(type), m_Base(base), m_Color(1.0f, 1.0f, 1.0f, 1.0f), : m_Base(base), m_Color(1.0f, 1.0f, 1.0f, 1.0f),
m_ProjectileModel(NULL), m_AmmunitionPoint(NULL), m_AmmunitionModel(NULL) m_ProjectileModel(NULL), m_AmmunitionModel(NULL), m_AmmunitionPoint(NULL), m_Model(NULL), m_Type(type)
{ {
} }

View File

@ -194,7 +194,7 @@ void CObjectManager::GetAllObjectNames(std::vector<CStr>& names)
struct CObjectThing_Entity : public CObjectThing struct CObjectThing_Entity : public CObjectThing
{ {
CObjectThing_Entity(CBaseEntity* b) : base(b), obj(g_ObjMan.FindObject((CStr)b->m_actorName)), ent(NULL) {} CObjectThing_Entity(CBaseEntity* b) : base(b), ent(NULL), obj(g_ObjMan.FindObject((CStr)b->m_actorName)) {}
~CObjectThing_Entity() {} ~CObjectThing_Entity() {}
CBaseEntity* base; CBaseEntity* base;
CEntity* ent; CEntity* ent;

View File

@ -15,7 +15,7 @@
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// CSkeletonAnimDef constructor // CSkeletonAnimDef constructor
CSkeletonAnimDef::CSkeletonAnimDef() : m_Keys(0), m_NumKeys(0), m_NumFrames(0), m_FrameTime(0) CSkeletonAnimDef::CSkeletonAnimDef() : m_FrameTime(0), m_NumKeys(0), m_NumFrames(0), m_Keys(0)
{ {
} }

View File

@ -85,8 +85,13 @@ void CTerrain::CalcPosition(u32 i,u32 j,CVector3D& pos)
// CalcFromPosition: calculate the vertex underneath the world space position // CalcFromPosition: calculate the vertex underneath the world space position
void CTerrain::CalcFromPosition(CVector3D& pos, u32& i, u32& j) void CTerrain::CalcFromPosition(CVector3D& pos, u32& i, u32& j)
{ {
i = pos.X / CELL_SIZE; float x = pos.X / CELL_SIZE;
j = pos.Z / CELL_SIZE; float z = pos.Z / CELL_SIZE;
debug_assert(x >= 0 && z >= 0);
i = (u32)x;
j = (u32)z;
} }

View File

@ -122,4 +122,4 @@ CUnit* CUnitManager::CreateUnit(CStr& actorName, CEntity* entity)
CUnit* unit = new CUnit(obj, obj->m_Model->Clone(), entity); CUnit* unit = new CUnit(obj, obj->m_Model->Clone(), entity);
AddUnit(unit); AddUnit(unit);
return unit; return unit;
} }

View File

@ -78,8 +78,9 @@ struct SGUIText
struct STextCall struct STextCall
{ {
STextCall() : STextCall() :
m_UseCustomColor(false),
m_Bold(false), m_Italic(false), m_Underlined(false), m_Bold(false), m_Italic(false), m_Underlined(false),
m_UseCustomColor(false), m_pSpriteCall(NULL) {} m_pSpriteCall(NULL) {}
/** /**
* Position * Position

View File

@ -64,4 +64,4 @@ u64 read_be64(const void* p)
#else #else
return SDL_Swap64(*(u64*)p); return SDL_Swap64(*(u64*)p);
#endif #endif
} }

View File

@ -119,6 +119,9 @@ STMT(\
case ER_SUPPRESS:\ case ER_SUPPRESS:\
suppress__ = 0xAA;\ suppress__ = 0xAA;\
break;\ break;\
case ER_CONTINUE:\
break;\
default:\
case ER_BREAK:\ case ER_BREAK:\
debug_break();\ debug_break();\
break;\ break;\
@ -219,7 +222,7 @@ const size_t DBG_FILE_LEN = 100;
// retrieved and stored. // retrieved and stored.
// sym_name and file must hold at least the number of chars above; // sym_name and file must hold at least the number of chars above;
// file is the base name only, not path (see rationale in wdbg_sym). // file is the base name only, not path (see rationale in wdbg_sym).
// the PDB implementation is rather slow (~500µs). // the PDB implementation is rather slow (~500s).
extern int debug_resolve_symbol(void* ptr_of_interest, char* sym_name, char* file, int* line); extern int debug_resolve_symbol(void* ptr_of_interest, char* sym_name, char* file, int* line);
// write a complete stack trace (including values of local variables) into // write a complete stack trace (including values of local variables) into

View File

@ -246,4 +246,4 @@ static void self_test()
RUN_SELF_TEST; RUN_SELF_TEST;
} // namespace test } // namespace test
#endif // #if SELF_TEST_ENABLED #endif // #if SELF_TEST_ENABLED

View File

@ -476,4 +476,4 @@ static void CALL_CONV emulate_glCompressedTexImage2D(
glTexImage2D(target_, level_, uc_int_fmt, w, h, 0, uc_fmt, GL_UNSIGNED_BYTE, uc_data); glTexImage2D(target_, level_, uc_int_fmt, w, h, 0, uc_fmt, GL_UNSIGNED_BYTE, uc_data);
(void)tex_free(&t); (void)tex_free(&t);
} }

View File

@ -956,4 +956,4 @@ int ogl_tex_transform(Handle ht, uint transforms)
CHECK_OGL_TEX(ot); CHECK_OGL_TEX(ot);
int ret = tex_transform(&ot->t, transforms); int ret = tex_transform(&ot->t, transforms);
return ret; return ret;
} }

View File

@ -280,7 +280,7 @@ int tex_codec_register(const TexCodecVTbl* c)
{ {
debug_assert(c != 0 && "tex_codec_register(0) - why?"); debug_assert(c != 0 && "tex_codec_register(0) - why?");
for(int i = 0; i < MAX_CODECS; i++) for(uint i = 0; i < MAX_CODECS; i++)
{ {
// slot available // slot available
if(codecs[i] == 0) if(codecs[i] == 0)
@ -518,7 +518,7 @@ int tex_transform(Tex* t, uint transforms)
CHECK_TEX(t); CHECK_TEX(t);
// find codec that understands the data, and transform // find codec that understands the data, and transform
for(int i = 0; i < MAX_CODECS; i++) for(uint i = 0; i < MAX_CODECS; i++)
{ {
// MAX_CODECS isn't a tight bound and we have hit a 0 entry // MAX_CODECS isn't a tight bound and we have hit a 0 entry
if(!codecs[i]) if(!codecs[i])

View File

@ -224,4 +224,4 @@ extern int snd_update(const float* pos, const float* dir, const float* up);
// call before h_mgr_shutdown. // call before h_mgr_shutdown.
extern void snd_shutdown(); extern void snd_shutdown();
#endif // #ifndef SND_H__ #endif // #ifndef SND_H__

View File

@ -4,6 +4,11 @@
#include "scripting/JSConversions.h" #include "scripting/JSConversions.h"
#include "scripting/ScriptingHost.h" #include "scripting/ScriptingHost.h"
namespace JSI_Vector3D
{
static CVector3D* GetVector( JSContext* cx, JSObject* obj );
}
JSClass JSI_Vector3D::JSI_class = { JSClass JSI_Vector3D::JSI_class = {
"Vector3D", JSCLASS_HAS_PRIVATE, "Vector3D", JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,

View File

@ -21,7 +21,6 @@ namespace JSI_Vector3D
component_y, component_y,
component_z component_z
}; };
static CVector3D* GetVector( JSContext* cx, JSObject* obj );
JSBool toString( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ); JSBool toString( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );
JSBool add( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ); JSBool add( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );
JSBool subtract( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ); JSBool subtract( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );

View File

@ -574,10 +574,10 @@ void CConsole::LoadHistory()
CStr bytes( (char*)buffer, buflen ); CStr bytes( (char*)buffer, buflen );
CStrW str( bytes.FromUTF8() ); CStrW str( bytes.FromUTF8() );
size_t pos = 0; size_t pos = 0;
while( pos != -1 ) while( pos != CStrW::npos )
{ {
pos = str.find( '\n' ); pos = str.find( '\n' );
if( pos != -1 ) if( pos != CStrW::npos )
{ {
if( pos > 0 ) if( pos > 0 )
m_deqBufHistory.push_front( str.Left( str[pos-1] == '\r' ? pos - 1 : pos ) ); m_deqBufHistory.push_front( str.Left( str[pos-1] == '\r' ? pos - 1 : pos ) );

View File

@ -429,7 +429,7 @@ int hotkeyInputHandler( const SDL_Event* ev )
{ {
if( mouse_buttons[keyCode-SDLK_LAST] != rqdState ) accept = false; if( mouse_buttons[keyCode-SDLK_LAST] != rqdState ) accept = false;
} }
else if( keyCode-UNIFIED_SHIFT < ARRAY_SIZE(unified) ) else if( (uint)(keyCode-UNIFIED_SHIFT) < ARRAY_SIZE(unified) )
{ {
if( unified[keyCode-UNIFIED_SHIFT] != rqdState ) accept = false; if( unified[keyCode-UNIFIED_SHIFT] != rqdState ) accept = false;
} }
@ -496,7 +496,7 @@ int hotkeyInputHandler( const SDL_Event* ev )
{ {
if( mouse_buttons[keyCode-SDLK_LAST] != rqdState ) accept = false; if( mouse_buttons[keyCode-SDLK_LAST] != rqdState ) accept = false;
} }
else if( keyCode-UNIFIED_SHIFT < ARRAY_SIZE(unified) ) else if( (uint)(keyCode-UNIFIED_SHIFT) < ARRAY_SIZE(unified) )
{ {
if( unified[keyCode-UNIFIED_SHIFT] != rqdState ) accept = false; if( unified[keyCode-UNIFIED_SHIFT] != rqdState ) accept = false;
} }

View File

@ -1173,4 +1173,4 @@ void CBuildingPlacer::render()
glColor3f(1,1,1); glColor3f(1,1,1);
glVertex3f(pos.X + 3*sin(m_angle), pos.Y, pos.Z + 3*cos(m_angle)); glVertex3f(pos.X + 3*sin(m_angle), pos.Y, pos.Z + 3*cos(m_angle));
glEnd();*/ glEnd();*/
} }

View File

@ -44,7 +44,7 @@ public:
// accessor for character data // accessor for character data
const CharData& chardata(char c) const { const CharData& chardata(char c) const {
debug_assert( !(c&0x80) ); // only allow 7-bit ASCII debug_assert( !(c&0x80) ); // only allow 7-bit ASCII
return _chars[c]; return _chars[(unsigned char)c];
} }
void GetOutputStringSize(const char* str,int& sx,int& sy); void GetOutputStringSize(const char* str,int& sx,int& sy);

View File

@ -318,9 +318,11 @@ bool CNetClient::PreGameHandler(CNetMessage *pMsg, CNetSession *pSession)
} }
HANDLED(pMsg); HANDLED(pMsg);
} }
default:
{
UNHANDLED(pMsg);
}
} }
UNHANDLED(pMsg);
} }
bool CNetClient::InGameHandler(CNetMessage *pMsg, CNetSession *pSession) bool CNetClient::InGameHandler(CNetMessage *pMsg, CNetSession *pSession)
@ -340,6 +342,7 @@ bool CNetClient::InGameHandler(CNetMessage *pMsg, CNetSession *pSession)
switch (msgType) switch (msgType)
{ {
case NMT_EndCommandBatch: case NMT_EndCommandBatch:
{
CEndCommandBatch *msg=(CEndCommandBatch *)pMsg; CEndCommandBatch *msg=(CEndCommandBatch *)pMsg;
pClient->SetTurnLength(1, msg->m_TurnLength); pClient->SetTurnLength(1, msg->m_TurnLength);
@ -356,8 +359,10 @@ bool CNetClient::InGameHandler(CNetMessage *pMsg, CNetSession *pSession)
HANDLED(pMsg); HANDLED(pMsg);
} }
UNHANDLED(pMsg); default:
UNHANDLED(pMsg);
}
} }
bool CNetClient::ChatHandler(CNetMessage *pMsg, CNetSession *pSession) bool CNetClient::ChatHandler(CNetMessage *pMsg, CNetSession *pSession)

View File

@ -14,8 +14,8 @@ CNetLog g_NetLog;
#define LOG_ARGS_SUFFIX #define LOG_ARGS_SUFFIX
CNetLog::CNetLog(): CNetLog::CNetLog():
m_Initialized(false),
m_Flush(true), m_Flush(true),
m_Initialized(false),
m_pFile(NULL) m_pFile(NULL)
{} {}

View File

@ -49,14 +49,14 @@ private:
*/ */
std::vector <CNetServerSession *> m_Observers; std::vector <CNetServerSession *> m_Observers;
uint m_MaxObservers;
int m_LastSessionID;
ENetServerState m_ServerState; ENetServerState m_ServerState;
CGame *m_pGame; CGame *m_pGame;
CGameAttributes *m_pGameAttributes; CGameAttributes *m_pGameAttributes;
uint m_MaxObservers;
int m_LastSessionID;
CPlayer *m_pServerPlayer; CPlayer *m_pServerPlayer;
CStrW m_Password; CStrW m_Password;

View File

@ -53,8 +53,10 @@ bool CNetServerSession::BaseHandler(CNetMessage *pMsg, CNetSession *pNetSession)
LOG(WARNING, LOG_CAT_NET, "CNetServerSession::BaseHandler(): NMT_ERROR: %s", msg->GetString().c_str()); LOG(WARNING, LOG_CAT_NET, "CNetServerSession::BaseHandler(): NMT_ERROR: %s", msg->GetString().c_str());
HANDLED(pMsg); HANDLED(pMsg);
} }
default:
UNHANDLED(pMsg);
} }
UNHANDLED(pMsg);
} }
bool CNetServerSession::HandshakeHandler(CNetMessage *pMsg, CNetSession *pNetSession) bool CNetServerSession::HandshakeHandler(CNetMessage *pMsg, CNetSession *pNetSession)
@ -83,8 +85,10 @@ bool CNetServerSession::HandshakeHandler(CNetMessage *pMsg, CNetSession *pNetSes
HANDLED(pMsg); HANDLED(pMsg);
} }
default:
return BaseHandler(pMsg, pNetSession);
} }
return BaseHandler(pMsg, pNetSession);
} }
bool CNetServerSession::AuthenticateHandler(CNetMessage *pMsg, CNetSession *pNetSession) bool CNetServerSession::AuthenticateHandler(CNetMessage *pMsg, CNetSession *pNetSession)

View File

@ -74,6 +74,8 @@ CSocketAddress::CSocketAddress(int port, ESocketProtocol proto)
memcpy(&m_Union.m_IPv6.sin6_addr, &in6addr_any, sizeof(in6addr_any)); memcpy(&m_Union.m_IPv6.sin6_addr, &in6addr_any, sizeof(in6addr_any));
m_Union.m_IPv6.sin6_port=htons(port); m_Union.m_IPv6.sin6_port=htons(port);
break; break;
default:
debug_warn("CSocketAddress::CSocketAddress: Bad proto");
} }
} }
@ -92,6 +94,8 @@ CSocketAddress CSocketAddress::Loopback(int port, ESocketProtocol proto)
memcpy(&ret.m_Union.m_IPv6.sin6_addr, &in6addr_loopback, sizeof(in6addr_loopback)); memcpy(&ret.m_Union.m_IPv6.sin6_addr, &in6addr_loopback, sizeof(in6addr_loopback));
ret.m_Union.m_IPv6.sin6_port=htons(port); ret.m_Union.m_IPv6.sin6_port=htons(port);
break; break;
default:
debug_warn("CSocketAddress::CSocketAddress: Bad proto");
} }
return ret; return ret;
} }

View File

@ -47,14 +47,14 @@ bool CColor::ParseString(const CStr& Value, float DefaultAlpha)
} }
COverlay::COverlay() COverlay::COverlay()
: m_Rect(CRect(0.f,0.f,0.f,0.f)), m_Z(0), m_Color(CColor(0,0,0,0)), m_Texture(""), m_HasBorder(false), m_BorderColor(CColor(0,0,0,0)) : m_Rect(CRect(0.f,0.f,0.f,0.f)), m_Z(0), m_Texture(""), m_Color(CColor(0,0,0,0)), m_HasBorder(false), m_BorderColor(CColor(0,0,0,0))
{ {
} }
COverlay::COverlay(const CRect& rect,int z,const CColor& color,const char* texturename, COverlay::COverlay(const CRect& rect,int z,const CColor& color,const char* texturename,
bool hasBorder,const CColor& bordercolor) bool hasBorder,const CColor& bordercolor)
: m_Rect(rect), m_Z(z), m_Color(color), m_Texture(texturename), m_HasBorder(hasBorder), m_BorderColor(bordercolor) : m_Rect(rect), m_Z(z), m_Texture(texturename), m_Color(color), m_HasBorder(hasBorder), m_BorderColor(bordercolor)
{ {
} }

View File

@ -17,7 +17,7 @@ COverlayText::COverlayText()
COverlayText::COverlayText(float x,float y,int z,const char* fontname,const char* string,const CColor& color) COverlayText::COverlayText(float x,float y,int z,const char* fontname,const char* string,const CColor& color)
: m_X(x), m_Y(y), m_Z(z), m_String(string), m_Color(color) : m_X(x), m_Y(y), m_Z(z), m_Color(color), m_String(string)
{ {
m_Font=NPFontManager::instance().add(fontname); m_Font=NPFontManager::instance().add(fontname);
} }

View File

@ -4,7 +4,10 @@
#include "lib.h" #include "lib.h"
#include "self_test.h" #include "self_test.h"
#if MSC_VERSION
#pragma warning(disable:4786) #pragma warning(disable:4786)
#endif
using namespace std; using namespace std;
//------------------------------------------------- //-------------------------------------------------
@ -833,7 +836,7 @@ bool CParser::InputTaskType(const string& strName, const string& strSyntax)
// Loop through the string and construct nodes in the binary tree // Loop through the string and construct nodes in the binary tree
// when applicable // when applicable
for (i=0; i<(int)strSyntax.size(); ++i) for (i=0; i<strSyntax.size(); ++i)
{ {
// Extract is a variable that is true when we want to extract // Extract is a variable that is true when we want to extract
// parts that is longer than one character. // parts that is longer than one character.

View File

@ -27,7 +27,9 @@ will exist, and it's up to the system to figure out which one acquired.
#include "Pyrogenesis.h" #include "Pyrogenesis.h"
#if MSC_VERSION
#pragma warning(disable:4786) #pragma warning(disable:4786)
#endif
//-------------------------------------------------------- //--------------------------------------------------------
// Includes / Compiler directives // Includes / Compiler directives

View File

@ -2,4 +2,4 @@ extern void WriteSystemInfo();
extern const wchar_t* ErrorString(int err); extern const wchar_t* ErrorString(int err);
extern void WriteScreenshot(const char* extension); extern void WriteScreenshot(const char* extension);

View File

@ -13,7 +13,7 @@
enum { EL_ATTR, EL_TEXT, EL_SUBEL }; enum { EL_ATTR, EL_TEXT, EL_SUBEL };
XMLWriter_File::XMLWriter_File(const char* encoding) XMLWriter_File::XMLWriter_File(const char* encoding)
: m_LastElement(NULL), m_Indent(0) : m_Indent(0), m_LastElement(NULL)
{ {
m_Data = "<?xml version=\"1.0\" encoding=\""; m_Data = "<?xml version=\"1.0\" encoding=\"";
m_Data += encoding; m_Data += encoding;

View File

@ -98,7 +98,7 @@ typedef struct XMLElement {
class XeroHandler : public DefaultHandler class XeroHandler : public DefaultHandler
{ {
public: public:
XeroHandler() : Root(NULL), m_locator(NULL) {} XeroHandler() : m_locator(NULL), Root(NULL) {}
~XeroHandler() ~XeroHandler()
{ {
if (Root) if (Root)

View File

@ -46,7 +46,7 @@ static SColor4ub ConvertColor(const RGBColor& src)
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
// CPatchRData constructor // CPatchRData constructor
CPatchRData::CPatchRData(CPatch* patch) : m_Patch(patch), m_Vertices(0), m_VBBase(0), m_VBBlends(0) CPatchRData::CPatchRData(CPatch* patch) : m_Patch(patch), m_VBBase(0), m_VBBlends(0), m_Vertices(0)
{ {
debug_assert(patch); debug_assert(patch);
Build(); Build();
@ -516,9 +516,9 @@ void CPatchRData::RenderStreamsAll(u32 streamflags)
void CPatchRData::RenderOutline() void CPatchRData::RenderOutline()
{ {
uint i; int i;
uint vsize=PATCH_SIZE+1; uint vsize=PATCH_SIZE+1;
u8* base=m_VBBase->m_Owner->Bind(); u8* base=m_VBBase->m_Owner->Bind(); //TODO: this makes no sense, get rid of it
UNUSED2(base); UNUSED2(base);
glBegin(GL_LINES); glBegin(GL_LINES);

View File

@ -219,6 +219,12 @@ void CRenderer::SetOptionBool(enum Option opt,bool value)
case OPT_SHADOWS: case OPT_SHADOWS:
m_Options.m_Shadows=value; m_Options.m_Shadows=value;
break; break;
case OPT_NOPBUFFER:
// NOT IMPLEMENTED
break;
default:
debug_warn("CRenderer::SetOptionBool: unknown option");
break;
} }
} }
@ -231,6 +237,9 @@ bool CRenderer::GetOptionBool(enum Option opt) const
return m_Options.m_NoVBO; return m_Options.m_NoVBO;
case OPT_SHADOWS: case OPT_SHADOWS:
return m_Options.m_Shadows; return m_Options.m_Shadows;
default:
debug_warn("CRenderer::GetOptionBool: unknown option");
break;
} }
return false; return false;
@ -244,6 +253,9 @@ void CRenderer::SetOptionColor(enum Option opt,const RGBAColor& value)
case OPT_SHADOWCOLOR: case OPT_SHADOWCOLOR:
m_Options.m_ShadowColor=value; m_Options.m_ShadowColor=value;
break; break;
default:
debug_warn("CRenderer::SetOptionColor: unknown option");
break;
} }
} }
@ -254,6 +266,9 @@ void CRenderer::SetOptionFloat(enum Option opt, float val)
case OPT_LODBIAS: case OPT_LODBIAS:
m_Options.m_LodBias = val; m_Options.m_LodBias = val;
break; break;
default:
debug_warn("CRenderer::SetOptionFloat: unknown option");
break;
} }
} }
@ -266,6 +281,9 @@ const RGBAColor& CRenderer::GetOptionColor(enum Option opt) const
switch (opt) { switch (opt) {
case OPT_SHADOWCOLOR: case OPT_SHADOWCOLOR:
return m_Options.m_ShadowColor; return m_Options.m_ShadowColor;
default:
debug_warn("CRenderer::GetOptionColor: unknown option");
break;
} }
return defaultColor; return defaultColor;

View File

@ -31,7 +31,7 @@ void CVertexBuffer::Shutdown()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// CVertexBuffer constructor // CVertexBuffer constructor
CVertexBuffer::CVertexBuffer(size_t vertexSize,bool dynamic) CVertexBuffer::CVertexBuffer(size_t vertexSize,bool dynamic)
: m_VertexSize(vertexSize), m_Dynamic(dynamic), m_SysMem(0), m_Handle(0) : m_VertexSize(vertexSize), m_Handle(0), m_SysMem(0), m_Dynamic(dynamic)
{ {
size_t size = MAX_VB_SIZE_BYTES; size_t size = MAX_VB_SIZE_BYTES;

View File

@ -40,7 +40,7 @@ public:
before = NULL; before = NULL;
after = NULL; after = NULL;
} }
~IEventTarget(); virtual ~IEventTarget();
// Set target that will receive each event after it is processed. // Set target that will receive each event after it is processed.
// unused // unused
inline void SetPriorObject( IEventTarget* obj ) inline void SetPriorObject( IEventTarget* obj )

View File

@ -32,7 +32,7 @@ enum EEventType
}; };
// Only used for entity events... (adds them as a property) // Only used for entity events... (adds them as a property)
static const wchar_t* EventNames[EVENT_LAST] = static const wchar_t* const EventNames[EVENT_LAST] =
{ {
/* EVENT_INITIALIZE */ L"onInitialize", /* EVENT_INITIALIZE */ L"onInitialize",
/* EVENT_TICK */ L"onTick", /* EVENT_TICK */ L"onTick",

View File

@ -72,6 +72,9 @@ public:
// Objects that inherit from this // Objects that inherit from this
InheritorsList m_Inheritors; InheritorsList m_Inheritors;
// Destructor
virtual ~IJSComplex() { }
// Set the base, and rebuild // Set the base, and rebuild
void SetBase( IJSComplex* m_Parent ); void SetBase( IJSComplex* m_Parent );

View File

@ -13,8 +13,6 @@
#define ALLOW_NONSHARED_NATIVES #define ALLOW_NONSHARED_NATIVES
static int pcount = 0;
class IJSObject; class IJSObject;
class IJSProperty class IJSProperty

View File

@ -122,6 +122,8 @@ struct CSynchedJSObjectBase
SynchedPropertyTable m_SynchedProperties; SynchedPropertyTable m_SynchedProperties;
protected: protected:
virtual ~CSynchedJSObjectBase() { }
// Called every time a property changes. // Called every time a property changes.
// This is where the individual callbacks are dispatched from. // This is where the individual callbacks are dispatched from.
virtual void Update(CStrW name, ISynchedJSProperty *prop)=0; virtual void Update(CStrW name, ISynchedJSProperty *prop)=0;

View File

@ -91,6 +91,7 @@ protected:
public: public:
CTurnManager(); CTurnManager();
virtual ~CTurnManager() { }
void Initialize(size_t numClients); void Initialize(size_t numClients);

View File

@ -51,7 +51,7 @@ private:
SOggFile memFile; SOggFile memFile;
Handle hf; Handle hf;
/*
struct IOSlot struct IOSlot
{ {
ALuint al_buffer; ALuint al_buffer;

View File

@ -137,4 +137,4 @@ const bool NOMERGE = false;
} }
#endif #endif