From 1209d2cd855b19c3698c3a3474cb2e503a26d35e Mon Sep 17 00:00:00 2001 From: avolkov Date: Thu, 6 Sep 2007 08:33:21 +0000 Subject: [PATCH] Increased the size of the display queue (disp_q) git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2847 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 2 ++ sc2/src/sc2code/battle.h | 4 ++++ sc2/src/sc2code/element.h | 2 +- sc2/src/sc2code/process.c | 5 +++++ sc2/src/sc2code/setup.c | 2 +- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index a7c87da56..3b150dc7c 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.7: +- Increased the size of display queue (elements were sometimes missing + in e.g. Nemesis vs. Nemesis battles with many marines out) - Alex - ShowPresentation() no longer clears the screen by force; presentations now do this by request - Michael - Added match_matchPatternOnce() - SvdB diff --git a/sc2/src/sc2code/battle.h b/sc2/src/sc2code/battle.h index 6839985d9..0f7194f07 100644 --- a/sc2/src/sc2code/battle.h +++ b/sc2/src/sc2code/battle.h @@ -29,6 +29,10 @@ typedef struct battlestate_struct { } BATTLE_STATE; extern QUEUE disp_q; +// The maximum number of elements is chosen to provide a slight margin. +// Currently, it is maximum *known used* in Melee + 30 +#define MAX_DISPLAY_ELEMENTS 150 + extern BYTE battle_counter[NUM_SIDES]; extern BOOLEAN instantVictory; #ifdef NETPLAY diff --git a/sc2/src/sc2code/element.h b/sc2/src/sc2code/element.h index f04b57505..1d10d1df7 100644 --- a/sc2/src/sc2code/element.h +++ b/sc2/src/sc2code/element.h @@ -157,7 +157,7 @@ struct element HELEMENT hTarget; }; -#define MAX_DISPLAY_PRIMS 280 +#define MAX_DISPLAY_PRIMS 330 extern COUNT DisplayFreeList; extern PRIMITIVE DisplayArray[MAX_DISPLAY_PRIMS]; diff --git a/sc2/src/sc2code/process.c b/sc2/src/sc2code/process.c index 2ca10b166..2f99cdc6d 100644 --- a/sc2/src/sc2code/process.c +++ b/sc2/src/sc2code/process.c @@ -80,6 +80,11 @@ AllocElement (void) LockElement (hElement, &ElementPtr); memset (ElementPtr, 0, sizeof (*ElementPtr)); ElementPtr->PrimIndex = AllocDisplayPrim (); + if (ElementPtr->PrimIndex == END_OF_LIST) + { + log_add (log_Error, "AllocElement: Out of display prims!"); + explode (); + } SetPrimType (&DisplayArray[ElementPtr->PrimIndex], NO_PRIM); UnlockElement (hElement); } diff --git a/sc2/src/sc2code/setup.c b/sc2/src/sc2code/setup.c index d894a88ee..c7cd3e81a 100644 --- a/sc2/src/sc2code/setup.c +++ b/sc2/src/sc2code/setup.c @@ -155,7 +155,7 @@ InitContexts (void) if (OffScreenContext == NULL) return FALSE; - if (!InitQueue (&disp_q, 100, sizeof (ELEMENT))) + if (!InitQueue (&disp_q, MAX_DISPLAY_ELEMENTS, sizeof (ELEMENT))) return FALSE; return TRUE;