From 976a4bfb6e709c47f1e60344fd6f0207c6b1a0f4 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Wed, 29 Nov 2006 04:22:13 +0000 Subject: [PATCH] Update the 'current selection' icon after deleting or inserting ships in a fleet in SuperMelee. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2557 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 2 ++ sc2/src/sc2code/melee.c | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 46e80c632..512144dbd 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.6: +- Update the 'current selection' icon after deleting or inserting ships + in a fleet in SuperMelee - SvdB - Correct top two lines of melebkgd.25.png - SvdB - Unix build scripts improvements. - SvdB - Build fixes for MacOS X (with thanks to Nic) - SvdB diff --git a/sc2/src/sc2code/melee.c b/sc2/src/sc2code/melee.c index d10982385..3487bfdf3 100644 --- a/sc2/src/sc2code/melee.c +++ b/sc2/src/sc2code/melee.c @@ -945,6 +945,17 @@ DrawMeleeShipStrings (PMELEE_STATE pMS, BYTE NewStarShip) UnlockMutex (GraphicsLock); } +static void +UpdateCurrentShip (PMELEE_STATE pMS) +{ + FleetShipIndex fleetShipIndex = GetShipIndex (pMS->row, pMS->col); + if (pMS->row == NUM_MELEE_ROWS) + pMS->CurIndex = MELEE_NONE; + else + pMS->CurIndex = pMS->TeamImage[pMS->side].ShipList[fleetShipIndex]; + DrawMeleeShipStrings (pMS, (BYTE)(pMS->CurIndex)); +} + // returns (COUNT) ~0 for an invalid ship. static COUNT GetShipValue (BYTE StarShip) @@ -1505,6 +1516,7 @@ DoEdit (PMELEE_STATE pMS) fleetShipIndex = GetShipIndex (pMS->row, pMS->col); fleetShipChanged (pMS, pMS->side, fleetShipIndex); AdvanceCursor (pMS); + UpdateCurrentShip(pMS); } else { @@ -1598,17 +1610,9 @@ DoEdit (PMELEE_STATE pMS) pMS->side = side; pMS->row = row; pMS->col = col; - if (row == NUM_MELEE_ROWS) - pMS->CurIndex = MELEE_NONE; - else - { - FleetShipIndex fleetShipIndex = GetShipIndex (row, col); - pMS->CurIndex = - pMS->TeamImage[side].ShipList[fleetShipIndex]; - } UnlockMutex (GraphicsLock); - DrawMeleeShipStrings (pMS, (BYTE)(pMS->CurIndex)); + UpdateCurrentShip(pMS); } } @@ -1696,8 +1700,7 @@ DoPickShip (PMELEE_STATE pMS) UnlockMutex (GraphicsLock); } - pMS->CurIndex = pMS->TeamImage[pMS->side].ShipList[index]; - DrawMeleeShipStrings (pMS, (BYTE)pMS->CurIndex); + UpdateCurrentShip(pMS); pMS->InputFunc = DoEdit;