(svn r27758) -Change: Increase the maximum number of GameScript texts to 64k, and NewGRF texts to 512k.

This commit is contained in:
frosch
2017-02-26 19:41:30 +00:00
parent fc4c4d080c
commit 2bb80d280c
5 changed files with 39 additions and 36 deletions

View File

@@ -24,7 +24,10 @@
*/
static inline StringTab GetStringTab(StringID str)
{
return (StringTab)GB(str, TAB_SIZE_BITS, 5);
StringTab result = (StringTab)(str >> TAB_SIZE_BITS);
if (result >= TEXT_TAB_NEWGRF_START) return TEXT_TAB_NEWGRF_START;
if (result >= TEXT_TAB_GAMESCRIPT_START) return TEXT_TAB_GAMESCRIPT_START;
return result;
}
/**
@@ -34,7 +37,7 @@ static inline StringTab GetStringTab(StringID str)
*/
static inline uint GetStringIndex(StringID str)
{
return GB(str, 0, TAB_SIZE_BITS);
return str - (GetStringTab(str) << TAB_SIZE_BITS);
}
/**
@@ -45,9 +48,15 @@ static inline uint GetStringIndex(StringID str)
*/
static inline StringID MakeStringID(StringTab tab, uint index)
{
assert(tab < TEXT_TAB_END);
assert(index < TAB_SIZE);
return tab << TAB_SIZE_BITS | index;
if (tab == TEXT_TAB_NEWGRF_START) {
assert(index < TAB_SIZE_NEWGRF);
} else if (tab == TEXT_TAB_GAMESCRIPT_START) {
assert(index < TAB_SIZE_GAMESCRIPT);
} else {
assert(tab < TEXT_TAB_END);
assert(index < TAB_SIZE);
}
return (tab << TAB_SIZE_BITS) + index;
}
class StringParameters {