From a2432adad37ef8762456adb1688ff4866d521228 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 30 Sep 2006 15:46:40 +0000 Subject: [PATCH] # GCC 4.1.1 compatibility which is just "class C { void C::f(); }" code, which other compilers seem to have ignored. Also removed HAVE_PCH from GCC because our build system doesn't have PCH. Added necessary headers to make it compile again. This was SVN commit r4437. --- source/graphics/ObjectBase.cpp | 1 + source/gui/GUIRenderer.h | 2 +- source/gui/IGUIButtonBehavior.h | 2 +- source/lib/cache_adt.h | 1 + source/lib/config.h | 2 +- source/lib/lib_errors.cpp | 2 +- source/lib/mmgr.cpp | 2 +- source/lib/sysdep/unix/dir_watch_fam.cpp | 22 +++++++++---------- source/lib/sysdep/unix/udbg.cpp | 15 +++++++------ source/lib/sysdep/unix/unix.cpp | 20 ++++++++--------- source/lib/sysdep/unix/x.cpp | 12 +++++----- source/ps/Interact.h | 2 ++ source/renderer/VertexBufferManager.h | 2 +- source/scripting/ScriptingHost.h | 2 +- source/simulation/AStarEngine.cpp | 2 +- source/simulation/AStarEngine.h | 2 +- source/simulation/Aura.h | 2 ++ source/simulation/Collision.h | 2 ++ source/simulation/EntityManager.h | 2 ++ source/simulation/EntityStateProcessing.cpp | 2 +- source/simulation/EntitySupport.h | 2 ++ source/simulation/ScriptObject.h | 2 ++ source/simulation/Technology.h | 2 +- .../tools/atlas/GameInterface/ActorViewer.h | 1 + source/tools/atlas/GameInterface/Brushes.h | 2 +- .../tools/atlas/GameInterface/CommandProc.cpp | 1 + source/tools/atlas/GameInterface/Register.cpp | 2 ++ source/tools/atlas/GameInterface/View.cpp | 1 + source/tools/atlas/GameInterface/View.h | 4 ++++ 29 files changed, 70 insertions(+), 46 deletions(-) diff --git a/source/graphics/ObjectBase.cpp b/source/graphics/ObjectBase.cpp index 185be661b8..30aefd7d5b 100644 --- a/source/graphics/ObjectBase.cpp +++ b/source/graphics/ObjectBase.cpp @@ -1,6 +1,7 @@ #include "precompiled.h" #include +#include #include "ObjectBase.h" diff --git a/source/gui/GUIRenderer.h b/source/gui/GUIRenderer.h index a1780e2dd0..b00f91765d 100644 --- a/source/gui/GUIRenderer.h +++ b/source/gui/GUIRenderer.h @@ -42,7 +42,7 @@ namespace GUIRenderer void clear(); DrawCalls(); DrawCalls(const DrawCalls&); - const DrawCalls& DrawCalls::operator=(const DrawCalls&); + const DrawCalls& operator=(const DrawCalls&); ~DrawCalls(); }; } diff --git a/source/gui/IGUIButtonBehavior.h b/source/gui/IGUIButtonBehavior.h index da1c7c17e2..f1c3cbb7f9 100644 --- a/source/gui/IGUIButtonBehavior.h +++ b/source/gui/IGUIButtonBehavior.h @@ -87,7 +87,7 @@ public: /** * Choosing which color of the following according to */ - CColor IGUIButtonBehavior::ChooseColor(); + CColor ChooseColor(); protected: diff --git a/source/lib/cache_adt.h b/source/lib/cache_adt.h index 8179d08d9f..860bbbf8e3 100644 --- a/source/lib/cache_adt.h +++ b/source/lib/cache_adt.h @@ -27,6 +27,7 @@ #include #include +#include /* Cache for items of variable size and value/"cost". diff --git a/source/lib/config.h b/source/lib/config.h index d84521b9e1..d3263bf3c0 100644 --- a/source/lib/config.h +++ b/source/lib/config.h @@ -332,7 +332,7 @@ #endif // precompiled headers (affects what precompiled.h pulls in; see there) -#if MSC_VERSION || (GCC_VERSION > 304) +#if MSC_VERSION # define HAVE_PCH 1 #else # define HAVE_PCH 0 diff --git a/source/lib/lib_errors.cpp b/source/lib/lib_errors.cpp index b5d797f69c..09a6943a68 100644 --- a/source/lib/lib_errors.cpp +++ b/source/lib/lib_errors.cpp @@ -33,7 +33,7 @@ #include #include // abs #include - +#include struct LibErrorAssociation { diff --git a/source/lib/mmgr.cpp b/source/lib/mmgr.cpp index b30f082486..6bbd95ec44 100644 --- a/source/lib/mmgr.cpp +++ b/source/lib/mmgr.cpp @@ -1122,7 +1122,7 @@ void free_dbg(const void* user_p, AllocType type, const char* file, int line, co if(!a) { log("[!] mmgr_free: not allocated by this memory manager\n"); - DEBUG_WARN_ERR(ERR::ALLOC_NOT_FOUND); + DEBUG_WARN_ERR(ERR::MEM_ALLOC_NOT_FOUND); goto fail; } // .. overrun? (note: alloc_is_valid already asserts if invalid) diff --git a/source/lib/sysdep/unix/dir_watch_fam.cpp b/source/lib/sysdep/unix/dir_watch_fam.cpp index ceebcbbfad..947676b183 100644 --- a/source/lib/sysdep/unix/dir_watch_fam.cpp +++ b/source/lib/sysdep/unix/dir_watch_fam.cpp @@ -27,7 +27,7 @@ LibError dir_add_watch(const char* const n_full_path, intptr_t* const watch) { // init already failed; don't try again or complain if(initialized == -1) - return ERR_FAIL; // NOWARN + return ERR::FAIL; // NOWARN if(!initialized) { @@ -41,7 +41,7 @@ LibError dir_add_watch(const char* const n_full_path, intptr_t* const watch) { initialized = -1; DISPLAY_ERROR(L"Error initializing FAM; hotloading will be disabled"); - return ERR_FAIL; // NOWARN + return ERR::FAIL; // NOWARN } } @@ -50,34 +50,34 @@ LibError dir_add_watch(const char* const n_full_path, intptr_t* const watch) { *watch = -1; debug_warn("res_watch_dir failed!"); - WARN_RETURN(ERR_FAIL); // no way of getting error code? + WARN_RETURN(ERR::FAIL); // no way of getting error code? } *watch = (intptr_t)req.reqnum; dirs[*watch] = n_full_path; - return INFO_OK; + return INFO::OK; } LibError dir_cancel_watch(const intptr_t watch) { if(initialized == -1) - return ERR_FAIL; // NOWARN + return ERR::FAIL; // NOWARN if(!initialized) - WARN_RETURN(ERR_LOGIC); + WARN_RETURN(ERR::LOGIC); FAMRequest req; req.reqnum = (int)watch; RETURN_ERR(FAMCancelMonitor(&fc, &req)); - return INFO_OK; + return INFO::OK; } int dir_get_changed_file(char* fn) { if(initialized == -1) - return ERR_FAIL; // NOWARN + return ERR::FAIL; // NOWARN if(!initialized) - WARN_RETURN(ERR_LOGIC); + WARN_RETURN(ERR::LOGIC); FAMEvent e; while(FAMPending(&fc) > 0) @@ -90,11 +90,11 @@ int dir_get_changed_file(char* fn) const char* dir = dirs[e.fr.reqnum].c_str(); snprintf(n_path, PATH_MAX, "%s%c%s", dir, DIR_SEP, e.filename); RETURN_ERR(file_make_portable_path(n_path, fn)); - return INFO_OK; + return INFO::OK; } } } // just nothing new; try again later - return ERR_AGAIN; // NOWARN + return ERR::AGAIN; // NOWARN } diff --git a/source/lib/sysdep/unix/udbg.cpp b/source/lib/sysdep/unix/udbg.cpp index d07707e84c..84aaca64ce 100644 --- a/source/lib/sysdep/unix/udbg.cpp +++ b/source/lib/sysdep/unix/udbg.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -39,11 +40,11 @@ // Hard-coded - yuck :P #if defined(TESTING) -#define EXE_NAME "ps_test" +#define EXE_NAME "pyrogenesis_test" #elif defined(NDEBUG) -#define EXE_NAME "ps" +#define EXE_NAME "pyrogenesis" #else -#define EXE_NAME "ps_dbg" +#define EXE_NAME "pyrogenesis_dbg" #endif struct symbol_file_context @@ -159,7 +160,7 @@ LibError debug_dump_stack(wchar_t* buf, size_t max_chars, uint skip, void* UNUSE bufpos += len; } - return INFO_OK; + return INFO::OK; } static int slurp_symtab(symbol_file_context *ctx) @@ -317,7 +318,7 @@ static LibError debug_resolve_symbol_dladdr(void *ptr, char* sym_name, char* fil int res=dladdr(ptr, &syminfo); if (res == 0) - WARN_RETURN(ERR_FAIL); + WARN_RETURN(ERR::FAIL); if (sym_name) { @@ -341,7 +342,7 @@ static LibError debug_resolve_symbol_dladdr(void *ptr, char* sym_name, char* fil *line=0; } - return INFO_OK; + return INFO::OK; } LibError debug_resolve_symbol(void* ptr_of_interest, char* sym_name, char* file, int* line) @@ -406,7 +407,7 @@ LibError debug_resolve_symbol(void* ptr_of_interest, char* sym_name, char* file, *line = ctx.line; } - return INFO_OK; + return INFO::OK; } void debug_puts(const char* text) diff --git a/source/lib/sysdep/unix/unix.cpp b/source/lib/sysdep/unix/unix.cpp index ef1ce1161f..ae4e76e837 100644 --- a/source/lib/sysdep/unix/unix.cpp +++ b/source/lib/sysdep/unix/unix.cpp @@ -34,11 +34,11 @@ LibError sys_get_executable_name(char* n_path, size_t buf_size) if (!dladdr((void *)sys_get_executable_name, &dl_info) || !dl_info.dli_fname ) { - return ERR_NO_SYS; + return ERR::NO_SYS; } strncpy(n_path, dl_info.dli_fname, buf_size); - return INFO_OK; + return INFO::OK; } extern int cpus; @@ -58,7 +58,7 @@ LibError sys_on_each_cpu(void(*cb)()) { UNUSED2(cb); - return ERR_NO_SYS; + return ERR::NO_SYS; } ErrorReaction sys_display_error(const wchar_t* text, uint flags) @@ -123,7 +123,7 @@ LibError sys_error_description_r(int err, char* buf, size_t max_chars) // don't need to do anything: lib/errors.cpp already queries // libc's strerror(). if we ever end up needing translation of // e.g. Qt or X errors, that'd go here. - return ERR_FAIL; + return ERR::FAIL; } // stub for sys_cursor_create - we don't need to implement this (SDL/X11 only @@ -141,7 +141,7 @@ LibError sys_cursor_create(uint w, uint h, void* bgra_img, UNUSED2(bgra_img); *cursor = 0; - return INFO_OK; + return INFO::OK; } // creates an empty cursor @@ -154,9 +154,9 @@ LibError sys_cursor_create_empty(void **cursor) // size 8x1 (cursor size must be a whole number of bytes ^^) // hotspot at 0,0 // SDL will make its own copies of data and mask - *cursor=SDL_CreateCursor(data, mask, 8, 1, 0, 0); + *cursor = SDL_CreateCursor(data, mask, 8, 1, 0, 0); - return cursor?INFO_OK:ERR_FAIL; + return cursor ? INFO::OK : ERR::FAIL; } SDL_Cursor *defaultCursor=NULL; @@ -174,7 +174,7 @@ LibError sys_cursor_set(void* cursor) SDL_SetCursor((SDL_Cursor *)cursor); - return INFO_OK; + return INFO::OK; } // destroys the indicated cursor and frees its resources. if it is @@ -183,7 +183,7 @@ LibError sys_cursor_free(void* cursor) { // bail now to prevent potential confusion below; there's nothing to do. if(!cursor) - return INFO_OK; + return INFO::OK; // if the cursor being freed is active, restore the default cursor // (just for safety). @@ -192,7 +192,7 @@ LibError sys_cursor_free(void* cursor) SDL_FreeCursor((SDL_Cursor *)cursor); - return INFO_OK; + return INFO::OK; } // note: just use the sector size: Linux aio doesn't really care about diff --git a/source/lib/sysdep/unix/x.cpp b/source/lib/sysdep/unix/x.cpp index 8567629296..56d4199732 100644 --- a/source/lib/sysdep/unix/x.cpp +++ b/source/lib/sysdep/unix/x.cpp @@ -35,7 +35,7 @@ LibError gfx_get_video_mode(int* xres, int* yres, int* bpp, int* freq) { Display* disp = XOpenDisplay(0); if(!disp) - WARN_RETURN(ERR_FAIL); + WARN_RETURN(ERR::FAIL); int screen = XDefaultScreen(disp); @@ -59,7 +59,7 @@ LibError gfx_get_video_mode(int* xres, int* yres, int* bpp, int* freq) if(freq) *freq = 0; XCloseDisplay(disp); - return INFO_OK; + return INFO::OK; } @@ -69,7 +69,7 @@ LibError gfx_get_monitor_size(int& width_mm, int& height_mm) { Display* disp = XOpenDisplay(0); if(!disp) - WARN_RETURN(ERR_FAIL); + WARN_RETURN(ERR::FAIL); int screen = XDefaultScreen(disp); @@ -77,7 +77,7 @@ LibError gfx_get_monitor_size(int& width_mm, int& height_mm) height_mm=XDisplayHeightMM(disp, screen); XCloseDisplay(disp); - return INFO_OK; + return INFO::OK; } /* @@ -190,7 +190,7 @@ wchar_t *sys_clipboard_get() LibError sys_clipboard_free(wchar_t *clip_buf) { free(clip_buf); - return INFO_OK; + return INFO::OK; } /* @@ -205,7 +205,7 @@ Setting the Selection (i.e. "copy") LibError sys_clipboard_set(const wchar_t *clip_str) { // Not Implemented, see comment before clipboard_get, above - WARN_RETURN(ERR_FAIL); + WARN_RETURN(ERR::FAIL); } #endif // #ifdef HAVE_X diff --git a/source/ps/Interact.h b/source/ps/Interact.h index 67c31187f7..ffe2f14513 100644 --- a/source/ps/Interact.h +++ b/source/ps/Interact.h @@ -7,12 +7,14 @@ // Mark Thompson (mot20@cam.ac.uk / mark@wildfiregames.com) #include +#include #include "Singleton.h" #include "simulation/EntityHandles.h" #include "ps/Vector2D.h" #include "lib/input.h" #include "lib/res/handle.h" +#include "ps/CStr.h" class CVector3D; class CUnit; diff --git a/source/renderer/VertexBufferManager.h b/source/renderer/VertexBufferManager.h index 7750c3bf1e..6147c9aea4 100644 --- a/source/renderer/VertexBufferManager.h +++ b/source/renderer/VertexBufferManager.h @@ -28,7 +28,7 @@ public: CVertexBuffer::VBChunk* Allocate(size_t vertexSize,size_t numVertices,bool dynamic); // return given chunk to it's owner - void CVertexBufferManager::Release(CVertexBuffer::VBChunk* chunk); + void Release(CVertexBuffer::VBChunk* chunk); // empty out the batch lists of all vertex buffers void ClearBatchIndices(); diff --git a/source/scripting/ScriptingHost.h b/source/scripting/ScriptingHost.h index 380fac4730..d971c7360f 100644 --- a/source/scripting/ScriptingHost.h +++ b/source/scripting/ScriptingHost.h @@ -91,7 +91,7 @@ public: jsval CallFunction(const std::string & functionName, jsval * params, int numParams); - jsval ScriptingHost::ExecuteScript(const CStrW& script, const CStrW& calledFrom = CStrW( L"Console" ), JSObject* contextObject = NULL ); + jsval ExecuteScript(const CStrW& script, const CStrW& calledFrom = CStrW( L"Console" ), JSObject* contextObject = NULL ); void RegisterFunction(const std::string & functionName, JSNative function, int numArgs); diff --git a/source/simulation/AStarEngine.cpp b/source/simulation/AStarEngine.cpp index 092f9818e1..1e9aaf4240 100644 --- a/source/simulation/AStarEngine.cpp +++ b/source/simulation/AStarEngine.cpp @@ -485,4 +485,4 @@ inline void CAStarEngine::SetPassableFlag(AStarNodeFlag* flag) inline void CAStarEngine::SetBlockedFlag(AStarNodeFlag* flag) { *flag |= kBlocked; -} \ No newline at end of file +} diff --git a/source/simulation/AStarEngine.h b/source/simulation/AStarEngine.h index b429c648ff..818c6efa50 100644 --- a/source/simulation/AStarEngine.h +++ b/source/simulation/AStarEngine.h @@ -172,4 +172,4 @@ public: }; -#endif \ No newline at end of file +#endif diff --git a/source/simulation/Aura.h b/source/simulation/Aura.h index b6ff75093c..f53afba623 100644 --- a/source/simulation/Aura.h +++ b/source/simulation/Aura.h @@ -3,6 +3,8 @@ #include "EntityHandles.h" #include "maths/Vector4D.h" +#include "scripting/SpiderMonkey.h" +#include "ps/CStr.h" class CEntity; diff --git a/source/simulation/Collision.h b/source/simulation/Collision.h index 884330cd50..f58f15acd5 100644 --- a/source/simulation/Collision.h +++ b/source/simulation/Collision.h @@ -19,6 +19,8 @@ class CEntity; class CPlayer; +class CStrW; + #include "EntityHandles.h" struct rayIntersectionResults diff --git a/source/simulation/EntityManager.h b/source/simulation/EntityManager.h index 65e2d78f59..47a9d8b749 100644 --- a/source/simulation/EntityManager.h +++ b/source/simulation/EntityManager.h @@ -18,6 +18,8 @@ #ifndef ENTITY_MANAGER_INCLUDED #define ENTITY_MANAGER_INCLUDED +#include + #include "ps/Singleton.h" #include "EntityHandles.h" #include "EntityPredicate.h" diff --git a/source/simulation/EntityStateProcessing.cpp b/source/simulation/EntityStateProcessing.cpp index cc524949c3..d918979cbf 100644 --- a/source/simulation/EntityStateProcessing.cpp +++ b/source/simulation/EntityStateProcessing.cpp @@ -62,7 +62,7 @@ float CEntity::chooseMovementSpeed( float distance ) // Modify the speed based on the slope of the terrain in our direction (obtained from our x orientation) float angle = m_orientation_unclamped.x; - int sector = ia32_rintf( angle / (PI/2) * m_base->m_pitchDivs ); + int sector = rintf( angle / (PI/2) * m_base->m_pitchDivs ); speed -= sector * m_base->m_pitchValue; // TODO: the animation code requires unicode for now. will be changed to diff --git a/source/simulation/EntitySupport.h b/source/simulation/EntitySupport.h index 064ffd0a6f..b9106bc416 100644 --- a/source/simulation/EntitySupport.h +++ b/source/simulation/EntitySupport.h @@ -3,6 +3,8 @@ #ifndef ENTITY_SUPPORT_INCLUDED #define ENTITY_SUPPORT_INCLUDED +#include "ps/CStr.h" + #include "EntityHandles.h" class CEntityManager; diff --git a/source/simulation/ScriptObject.h b/source/simulation/ScriptObject.h index 115ed105d3..4f9bc10dec 100644 --- a/source/simulation/ScriptObject.h +++ b/source/simulation/ScriptObject.h @@ -9,6 +9,8 @@ class CStrW; class CScriptEvent; +#include "scripting/SpiderMonkey.h" + class CScriptObject { JSFunction* Function; diff --git a/source/simulation/Technology.h b/source/simulation/Technology.h index cd1afb852a..b808651440 100644 --- a/source/simulation/Technology.h +++ b/source/simulation/Technology.h @@ -87,4 +87,4 @@ private: bool hasReqTechs(); }; -#endif \ No newline at end of file +#endif diff --git a/source/tools/atlas/GameInterface/ActorViewer.h b/source/tools/atlas/GameInterface/ActorViewer.h index 496fdb520d..fcc472cfc4 100644 --- a/source/tools/atlas/GameInterface/ActorViewer.h +++ b/source/tools/atlas/GameInterface/ActorViewer.h @@ -4,6 +4,7 @@ struct ActorViewerImpl; struct SColor4ub; class CUnit; +class CStrW; class ActorViewer { diff --git a/source/tools/atlas/GameInterface/Brushes.h b/source/tools/atlas/GameInterface/Brushes.h index 6ee5f4ad20..0193f757e9 100644 --- a/source/tools/atlas/GameInterface/Brushes.h +++ b/source/tools/atlas/GameInterface/Brushes.h @@ -37,4 +37,4 @@ extern Brush g_CurrentBrush; } -#endif // BRUSHES_H__ \ No newline at end of file +#endif // BRUSHES_H__ diff --git a/source/tools/atlas/GameInterface/CommandProc.cpp b/source/tools/atlas/GameInterface/CommandProc.cpp index 41e5b82114..6444da5290 100644 --- a/source/tools/atlas/GameInterface/CommandProc.cpp +++ b/source/tools/atlas/GameInterface/CommandProc.cpp @@ -3,6 +3,7 @@ #include "CommandProc.h" #include +#include ////////////////////////////////////////////////////////////////////////// diff --git a/source/tools/atlas/GameInterface/Register.cpp b/source/tools/atlas/GameInterface/Register.cpp index 9492f851d3..f1788f3de5 100644 --- a/source/tools/atlas/GameInterface/Register.cpp +++ b/source/tools/atlas/GameInterface/Register.cpp @@ -6,6 +6,8 @@ // so cheat and undefine its include-guard #undef MESSAGES_H__ +#include + #include "SharedTypes.h" #include "Shareable.h" diff --git a/source/tools/atlas/GameInterface/View.cpp b/source/tools/atlas/GameInterface/View.cpp index 773014e934..84377a9fb7 100644 --- a/source/tools/atlas/GameInterface/View.cpp +++ b/source/tools/atlas/GameInterface/View.cpp @@ -6,6 +6,7 @@ #include "GameLoop.h" #include "Messages.h" +#include "graphics/GameView.h" #include "graphics/SColor.h" #include "graphics/UnitManager.h" #include "renderer/Renderer.h" diff --git a/source/tools/atlas/GameInterface/View.h b/source/tools/atlas/GameInterface/View.h index 9e86de1c1e..9a6cdc26c8 100644 --- a/source/tools/atlas/GameInterface/View.h +++ b/source/tools/atlas/GameInterface/View.h @@ -1,6 +1,10 @@ #ifndef VIEW_H__ #define VIEW_H__ +#include "graphics/Camera.h" + +#include "Messages.h" + class CUnit; class ViewGame;