ClearEntities();
}
-DEntity* DMap::AddEntity( char *classname, int ID ){
+DEntity* DMap::AddEntity( const char *classname, int ID ){
DEntity* newEntity;
if ( ID == -1 ) {
newEntity = new DEntity( classname, m_nNextEntity++ );
void ClearEntities();
DEntity* GetEntityForID( int ID );
-DEntity* AddEntity( char* classname = "worldspawn", int ID = -1 );
+DEntity* AddEntity( const char* classname = "worldspawn", int ID = -1 );
std::list<DEntity*> entityList;
int newHeight = p1->height + p2->height - 1;
if ( newHeight > MAX_PATCH_HEIGHT ) {
- return false;
+ return NULL;
}
DPatch* newPatch = new DPatch();
std::list<DPatch> DPatch::Split(){
std::list<DPatch> patchList;
- int i;
- int x, y;
if ( width >= 5 ) {
std::list<DPatch> patchColList = SplitCols();
}
// plugin name
-char* PLUGIN_NAME = "bobToolz";
+const char* PLUGIN_NAME = "bobToolz";
// commands in the menu
-static char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge";
+static const char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge";
// globals
GtkWidget *g_pRadiantWnd = NULL;
public:
BobToolzPluginDependencies() :
GlobalEntityModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entities" ) ),
+ GlobalEntityClassManagerModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entityclass" ) ),
GlobalShadersModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "shaders" ) ),
GlobalBrushModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "brushtypes" ) ),
- GlobalPatchModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "patchtypes" ) ),
- GlobalEntityClassManagerModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entityclass" ) ){
-}
+ GlobalPatchModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "patchtypes" ) )
+ {}
};
class BobToolzPluginModule : public TypeSystemRef
Data validation Routines
---------------------------------*/
-bool ValidateTextFloat( const char* pData, char* error_title, float* value ){
+bool ValidateTextFloat( const char* pData, const char* error_title, float* value ){
if ( pData ) {
float testNum = (float)atof( pData );
return FALSE;
}
-bool ValidateTextFloatRange( const char* pData, float min, float max, char* error_title, float* value ){
+bool ValidateTextFloatRange( const char* pData, float min, float max, const char* error_title, float* value ){
char error_buffer[256];
sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max );
return FALSE;
}
-bool ValidateTextIntRange( const char* pData, int min, int max, char* error_title, int* value ){
+bool ValidateTextIntRange( const char* pData, int min, int max, const char* error_title, int* value ){
char error_buffer[256];
sprintf( error_buffer, "Please Enter An Integer Between %i and %i", min, max );
return FALSE;
}
-bool ValidateTextInt( const char* pData, char* error_title, int* value ){
+bool ValidateTextInt( const char* pData, const char* error_title, int* value ){
if ( pData ) {
int testNum = atoi( pData );
EMessageBoxReturn ret;
int loop = 1;
- char *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
+ const gchar *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
EMessageBoxReturn ret;
int loop = 1;
- char *text = "Please set a value in the boxes below and press 'OK' to make a chain";
+ const gchar *text = "Please set a value in the boxes below and press 'OK' to make a chain";
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_widget_destroy( window );
return ret;
-}
\ No newline at end of file
+}
std::size_t l = strlen( buf );
char* out = buf2;
- for ( int i = 0 ; i < l ; i++ )
+ for ( std::size_t i = 0 ; i < l ; i++ )
{
if ( buf[i] == '\n' ) {
*out++ = '\r';
int compare( const void *arg1, const void *arg2 ){
- if ( portals.portal[*( (int *)arg1 )].dist > portals.portal[*( (int *)arg2 )].dist ) {
+ if ( portals.portal[*( (const int *)arg1 )].dist > portals.portal[*( (const int *)arg2 )].dist ) {
return -1;
}
- else if ( portals.portal[*( (int *)arg1 )].dist < portals.portal[*( (int *)arg2 )].dist ) {
+ else if ( portals.portal[*( (const int *)arg1 )].dist < portals.portal[*( (const int *)arg2 )].dist ) {
return 1;
}
char *c = def;
unsigned int n;
int dummy1, dummy2;
- int res_cnt, i;
+ int res_cnt = 0, i;
if ( portals.hint_flags ) {
res_cnt = sscanf( def, "%u %d %d %d", &point_count, &dummy1, &dummy2, (int *)&hint );
}
void CPortalsDrawSolidOutline::render( RenderStateFlags state ) const {
- for ( int n = 0; n < portals.portal_count; n++ )
+ for ( unsigned int n = 0; n < portals.portal_count; n++ )
{
if ( portals.lines == 2 && !portals.portal[n].hint ) {
continue;
glBegin( GL_LINE_LOOP );
- for ( int p = 0; p < portals.portal[n].point_count; p++ )
+ for ( unsigned int p = 0; p < portals.portal[n].point_count; p++ )
glVertex3fv( portals.portal[n].inner_point[p].p );
glEnd();
#define CONFIG_SECTION "Configuration"
-int INIGetInt( char *key, int def ){
+int INIGetInt( const char *key, int def ){
char value[1024];
if ( read_var( INIfn.c_str(), CONFIG_SECTION, key, value ) ) {
}
}
-void INISetInt( char *key, int val, char *comment /* = NULL */ ){
+void INISetInt( const char* key, int val, const char* comment /* = NULL */ ){
char s[1000];
if ( comment ) {
void InitInstance();
void SaveConfig();
-int INIGetInt( char *key, int def );
-void INISetInt( char *key, int val, char *comment = 0 );
+int INIGetInt( const char *key, int def );
+void INISetInt( const char *key, int val, const char *comment = 0 );
#define IDOK 1
#define IDCANCEL 2
typedef FreeCaller1<const char*, LoadTextureFile> LoadTextureFileCaller;
-void GetTextures( char* extension ){
+void GetTextures( const char* extension ){
GlobalFileSystem().forEachFile( "textures/", extension, LoadTextureFileCaller(), 0 );
}
* This is useful for popping up 'are you sure you want to quit?'
* type dialogs.
*/
-static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ){
+/*static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ){
return FALSE;
-}
+}*/
/**
* @brief destroy widget if destroy signal is passed to widget
*/
-static void destroy( GtkWidget *widget, gpointer data ){
+/*static void destroy( GtkWidget *widget, gpointer data ){
gtk_widget_destroy( widget );
-}
+}*/
/**
* @brief function for close button to destroy the toplevel widget
*/
-static void close_window( GtkWidget *widget, gpointer data ){
+/*static void close_window( GtkWidget *widget, gpointer data ){
gtk_widget_destroy( gtk_widget_get_toplevel( widget ) );
-}
+}*/
/* =============================== */
class ArchiveFile
{
public:
+virtual ~ArchiveFile(){}
/// \brief Destroys the file object.
virtual void release() = 0;
/// \brief Returns the size of the file data in bytes.
class ArchiveTextFile
{
public:
+virtual ~ArchiveTextFile(){}
/// \brief Destroys the file object.
virtual void release() = 0;
/// \brief Returns the stream associated with this file.
class Visitor
{
public:
+virtual ~Visitor(){}
virtual void visit( const char* name ) = 0;
};
eFilesAndDirectories = 0x03,
};
+virtual ~Archive(){}
/// \brief Destroys the archive object.
/// Any unreleased file object associated with the archive remains valid. */
virtual void release() = 0;
class EntityKeyValue
{
public:
+virtual ~EntityKeyValue(){}
virtual const char* c_str() const = 0;
virtual void assign( const char* other ) = 0;
virtual void attach( const KeyObserver& observer ) = 0;
class Observer
{
public:
+virtual ~Observer(){}
virtual void insert( const char* key, EntityKeyValue& value ) = 0;
virtual void erase( const char* key, EntityKeyValue& value ) = 0;
virtual void clear() { };
class Visitor
{
public:
+virtual ~Visitor(){}
virtual void visit( const char* key, const char* value ) = 0;
};
+virtual ~Entity(){}
virtual const EntityClass& getEntityClass() const = 0;
virtual void forEachKeyValue( Visitor& visitor ) const = 0;
virtual void setKeyValue( const char* key, const char* value ) = 0;
class Image
{
public:
+virtual ~Image(){}
virtual void release() = 0;
virtual byte* getRGBAPixels() const = 0;
virtual unsigned int getWidth() const = 0;
{
public:
STRING_CONSTANT( Name, "MapImporter" );
-
+virtual ~MapImporter() {}
virtual bool importTokens( Tokeniser& tokeniser ) = 0;
};
public:
STRING_CONSTANT( Name, "MapExporter" );
+virtual ~MapExporter() {}
virtual void exportTokens( TokenWriter& writer ) const = 0;
};
STRING_CONSTANT( Name, "map" );
mutable bool wrongFormat;
+virtual ~MapFormat(){}
/// \brief Read a map graph into \p root from \p outputStream, using \p entityTable to create entities.
virtual void readGraph( scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable ) const = 0;
/// \brief Write the map graph obtained by applying \p traverse to \p root into \p outputStream.
class RendererLight
{
public:
+virtual ~RendererLight(){}
virtual Shader* getShader() const = 0;
virtual const AABB& aabb() const = 0;
virtual bool testAABB( const AABB& other ) const = 0;
class LightCullable
{
public:
+virtual ~LightCullable(){}
virtual bool testLight( const RendererLight& light ) const = 0;
virtual void insertLight( const RendererLight& light ){
}
class LightList
{
public:
+virtual ~LightList(){}
virtual void evaluateLights() const = 0;
virtual void lightsChanged() const = 0;
virtual void forEachLight( const RendererLightCallback& callback ) const = 0;
class OpenGLRenderable
{
public:
+virtual ~OpenGLRenderable(){}
virtual void render( RenderStateFlags state ) const = 0;
};
class Shader
{
public:
+virtual ~Shader(){}
virtual void addRenderable( const OpenGLRenderable& renderable, const Matrix4& modelview, const LightList* lights = 0 ) = 0;
virtual void incrementUsed() = 0;
virtual void decrementUsed() = 0;
INTEGER_CONSTANT( Version, 1 );
STRING_CONSTANT( Name, "renderstate" );
+virtual ~ShaderCache(){}
virtual Shader* capture( const char* name ) = 0;
virtual void release( const char* name ) = 0;
/*! Render all Shader objects. */
class Walker
{
public:
+virtual ~Walker(){}
/// \brief Called before traversing the first child-instance of 'instance'. If the return value is false, the children of the current instance are not traversed.
virtual bool pre( const Path& path, Instance& instance ) const = 0;
/// \brief Called after traversing the last child-instance of 'instance'.
}
};
+virtual ~Graph(){}
/// \brief Returns the root-node of the graph.
virtual Node& root() = 0;
/// \brief Sets the root-node of the graph to be 'node'.
class Tokeniser
{
public:
+virtual ~Tokeniser(){}
virtual void release() = 0;
virtual void nextLine() = 0;
virtual const char* getToken() = 0;
class TokenWriter
{
public:
+virtual ~TokenWriter(){}
virtual void release() = 0;
virtual void nextLine() = 0;
virtual void writeToken( const char* token ) = 0;
public:
STRING_CONSTANT( Name, "Selectable" );
+virtual ~Selectable(){}
virtual void setSelected( bool select ) = 0;
virtual bool isSelected() const = 0;
};
class InstanceSelectionObserver
{
public:
+virtual ~InstanceSelectionObserver(){}
virtual void onSelectedChanged( scene::Instance& instance ) = 0;
};
eClip,
};
+virtual ~SelectionSystem(){}
virtual void SetMode( EMode mode ) = 0;
virtual EMode Mode() const = 0;
virtual void SetComponentMode( EComponentMode mode ) = 0;
class Visitor
{
public:
+virtual ~Visitor(){}
virtual void visit( scene::Instance& instance ) const = 0;
};
virtual void foreachSelected( const Visitor& visitor ) const = 0;
class TextInputStream
{
public:
+virtual ~TextInputStream(){}
/// \brief Attempts to read the next \p length characters from the stream to \p buffer.
/// Returns the number of characters actually stored in \p buffer.
virtual std::size_t read( char* buffer, std::size_t length ) = 0;
class TextOutputStream
{
public:
+virtual ~TextOutputStream(){}
/// \brief Attempts to write \p length characters to the stream from \p buffer.
/// Returns the number of characters actually read from \p buffer.
virtual std::size_t write( const char* buffer, std::size_t length ) = 0;
class TexturesCacheObserver
{
public:
+virtual ~TexturesCacheObserver(){}
virtual void unrealise() = 0;
virtual void realise() = 0;
};
public:
INTEGER_CONSTANT( Version, 1 );
STRING_CONSTANT( Name, "textures" );
+virtual ~TexturesCache(){}
virtual LoadImageCallback defaultLoader() const = 0;
virtual Image* loadImage( const char* name ) = 0;
virtual qtexture_t* capture( const char* name ) = 0;
{
public:
STRING_CONSTANT( Name, "ModelSkin" );
+virtual ~ModelSkin(){}
/// \brief Attach an \p observer whose realise() and unrealise() methods will be called when the skin is loaded or unloaded.
virtual void attach( ModuleObserver& observer ) = 0;
/// \brief Detach an \p observer previously-attached by calling \c attach.
{
public:
STRING_CONSTANT( Name, "SkinnedModel" );
+virtual ~SkinnedModel(){}
/// \brief Instructs the skinned model to update its skin.
virtual void skinChanged() = 0;
};
public:
INTEGER_CONSTANT( Version, 1 );
STRING_CONSTANT( Name, "modelskin" );
+virtual ~ModelSkinCache(){}
/// \brief Increments the reference count of and returns a reference to the skin uniquely identified by 'name'.
virtual ModelSkin& capture( const char* name ) = 0;
/// \brief Decrements the reference-count of the skin uniquely identified by 'name'.
virtual void PushState() = 0;
virtual void PopState() = 0;
virtual void SetState( Shader* state, EStyle mode ) = 0;
-virtual const EStyle getStyle() const = 0;
+virtual EStyle getStyle() const = 0;
virtual void Highlight( EHighlightMode mode, bool bEnable = true ) = 0;
virtual void setLights( const LightList& lights ){
}
class WindowObserver
{
public:
+virtual ~WindowObserver(){}
virtual void release() = 0;
virtual void onSizeChanged( int width, int height ) = 0;
virtual void onMouseDown( const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers ) = 0;
GrowFile( m_nPosition + length );
}
- memcpy( (unsigned char*)m_pBuffer + m_nPosition, (unsigned char*)buffer, length );
+ memcpy( (unsigned char*)m_pBuffer + m_nPosition, (const unsigned char*)buffer, length );
m_nPosition += size_type( length );
lNewPos = m_nFileSize + lOff;
}
else{
- return ( position_type ) - 1;
+ return - 1;
}
m_nPosition = lNewPos;
fclose( f );
}
- return true;
+ return ret;
}
int profile_load_int( const char *filename, const char *section, const char *key, int default_value ){
RenderIndex m_prev1;
RenderIndex m_prev2;
-const RenderIndex find_or_insert( const Vertex& vertex ){
+RenderIndex find_or_insert( const Vertex& vertex ){
RenderIndex index = 0;
while ( 1 )
}
else
{
- g_pStrWork = "";
g_pStrWork = new char[1];
g_pStrWork[0] = '\0';
}
}
else
{
- g_pStrWork = "";
g_pStrWork = new char[1];
g_pStrWork[0] = '\0';
}
bool operator >( const char* pStr ) const { return ( m_bIgnoreCase ) ? stricmp( m_pStr, pStr ) > 0 : strcmp( m_pStr, pStr ) > 0; }
char& operator []( std::size_t nIndex ) { return m_pStr[nIndex]; }
const char& operator []( std::size_t nIndex ) const { return m_pStr[nIndex]; }
-const char GetAt( std::size_t nIndex ) { return m_pStr[nIndex]; }
+char GetAt( std::size_t nIndex ) { return m_pStr[nIndex]; }
};
}
-#define RETURN_FALSE_IF_FAIL( expression ) if ( !expression ) {return false; }else
+#define RETURN_FALSE_IF_FAIL( expression ) if ( !expression ) {return false; }
inline void Tokeniser_unexpectedError( Tokeniser& tokeniser, const char* token, const char* expected ){
globalErrorStream() << Unsigned( tokeniser.getLine() ) << ":" << Unsigned( tokeniser.getColumn() ) << ": parse error at '" << ( token != 0 ? token : "#EOF" ) << "': expected '" << expected << "'\n";
class XMLAttrVisitor
{
public:
+virtual ~XMLAttrVisitor(){}
virtual void visit( const char* name, const char* value ) = 0;
};
class XMLElement
{
public:
+virtual ~XMLElement(){}
virtual const char* name() const = 0;
virtual const char* attribute( const char* name ) const = 0;
virtual void forEachAttribute( XMLAttrVisitor& visitor ) const = 0;
{
public:
STRING_CONSTANT( Name, "XMLImporter" );
-
+virtual ~XMLImporter(){}
virtual void pushElement( const XMLElement& element ) = 0;
virtual void popElement( const char* name ) = 0;
};
{
public:
STRING_CONSTANT( Name, "XMLExporter" );
-
+virtual ~XMLExporter(){}
virtual void exportXML( XMLImporter& importer ) = 0;
};
: m_istream( istream ){
}
virtual void exportXML( XMLImporter& importer ){
- bool wellFormed = false;
+ //bool wellFormed = false;
char chars[BUFSIZE];
std::size_t res = m_istream.read( chars, 4 );
}
xmlParseChunk( ctxt, chars, 0, 1 );
- wellFormed = ( ctxt->wellFormed == 1 );
+ //wellFormed = ( ctxt->wellFormed == 1 );
xmlFreeParserCtxt( ctxt );
}
xmlTextWriterStartDocument( writer, NULL, "UTF-8", NULL );
// create the root node with stock and custom elements
- xmlTextWriterStartElement( writer, (xmlChar*)"root" );
- xmlTextWriterWriteString( writer, (xmlChar*)"\n " );
- xmlTextWriterStartElement( writer, (xmlChar*)"stock" );
- xmlTextWriterWriteString( writer, (xmlChar*)"\n " );
+ xmlTextWriterStartElement( writer, (const xmlChar*)"root" );
+ xmlTextWriterWriteString( writer, (const xmlChar*)"\n " );
+ xmlTextWriterStartElement( writer, (const xmlChar*)"stock" );
+ xmlTextWriterWriteString( writer, (const xmlChar*)"\n " );
xmlTextWriterEndElement( writer );
- xmlTextWriterWriteString( writer, (xmlChar*)"\n " );
- xmlTextWriterStartElement( writer, (xmlChar*)"custom" );
- xmlTextWriterWriteString( writer, (xmlChar*)"\n " );
+ xmlTextWriterWriteString( writer, (const xmlChar*)"\n " );
+ xmlTextWriterStartElement( writer, (const xmlChar*)"custom" );
+ xmlTextWriterWriteString( writer, (const xmlChar*)"\n " );
xmlTextWriterEndElement( writer );
- xmlTextWriterWriteString( writer, (xmlChar*)"\n" );
+ xmlTextWriterWriteString( writer, (const xmlChar*)"\n" );
xmlTextWriterEndElement( writer );
// end of the xml document
switch ( nodeShaderType )
{
case SHADER:
- newnode = xmlNewNode( NULL, (xmlChar*)"shader" );
+ newnode = xmlNewNode( NULL, (const xmlChar*)"shader" );
break;
case TEXTURE:
- newnode = xmlNewNode( NULL, (xmlChar*)"texture" );
+ newnode = xmlNewNode( NULL, (const xmlChar*)"texture" );
+ default:
+ return false;
};
newnode = xmlDocCopyNode( newnode, doc, 1 );
- xmlSetProp( newnode, (xmlChar*)"path", (xmlChar*)shader );
- xmlNodeSetContent( newnode, (xmlChar*)"\n " );
+ xmlSetProp( newnode, (const xmlChar*)"path", (const xmlChar*)shader );
+ xmlNodeSetContent( newnode, (const xmlChar*)"\n " );
if ( nodePtr->nodeTab[0]->children->next == NULL ) { // there are no shaders yet
// add spaces
- newtext = xmlNewText( (xmlChar*)" " );
+ newtext = xmlNewText( (const xmlChar*)" " );
xmlAddChild( nodeParent->children, newtext );
// add the new node
xmlAddNextSibling( nodeParent->children, newnode );
// append a new line
- newtext = xmlNewText( (xmlChar*)"\n " );
+ newtext = xmlNewText( (const xmlChar*)"\n " );
xmlAddNextSibling( nodeParent->children->next, newtext );
}
else {
xmlAddNextSibling( nodeParent->children, newnode );
// append a new line and spaces
- newtext = xmlNewText( (xmlChar*)"\n " );
+ newtext = xmlNewText( (const xmlChar*)"\n " );
xmlAddNextSibling( nodeParent->children->next, newtext );
}
}
if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { // node was found
- xmlNodePtr newnode = xmlNewNode( NULL, (xmlChar*)"tag" );
+ xmlNodePtr newnode = xmlNewNode( NULL, (const xmlChar*)"tag" );
xmlNodePtr nodeParent = nodePtr->nodeTab[0];
newnode = xmlDocCopyNode( newnode, doc, 1 );
- xmlNodeSetContent( newnode, (xmlChar*)content );
+ xmlNodeSetContent( newnode, (const xmlChar*)content );
if ( nodePtr->nodeTab[0]->children->next == NULL ) { // shader node has NO children
// add spaces
- xmlNodePtr newtext = xmlNewText( (xmlChar*)" " );
+ xmlNodePtr newtext = xmlNewText( (const xmlChar*)" " );
xmlAddChild( nodeParent->children, newtext );
// add new node
xmlAddNextSibling( nodeParent->children, newnode );
// append a new line + spaces
- newtext = xmlNewText( (xmlChar*)"\n " );
+ newtext = xmlNewText( (const xmlChar*)"\n " );
xmlAddNextSibling( nodeParent->children->next, newtext );
}
else { // shader node has children already - the new node will be the first sibling
xmlAddNextSibling( nodeParent->children, newnode );
- xmlNodePtr newtext = xmlNewText( (xmlChar*)"\n " );
+ xmlNodePtr newtext = xmlNewText( (const xmlChar*)"\n " );
xmlAddNextSibling( nodeParent->children->next, newtext );
}
xmlXPathFreeObject( xpathPtr );
strcat( expression, oldtag );
strcat( expression, "']/*" );
- xmlXPathObjectPtr result = xmlXPathEvalExpression( (xmlChar*)expression, context );
+ xmlXPathObjectPtr result = xmlXPathEvalExpression( (const xmlChar*)expression, context );
if ( !result ) {
return 0;
}
char* content = (char*)xmlNodeGetContent( ptrContent );
if ( strcmp( content, oldtag ) == 0 ) { // found a node with old content?
- xmlNodeSetContent( ptrContent, (xmlChar*)newtag.c_str() );
+ xmlNodeSetContent( ptrContent, (const xmlChar*)newtag.c_str() );
num++;
}
}
for ( int i = 0; i < nodePtr->nodeNr; i++ )
{
xmlNodePtr ptrContent = nodePtr->nodeTab[i];
- char* content = (char*)(xmlChar*)xmlNodeGetContent( ptrContent );
+ const char* content = (const char*)xmlNodeGetContent( ptrContent );
if ( strcmp( content, tag ) == 0 ) { // find the node
xmlNodePtr ptrWhitespace = nodePtr->nodeTab[i]->prev;
returns a vector containing the tags
*/
- char* expression;
+ const char* expression;
if ( shader == NULL ) { // get all tags from all shaders
expression = "/root/*/*/tag";
returns a set containing the shaders (with path)
*/
- char* expression = "/root/*/*[not(child::tag)]";
+ const char* expression = "/root/*/*[not(child::tag)]";
xmlXPathObjectPtr xpathPtr = XpathEval( expression );
xmlNodeSetPtr nodePtr;
for ( int i = 0; i < nodePtr->nodeNr; i++ )
{
ptr = nodePtr->nodeTab[i];
- shaders.insert( (char*)xmlGetProp( ptr, (xmlChar*)"path" ) );
+ shaders.insert( (char*)xmlGetProp( ptr, (const xmlChar*)"path" ) );
}
}
returns a set containing all used tags
*/
- char* expression = "/root/*/*/tag";
+ const char* expression = "/root/*/*/tag";
xmlXPathObjectPtr xpathPtr = XpathEval( expression );
xmlNodeSetPtr nodePtr;
for ( int i = 0; i < nodePtr->nodeNr; i++ )
{
ptr = nodePtr->nodeTab[i];
- xmlattrib = xmlGetProp( ptr, (xmlChar*)"path" );
+ xmlattrib = xmlGetProp( ptr, (const xmlChar*)"path" );
paths.insert( (CopiedString)(char*)xmlattrib );
}
}
xmlNodeSetPtr nodePtr;
xmlXPathObjectPtr XpathEval( const char* queryString ){
- xmlChar* expression = (xmlChar*)queryString;
+ const xmlChar* expression = (const xmlChar*)queryString;
xmlXPathObjectPtr result = xmlXPathEvalExpression( expression, context );
return result;
};
points[6] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[6], 1 ) ) );
points[7] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[7], 1 ) ) );
Vector4 test1 = matrix4_transformed_vector4( unproject, Vector4( 0.5f, 0.5f, 0.5f, 1 ) );
- Vector3 test2 = vector4_projected( test1 );
+ /*Vector3 test2 =*/ vector4_projected( test1 );
aabb_draw_wire( points );
}
};
for ( count = 0; count < widthPix; count++ )
{
- unsigned char iRed, iBlu, iGrn, iAlp;
+ unsigned char iRed, iBlu, iGrn;
unsigned char *oRed, *oBlu, *oGrn, *oAlp;
iRed = *( jpegline + count * 4 + 0 );
iGrn = *( jpegline + count * 4 + 1 );
iBlu = *( jpegline + count * 4 + 2 );
- iAlp = *( jpegline + count * 4 + 3 );
oRed = outBuf + offset + count * 4 + 0;
oGrn = outBuf + offset + count * 4 + 1;
#if 1
*oAlp = 255;
#else
- *oAlp = iAlp;
+ *oAlp = *( jpegline + count * 4 + 3 );
#endif
}
}
class KTX_Decoder
{
public:
+ virtual ~KTX_Decoder(){}
virtual void Decode( PointerInputStream& istream, byte* out ) = 0;
virtual unsigned int GetPixelSize() = 0;
};
Image* LoadHLWBuff( byte* buffer ){
byte *buf_p;
unsigned long mipdatasize;
- int columns, rows, numPixels;
+ int columns, rows;
byte *pixbuf;
int row, column;
byte *palette;
columns = lpMip->width;
rows = lpMip->height;
- numPixels = columns * rows;
+ //int numPixels = columns * rows;
RGBAImage* image = new RGBAImage( columns, rows );
Image* LoadMIPBuff( byte* buffer ){
byte *buf_p;
int palettelength;
- unsigned long mipdatasize;
int columns, rows, numPixels;
byte *pixbuf;
int i;
return 0;
}
- mipdatasize = GET_MIP_DATA_SIZE( columns, rows );
+ // unsigned long mipdatasize = GET_MIP_DATA_SIZE( columns, rows );
palettelength = vfsLoadFile( "gfx/palette.lmp", (void **) &loadedpalette );
if ( palettelength == 768 ) {
Image* LoadIDSPBuff( byte *buffer ){
byte *buf_p;
- int columns, rows, numPixels;
+ int columns, rows;
byte *pixbuf;
int row, column;
// palette = buffer+mipdatasize+2;
// buf_p = buffer+lpMip->offsets[0];
- numPixels = columns * rows;
+ //int numPixels = columns * rows;
RGBAImage* image = new RGBAImage( columns, rows );
if ( !Tokeniser_getSize( tokeniser, version ) ) {
return;
}
- if ( version != MapVersion() ) {
+ if ( version != std::size_t(MapVersion()) ) {
globalErrorStream() << "Doom 3 map version " << MapVersion() << " supported, version is " << Unsigned( version ) << "\n";
return;
}
if ( !Tokeniser_getSize( tokeniser, version ) ) {
return;
}
- if ( version != MapVersion() ) {
+ if ( version != std::size_t(MapVersion()) ) {
globalErrorStream() << "Quake 4 map version " << MapVersion() << " supported, version is " << Unsigned( version ) << "\n";
return;
}
#include "model.h"
-#define MD5_RETURN_FALSE_IF_FAIL( expression ) if ( !( expression ) ) { globalErrorStream() << "md5 parse failed: " # expression "\n"; return false; } else
+#define MD5_RETURN_FALSE_IF_FAIL( expression ) if ( !( expression ) ) { globalErrorStream() << "md5 parse failed: " # expression "\n"; return false; }
bool MD5_parseToken( Tokeniser& tokeniser, const char* string ){
const char* token = tokeniser.getToken();
float evaluateFloat( const ShaderValue& value, const ShaderParameters& params, const ShaderArguments& args ){
const char* result = evaluateShaderValue( value.c_str(), params, args );
- float f;
+ float f = 0;
if ( !string_parse_float( result, f ) ) {
globalErrorStream() << "parsing float value failed: " << makeQuoted( result ) << "\n";
}
for ( archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i )
{
- if ( ( *i ).is_pakfile && ( flag & VFS_SEARCH_PAK ) != 0
- || !( *i ).is_pakfile && ( flag & VFS_SEARCH_DIR ) != 0 ) {
+ if ( (( *i ).is_pakfile && ( flag & VFS_SEARCH_PAK ) != 0)
+ || (!( *i ).is_pakfile && ( flag & VFS_SEARCH_DIR ) != 0) ) {
if ( ( *i ).archive->containsFile( fixed ) ) {
++count;
}
Vector3 first = from;
Vector3 second = to;
- if ( vector3_dot( from, plane.normal() ) > 0 == vector3_dot( to, plane.normal() ) > 0 ) {
+ if ( (vector3_dot( from, plane.normal() ) > 0) == (vector3_dot( to, plane.normal() ) > 0) ) {
first = vector3_negated( first );
second = vector3_negated( second );
}
Matrix4 swap = matrix4_swap_axes( first, second );
- Matrix4 tmp = matrix4_reflection_for_plane( plane );
+ /*Matrix4 tmp =*/ matrix4_reflection_for_plane( plane );
swap.tx() = -static_cast<float>( -2 * plane.a * plane.d );
swap.ty() = -static_cast<float>( -2 * plane.b * plane.d );
class Evaluatable
{
public:
+virtual ~Evaluatable(){}
virtual void evaluate( StringBuffer& output ) = 0;
virtual void exportXML( XMLImporter& importer ) = 0;
};
}
void Cam_MouseControl( camera_t& camera, int x, int y ){
- int xl, xh;
- int yl, yh;
float xf, yf;
xf = (float)( x - camera.width / 2 ) / ( camera.width / 2 );
yf = (float)( y - camera.height / 2 ) / ( camera.height / 2 );
- xl = camera.width / 3;
- xh = xl * 2;
- yl = camera.height / 3;
- yh = yl * 2;
+ //int xl = camera.width / 3;
+ //int xh = xl * 2;
+ //int yl = camera.height / 3;
+ //int yh = yl * 2;
xf *= 1.0f - fabsf( yf );
if ( xf < 0 ) {
m_state_stack.back().m_state = state;
}
}
-const EStyle getStyle() const {
+EStyle getStyle() const {
return eFullMaterials;
}
void PushState(){
typedef ReferenceCaller1<CopiedString, const StringImportCallback&, StringExport> StringExportCaller;
-struct DLG_DATA
+class DLG_DATA
{
+public:
+ virtual ~DLG_DATA(){}
virtual void release() = 0;
virtual void importData() const = 0;
virtual void exportData() const = 0;
typedef std::map<const char*, EntityClass*, RawStringLessNoCase> EntityClasses;
EntityClasses g_entityClasses;
EntityClass *eclass_bad = 0;
-char eclass_directory[1024];
+//char eclass_directory[1024];
typedef std::map<CopiedString, ListAttributeType> ListAttributeTypes;
ListAttributeTypes g_listTypes;
}
globalErrorStream() << message;
}
-#define PARSE_RETURN_FALSE_IF_FAIL( expression ) if ( !( expression ) ) { printParseError( FILE_LINE "\nparse failed: " # expression "\n" ); return false; } else
+#define PARSE_RETURN_FALSE_IF_FAIL( expression ) if ( !( expression ) ) { printParseError( FILE_LINE "\nparse failed: " # expression "\n" ); return false; }
bool EntityClassDoom3_parseToken( Tokeniser& tokeniser ){
const char* token = tokeniser.getToken();
class EntityAttribute
{
public:
+virtual ~EntityAttribute(){}
virtual GtkWidget* getWidget() const = 0;
virtual void update() = 0;
virtual void release() = 0;
#include "cmdlib.h"
int g_argc;
-char** g_argv;
+const char ** g_argv;
void args_init( int argc, char* argv[] ){
int i, j, k;
}
g_argc = argc;
- g_argv = argv;
+ g_argv = (const char **)argv;
}
-char *gamedetect_argv_buffer[1024];
-void gamedetect_found_game( char *game, char *path ){
+const char *gamedetect_argv_buffer[1024];
+void gamedetect_found_game( const char *game, char *path ){
int argc;
static char buf[128];
g_argv = gamedetect_argv_buffer;
}
-bool gamedetect_check_game( char *gamefile, const char *checkfile1, const char *checkfile2, char *buf /* must have 64 bytes free after bufpos */, int bufpos ){
+bool gamedetect_check_game( const char *gamefile, const char *checkfile1, const char *checkfile2, char *buf /* must have 64 bytes free after bufpos */, int bufpos ){
buf[bufpos] = '/';
strcpy( buf + bufpos + 1, checkfile1 );
;
/// brief Returns the filename of the executable belonging to the current process, or 0 if not found.
-char* getexename( char *buf ){
+const char* getexename( char *buf ){
/* Now read the symbolic link */
int ret = readlink( LINK_NAME, buf, PATH_MAX );
const char* environment_get_app_path();
extern int g_argc;
-extern char** g_argv;
+extern const char** g_argv;
#endif
struct filetype_copy_t
{
filetype_copy_t( const char* moduleName, const filetype_t other )
- : m_moduleName( moduleName ), m_name( other.name ), m_pattern( other.pattern ), m_can_load( other.can_load ), m_can_import( other.can_import ), m_can_save( other.can_save ){
+ : m_can_load( other.can_load ), m_can_import( other.can_import ), m_can_save( other.can_save ),
+ m_moduleName( moduleName ), m_name( other.name ), m_pattern( other.pattern ) {
}
const char* getModuleName() const {
return m_moduleName.c_str();
FindTextureDialog_apply();
}
-static void OnFind( GtkWidget* widget, gpointer data ){
+/*static void OnFind( GtkWidget* widget, gpointer data ){
g_FindTextureDialog.exportData();
FindTextureDialog_apply();
}
g_FindTextureDialog.exportData();
FindTextureDialog_apply();
g_FindTextureDialog.HideDlg();
-}
+}*/
static void OnClose( GtkWidget* widget, gpointer data ){
g_FindTextureDialog.HideDlg();
// =============================================================================
// Add new shader tag dialog
-EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, char* title ){
+EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, const char* title ){
ModalDialog dialog;
GtkEntry* textentry;
ModalDialogButton ok_button( dialog, eIDOK );
return ret;
}
-EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char* title ){
+EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const char* title ){
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
#include "string/string.h"
EMessageBoxReturn DoLightIntensityDlg( int *intensity );
-EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, char* title );
-EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char* title );
+EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, const char* title );
+EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const char* title );
EMessageBoxReturn DoTextureLayout( float *fx, float *fy );
void DoTextEditor( const char* filename, int cursorpos );
gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
- GtkButton* g_view_entities_button = toolbar_append_button( toolbar, "Entities (N)", "entities.bmp", "ToggleEntityInspector" );
+ /*GtkButton* g_view_entities_button =*/ toolbar_append_button( toolbar, "Entities (N)", "entities.bmp", "ToggleEntityInspector" );
GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.bmp", "ToggleConsole" );
GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.bmp", "ToggleTextures" );
// TODO: call light inspector
//GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.bmp", "ToggleLightInspector");
gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
- GtkButton* g_refresh_models_button = toolbar_append_button( toolbar, "Refresh Models", "refresh_models.bmp", "RefreshReferences" );
+ /*GtkButton* g_refresh_models_button =*/ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.bmp", "RefreshReferences" );
// disable the console and texture button in the regular layouts
// vPos[1] = aabb.origin;
// vPos[2] = vector3_added(aabb.origin, aabb.extents);
- int i, j;
float f = 1 / cos( M_PI / n );
- for ( i = 0; i < width; ++i )
+ for ( std::size_t i = 0; i < width; ++i )
{
float angle = ( M_PI * i ) / n; // 0 to 2pi
float x = vPos[1][0] + ( vPos[2][0] - vPos[1][0] ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f );
float y = vPos[1][1] + ( vPos[2][1] - vPos[1][1] ) * sin( angle ) * ( ( i & 1 ) ? f : 1.0f );
- for ( j = 0; j < height; ++j )
+ for ( std::size_t j = 0; j < height; ++j )
{
float z = vPos[0][2] + ( vPos[2][2] - vPos[0][2] ) * ( j / (float)( height - 1 ) );
PatchControl *v;
// vPos[1] = aabb.origin;
// vPos[2] = vector3_added(aabb.origin, aabb.extents);
- int i, j;
float f = 1 / cos( M_PI / n );
- for ( i = 0; i < width; ++i )
+ for ( std::size_t i = 0; i < width; ++i )
{
float angle = ( M_PI * i ) / n;
- for ( j = 0; j < height; ++j )
+ for ( std::size_t j = 0; j < height; ++j )
{
float x = vPos[1][0] + ( 1.0f - ( j / (float)( height - 1 ) ) ) * ( vPos[2][0] - vPos[1][0] ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f );
float y = vPos[1][1] + ( 1.0f - ( j / (float)( height - 1 ) ) ) * ( vPos[2][1] - vPos[1][1] ) * sin( angle ) * ( ( i & 1 ) ? f : 1.0f );
// vPos[1] = aabb.origin;
// vPos[2] = vector3_added(aabb.origin, aabb.extents);
- int i, j;
float f = 1 / cos( M_PI / n );
float g = 1 / cos( M_PI / ( 2 * m ) );
- for ( i = 0; i < width; ++i )
+ for ( std::size_t i = 0; i < width; ++i )
{
float angle = ( M_PI * i ) / n;
- for ( j = 0; j < height; ++j )
+ for ( std::size_t j = 0; j < height; ++j )
{
float angle2 = ( M_PI * j ) / ( 2 * m );
float x = vPos[1][0] + ( vPos[2][0] - vPos[1][0] ) * sin( angle2 ) * ( ( j & 1 ) ? g : 1.0f ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f );
name << GlobalRadiant().getAppPath() << "bitmaps/notex.bmp";
g_notex = name.c_str();
- name = NULL;
+ name = StringOutputStream();
name << GlobalRadiant().getAppPath() << "bitmaps/shadernotex.bmp";
g_shadernotex = name.c_str();
}
m_undoables.erase( undoable );
}
void setLevels( std::size_t levels ){
- if ( levels > MAX_UNDO_LEVELS() ) {
+ if ( levels > std::size_t(MAX_UNDO_LEVELS()) ) {
levels = MAX_UNDO_LEVELS();
}
class ISAXHandler
{
public:
-virtual void Release(){
-}
+virtual ~ISAXHandler(){}
+virtual void Release(){}
virtual void saxStartElement( message_info_t* ctx, const xmlChar* name, const xmlChar** attrs ) = 0;
virtual void saxEndElement( message_info_t* ctx, const xmlChar* name ) = 0;
virtual void saxCharacters( message_info_t* ctx, const xmlChar* ch, int len ) = 0;
case ButtonEnumeration::LEFT: buttons |= RAD_LBUTTON; break;
case ButtonEnumeration::MIDDLE: buttons |= RAD_MBUTTON; break;
case ButtonEnumeration::RIGHT: buttons |= RAD_RBUTTON; break;
+ default: break;
}
if ( bitfield_enabled( flags, c_modifierControl ) ) {
globalOutputStream() << "Loaded background texture " << relative << "\n";
g_pParentWnd->ActiveXY()->m_backgroundActivated = true;
- int m_ix, m_iy;
+ int m_ix = 0, m_iy = 0;
switch ( g_pParentWnd->ActiveXY()->m_viewType )
{
case XY:
m_state_stack.back().m_state = state;
}
}
-const EStyle getStyle() const {
+EStyle getStyle() const {
return eWireframeOnly;
}
void PushState(){