forked from Mirrors/openclonk
Remove the last traces of the Strings.txt
parent
9646d94757
commit
6d3fc6032b
|
@ -254,10 +254,6 @@ bool C4Game::OpenScenario()
|
|||
if (!Parameters.Load(ScenarioFile, &C4S, GameText.GetData(), &ScenarioLangStringTable, DefinitionFilenames))
|
||||
return false;
|
||||
|
||||
// Load Strings (since kept objects aren't denumerated in sect-load, no problems should occur...)
|
||||
if (ScenarioFile.FindEntry(C4CFN_Strings))
|
||||
if (!Strings.Load(ScenarioFile))
|
||||
{ LogFatal(LoadResStr("IDS_ERR_STRINGS")); return false; }
|
||||
SetInitProgress(4);
|
||||
|
||||
// Compile runtime data
|
||||
|
|
|
@ -114,7 +114,6 @@
|
|||
#define C4CFN_RankFaces "Rank.bmp"
|
||||
#define C4CFN_RankFacesPNG "Rank.png"
|
||||
#define C4CFN_ClonkRank "Rank.png" // custom rank in info file: One rank image only
|
||||
#define C4CFN_Strings "Strings.txt"
|
||||
#define C4CFN_LeagueInfo "League.txt" // read by frontend only
|
||||
#define C4CFN_PlayerInfos "PlayerInfos.txt"
|
||||
#define C4CFN_SavePlayerInfos "SavePlayerInfos.txt"
|
||||
|
|
|
@ -480,8 +480,6 @@ void C4AulScriptEngine::UnLink()
|
|||
{
|
||||
// unlink scripts
|
||||
C4AulScript::UnLink();
|
||||
// clear string table ("hold" strings only)
|
||||
Strings.Clear();
|
||||
// Do not clear global variables and constants, because they are registered by the
|
||||
// preparser. Note that keeping those fields means that you cannot delete a global
|
||||
// variable or constant at runtime by removing it from the script.
|
||||
|
|
|
@ -126,18 +126,10 @@ C4StringTable::C4StringTable()
|
|||
|
||||
C4StringTable::~C4StringTable()
|
||||
{
|
||||
Clear();
|
||||
for (unsigned int i = 0; i < P_LAST; ++i) P[i]->DecRef();
|
||||
assert(!Set.GetSize());
|
||||
}
|
||||
|
||||
void C4StringTable::Clear()
|
||||
{
|
||||
for (unsigned int i = 0; i < Stringstxt.size(); ++i)
|
||||
Stringstxt[i]->DecRef();
|
||||
Stringstxt.clear();
|
||||
}
|
||||
|
||||
C4String *C4StringTable::RegString(StdStrBuf String)
|
||||
{
|
||||
C4String * s = FindString(String.getData());
|
||||
|
@ -160,34 +152,4 @@ C4String *C4StringTable::FindString(C4String *pString)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
C4String *C4StringTable::FindString(int iEnumID)
|
||||
{
|
||||
if (iEnumID >= 0 && iEnumID < int(Stringstxt.size()))
|
||||
return Stringstxt[iEnumID];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool C4StringTable::Load(C4Group& ParentGroup)
|
||||
{
|
||||
Clear();
|
||||
// read data
|
||||
char *pData;
|
||||
if (!ParentGroup.LoadEntry(C4CFN_Strings, &pData, NULL, 1))
|
||||
return false;
|
||||
// read all strings
|
||||
char strBuf[1024 + 1]; // 1024 was the last used value to write the Strings.txt
|
||||
for (int i = 0; SCopySegment(pData, i, strBuf, 0x0A, 1024); i++)
|
||||
{
|
||||
SReplaceChar(strBuf, 0x0D, 0x00);
|
||||
// add string to list
|
||||
C4String *pnString;
|
||||
pnString = RegString(StdStrBuf(strBuf));
|
||||
pnString->IncRef();
|
||||
Stringstxt.push_back(pnString);
|
||||
}
|
||||
// delete data
|
||||
delete[] pData;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4StringTable Strings;
|
||||
|
|
|
@ -223,21 +223,14 @@ public:
|
|||
C4StringTable();
|
||||
virtual ~C4StringTable();
|
||||
|
||||
void Clear();
|
||||
|
||||
C4String *RegString(StdStrBuf String);
|
||||
C4String *RegString(const char * s) { return RegString(StdStrBuf(s)); }
|
||||
// Find existing C4String
|
||||
C4String *FindString(const char *strString);
|
||||
// Check wether the pointer is a C4String
|
||||
C4String *FindString(C4String *pString);
|
||||
// Get a string from the Strings.txt
|
||||
C4String *FindString(int iEnumID);
|
||||
|
||||
bool Load(C4Group& ParentGroup);
|
||||
|
||||
C4Set<C4String *> Set;
|
||||
std::vector<C4String *> Stringstxt;
|
||||
C4String * P[P_LAST];
|
||||
};
|
||||
|
||||
|
|
|
@ -638,22 +638,6 @@ void C4Value::CompileFunc(StdCompiler *pComp)
|
|||
delete pExc;
|
||||
cC4VID = 'A';
|
||||
}
|
||||
// old style string
|
||||
if (cC4VID == 'S')
|
||||
{
|
||||
int32_t iTmp;
|
||||
pComp->Value(iTmp);
|
||||
// search
|
||||
C4String *pString = ::Strings.FindString(iTmp);
|
||||
if (pString)
|
||||
{
|
||||
Data.Str = pString;
|
||||
pString->IncRef();
|
||||
}
|
||||
else
|
||||
Type = C4V_Any;
|
||||
return;
|
||||
}
|
||||
Type = GetC4VFromID(cC4VID);
|
||||
}
|
||||
// Data
|
||||
|
@ -712,7 +696,6 @@ void C4Value::CompileFunc(StdCompiler *pComp)
|
|||
break;
|
||||
}
|
||||
|
||||
// string: save string number
|
||||
case C4V_String:
|
||||
{
|
||||
// search
|
||||
|
|
Loading…
Reference in New Issue