diff options
Diffstat (limited to '')
-rw-r--r-- | src/text/Text.cpp | 11 | ||||
-rw-r--r-- | src/text/Text.h | 16 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 5f7a07cc..a11acd26 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -13,7 +13,7 @@ static wchar WideErrorString[25]; -CText TheText; +CText *CText::msInstance = nil; CText::CText(void) { @@ -41,7 +41,7 @@ CText::Load(void) CFileMgr::SetDir("TEXT"); switch(FrontEndMenuManager.m_PrefsLanguage){ case CMenuManager::LANGUAGE_AMERICAN: - sprintf(filename, "AMERICAN.GXT"); + sprintf(filename, "ENGLISH.GXT"); break; case CMenuManager::LANGUAGE_FRENCH: sprintf(filename, "FRENCH.GXT"); @@ -93,11 +93,13 @@ CText::Load(void) keyArray.Update(data.chars); CFileMgr::CloseFile(file); CFileMgr::SetDir(""); + bIsLoaded = true; } void CText::Unload(void) { + bIsLoaded = false; CMessages::ClearAllMessagesDisplayedByGame(); keyArray.Unload(); data.Unload(); @@ -307,6 +309,11 @@ CText::LoadMissionText(char *MissionTableName) bIsMissionTextLoaded = true; } +bool +CText::IsLoaded() +{ + return bIsLoaded; +} void CKeyArray::Load(size_t length, int file, size_t* offset) diff --git a/src/text/Text.h b/src/text/Text.h index 33dc313e..3e11ea46 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -58,7 +58,7 @@ public: uint32 offset; }; - enum {MAX_MISSION_TEXTS = 90}; // beware that LCS has more + enum {MAX_MISSION_TEXTS = 200}; Entry data[MAX_MISSION_TEXTS]; uint16 size; // You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready. @@ -84,6 +84,9 @@ class CText bool bIsMissionTextLoaded; char szMissionTableName[8]; CMissionTextOffsets MissionTextOffsets; + bool bIsLoaded; + + static CText *msInstance; public: CText(void); void Load(void); @@ -94,6 +97,15 @@ public: void GetNameOfLoadedMissionText(char *outName); void ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *bytes_read); void LoadMissionText(char *MissionTableName); + bool IsLoaded(); + void GetUTF8(const char*, char*, int); // TODO but unused + + static CText &Instance() + { + if (!msInstance) + msInstance = new CText; + return *msInstance; + } }; -extern CText TheText; +#define TheText CText::Instance() |