[Gcblue-commits] gcb_wx/scripts Menu.py,1.32,1.33
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-12-28 23:41:17
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4466/scripts Modified Files: Menu.py Log Message: Index: Menu.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/Menu.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Menu.py 20 Dec 2006 00:45:46 -0000 1.32 --- Menu.py 28 Dec 2006 23:41:12 -0000 1.33 *************** *** 38,44 **** def BuildGroupMenu(GroupMenu, GroupInfo): GroupMenu.Clear() ! unit_count = GroupInfo.GetUnitCount() #GroupMenu.AddItem('Total units: %d' % unit_count, '') GroupMenu.AddItemUI('Change heading','SetHeadingGroup','Heading') --- 38,67 ---- def BuildGroupMenu(GroupMenu, GroupInfo): GroupMenu.Clear() ! unit_count = GroupInfo.GetUnitCount() + + #determine number of carriers, helos, subs etc. in group + #used to build menu depending on group configuration + carrier_count = 0 + helo_count = 0 + air_count = 0 + for n in range(0,unit_count): + UI = GroupInfo.GetPlatformInterface(n) + if(UI.HasFlightPort()): + carrier_count = carrier_count + 1 + if(UI.IsHelo()): + helo_count = helo_count + 1 + if(UI.IsAir()): + air_count = air_count + 1 + + #GroupMenu.AddItem('Total units: %d' % unit_count, '') + + # display info if group consists only of aircraft/helo + if(air_count==unit_count and helo_count == 0): + GroupMenu.AddItem('Air Group: %d units' % air_count,'') + if(helo_count==unit_count): + GroupMenu.AddItem('Helo Group: %d units' % helo_count,'') + GroupMenu.AddItemUI('Change heading','SetHeadingGroup','Heading') *************** *** 58,62 **** GroupMenu.AddItem('Group 100%','RelGroupSpeed100') GroupMenu.EndSubMenu() ! # Group orders GroupMenu.AddItem('Tasks','') --- 81,119 ---- GroupMenu.AddItem('Group 100%','RelGroupSpeed100') GroupMenu.EndSubMenu() ! ! # aircraft/helo altitude submenu, when group is aircraft/helo only ! # we add a specific altitude control submenu. ! if(air_count == unit_count and helo_count == 0): ! GroupMenu.AddItem('Altitude','') ! GroupMenu.BeginSubMenu() ! GroupMenu.AddItem('High','GroupAltitudeHigh') ! GroupMenu.AddItem('Medium','GroupAltitudeMedium') ! GroupMenu.AddItem('Low','GroupAltitudeLow') ! GroupMenu.AddItem('Very low','GroupAltitudeVeryLow') ! GroupMenu.EndSubMenu() ! if(helo_count == unit_count): ! GroupMenu.AddItem('Altitude','') ! GroupMenu.BeginSubMenu() ! GroupMenu.AddItem('Medium','GroupHeloAltitudeMedium') ! GroupMenu.AddItem('Low','GroupHeloAltitudeLow') ! GroupMenu.AddItem('Very low','GroupHeloAltitudeVeryLow') ! GroupMenu.EndSubMenu() ! ! # Group Sensor Settings ! GroupMenu.AddItem('Sensors','') ! GroupMenu.BeginSubMenu() ! GroupMenu.AddItem('full Sensors','GroupAllSensors') ! GroupMenu.AddItem('passive Sensors','GroupPassiveSensors') ! GroupMenu.AddItem('offline','GroupOfflineSensors') ! GroupMenu.EndSubMenu() ! ! # aircraft/helo landing submenu, only if helo/air group ! if((air_count == unit_count and helo_count == 0)or(helo_count==unit_count)): ! GroupMenu.AddItem('Land','') ! GroupMenu.BeginSubMenu() ! GroupMenu.AddItemUI('Land at selected','GroupAddLandingOrder','Target') ! GroupMenu.AddItem('Land at homebases','GroupAddLandingHBOrder') ! GroupMenu.EndSubMenu() ! # Group orders GroupMenu.AddItem('Tasks','') |