diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e9990d53..482a5e086 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,8 +255,8 @@ set(OC_CLONK_SOURCES src/graphics/C4FacetEx.cpp src/graphics/C4FacetEx.h src/graphics/C4Facet.h - src/graphics/C4Fonts.cpp - src/graphics/C4Fonts.h + src/graphics/C4FontLoader.cpp + src/graphics/C4FontLoader.h src/graphics/C4GraphicsResource.cpp src/graphics/C4GraphicsResource.h src/graphics/C4Surface.cpp @@ -510,8 +510,6 @@ set(OC_CLONK_SOURCES src/platform/PlatformAbstraction.h src/platform/StdFile.cpp src/platform/StdFile.h - src/platform/StdFont.cpp - src/platform/StdFont.h src/platform/StdRegistry.cpp src/platform/StdRegistry.h src/platform/StdScheduler.cpp diff --git a/Makefile.am b/Makefile.am index d5df780ed..8a88329af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -228,8 +228,8 @@ src/graphics/C4Facet.cpp \ src/graphics/C4FacetEx.cpp \ src/graphics/C4FacetEx.h \ src/graphics/C4Facet.h \ -src/graphics/C4Fonts.cpp \ -src/graphics/C4Fonts.h \ +src/graphics/C4FontLoader.cpp \ +src/graphics/C4FontLoader.h \ src/graphics/C4GraphicsResource.cpp \ src/graphics/C4GraphicsResource.h \ src/graphics/C4Surface.cpp \ @@ -468,8 +468,6 @@ src/platform/C4Window.h \ src/platform/C4windowswrapper.h \ src/platform/PlatformAbstraction.cpp \ src/platform/PlatformAbstraction.h \ -src/platform/StdFont.cpp \ -src/platform/StdFont.h \ src/platform/StdSync.h \ src/platform/StdVideo.cpp \ src/platform/StdVideo.h \ diff --git a/src/game/C4Application.cpp b/src/game/C4Application.cpp index 7930b0112..9df2b3f7d 100644 --- a/src/game/C4Application.cpp +++ b/src/game/C4Application.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -723,7 +722,7 @@ bool C4Application::SetGameFont(const char *szFontFace, int32_t iFontSize) // first, check if the selected font can be created at all // check regular font only - there's no reason why the other fonts couldn't be created CStdFont TestFont; - if (!::FontLoader.InitFont(TestFont, szFontFace, C4FontLoader::C4FT_Main, iFontSize, &::GraphicsResource.Files)) + if (!::FontLoader.InitFont(&TestFont, szFontFace, C4FontLoader::C4FT_Main, iFontSize, &::GraphicsResource.Files)) return false; // OK; reinit all fonts StdStrBuf sOldFont; sOldFont.Copy(Config.General.RXFontName); diff --git a/src/game/C4Game.cpp b/src/game/C4Game.cpp index b261594b7..0fe562e9e 100644 --- a/src/game/C4Game.cpp +++ b/src/game/C4Game.cpp @@ -77,7 +77,6 @@ #include #include #include -#include #include #include #include diff --git a/src/graphics/C4Draw.cpp b/src/graphics/C4Draw.cpp index fba875cd1..3ddbffc16 100644 --- a/src/graphics/C4Draw.cpp +++ b/src/graphics/C4Draw.cpp @@ -26,12 +26,12 @@ #include #include "C4App.h" +#include #include #include #include #include #include -#include #include "C4Rect.h" #include #include "StdMesh.h" diff --git a/src/platform/StdFont.cpp b/src/graphics/C4FontLoader.cpp similarity index 86% rename from src/platform/StdFont.cpp rename to src/graphics/C4FontLoader.cpp index a35efd5ca..06e40f5a6 100644 --- a/src/platform/StdFont.cpp +++ b/src/graphics/C4FontLoader.cpp @@ -23,14 +23,17 @@ // text drawing facility for C4Draw -#include "C4Include.h" -#include +#include +#include "C4FontLoader.h" -#include "Standard.h" -#include +#include +#include #include -#include +#include +#include #include +#include + #include #include @@ -45,6 +48,144 @@ /* Initialization */ +bool C4FontLoader::InitFont(CStdFont * rFont, const char *szFontName, FontType eType, int32_t iSize, C4GroupSet *pGfxGroups, bool fDoShadow) +{ +#ifdef USE_CONSOLE + return true; +#endif + // safety + assert(szFontName); + if (!szFontName || !*szFontName) + { + LogFatal(FormatString("%s (\"%s\")", LoadResStr("IDS_ERR_INITFONTS"), szFontName ? szFontName : "(null)").getData()); + return false; + } + // if def has not been found, use the def as font name + // determine font def string + const char *szFontString = szFontName; + // font not assigned? + assert(*szFontString); + if (!*szFontString) + { + // invalid call or spec + LogFatal(LoadResStr("IDS_ERR_INITFONTS")); return false; + } + // get font name + char FontFaceName[C4MaxName+1], FontParam[C4MaxName+1]; + SCopyUntil(szFontString, FontFaceName, ',', C4MaxName); + // is it an image file? + int32_t iDefFontSize; DWORD dwDefWeight=FW_NORMAL; + switch (eType) + { + case C4FT_Log: iDefFontSize = iSize*12/14; break; + case C4FT_MainSmall:iDefFontSize = iSize*13/14; break; + case C4FT_Main: iDefFontSize = iSize; break; + case C4FT_Caption: iDefFontSize = iSize*16/14; /*dwDefWeight = FW_MEDIUM;*/ break; + case C4FT_Title: iDefFontSize = iSize*22/14; /*dwDefWeight = FW_MEDIUM;*/ break; + default: assert(false); LogFatal(LoadResStr("IDS_ERR_INITFONTS")); return false; // invalid call + } + // regular font name: let WinGDI or Freetype draw a font with the given parameters + // font size given? + if (SCopySegment(szFontString, 1, FontParam, ',', C4MaxName)) + sscanf(FontParam, "%i", &iDefFontSize); + // font weight given? + if (SCopySegment(szFontString, 2, FontParam, ',', C4MaxName)) + { + int iDefWeight; + sscanf(FontParam, "%i", &iDefWeight); + dwDefWeight = iDefWeight; + } + // check if it's already loaded from that group with that parameters + if (rFont->IsSameAs(FontFaceName, iDefFontSize, dwDefWeight)) + return true; + // it's not; so (re-)load it now! + if (rFont->IsInitialized()) + { + // reloading + rFont->Clear(); + LogF(LoadResStr("IDS_PRC_UPDATEFONT"), FontFaceName, iDefFontSize, dwDefWeight); + } + // check if one of the internally listed fonts should be used + const char * const extensions[] = { "ttf", "otf", "ttc", "fon", "fnt", "fot", NULL }; + char FileName[_MAX_PATH+1]; + int32_t ID; + C4Group * pGrp = pGfxGroups->FindSuitableFile(FontFaceName, extensions, FileName, &ID); + if (pGrp) + { + if (LastUsedGrpID != ID || LastUsedName != FontFaceName) + { + DestroyFont(pLastUsedFont); + pLastUsedFont = NULL; + } + if (!pLastUsedFont) + { + StdBuf Data; + if (pGrp->LoadEntry(FileName, &Data)) + { + try + { + pLastUsedFont = CreateFont(Data); + LastUsedGrpID = ID; + LastUsedName = FontFaceName; + } + catch (std::runtime_error & e) + { + LogFatal(e.what()); + pGrp = NULL; + } + } + } + } + // no internal font match? Then create one using the given face/filename (using a system font) + if (!pGrp) + { + if (LastUsedGrpID != -1 || LastUsedName != FontFaceName) + { + DestroyFont(pLastUsedFont); + pLastUsedFont = NULL; + } + if (!pLastUsedFont) + { + try + { + pLastUsedFont = CreateFont(FontFaceName); + if (!pLastUsedFont) + // no match for font face found + throw std::runtime_error(FormatString("Font face %s undefined", FontFaceName).getData()); + LastUsedGrpID = -1; + LastUsedName = FontFaceName; + } + catch (std::runtime_error & e) + { + LogFatal(e.what()); + } + } + } + if (!pLastUsedFont) + { + LogFatal(LoadResStr("IDS_ERR_INITFONTS")); + return false; + } + try + { + rFont->Init(*pLastUsedFont, FontFaceName, iDefFontSize, dwDefWeight, fDoShadow); // throws exception on error + return true; + } + catch (std::runtime_error & e) + { + LogFatal(e.what()); + LogFatal(LoadResStr("IDS_ERR_INITFONTS")); + return false; + } +} + +void C4FontLoader::Clear() +{ + // delete vector font cache + DestroyFont(pLastUsedFont); + pLastUsedFont = NULL; +} + #ifdef HAVE_FREETYPE class CStdVectorFont { @@ -123,15 +264,15 @@ public: int RefCnt; }; -CStdVectorFont * CStdFont::CreateFont(const char *szFaceName) +CStdVectorFont * C4FontLoader::CreateFont(const char *szFaceName) { return new CStdVectorFont(szFaceName); } -CStdVectorFont * CStdFont::CreateFont(StdBuf & Data) +CStdVectorFont * C4FontLoader::CreateFont(StdBuf & Data) { return new CStdVectorFont(Data); } -void CStdFont::DestroyFont(CStdVectorFont * pFont) +void C4FontLoader::DestroyFont(CStdVectorFont * pFont) { if (!pFont) return; --(pFont->RefCnt); @@ -139,19 +280,21 @@ void CStdFont::DestroyFont(CStdVectorFont * pFont) delete pFont; } #else -CStdVectorFont * CStdFont::CreateFont(StdBuf & Data) +CStdVectorFont * C4FontLoader::CreateFont(StdBuf & Data) { return 0; } -CStdVectorFont * CStdFont::CreateFont(const char *szFaceName) +CStdVectorFont * C4FontLoader::CreateFont(const char *szFaceName) { return 0; } -void CStdFont::DestroyFont(CStdVectorFont * pFont) +void C4FontLoader::DestroyFont(CStdVectorFont * pFont) { } #endif +C4FontLoader FontLoader; + CStdFont::CStdFont() { // set default values @@ -375,7 +518,7 @@ void CStdFont::Init(CStdVectorFont & VectorFont, const char *font_face_name, DWO void CStdFont::Clear() { #if defined HAVE_FREETYPE - DestroyFont(pVectorFont); + FontLoader.DestroyFont(pVectorFont); pVectorFont = NULL; #endif // clear font sfcs diff --git a/src/platform/StdFont.h b/src/graphics/C4FontLoader.h similarity index 85% rename from src/platform/StdFont.h rename to src/graphics/C4FontLoader.h index 8d0af57db..000189397 100644 --- a/src/platform/StdFont.h +++ b/src/graphics/C4FontLoader.h @@ -45,6 +45,34 @@ class C4Markup; class CStdVectorFont; +// font loader +class C4FontLoader +{ +public: + // enum of different fonts used in the clonk engine + enum FontType { C4FT_Log, C4FT_MainSmall, C4FT_Main, C4FT_Caption, C4FT_Title }; + + C4FontLoader(): pLastUsedFont(NULL), LastUsedGrpID(0) { } // ctor + ~C4FontLoader() { Clear(); } // dtor + + void Clear(); // clear loaded fonts + // init a font class of the given type + // iSize is always the size of the normal font, which is adjusted for larger (title) and smaller (log) font types + bool InitFont(CStdFont * Font, const char *szFontName, FontType eType, int32_t iSize, C4GroupSet *pGfxGroups, bool fDoShadow=true); + +protected: + CStdVectorFont * pLastUsedFont; // cache + StdCopyStrBuf LastUsedName; + int32_t LastUsedGrpID; + + CStdVectorFont * CreateFont(StdBuf & Data); + CStdVectorFont * CreateFont(const char *szFaceName); + void DestroyFont(CStdVectorFont * pFont); + friend class CStdFont; +}; + +extern C4FontLoader FontLoader; + class CStdFont { public: @@ -60,10 +88,6 @@ public: virtual ~CustomImages() { } }; - static CStdVectorFont * CreateFont(StdBuf & Data); - static CStdVectorFont * CreateFont(const char *szFaceName); - static void DestroyFont(CStdVectorFont * pFont); -public: int id; // used by the engine to keep track of where the font came from protected: diff --git a/src/graphics/C4Fonts.cpp b/src/graphics/C4Fonts.cpp deleted file mode 100644 index f0dd337da..000000000 --- a/src/graphics/C4Fonts.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * OpenClonk, http://www.openclonk.org - * - * Copyright (c) 2004-2007 Sven Eberhardt - * Copyright (c) 2005-2007, 2010 Günther Brammer - * Copyright (c) 2010 Benjamin Herr - * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de - * - * Portions might be copyrighted by other authors who have contributed - * to OpenClonk. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * See isc_license.txt for full license and disclaimer. - * - * "Clonk" is a registered trademark of Matthes Bender. - * See clonk_trademark_license.txt for full license. - */ -// engine font loading - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -void C4FontLoader::Clear() -{ - // delete vector font cache - CStdFont::DestroyFont(pLastUsedFont); - pLastUsedFont = NULL; -} - -bool C4FontLoader::InitFont(CStdFont &rFont, const char *szFontName, FontType eType, int32_t iSize, C4GroupSet *pGfxGroups, bool fDoShadow) -{ -#ifdef USE_CONSOLE - return true; -#endif - // safety - assert(szFontName); - if (!szFontName || !*szFontName) - { - LogFatal(FormatString("%s (\"%s\")", LoadResStr("IDS_ERR_INITFONTS"), szFontName ? szFontName : "(null)").getData()); - return false; - } - // if def has not been found, use the def as font name - // determine font def string - const char *szFontString = szFontName; - // font not assigned? - assert(*szFontString); - if (!*szFontString) - { - // invalid call or spec - LogFatal(LoadResStr("IDS_ERR_INITFONTS")); return false; - } - // get font name - char FontFaceName[C4MaxName+1], FontParam[C4MaxName+1]; - SCopyUntil(szFontString, FontFaceName, ',', C4MaxName); - // is it an image file? - int32_t iDefFontSize; DWORD dwDefWeight=FW_NORMAL; - switch (eType) - { - case C4FT_Log: iDefFontSize = iSize*12/14; break; - case C4FT_MainSmall:iDefFontSize = iSize*13/14; break; - case C4FT_Main: iDefFontSize = iSize; break; - case C4FT_Caption: iDefFontSize = iSize*16/14; /*dwDefWeight = FW_MEDIUM;*/ break; - case C4FT_Title: iDefFontSize = iSize*22/14; /*dwDefWeight = FW_MEDIUM;*/ break; - default: assert(false); LogFatal(LoadResStr("IDS_ERR_INITFONTS")); return false; // invalid call - } - // regular font name: let WinGDI or Freetype draw a font with the given parameters - // font size given? - if (SCopySegment(szFontString, 1, FontParam, ',', C4MaxName)) - sscanf(FontParam, "%i", &iDefFontSize); - // font weight given? - if (SCopySegment(szFontString, 2, FontParam, ',', C4MaxName)) - { - int iDefWeight; - sscanf(FontParam, "%i", &iDefWeight); - dwDefWeight = iDefWeight; - } - // check if it's already loaded from that group with that parameters - if (rFont.IsSameAs(FontFaceName, iDefFontSize, dwDefWeight)) - return true; - // it's not; so (re-)load it now! - if (rFont.IsInitialized()) - { - // reloading - rFont.Clear(); - LogF(LoadResStr("IDS_PRC_UPDATEFONT"), FontFaceName, iDefFontSize, dwDefWeight); - } - // check if one of the internally listed fonts should be used - const char * const extensions[] = { "ttf", "otf", "ttc", "fon", "fnt", "fot", NULL }; - char FileName[_MAX_PATH+1]; - int32_t ID; - C4Group * pGrp = pGfxGroups->FindSuitableFile(FontFaceName, extensions, FileName, &ID); - if (pGrp) - { - if (LastUsedGrpID != ID || LastUsedName != FontFaceName) - { - CStdFont::DestroyFont(pLastUsedFont); - pLastUsedFont = NULL; - } - if (!pLastUsedFont) - { - StdBuf Data; - if (pGrp->LoadEntry(FileName, &Data)) - { - try - { - pLastUsedFont = CStdFont::CreateFont(Data); - LastUsedGrpID = ID; - LastUsedName = FontFaceName; - } - catch (std::runtime_error & e) - { - LogFatal(e.what()); - pGrp = NULL; - } - } - } - } - // no internal font match? Then create one using the given face/filename (using a system font) - if (!pGrp) - { - if (LastUsedGrpID != -1 || LastUsedName != FontFaceName) - { - CStdFont::DestroyFont(pLastUsedFont); - pLastUsedFont = NULL; - } - if (!pLastUsedFont) - { - try - { - pLastUsedFont = CStdFont::CreateFont(FontFaceName); - if (!pLastUsedFont) - // no match for font face found - throw std::runtime_error(FormatString("Font face %s undefined", FontFaceName).getData()); - LastUsedGrpID = -1; - LastUsedName = FontFaceName; - } - catch (std::runtime_error & e) - { - LogFatal(e.what()); - } - } - } - if (!pLastUsedFont) - { - LogFatal(LoadResStr("IDS_ERR_INITFONTS")); - return false; - } - try - { - rFont.Init(*pLastUsedFont, FontFaceName, iDefFontSize, dwDefWeight, fDoShadow); // throws exception on error - return true; - } - catch (std::runtime_error & e) - { - LogFatal(e.what()); - LogFatal(LoadResStr("IDS_ERR_INITFONTS")); - return false; - } -} - -C4FontLoader FontLoader; diff --git a/src/graphics/C4Fonts.h b/src/graphics/C4Fonts.h deleted file mode 100644 index 60798dcbd..000000000 --- a/src/graphics/C4Fonts.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * OpenClonk, http://www.openclonk.org - * - * Copyright (c) 2004-2005 Sven Eberhardt - * Copyright (c) 2006 Günther Brammer - * Copyright (c) 2004-2009, RedWolf Design GmbH, http://www.clonk.de - * - * Portions might be copyrighted by other authors who have contributed - * to OpenClonk. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * See isc_license.txt for full license and disclaimer. - * - * "Clonk" is a registered trademark of Matthes Bender. - * See clonk_trademark_license.txt for full license. - */ -// engine font loading - -#ifndef INC_C4Fonts -#define INC_C4Fonts - -#include - -// font loader -class C4FontLoader -{ -protected: - CStdVectorFont * pLastUsedFont; // cache - StdCopyStrBuf LastUsedName; - int32_t LastUsedGrpID; - -public: - // enum of different fonts used in the clonk engine - enum FontType { C4FT_Log, C4FT_MainSmall, C4FT_Main, C4FT_Caption, C4FT_Title }; - -public: - C4FontLoader(): pLastUsedFont(NULL), LastUsedGrpID(0) { } // ctor - ~C4FontLoader() { Clear(); } // dtor - - void Clear(); // clear loaded fonts - // init a font class of the given type - // iSize is always the size of the normal font, which is adjusted for larger (title) and smaller (log) font types - bool InitFont(CStdFont &rFont, const char *szFontName, FontType eType, int32_t iSize, C4GroupSet *pGfxGroups, bool fDoShadow=true); -}; - -extern C4FontLoader FontLoader; - -#endif // INC_C4Fonts diff --git a/src/graphics/C4GraphicsResource.cpp b/src/graphics/C4GraphicsResource.cpp index 0648b5e67..c465c67ca 100644 --- a/src/graphics/C4GraphicsResource.cpp +++ b/src/graphics/C4GraphicsResource.cpp @@ -26,11 +26,11 @@ #include #include +#include #include #include #include #include -#include #include @@ -154,15 +154,15 @@ bool C4GraphicsResource::InitFonts() // this regards scenario-specific fonts or overloads in Extra.ocg const char *szFont; if (*Game.C4S.Head.Font) szFont = Game.C4S.Head.Font; else szFont = Config.General.RXFontName; - if (!::FontLoader.InitFont(FontRegular, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &Files)) return false; + if (!::FontLoader.InitFont(&FontRegular, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &Files)) return false; Game.SetInitProgress(ProgressStart); ProgressStart += ProgressIncrement; - if (!::FontLoader.InitFont(FontTiny, szFont, C4FontLoader::C4FT_Log, Config.General.RXFontSize, &Files)) return false; + if (!::FontLoader.InitFont(&FontTiny, szFont, C4FontLoader::C4FT_Log, Config.General.RXFontSize, &Files)) return false; Game.SetInitProgress(ProgressStart); ProgressStart += ProgressIncrement; - if (!::FontLoader.InitFont(FontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &Files)) return false; + if (!::FontLoader.InitFont(&FontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &Files)) return false; Game.SetInitProgress(ProgressStart); ProgressStart += ProgressIncrement; - if (!::FontLoader.InitFont(FontCaption, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &Files)) return false; + if (!::FontLoader.InitFont(&FontCaption, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &Files)) return false; Game.SetInitProgress(ProgressStart); ProgressStart += ProgressIncrement; - if (!::FontLoader.InitFont(FontTooltip, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &Files, false)) return false; + if (!::FontLoader.InitFont(&FontTooltip, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &Files, false)) return false; Game.SetInitProgress(ProgressStart); ProgressStart += ProgressIncrement; // assign def list as custom image source FontRegular.SetCustomImages(&::Definitions); diff --git a/src/gui/C4Gui.h b/src/gui/C4Gui.h index ded41e714..e5de585a0 100644 --- a/src/gui/C4Gui.h +++ b/src/gui/C4Gui.h @@ -32,6 +32,7 @@ #ifndef INC_C4Gui #define INC_C4Gui +#include #include "C4Rect.h" #include "C4Shape.h" #include "C4FacetEx.h" diff --git a/src/gui/C4Startup.cpp b/src/gui/C4Startup.cpp index 0fd87300b..451d1282d 100644 --- a/src/gui/C4Startup.cpp +++ b/src/gui/C4Startup.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -34,7 +35,6 @@ #include #include #include -#include bool C4StartupGraphics::LoadFile(C4FacetID &rToFct, const char *szFilename) { @@ -95,16 +95,16 @@ bool C4StartupGraphics::Init() bool C4StartupGraphics::InitFonts() { const char *szFont = Config.General.RXFontName; - if (!::FontLoader.InitFont(BookFontCapt, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &::GraphicsResource.Files, false)) + if (!::FontLoader.InitFont(&BookFontCapt, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &::GraphicsResource.Files, false)) { LogFatal("Font Error (1)"); return false; } Game.SetInitProgress(97); - if (!::FontLoader.InitFont(BookFont, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &::GraphicsResource.Files, false)) + if (!::FontLoader.InitFont(&BookFont, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &::GraphicsResource.Files, false)) { LogFatal("Font Error (2)"); return false; } Game.SetInitProgress(98); - if (!::FontLoader.InitFont(BookFontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &::GraphicsResource.Files, false)) + if (!::FontLoader.InitFont(&BookFontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &::GraphicsResource.Files, false)) { LogFatal("Font Error (3)"); return false; } Game.SetInitProgress(99); - if (!::FontLoader.InitFont(BookSmallFont, szFont, C4FontLoader::C4FT_MainSmall, Config.General.RXFontSize, &::GraphicsResource.Files, false)) + if (!::FontLoader.InitFont(&BookSmallFont, szFont, C4FontLoader::C4FT_MainSmall, Config.General.RXFontSize, &::GraphicsResource.Files, false)) { LogFatal("Font Error (4)"); return false; } return true; } diff --git a/src/lib/C4LogBuf.cpp b/src/lib/C4LogBuf.cpp index 939955b13..716dbbba1 100644 --- a/src/lib/C4LogBuf.cpp +++ b/src/lib/C4LogBuf.cpp @@ -20,6 +20,8 @@ #include "C4Include.h" #include "C4LogBuf.h" +#include + C4LogBuffer::C4LogBuffer(int iSize, int iMaxLines, int iLBWidth, const char *szIndentChars, bool fDynamicGrow, bool fMarkup) : iBufSize(iSize), iFirstLinePos(0), iAfterLastLinePos(0), iLineDataPos(0), iNextLineDataPos(0), iMaxLineCount(iMaxLines), iLineCount(0), iLineBreakWidth(iLBWidth), fDynamicGrow(fDynamicGrow), fMarkup(fMarkup) diff --git a/src/lib/C4LogBuf.h b/src/lib/C4LogBuf.h index 921e2fa49..8c3dcdb84 100644 --- a/src/lib/C4LogBuf.h +++ b/src/lib/C4LogBuf.h @@ -20,8 +20,6 @@ #ifndef INC_C4LogBuf #define INC_C4LogBuf -#include - // circular log buffer to holding line-wise log data class C4LogBuffer { diff --git a/src/object/C4DefList.h b/src/object/C4DefList.h index 6acceffdc..00085601c 100644 --- a/src/object/C4DefList.h +++ b/src/object/C4DefList.h @@ -23,7 +23,7 @@ #ifndef INC_C4DefList #define INC_C4DefList -#include +#include class C4DefList: public CStdFont::CustomImages {