mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-27 14:12:23 +00:00
Fix some GCC warnings
This was SVN commit r7048.
This commit is contained in:
@@ -204,7 +204,7 @@ static bool IsVisible_XSI(FCDSceneNode* node, bool& visible)
|
||||
|
||||
static bool IsVisible(FCDSceneNode* node)
|
||||
{
|
||||
bool visible;
|
||||
bool visible = false;
|
||||
|
||||
// Try the XSI visibility property
|
||||
if (IsVisible_XSI(node, visible))
|
||||
|
||||
+1
-1
@@ -513,7 +513,7 @@ void CGUI::Draw()
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void CGUI::DrawSprite(CGUISpriteInstance& Sprite,
|
||||
void CGUI::DrawSprite(const CGUISpriteInstance& Sprite,
|
||||
int CellID,
|
||||
const float& Z,
|
||||
const CRect& Rect,
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ public:
|
||||
* @param Rect Position and Size
|
||||
* @param Clipping The sprite shouldn't be drawn outside this rectangle
|
||||
*/
|
||||
void DrawSprite(CGUISpriteInstance& Sprite, int CellID, const float &Z,
|
||||
void DrawSprite(const CGUISpriteInstance& Sprite, int CellID, const float &Z,
|
||||
const CRect &Rect, const CRect &Clipping=CRect());
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,7 +67,7 @@ void CGUIScrollBarVertical::Draw()
|
||||
if (m_UseEdgeButtons)
|
||||
{
|
||||
// Get Appropriate sprites
|
||||
CGUISpriteInstance *button_top, *button_bottom;
|
||||
const CGUISpriteInstance *button_top, *button_bottom;
|
||||
|
||||
// figure out what sprite to use for top button
|
||||
if (m_ButtonMinusHovered)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "precompiled.h"
|
||||
#include "CGUISprite.h"
|
||||
|
||||
void CGUISpriteInstance::Draw(CRect Size, int CellID, std::map<CStr, CGUISprite> &Sprites)
|
||||
void CGUISpriteInstance::Draw(CRect Size, int CellID, std::map<CStr, CGUISprite> &Sprites) const
|
||||
{
|
||||
if (m_CachedSize != Size || m_CachedCellID != CellID)
|
||||
{
|
||||
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
CGUISpriteInstance(const CStr& SpriteName);
|
||||
CGUISpriteInstance(const CGUISpriteInstance &Sprite);
|
||||
CGUISpriteInstance &operator=(const CStr& SpriteName);
|
||||
void Draw(CRect Size, int CellID, std::map<CStr, CGUISprite> &Sprites);
|
||||
void Draw(CRect Size, int CellID, std::map<CStr, CGUISprite> &Sprites) const;
|
||||
void Invalidate();
|
||||
bool IsEmpty() const;
|
||||
const CStr& GetName() { return m_SpriteName; }
|
||||
@@ -165,11 +165,11 @@ private:
|
||||
CStr m_SpriteName;
|
||||
|
||||
// Stored drawing calls, for more efficient rendering
|
||||
GUIRenderer::DrawCalls m_DrawCallCache;
|
||||
mutable GUIRenderer::DrawCalls m_DrawCallCache;
|
||||
// Relevant details of previously rendered sprite; the cache is invalidated
|
||||
// whenever any of these values changes.
|
||||
CRect m_CachedSize;
|
||||
int m_CachedCellID;
|
||||
mutable CRect m_CachedSize;
|
||||
mutable int m_CachedCellID;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
|
||||
// Functions to perform drawing-related actions:
|
||||
|
||||
void GUIRenderer::UpdateDrawCallCache(DrawCalls &Calls, CStr& SpriteName, CRect &Size, int CellID, std::map<CStr, CGUISprite> &Sprites)
|
||||
void GUIRenderer::UpdateDrawCallCache(DrawCalls &Calls, const CStr& SpriteName, const CRect &Size, int CellID, std::map<CStr, CGUISprite> &Sprites)
|
||||
{
|
||||
// This is called only when something has changed (like the size of the
|
||||
// sprite), so it doesn't need to be particularly efficient.
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace GUIRenderer
|
||||
|
||||
namespace GUIRenderer
|
||||
{
|
||||
void UpdateDrawCallCache(DrawCalls &Calls, CStr&SpriteName, CRect& Size, int CellID, std::map<CStr, CGUISprite> &Sprites);
|
||||
void UpdateDrawCallCache(DrawCalls &Calls, const CStr& SpriteName, const CRect& Size, int CellID, std::map<CStr, CGUISprite> &Sprites);
|
||||
|
||||
void Draw(DrawCalls &Calls);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,8 @@ void CInternalCGUIAccessorBase::HandleMessage(IGUIObject *pObject, const SGUIMes
|
||||
#ifndef NDEBUG
|
||||
#define TYPE(T) \
|
||||
template<> void CheckType<T>(const IGUIObject* obj, const CStr& setting) { \
|
||||
if (((IGUIObject*)obj)->m_Settings[setting].m_Type != GUIST_##T) \
|
||||
std::map<CStr, SGUISetting>::const_iterator it = obj->m_Settings.find(setting); \
|
||||
if (it == obj->m_Settings.end() || it->second.m_Type != GUIST_##T) \
|
||||
{ \
|
||||
/* Abort now, to avoid corrupting everything by invalidly \
|
||||
casting pointers */ \
|
||||
|
||||
@@ -222,9 +222,9 @@ public:
|
||||
* @param sec Secondary sprite if Primary should fail
|
||||
* @return Resulting string
|
||||
*/
|
||||
static CGUISpriteInstance& FallBackSprite(
|
||||
CGUISpriteInstance& prim,
|
||||
CGUISpriteInstance& sec)
|
||||
static const CGUISpriteInstance& FallBackSprite(
|
||||
const CGUISpriteInstance& prim,
|
||||
const CGUISpriteInstance& sec)
|
||||
{
|
||||
// CStr() == empty string, null
|
||||
return (prim.IsEmpty() ? sec : prim);
|
||||
|
||||
@@ -50,7 +50,7 @@ void IGUIScrollBar::SetupBarSize()
|
||||
m_BarSize = std::min((float)m_ScrollSpace/(float)m_ScrollRange, 1.f);
|
||||
}
|
||||
|
||||
SGUIScrollBarStyle *IGUIScrollBar::GetStyle() const
|
||||
const SGUIScrollBarStyle *IGUIScrollBar::GetStyle() const
|
||||
{
|
||||
if (!m_pHostObject)
|
||||
return NULL;
|
||||
|
||||
@@ -304,7 +304,7 @@ public:
|
||||
* Get style used by the scrollbar
|
||||
* @return Scroll bar style struct.
|
||||
*/
|
||||
SGUIScrollBarStyle * GetStyle() const;
|
||||
const SGUIScrollBarStyle * GetStyle() const;
|
||||
|
||||
/**
|
||||
* Get the rectangle of the actual BAR. not the whole scroll-bar.
|
||||
|
||||
@@ -58,21 +58,22 @@ void IGUIScrollBarOwner::AddScrollBar(IGUIScrollBar * scrollbar)
|
||||
m_ScrollBars.push_back(scrollbar);
|
||||
}
|
||||
|
||||
SGUIScrollBarStyle * IGUIScrollBarOwner::GetScrollBarStyle(const CStr& style) const
|
||||
const SGUIScrollBarStyle * IGUIScrollBarOwner::GetScrollBarStyle(const CStr& style) const
|
||||
{
|
||||
if (!GetGUI())
|
||||
{
|
||||
// TODO Gee: Output in log
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (GetGUI()->m_ScrollBarStyles.count(style) == 0)
|
||||
|
||||
std::map<CStr, SGUIScrollBarStyle>::const_iterator it = GetGUI()->m_ScrollBarStyles.find(style);
|
||||
if (it == GetGUI()->m_ScrollBarStyles.end())
|
||||
{
|
||||
// TODO Gee: Output in log
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &((CGUI*)GetGUI())->m_ScrollBarStyles.find(style)->second;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
void IGUIScrollBarOwner::HandleMessage(const SGUIMessage &Message)
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
/**
|
||||
* Interface for the m_ScrollBar to use.
|
||||
*/
|
||||
virtual SGUIScrollBarStyle *GetScrollBarStyle(const CStr& style) const;
|
||||
virtual const SGUIScrollBarStyle *GetScrollBarStyle(const CStr& style) const;
|
||||
|
||||
/**
|
||||
* Add a scroll-bar
|
||||
|
||||
@@ -109,7 +109,7 @@ bool CLocale::LoadStrings(const char* data)
|
||||
u8 NameLength = *(u8*)data;
|
||||
data += 1;
|
||||
|
||||
std::string NameText ((char*)data, (char*)(data + NameLength));
|
||||
std::string NameText ((const char*)data, (const char*)(data + NameLength));
|
||||
data += NameLength;
|
||||
|
||||
u8 ParamCount = *(u8*)data;
|
||||
|
||||
@@ -55,11 +55,11 @@ const char* StringPool::UniqueCopy(const char* string)
|
||||
return existingString;
|
||||
|
||||
const size_t length = strlen(string);
|
||||
const char* uniqueCopy = (const char*)pool_alloc(&m_pool, length+1);
|
||||
char* uniqueCopy = (char*)pool_alloc(&m_pool, length+1);
|
||||
if(!uniqueCopy)
|
||||
throw std::bad_alloc();
|
||||
cpu_memcpy((void*)uniqueCopy, string, length);
|
||||
((char*)uniqueCopy)[length] = '\0';
|
||||
uniqueCopy[length] = '\0';
|
||||
|
||||
m_map.insert(uniqueCopy, uniqueCopy);
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ bool IEventTarget::_DispatchEvent( CScriptEvent* evt, IEventTarget* target )
|
||||
// returns: whether the event arrived (i.e. wasn't cancelled) [bool]
|
||||
bool IEventTarget::DispatchEvent( CScriptEvent* evt )
|
||||
{
|
||||
char* data;
|
||||
const char* data;
|
||||
PROFILE_START( "intern string" );
|
||||
data = (char*) g_Profiler.InternString( "script: " + (CStr8)evt->m_Type );
|
||||
data = g_Profiler.InternString( "script: " + (CStr8)evt->m_Type );
|
||||
PROFILE_END( "intern string" );
|
||||
g_Profiler.StartScript( data );
|
||||
evt->m_Target = this;
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_SPIDERMONKEY
|
||||
#define INCLUDED_SPIDERMONKEY
|
||||
|
||||
// Master header for the SpiderMonkey Javascript library.
|
||||
//
|
||||
// Include this instead of accessing any <js*.h> headers directly.
|
||||
@@ -58,3 +61,5 @@
|
||||
#ifndef NDEBUG
|
||||
# define JS_AddRoot(cx, rp) JS_AddNamedRoot((cx), (rp), __FILE__ )
|
||||
#endif
|
||||
|
||||
#endif // INCLUDED_SPIDERMONKEY
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
struct SEntityAction
|
||||
{
|
||||
int m_Id;
|
||||
float m_MaxRange;
|
||||
float m_MinRange;
|
||||
float m_MaxRange;
|
||||
int m_Speed;
|
||||
CStr8 m_Animation;
|
||||
SEntityAction()
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DLLINTERFACE_INCLUDED
|
||||
#define DLLINTERFACE_INCLUDED
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
namespace AtlasMessage { class MessagePasser; }
|
||||
@@ -31,4 +34,4 @@ ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, size_t flags);
|
||||
|
||||
ATLASDLLIMPEXP void Atlas_ReportError();
|
||||
|
||||
ATLASDLLIMPEXP void Atlas_ReportError();
|
||||
#endif // DLLINTERFACE_INCLUDED
|
||||
|
||||
Reference in New Issue
Block a user