Increase script message lists capacity

This commit is contained in:
Alexander Batalov 2022-08-12 15:49:43 +03:00
parent 140234f40e
commit c3bffa6777
1 changed files with 8 additions and 4 deletions

View File

@ -36,6 +36,10 @@
#define SCRIPT_LIST_EXTENT_SIZE 16 #define SCRIPT_LIST_EXTENT_SIZE 16
// SFALL: Increase number of message lists for scripted dialogs.
// CE: In Sfall this increase is configurable with `BoostScriptDialogLimit`.
#define SCRIPT_DIALOG_MESSAGE_LIST_CAPACITY 10000
typedef struct ScriptsListEntry { typedef struct ScriptsListEntry {
char name[16]; char name[16];
int local_vars_num; int local_vars_num;
@ -242,7 +246,7 @@ static Object* gScriptsRequestedStealingBy;
static Object* gScriptsRequestedStealingFrom; static Object* gScriptsRequestedStealingFrom;
// 0x6649D4 // 0x6649D4
static MessageList _script_dialog_msgs[1450]; static MessageList _script_dialog_msgs[SCRIPT_DIALOG_MESSAGE_LIST_CAPACITY];
// scr.msg // scr.msg
// //
@ -1494,7 +1498,7 @@ int scriptsInit()
return -1; return -1;
} }
for (int index = 0; index < 1450; index++) { for (int index = 0; index < SCRIPT_DIALOG_MESSAGE_LIST_CAPACITY; index++) {
if (!messageListInit(&(_script_dialog_msgs[index]))) { if (!messageListInit(&(_script_dialog_msgs[index]))) {
return -1; return -1;
} }
@ -1541,7 +1545,7 @@ int _scr_game_init()
return -1; return -1;
} }
for (i = 0; i < 1450; i++) { for (i = 0; i < SCRIPT_DIALOG_MESSAGE_LIST_CAPACITY; i++) {
if (!messageListInit(&(_script_dialog_msgs[i]))) { if (!messageListInit(&(_script_dialog_msgs[i]))) {
debugPrint("\nERROR IN SCRIPT_DIALOG_MSGS!"); debugPrint("\nERROR IN SCRIPT_DIALOG_MSGS!");
return -1; return -1;
@ -1611,7 +1615,7 @@ int scriptsExit()
// 0x4A52F4 // 0x4A52F4
int _scr_message_free() int _scr_message_free()
{ {
for (int index = 0; index < 1450; index++) { for (int index = 0; index < SCRIPT_DIALOG_MESSAGE_LIST_CAPACITY; index++) {
MessageList* messageList = &(_script_dialog_msgs[index]); MessageList* messageList = &(_script_dialog_msgs[index]);
if (messageList->entries_num != 0) { if (messageList->entries_num != 0) {
if (!messageListFree(messageList)) { if (!messageListFree(messageList)) {