From ccd0285168327e3858a5d10ab6c8ad3352fc2f45 Mon Sep 17 00:00:00 2001 From: avolkov Date: Thu, 12 Jul 2007 04:14:52 +0000 Subject: [PATCH] Fixed wrong Sa-Matra guards icons; bug #1001 git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2806 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/grpinfo.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sc2/src/sc2code/grpinfo.c b/sc2/src/sc2code/grpinfo.c index 11dfa2ce7..7c067a9ef 100644 --- a/sc2/src/sc2code/grpinfo.c +++ b/sc2/src/sc2code/grpinfo.c @@ -452,18 +452,8 @@ FlushGroupInfo (GROUP_HEADER* pGH, DWORD offset, BYTE which_group, void *fp) } else if (which_group > pGH->NumGroups) { /* Group not present yet -- add it */ - HSHIPFRAG hStarShip; - SHIP_FRAGMENT *FragPtr; - pGH->NumGroups = which_group; pGH->GroupOffset[which_group] = LengthStateFile (fp); - - /* The first ship in a group defines the alien race */ - hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q)); - FragPtr = LockShipFrag (&GLOBAL (npc_built_ship_q), hStarShip); - SeekStateFile (fp, pGH->GroupOffset[which_group], SEEK_SET); - swrite_8 (fp, FragPtr->race_id); - UnlockShipFrag (&GLOBAL (npc_built_ship_q), hStarShip); } SeekStateFile (fp, offset, SEEK_SET); @@ -479,7 +469,6 @@ FlushGroupInfo (GROUP_HEADER* pGH, DWORD offset, BYTE which_group, void *fp) { /* Write out ip_group_q as group 0 */ HIPGROUP hGroup, hNextGroup; - // XXX: will use ip_group_q here BYTE NumGroups = CountLinks (&GLOBAL (ip_group_q)); SeekStateFile (fp, pGH->GroupOffset[0], SEEK_SET); @@ -516,12 +505,23 @@ FlushGroupInfo (GROUP_HEADER* pGH, DWORD offset, BYTE which_group, void *fp) /* Write out npc_built_ship_q as 'which_group' group */ HSHIPFRAG hStarShip, hNextShip; BYTE NumShips = CountLinks (&GLOBAL (npc_built_ship_q)); - - /* Do not change RaceType of the group (skip it) */ - SeekStateFile (fp, pGH->GroupOffset[which_group] + 1, SEEK_SET); - swrite_8 (fp, NumShips); + BYTE RaceType = 0; hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q)); + if (NumShips > 0) + { + SHIP_FRAGMENT *FragPtr; + + /* The first ship in a group defines the alien race */ + FragPtr = LockShipFrag (&GLOBAL (npc_built_ship_q), hStarShip); + RaceType = FragPtr->race_id; + UnlockShipFrag (&GLOBAL (npc_built_ship_q), hStarShip); + } + + SeekStateFile (fp, pGH->GroupOffset[which_group], SEEK_SET); + swrite_8 (fp, RaceType); + swrite_8 (fp, NumShips); + for ( ; NumShips; --NumShips, hStarShip = hNextShip) { SHIP_FRAGMENT *FragPtr;