gcblue-commits Mailing List for Global Conflict Blue
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
From: Dewitt C. <ddc...@us...> - 2006-12-28 23:44:21
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv5680 Modified Files: UnitCommands.py Log Message: Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** UnitCommands.py 20 Dec 2006 00:45:46 -0000 1.34 --- UnitCommands.py 28 Dec 2006 23:44:19 -0000 1.35 *************** *** 494,497 **** --- 494,498 ---- # Group menu functions from Ben "Mnfe" 20061217 post + # Updated with 20061220 post def RelGroupSpeed100(GI): unit_count = GI.GetUnitCount() *************** *** 504,508 **** for n in range(0,unit_count): UI = GI.GetPlatformInterface(n) ! UI.SetSpeed(max_speed) def RelGroupSpeed80(GI): --- 505,513 ---- for n in range(0,unit_count): UI = GI.GetPlatformInterface(n) ! if(not UI.HasThrottle()): ! UI.SetSpeed(max_speed) ! else: ! this_speed=UI.GetMaxSpeed() ! UI.SetThrottle(max_speed/this_speed) def RelGroupSpeed80(GI): *************** *** 516,520 **** for n in range(0,unit_count): UI = GI.GetPlatformInterface(n) ! UI.SetSpeed(0.8*max_speed) def RelGroupSpeed50(GI): --- 521,529 ---- for n in range(0,unit_count): UI = GI.GetPlatformInterface(n) ! if(not UI.HasThrottle()): ! UI.SetSpeed(0.8*max_speed) ! else: ! this_speed=UI.GetMaxSpeed() ! UI.SetThrottle((0.8*max_speed)/this_speed) def RelGroupSpeed50(GI): *************** *** 528,532 **** for n in range(0,unit_count): UI = GI.GetPlatformInterface(n) ! UI.SetSpeed(0.5*max_speed) def RelGroupSpeed30(GI): --- 537,545 ---- for n in range(0,unit_count): UI = GI.GetPlatformInterface(n) ! if(not UI.HasThrottle()): ! UI.SetSpeed(0.5*max_speed) ! else: ! this_speed=UI.GetMaxSpeed() ! UI.SetThrottle((0.5*max_speed)/this_speed) def RelGroupSpeed30(GI): *************** *** 540,545 **** for n in range(0,unit_count): UI = GI.GetPlatformInterface(n) ! UI.SetSpeed(0.3*max_speed) ! def AddEngageAllOrderGroup(GI): unit_count=GI.GetUnitCount() --- 553,562 ---- for n in range(0,unit_count): UI = GI.GetPlatformInterface(n) ! if(not UI.HasThrottle()): ! UI.SetSpeed(0.3*max_speed) ! else: ! this_speed=UI.GetMaxSpeed() ! UI.SetThrottle((0.3*max_speed)/this_speed) ! def AddEngageAllOrderGroup(GI): unit_count=GI.GetUnitCount() *************** *** 549,551 **** --- 566,661 ---- AddEngageAllOrder(UnitInfo) + def GroupAllSensors(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UnitInfo=GI.GetPlatformInterface(n) + UnitInfo.SetAllSensorState(1) + + def GroupPassiveSensors(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UnitInfo=GI.GetPlatformInterface(n) + nSensors = UnitInfo.GetSensorCount() + for n in range(0, nSensors): + sensor_info = UnitInfo.GetSensorInfo(n) + if (sensor_info.IsPassive()): + UnitInfo.SetSensorState(n, 1) + else: + UnitInfo.SetSensorState(n, 0) + + def GroupOfflineSensors(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UnitInfo=GI.GetPlatformInterface(n) + UnitInfo.SetAllSensorState(0) + + + def GroupHeloAltitudeMedium(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + if(UI.IsHelo()): + AltitudeMedium(UI) + + def GroupHeloAltitudeLow(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + if(UI.IsHelo()): + AltitudeLow(UI) + + def GroupHeloAltitudeVeryLow(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + if(UI.IsHelo()): + AltitudeVeryLow(UI) + + def GroupAltitudeHigh(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + if(UI.IsAir() and not UI.IsHelo()): + AltitudeHigh(UI) + + def GroupAltitudeMedium(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + if(UI.IsAir() and not UI.IsHelo()): + AltitudeMedium(UI) + + def GroupAltitudeLow(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + if(UI.IsAir() and not UI.IsHelo()): + AltitudeLow(UI) + + def GroupAltitudeVeryLow(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + if(UI.IsAir() and not UI.IsHelo()): + AltitudeVeryLow(UI) + + def GroupAddLandingOrder(GI,dest_id): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + AddLandingOrder(UI,dest_id) + + def GroupAddLandingHBOrder(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UI=GI.GetPlatformInterface(n) + BB = UI.GetBlackboardInterface() + homebase = BB.ReadMessage('Home') + if (homebase != ''): + if (UI.IsHelo()): + UI.AddTask('LandHelo', 3.0, 0) + else: + UI.AddTask('Land', 3.0, 0) + BB.Write('LandTarget', homebase) + |
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','') |
From: Dewitt C. <ddc...@us...> - 2006-12-22 14:29:17
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv23381/src/graphics Modified Files: tcMapOverlay.cpp tcMapView.cpp Log Message: Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** tcMapView.cpp 20 Dec 2006 00:45:46 -0000 1.55 --- tcMapView.cpp 22 Dec 2006 14:29:14 -0000 1.56 *************** *** 2684,2687 **** --- 2684,2695 ---- void tcTacticalMapView::OnLButtonDClick(wxMouseEvent& event) { + if (overlay->IsInteracting()) + { + overlay->ClearInteraction(); + return; + } + + if (hookedId.size() == 0) return; + wxPoint pos = event.GetPosition(); Index: tcMapOverlay.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapOverlay.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcMapOverlay.cpp 13 Dec 2006 02:10:58 -0000 1.6 --- tcMapOverlay.cpp 22 Dec 2006 14:29:14 -0000 1.7 *************** *** 255,259 **** tcMapObject* obj = overlayObjects[n]; ! if (true || obj->IsInteractive()) { float dist = overlayObjects[n]->GetScreenDistanceFrom(pos); --- 255,259 ---- tcMapObject* obj = overlayObjects[n]; ! if (obj->IsInteractive()) { float dist = overlayObjects[n]->GetScreenDistanceFrom(pos); |
From: Dewitt C. <ddc...@us...> - 2006-12-22 14:29:17
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv23381/include/graphics Modified Files: tcMapOverlay.h Log Message: Index: tcMapOverlay.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapOverlay.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcMapOverlay.h 13 Dec 2006 02:10:58 -0000 1.7 --- tcMapOverlay.h 22 Dec 2006 14:29:14 -0000 1.8 *************** *** 70,73 **** --- 70,74 ---- void OnMouseMove(wxMouseEvent& event); void OnSize(wxSizeEvent& event); + void ClearInteraction(); virtual tcUpdateStream& operator<<(tcUpdateStream& stream); *************** *** 87,91 **** size_t hookedIdx; ! void ClearInteraction(); void DeleteFlaggedObjects(); void HookObject(size_t idx); --- 88,92 ---- size_t hookedIdx; ! void DeleteFlaggedObjects(); void HookObject(size_t idx); |
From: Dewitt C. <ddc...@us...> - 2006-12-20 01:39:24
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14177/xml Modified Files: chat_box.xml network_view.xml options.xml scenarioselect_view.xml Log Message: Index: scenarioselect_view.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/scenarioselect_view.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scenarioselect_view.xml 10 Sep 2005 21:49:21 -0000 1.2 --- scenarioselect_view.xml 20 Dec 2006 01:39:20 -0000 1.3 *************** *** 1,9 **** <Window> ! <Button X="30" Y="25" Width="65" Height="15" Caption="Main" Command="10"/> ! <Button X="100" Y="25" Width="65" Height="15" Caption="Credits" Command="20"/> ! <Button X="170" Y="25" Width="65" Height="15" Caption="Database" Command="30"/> ! <Button X="240" Y="25" Width="65" Height="15" Caption="Options" Command="40"/> ! <Button X="310" Y="25" Width="65" Height="15" Caption="Briefing" Command="65"/> ! <Button X="380" Y="25" Width="65" Height="15" Caption="Play" Command="70"/> </Window> \ No newline at end of file --- 1,9 ---- <Window> ! <Button X="30" Y="25" Width="65" Height="15" Caption="Main" Command="10" Alpha="0.7"/> ! <Button X="100" Y="25" Width="65" Height="15" Caption="Credits" Command="20" Alpha="0.7"/> ! <Button X="170" Y="25" Width="65" Height="15" Caption="Database" Command="30" Alpha="0.7"/> ! <Button X="240" Y="25" Width="65" Height="15" Caption="Options" Command="40" Alpha="0.7"/> ! <Button X="310" Y="25" Width="65" Height="15" Caption="Briefing" Command="65" Alpha="0.7"/> ! <Button X="380" Y="25" Width="65" Height="15" Caption="Play" Command="70" Alpha="0.7"/> </Window> \ No newline at end of file Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** options.xml 29 Nov 2006 02:51:44 -0000 1.33 --- options.xml 20 Dec 2006 01:39:20 -0000 1.34 *************** *** 11,15 **** <ShowPythonErrors /> <CacheFullDatabase /> ! <UserName>Dewittaaa</UserName> <DisplaySettings>default</DisplaySettings> </Options> --- 11,15 ---- <ShowPythonErrors /> <CacheFullDatabase /> ! <UserName>Serv</UserName> <DisplaySettings>default</DisplaySettings> </Options> Index: network_view.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/network_view.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** network_view.xml 18 Jun 2006 00:50:09 -0000 1.12 --- network_view.xml 20 Dec 2006 01:39:20 -0000 1.13 *************** *** 1,10 **** <Window> ! <Button X="30" Y="50" Width="65" Height="15" Caption="Main" Command="10"/> ! <Button X="100" Y="50" Width="65" Height="15" Caption="Credits" Command="20"/> ! <Button X="170" Y="50" Width="65" Height="15" Caption="Database" Command="30"/> ! <Button X="240" Y="50" Width="65" Height="15" Caption="Options" Command="40"/> ! <Button X="310" Y="50" Width="65" Height="15" Caption="Scenarios" Command="50"/> ! <Button X="380" Y="50" Width="65" Height="15" Caption="Briefing" Command="65"/> ! <Button X="450" Y="50" Width="65" Height="15" Caption="MP Game" Command="62"/> <RadioButton X="30" Y="130" Width="170" Height="40" Caption="Multiplayer Mode" Command="150"> --- 1,10 ---- <Window> ! <Button X="30" Y="50" Width="65" Height="15" Caption="Main" Command="10" Alpha="0.7"/> ! <Button X="100" Y="50" Width="65" Height="15" Caption="Credits" Command="20" Alpha="0.7"/> ! <Button X="170" Y="50" Width="65" Height="15" Caption="Database" Command="30" Alpha="0.7"/> ! <Button X="240" Y="50" Width="65" Height="15" Caption="Options" Command="40" Alpha="0.7"/> ! <Button X="310" Y="50" Width="65" Height="15" Caption="Scenarios" Command="50" Alpha="0.7"/> ! <Button X="380" Y="50" Width="65" Height="15" Caption="Briefing" Command="65" Alpha="0.7"/> ! <Button X="450" Y="50" Width="65" Height="15" Caption="MP Game" Command="62" Alpha="0.7"/> <RadioButton X="30" Y="130" Width="170" Height="40" Caption="Multiplayer Mode" Command="150"> Index: chat_box.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/chat_box.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** chat_box.xml 2 Dec 2006 02:23:49 -0000 1.4 --- chat_box.xml 20 Dec 2006 01:39:20 -0000 1.5 *************** *** 1,4 **** <Window> ! <ChatBox X="10" Y="10" Width="400" Height="250" FontSize="14.0" Wrap="70" DrawBorder="1"/> <ChatEntry X="10" Y="260" Width="400" Height="16" BarX="0.0" BarY="1.0" BarWidth="400.0" BarHeight="14.0" Caption="" FontSize="14.0" DrawBorder="1"/> <Button X="400" Y="2" Width="16" Height="16" Command="86" Caption=""> --- 1,6 ---- <Window> ! <Button X="10" Y="5" Width="35" Height="15" Caption="ALL" Command="10" FontSize="10" Alpha="0.5"/> ! <Button X="50" Y="5" Width="35" Height="15" Caption="TEAM" Command="20" FontSize="10" Alpha="0.5"/> ! <ChatBox X="10" Y="25" Width="400" Height="235" FontSize="14.0" Wrap="70" DrawBorder="1"/> <ChatEntry X="10" Y="260" Width="400" Height="16" BarX="0.0" BarY="1.0" BarWidth="400.0" BarHeight="14.0" Caption="" FontSize="14.0" DrawBorder="1"/> <Button X="400" Y="2" Width="16" Height="16" Command="86" Caption=""> |
From: Dewitt C. <ddc...@us...> - 2006-12-20 01:39:23
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14177/src/graphics Modified Files: tcChatBox.cpp Log Message: Index: tcChatBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcChatBox.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcChatBox.cpp 2 Dec 2006 02:23:48 -0000 1.6 --- tcChatBox.cpp 20 Dec 2006 01:39:20 -0000 1.7 *************** *** 40,43 **** --- 40,45 ---- EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcChatBox::SendChatText) EVT_COMMAND(86, wxEVT_COMMAND_BUTTON_CLICKED, tcChatBox::OnCloseCommand) + EVT_COMMAND(10, wxEVT_COMMAND_BUTTON_CLICKED, tcChatBox::OnChatModeAll) + EVT_COMMAND(20, wxEVT_COMMAND_BUTTON_CLICKED, tcChatBox::OnChatModeTeam) END_EVENT_TABLE() *************** *** 69,72 **** --- 71,86 ---- } + void tcChatBox::OnChatModeAll(wxCommandEvent& event) + { + chatModeTeam = false; + UpdateChatModeButtons(); + } + + void tcChatBox::OnChatModeTeam(wxCommandEvent& event) + { + chatModeTeam = true; + UpdateChatModeButtons(); + } + /** * Close and destroy window at next safe opportunity *************** *** 127,130 **** --- 141,160 ---- } + void tcChatBox::UpdateChatModeButtons() + { + tcButton* all = GetButtonWithCommand(10); + tcButton* team = GetButtonWithCommand(20); + + if ((all == 0) || (team == 0)) + { + wxASSERT(false); + fprintf(stderr, "tcChatBox::UpdateChatModeButtons - buttons not found\n"); + return; + } + + all->SetOn(!chatModeTeam); + team->SetOn(chatModeTeam); + } + /** *************** *** 134,138 **** const wxPoint& pos, const wxSize& size, const wxString& name, const wxString& configFile) ! : tcXmlWindow(parent, pos, size, configFile, name) { --- 164,169 ---- const wxPoint& pos, const wxSize& size, const wxString& name, const wxString& configFile) ! : tcXmlWindow(parent, pos, size, configFile, name), ! chatModeTeam(false) { *************** *** 167,170 **** --- 198,203 ---- chatEntry->SetClearOnReturn(true); chatEntry->SetBuffer("Enter chat text here"); + + UpdateChatModeButtons(); } |
From: Dewitt C. <ddc...@us...> - 2006-12-20 01:39:23
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14177/src/network Modified Files: tcMultiplayerInterface.cpp Log Message: Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tcMultiplayerInterface.cpp 6 Dec 2006 01:20:42 -0000 1.40 --- tcMultiplayerInterface.cpp 20 Dec 2006 01:39:20 -0000 1.41 *************** *** 447,452 **** /** * Broadcast chat text to all connected clients */ ! void tcMultiplayerInterface::BroadcastChatText(const std::string& message) { char buff[256]; --- 447,453 ---- /** * Broadcast chat text to all connected clients + * @param alliance 0 to broadcast to all players, otherwise only send to players matching alliance */ ! void tcMultiplayerInterface::BroadcastChatText(const std::string& message, unsigned char alliance) { char buff[256]; *************** *** 464,469 **** int destination = *iter; ! networkInterface->SendMessage(destination, MSG_CHATTEXT, ! messageLength, (unsigned char*)buff, protocol); } --- 465,474 ---- int destination = *iter; ! tcPlayerStatus& player = GetPlayerStatus(destination); ! if ((alliance == 0) || (player.GetAlliance() == alliance)) ! { ! networkInterface->SendMessage(destination, MSG_CHATTEXT, ! messageLength, (unsigned char*)buff, protocol); ! } } *************** *** 1184,1189 **** { SendChatText(connectionId, "*** Help ***"); - SendChatText(connectionId, " /help - print command list"); SendChatText(connectionId, " /alliance <int> - choose alliance"); } else if (command == "alliance") --- 1189,1199 ---- { SendChatText(connectionId, "*** Help ***"); SendChatText(connectionId, " /alliance <int> - choose alliance"); + if (pstatus.IsGM()) + { + SendChatText(connectionId, " /gm - game master commands"); + } + SendChatText(connectionId, " /help - print command list"); + SendChatText(connectionId, " /who - list players"); } else if (command == "alliance") *************** *** 1195,1198 **** --- 1205,1212 ---- ProcessGameMasterCommand(pstatus, args); } + else if (command == "team") + { + ProcessTeamChat(pstatus, args); + } else if (command == "who") { *************** *** 1299,1302 **** --- 1313,1325 ---- /** + * Send chat text to all players with matching alliance + */ + void tcMultiplayerInterface::ProcessTeamChat(const tcPlayerStatus& player, const wxString& msg) + { + BroadcastChatText(msg.c_str(), player.GetAlliance()); + } + + + /** * Send list of players currently in game back to client */ |
From: Dewitt C. <ddc...@us...> - 2006-12-20 01:39:23
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14177/include/graphics Modified Files: tcChatBox.h Log Message: Index: tcChatBox.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcChatBox.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcChatBox.h 2 Dec 2006 02:23:48 -0000 1.4 --- tcChatBox.h 20 Dec 2006 01:39:20 -0000 1.5 *************** *** 48,51 **** --- 48,53 ---- void OnCloseCommand(wxCommandEvent& event); void OnKeyDown(wxKeyEvent& event); + void OnChatModeAll(wxCommandEvent& event); + void OnChatModeTeam(wxCommandEvent& event); void SendChatText(wxCommandEvent& event); *************** *** 58,61 **** --- 60,66 ---- tcConsoleBox *chatHistory; tcEditBox *chatEntry; + bool chatModeTeam; + + void UpdateChatModeButtons(); DECLARE_EVENT_TABLE() |
From: Dewitt C. <ddc...@us...> - 2006-12-20 01:39:23
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14177/include/network Modified Files: tcMultiplayerInterface.h Log Message: Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcMultiplayerInterface.h 6 Dec 2006 01:20:42 -0000 1.33 --- tcMultiplayerInterface.h 20 Dec 2006 01:39:20 -0000 1.34 *************** *** 123,127 **** void AuthenticatePlayer(int connectionId, const std::string& username, const std::string& passwordHash); ! void BroadcastChatText(const std::string& message); void BroadcastControlMessage(int messageCode); void BroadcastScenarioInfo(); --- 123,127 ---- void AuthenticatePlayer(int connectionId, const std::string& username, const std::string& passwordHash); ! void BroadcastChatText(const std::string& message, unsigned char alliance = 0); void BroadcastControlMessage(int messageCode); void BroadcastScenarioInfo(); *************** *** 218,221 **** --- 218,222 ---- void ProcessReceiveMessages(); + void ProcessTeamChat(const tcPlayerStatus& player, const wxString& msg); void ProcessWho(tcPlayerStatus& player, const wxString& args); void UpdateDestroyedEntities(int connectionId); |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:51
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/src/scriptinterface Modified Files: tcPlatformInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** tcPlatformInterface.cpp 20 Nov 2006 00:17:43 -0000 1.67 --- tcPlatformInterface.cpp 20 Dec 2006 00:45:46 -0000 1.68 *************** *** 107,110 **** --- 107,111 ---- float tcPlatformInterface::GetFuel() const { + if (mpPlatformObj == 0) return 0; return mpPlatformObj->fuel_kg / mpPlatformObj->GetFuelCapacity(); } *************** *** 124,127 **** --- 125,129 ---- float tcPlatformInterface::GetSpeed() { + if (mpPlatformObj == 0) return 0; return mpPlatformObj->mcKin.mfSpeed_kts; } *************** *** 129,132 **** --- 131,135 ---- float tcPlatformInterface::GetMaxSpeed() { + if (mpPlatformObj == 0) return 0; return mpPlatformObj->mpDBObject->mfMaxSpeed_kts; } *************** *** 134,137 **** --- 137,141 ---- float tcPlatformInterface::GetHeading() { + if (mpPlatformObj == 0) return 0; return C_180OVERPI*mpPlatformObj->mcKin.mfHeading_rad; } *************** *** 139,142 **** --- 143,147 ---- float tcPlatformInterface::GetHeadingRad() { + if (mpPlatformObj == 0) return 0; return mpPlatformObj->mcKin.mfHeading_rad; } *************** *** 196,199 **** --- 201,205 ---- void tcPlatformInterface::SetAltitude(float alt_m) { + if (mpPlatformObj == 0) return; if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->SetAltitude(alt_m); *************** *** 206,209 **** --- 212,216 ---- void tcPlatformInterface::SetLandingState(int state) { + if (mpPlatformObj == 0) return; if (!mpPlatformObj->IsControlled()) return; if (tcAirObject *air = dynamic_cast<tcAirObject*>(mpPlatformObj)) *************** *** 227,230 **** --- 234,238 ---- void tcPlatformInterface::SetSpeed(float speed_kts) { + if (mpPlatformObj == 0) return; if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->SetSpeed(speed_kts); *************** *** 253,256 **** --- 261,265 ---- void tcPlatformInterface::SetThrottle(float throttleFraction) { + if (mpPlatformObj == 0) {return;} if (!mpPlatformObj->IsControlled()) return; if (tcAeroAirObject* aaObj = dynamic_cast<tcAeroAirObject*>(mpPlatformObj)) *************** *** 263,266 **** --- 272,277 ---- bool tcPlatformInterface::IsSurface() const { + if (mpPlatformObj == 0) return false; + return (mpPlatformObj->mnModelType == MTYPE_SURFACE); } *************** *** 269,272 **** --- 280,285 ---- bool tcPlatformInterface::IsAir() const { + if (mpPlatformObj == 0) return false; + UINT32 nModelType = mpPlatformObj->mnModelType; return (nModelType == MTYPE_FIXEDWING)||(nModelType == MTYPE_FIXEDWINGX) *************** *** 277,280 **** --- 290,294 ---- bool tcPlatformInterface::IsHelo() const { + if (mpPlatformObj == 0) return false; return (mpPlatformObj->mnModelType == MTYPE_HELO); } *************** *** 282,285 **** --- 296,300 ---- bool tcPlatformInterface::IsFixed() const { + if (mpPlatformObj == 0) return false; return (mpPlatformObj->mnModelType == MTYPE_FIXED) || (mpPlatformObj->mnModelType == MTYPE_AIRFIELD); *************** *** 289,292 **** --- 304,308 ---- bool tcPlatformInterface::IsSub() const { + if (mpPlatformObj == 0) return false; return (mpPlatformObj->mnModelType == MTYPE_SUBMARINE); } *************** *** 303,306 **** --- 319,323 ---- void tcPlatformInterface::SetTarget(long anID) { + if (mpPlatformObj == 0) return; if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->DesignateTarget(anID); *************** *** 309,312 **** --- 326,330 ---- long tcPlatformInterface::GetTarget() { + if (mpPlatformObj == 0) return -1; return mpPlatformObj->GetBrain()->GetTarget(); } *************** *** 314,317 **** --- 332,336 ---- float tcPlatformInterface::GetRangeToTarget() { + if (mpPlatformObj == 0) return 0; tcSensorMapTrack track; if (!GetTargetTrack(track)) *************** *** 325,328 **** --- 344,348 ---- bool tcPlatformInterface::GetTargetTrack(tcSensorMapTrack& track) { + if (mpPlatformObj == 0) return false; tcGameObject* pGameObj = GetTargetObj(); *************** *** 410,413 **** --- 430,434 ---- bool tcPlatformInterface::IsLauncherEffective(int anLauncher) { + if (mpPlatformObj == 0) return false; tcLauncher* pLauncher = mpPlatformObj->GetLauncher(anLauncher); if (pLauncher == 0) return false; // bad launcher index *************** *** 434,437 **** --- 455,459 ---- { wxASSERT(mpPlatformObj); + if (mpPlatformObj == 0) return 0; tcLauncherState* launcherState; *************** *** 455,458 **** --- 477,482 ---- void tcPlatformInterface::SetHeading(float heading_deg) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsControlled()) return; *************** *** 465,468 **** --- 489,494 ---- void tcPlatformInterface::SetHeadingRad(float heading_rad) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->SetHeading(heading_rad); *************** *** 475,478 **** --- 501,506 ---- float tcPlatformInterface::SetHeadingToInterceptTarget() { + if (mpPlatformObj == 0) return 0; + if (!mpPlatformObj->IsControlled()) return 0; tcSensorMapTrack track; *************** *** 488,491 **** --- 516,521 ---- float tcPlatformInterface::GetHeadingToDatum(float afLon_rad, float afLat_rad) { + if (mpPlatformObj == 0) return 0; + GeoPoint p; p.mfAlt_m = 0; *************** *** 498,501 **** --- 528,533 ---- float tcPlatformInterface::GetRangeToDatum(float afLon_rad, float afLat_rad) { + if (mpPlatformObj == 0) return 0; + GeoPoint p; p.mfAlt_m = 0; *************** *** 516,519 **** --- 548,553 ---- best.mfRange_km = 0; + if (mpPlatformObj == 0) return best; + tcSensorMapTrack track; if (!GetTargetTrack(track)) {return best;} *************** *** 596,599 **** --- 630,635 ---- bool tcPlatformInterface::GetLauncherInfo(scriptinterface::tcLauncherInfo& info, int anLauncher) { + if (mpPlatformObj == 0) return false; + info.mnLauncher = -1; info.launcherStatus = tcLauncher::LAUNCHER_BUSY; *************** *** 694,697 **** --- 730,739 ---- std::string s; + if (mpPlatformObj == 0) + { + s = "Error"; + return s; + } + int nCount = GetLauncherCount(); if ((anLauncher < 0)||(anLauncher >= nCount)) *************** *** 709,712 **** --- 751,756 ---- float alt_m, int anLauncher) { + if (mpPlatformObj == 0) return; + GeoPoint p; p.mfLon_rad = afLon_rad; *************** *** 718,721 **** --- 762,767 ---- bool tcPlatformInterface::HandoffTargetToLauncher(int anLauncher) { + if (mpPlatformObj == 0) return false; + UINT32 nTargetID = mpPlatformObj->GetBrain()->GetTarget(); bool bAccept = mpSimState->DesignateLauncherTarget(mpPlatformObj->mnID, *************** *** 726,729 **** --- 772,777 ---- void tcPlatformInterface::Launch(int anLauncher, int quantity) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsControlled()) return; int launcherStatus = mpPlatformObj->SetLaunch(anLauncher, quantity); *************** *** 736,739 **** --- 784,789 ---- int tcPlatformInterface::GetLauncherQuantity(int anLauncher) { + if (mpPlatformObj == 0) return 0; + return mpPlatformObj->GetLauncherQuantity(anLauncher); } *************** *** 745,748 **** --- 795,800 ---- int tcPlatformInterface::GetLauncherTypesCount(int anLauncher) { + if (mpPlatformObj == 0) return 0; + if (tcLauncher* launcher = mpPlatformObj->GetLauncher(anLauncher)) { *************** *** 760,763 **** --- 812,817 ---- std::string tcPlatformInterface::GetLauncherTypeName(int anLauncher, int anType) { + if (mpPlatformObj == 0) return std::string("Error"); + if (tcLauncher* launcher = mpPlatformObj->GetLauncher(anLauncher)) { *************** *** 775,778 **** --- 829,834 ---- bool tcPlatformInterface::CanMagazineAcceptItem(std::string item) { + if (mpPlatformObj == 0) return false; + unsigned int nMagazines = mpPlatformObj->GetMagazineCount(); for (unsigned int n=0; n<nMagazines; n++) *************** *** 789,792 **** --- 845,850 ---- int tcPlatformInterface::GetMagazineQuantity(std::string item) { + if (mpPlatformObj == 0) return 0; + return (int)mpPlatformObj->GetMagazineQuantity(item); } *************** *** 797,800 **** --- 855,860 ---- void tcPlatformInterface::LoadLauncher(int anLauncher, const std::string& item) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsControlled()) return; // verify launcher is empty and item is compatible with launcher *************** *** 826,829 **** --- 886,891 ---- void tcPlatformInterface::LoadOther(const std::string& item) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsControlled()) return; *************** *** 858,861 **** --- 920,925 ---- bool tcPlatformInterface::IsRefueling() const { + if (mpPlatformObj == 0) return false; + return mpPlatformObj->IsRefueling(); } *************** *** 866,869 **** --- 930,935 ---- void tcPlatformInterface::UnloadLauncher(int anLauncher) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsControlled()) return; tcLauncher* launcher = mpPlatformObj->GetLauncher(anLauncher); *************** *** 887,896 **** } - - - - void tcPlatformInterface::AddTask(const std::string& taskName, double priority, int attributes) { ai::Brain* brain = mpPlatformObj->GetBrain(); wxASSERT(brain); --- 953,960 ---- } void tcPlatformInterface::AddTask(const std::string& taskName, double priority, int attributes) { + if (mpPlatformObj == 0) return; + ai::Brain* brain = mpPlatformObj->GetBrain(); wxASSERT(brain); *************** *** 901,904 **** --- 965,970 ---- void tcPlatformInterface::AddNavWaypoint(float afLon_rad, float afLat_rad) { + if (mpPlatformObj == 0) return; + if (mpPlatformObj->IsClientMode()) return; *************** *** 919,922 **** --- 985,990 ---- void tcPlatformInterface::EditNavWaypoint(size_t idx, float afLon_rad, float afLat_rad) { + if (mpPlatformObj == 0) return; + if (mpPlatformObj->IsClientMode()) return; *************** *** 933,936 **** --- 1001,1006 ---- unsigned int tcPlatformInterface::GetCurrentWaypoint() const { + if (mpPlatformObj == 0) return 0; + if (mpPlatformObj->IsClientMode()) return 0; *************** *** 948,951 **** --- 1018,1023 ---- void tcPlatformInterface::SetNavLoopState(bool state) { + if (mpPlatformObj == 0) return; + if (mpPlatformObj->IsClientMode()) return; *************** *** 968,971 **** --- 1040,1045 ---- void tcPlatformInterface::ClearTasks() { + if (mpPlatformObj == 0) return; + if (mpPlatformObj->IsClientMode()) return; *************** *** 978,981 **** --- 1052,1057 ---- void tcPlatformInterface::DeleteTask(const std::string& taskName) { + if (mpPlatformObj == 0) return; + if (mpPlatformObj->IsClientMode()) return; *************** *** 991,994 **** --- 1067,1075 ---- ai::BlackboardInterface tcPlatformInterface::GetBlackboardInterface() { + static ai::Blackboard errorBoard; + static ai::BlackboardInterface errorInterface(&errorBoard, -1, 0); + + if (mpPlatformObj == 0) return errorInterface; + ai::Brain* brain = mpPlatformObj->GetBrain(); wxASSERT(brain); *************** *** 999,1002 **** --- 1080,1085 ---- bool tcPlatformInterface::TaskExists(const std::string& taskName) { + if (mpPlatformObj == 0) return false; + ai::Brain* brain = mpPlatformObj->GetBrain(); wxASSERT(brain); *************** *** 1254,1257 **** --- 1337,1342 ---- float tcPlatformInterface::GetInterceptHeadingToTrack(const tcSensorMapTrack& track) { + if (mpPlatformObj == 0) return 0; + float fHeading_rad, fTTI; *************** *** 1266,1269 **** --- 1351,1355 ---- float tcPlatformInterface::GetRangeToTrack(const tcSensorMapTrack& track) { + if (mpPlatformObj == 0) return 0; wxASSERT(mpPlatformObj); *************** *** 1279,1282 **** --- 1365,1369 ---- float tcPlatformInterface::SetHeadingToInterceptTrack(tcSensorMapTrack track) { + if (mpPlatformObj == 0) return 0; if (!mpPlatformObj->IsControlled()) return 0; float fHeading_rad, fTTI; *************** *** 1292,1295 **** --- 1379,1384 ---- tcSensorMapTrack track; + if (mpPlatformObj == 0) return track; + mpSimState->GetTrack(id, mpPlatformObj->GetAlliance(), track); *************** *** 1301,1304 **** --- 1390,1395 ---- int tcPlatformInterface::GetSensorCount() { + if (mpPlatformObj == 0) return 0; + return (int)mpPlatformObj->GetSensorCount(); } *************** *** 1310,1313 **** --- 1401,1406 ---- info.type = 0xFF; + if (mpPlatformObj == 0) return info; + unsigned nSensors = mpPlatformObj->GetSensorCount(); if ((n < 0)||((unsigned)n >= nSensors)) return info; *************** *** 1349,1352 **** --- 1442,1447 ---- void tcPlatformInterface::SetAllSensorState(int anState) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsControlled()) return; unsigned nSensors = mpPlatformObj->GetSensorCount(); *************** *** 1360,1363 **** --- 1455,1460 ---- void tcPlatformInterface::SetSensorState(int n, int state) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->SetSensorState((unsigned)n, state != 0); *************** *** 1367,1370 **** --- 1464,1469 ---- std::string tcPlatformInterface::GetController() const { + if (mpPlatformObj == 0) return std::string("Error, not platform"); + return std::string(mpPlatformObj->GetController()); } *************** *** 1372,1375 **** --- 1471,1476 ---- bool tcPlatformInterface::IsAvailable() const { + if (mpPlatformObj == 0) return false; + return mpPlatformObj->IsAvailable(); } *************** *** 1382,1385 **** --- 1483,1488 ---- void tcPlatformInterface::ReleaseControl() { + if (mpPlatformObj == 0) return; + using network::tcMultiplayerInterface; if (mpPlatformObj->IsControlled()) *************** *** 1399,1402 **** --- 1502,1507 ---- void tcPlatformInterface::TakeControl() { + if (mpPlatformObj == 0) return; + using network::tcMultiplayerInterface; if (mpPlatformObj->IsAvailable()) *************** *** 1417,1420 **** --- 1522,1527 ---- double tcPlatformInterface::GetTime() const { + if (mpPlatformObj == 0) return -123.4; + wxASSERT(mpPlatformObj); return mpPlatformObj->mfStatusTime; *************** *** 1434,1437 **** --- 1541,1546 ---- bool tcPlatformInterface::IsPlayerControlled() const { + if (mpPlatformObj == 0) return false; + // single player, check for alliance match only if (!mpSimState->IsMultiplayerActive()) *************** *** 1447,1450 **** --- 1556,1561 ---- long tcPlatformInterface::LookupFriendlyId(const std::string& unitName) { + if (mpPlatformObj == 0) return -1; + tcGameObject* obj = mpSimState->GetObjectByName(unitName); bool isOwnAlliance = (obj != 0) && (mpPlatformObj->GetAlliance() == obj->GetAlliance()); *************** *** 1462,1465 **** --- 1573,1578 ---- std::string tcPlatformInterface::LookupFriendlyName(long id) { + if (mpPlatformObj == 0) return "Error, not platform"; + tcGameObject* obj = mpSimState->GetObject(id); bool isOwnAlliance = (obj != 0) && (mpPlatformObj->GetAlliance() == obj->GetAlliance()); *************** *** 1549,1552 **** --- 1662,1667 ---- void tcPlatformInterface::SetActionText(const std::string& text) { + if (mpPlatformObj == 0) return; + mpPlatformObj->mcAI.mzActionText = text; } *************** *** 1573,1576 **** --- 1688,1695 ---- tcTrack tcPlatformInterface::GetLandingData(long id) { + static tcTrack errorTrack; + + if (mpPlatformObj == 0) return errorTrack; + tcGameObject* obj = mpSimState->GetObject(id); *************** *** 1626,1629 **** --- 1745,1750 ---- void tcPlatformInterface::DeletePlatform() { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsEditMode()) return; *************** *** 1634,1637 **** --- 1755,1760 ---- void tcPlatformInterface::MovePlatform(float afLon_rad, float afLat_rad) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsEditMode()) return; *************** *** 1642,1645 **** --- 1765,1770 ---- void tcPlatformInterface::RenamePlatform(const std::string& s) { + if (mpPlatformObj == 0) return; + if (!mpPlatformObj->IsEditMode()) return; |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:49
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/include/graphics Modified Files: tc3DModel.h Log Message: Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tc3DModel.h 17 Aug 2006 01:27:10 -0000 1.24 --- tc3DModel.h 20 Dec 2006 00:45:45 -0000 1.25 *************** *** 171,175 **** osg::ref_ptr<osg::LOD> modelGroup; ///< top level group for (identified) model, not shared osg::ref_ptr<osg::MatrixTransform> modelTransform; ///< positions object in world, not shared ! osg::ref_ptr<osg::Node> modelNode; ///< shared between instances of model // osgAL sound node for 3D sound --- 171,175 ---- osg::ref_ptr<osg::LOD> modelGroup; ///< top level group for (identified) model, not shared osg::ref_ptr<osg::MatrixTransform> modelTransform; ///< positions object in world, not shared ! osg::ref_ptr<osg::Group> modelNode; ///< shared between instances of model // osgAL sound node for 3D sound *************** *** 204,207 **** --- 204,208 ---- void LoadXmlMountInfo(TiXmlDocument* doc); void LoadXmlSmokeInfo(TiXmlDocument* doc); + void LoadXmlSubmodels(TiXmlDocument* doc); void ProcessAnimations(); void UpdateExplosions(); |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/src/sim Modified Files: Game.cpp tcObjectControl.cpp tcSensorState.cpp tcSimState.cpp tcSonar.cpp Added Files: tcSonarEnvironment.cpp tcSonarRay.cpp Log Message: Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** tcObjectControl.cpp 28 Nov 2006 01:57:37 -0000 1.56 --- tcObjectControl.cpp 20 Dec 2006 00:45:46 -0000 1.57 *************** *** 1949,1952 **** --- 1949,1955 ---- altitudeControl->SetActive(true); break; + case MTYPE_MISSILE: + altitudeControl->SetActive(false); + break; default: altitudeControl->SetActive(true); Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** tcSimState.cpp 30 Nov 2006 04:11:13 -0000 1.103 --- tcSimState.cpp 20 Dec 2006 00:45:46 -0000 1.104 *************** *** 59,62 **** --- 59,63 ---- #include "tcSubObject.h" #include "tcSubDBObject.h" + #include "tcSonarEnvironment.h" #include "tcLauncher.h" *************** *** 2757,2760 **** --- 2758,2763 ---- objectNameMap.clear(); captiveObjectMap.clear(); + + tcSonarEnvironment::Get()->Clear(); } *************** *** 2828,2832 **** tcSimState::~tcSimState() { ! Clear(); if (positionRegistry) delete positionRegistry; --- 2831,2835 ---- tcSimState::~tcSimState() { ! maPlatformState.RemoveAll(); if (positionRegistry) delete positionRegistry; Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcSensorState.cpp 6 Dec 2006 01:20:43 -0000 1.20 --- tcSensorState.cpp 20 Dec 2006 00:45:46 -0000 1.21 *************** *** 38,42 **** tcDatabase* tcSensorState::database = NULL; tcSimState* tcSensorState::simState = NULL; ! /** --- 38,42 ---- tcDatabase* tcSensorState::database = NULL; tcSimState* tcSensorState::simState = NULL; ! long tcSensorState::nextSensorId = 1000; /** *************** *** 357,360 **** --- 357,362 ---- tcSensorState& tcSensorState::operator=(tcSensorState& ss) { + wxASSERT(false); // is this method used? + mbActive = ss.mbActive; isHidden = ss.isHidden; *************** *** 380,383 **** --- 382,387 ---- tcSensorState* tcSensorState::Clone() { + wxASSERT(false); // is this method used? + // TODO: should use a copy constructor (if this method is used) tcSensorState *pNew = new tcSensorState(); *************** *** 387,391 **** /** ! * */ tcSensorState::tcSensorState() : --- 391,396 ---- /** ! * Used to initialize tcSimState::mcDefaultRadar for detect before ! * create seeker test. */ tcSensorState::tcSensorState() : *************** *** 401,405 **** sensorPlatform(0), fireControlId(-1), ! fireControlIdx(0) { mcTrack.mnID = NULL_INDEX; --- 406,411 ---- sensorPlatform(0), fireControlId(-1), ! fireControlIdx(0), ! sensorId(nextSensorId++) { mcTrack.mnID = NULL_INDEX; *************** *** 424,428 **** fireControlIdx(0), parent(0), ! sensorPlatform(0) { wxASSERT(dbObj); --- 430,435 ---- fireControlIdx(0), parent(0), ! sensorPlatform(0), ! sensorId(nextSensorId++) { wxASSERT(dbObj); Index: tcSonar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSonar.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcSonar.cpp 27 Nov 2006 00:46:40 -0000 1.19 --- tcSonar.cpp 20 Dec 2006 00:45:46 -0000 1.20 *************** *** 33,37 **** --- 33,39 ---- #include "tcSimState.h" #include "tcGameObjIterator.h" + #include "tcSonarEnvironment.h" #include "common/tcObjStream.h" + #include "simmath.h" #ifdef _DEBUG *************** *** 141,151 **** range_km = C_RADTOKM * nsNav::GCDistanceApprox_rad(par_kin->mfLat_rad, par_kin->mfLon_rad, tgt_kin->mfLat_rad, tgt_kin->mfLon_rad); - float TL = 60.0f + 20.0f * log10f(range_km) + - mpDBObj->alpha * range_km; // one-way transmission loss referenced to 1 m ! ! float sonarAlt_m = par_kin->mfAlt_m; ! float targetAlt_m = tgt_kin->mfAlt_m; // if parent or target airborne, assume helo dipping sonar and subtract scope_m from alt --- 143,152 ---- range_km = C_RADTOKM * nsNav::GCDistanceApprox_rad(par_kin->mfLat_rad, par_kin->mfLon_rad, tgt_kin->mfLat_rad, tgt_kin->mfLon_rad); + float range_m = 1000.0f * range_km; ! ! float sonarAlt_m = (par_kin->mfAlt_m == 0) ? -5.0f : par_kin->mfAlt_m; ! float targetAlt_m = (tgt_kin->mfAlt_m == 0) ? -5.0f : tgt_kin->mfAlt_m; // if parent or target airborne, assume helo dipping sonar and subtract scope_m from alt *************** *** 169,181 **** else { ! wxASSERT(false); // non-helo dipping sonar? ! return false; } } ! // crude thermocline ! bool parentAbove = sonarAlt_m >= -80.0; ! bool targetAbove = targetAlt_m >= -80.0; ! if (parentAbove != targetAbove) TL += 10.0f; // add 10 dB loss float excessSNR; --- 170,186 ---- else { ! return false; // e.g. sonobuoy not in the water yet } } ! long key = sensorId; ! float TL = tcSonarEnvironment::Get()->GetTL(key, parent->mfStatusTime, -sonarAlt_m, range_m, -targetAlt_m); ! TL += mpDBObj->alpha * range_km; // add freq based atten here (not in tcSonarEnvironment yet) ! ! ! // ambient noise (flawed as is because assumes target signal is always centered in sonar passband) ! float NL_background_dB = tcSonarEnvironment::Get()->GetAmbientNL(mpDBObj->averageFreq_Hz); ! NL = Add_dB(NL_background_dB, NL); ! float excessSNR; --- NEW FILE: tcSonarRay.cpp --- /** ** @file tcSonarRay.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #include "stdwx.h" #include "tcSonarRay.h" #include <osg/Timer> #ifdef _DEBUG #define new DEBUG_NEW #endif /** * @return depth of ray at range_m or -999.9f if beyond last point */ float tcSonarRay::CalculateDepth(float range_m, float& reflectionLoss_dB) const { const float beyondRay = -999.9f; reflectionLoss_dB = 99.0f; if (data.size() == 0) { wxASSERT(false); return beyondRay; } if (range_m >= data.back().xmax) return beyondRay; for (size_t k=0; k<data.size(); k++) { if (range_m < data[k].xmax) { reflectionLoss_dB = data[k].reflectionLoss_dB; float dx = range_m - data[k].xc; float yterm = sqrtf(data[k].R2 - dx*dx); return (data[k].R < 0) ? -yterm + data[k].yc : yterm + data[k].yc; } } wxASSERT(false); // error, not found in ray and not beyond ray return beyondRay; } /** * */ tcSonarRay::tcSonarRay() { } /** * */ tcSonarRay::~tcSonarRay() { } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** Game.cpp 6 Dec 2006 01:20:43 -0000 1.166 --- Game.cpp 20 Dec 2006 00:45:46 -0000 1.167 *************** *** 68,71 **** --- 68,72 ---- #include "tcPlatformDBObject.h" #include "tcDatabaseViewer.h" + #include "tcSonarEnvironment.h" #include <osg/Timer> *************** *** 562,565 **** --- 563,572 ---- std::cout << "Time init success" << std::endl; + #ifdef _DEBUG + // tcSonarEnvironment::Get()->Test(); + #endif + + + try { *************** *** 2784,2787 **** --- 2791,2799 ---- return; } + else if (chatBox->mbActive) + { + chatBox->SetActive(false); + return; + } --- NEW FILE: tcSonarEnvironment.cpp --- /** ** @file tcSonarEnvironment.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #include "stdwx.h" #include "tcSonarEnvironment.h" #include "tcSonarRay.h" #include "tcOptions.h" #include <osg/Timer> #ifdef _DEBUG #define new DEBUG_NEW #endif tcSonarEnvironment* tcSonarEnvironment::Get() { static tcSonarEnvironment instance; return &instance; } void tcSonarEnvironment::AddSVPPoint(float depth_m, float speed_mps) { SVPData data; data.depth_m = depth_m; data.v_mps = speed_mps; svp.push_back(data); if (svp.size() < 2) return; if (!ValidateSVP()) return; for (size_t k=0; k<svp.size()-1; k++) { float inv_gradient = 0; if (svp[k+1].v_mps != svp[k].v_mps) { inv_gradient = (svp[k+1].depth_m - svp[k].depth_m) / (svp[k+1].v_mps - svp[k].v_mps); } else { inv_gradient = 1e7; } float R = svp[k].v_mps * inv_gradient; svp[k].R_m = R; svp[k].R2_m = R*R; } svp.back().R_m = 1e10f; svp.back().R2_m = 1e20f; } /** * @param startDepth_m depth of sonar (positive number) * @param startAngle_rad starting angle of ray, positive is down */ const tcSonarRay& tcSonarEnvironment::CalculateRay(float startDepth_m, float startAngle_rad) { static tcSonarRay ray; ray.data.clear(); const float max_x = 100e3; float x = 0; float y = startDepth_m; float angle = startAngle_rad; unsigned int bounces = 0; const unsigned int maxBounces = 4; float reflectionLoss_dB = 0; if (fabsf(angle) < 0.002f) { angle = (angle > 0) ? 0.002f : -0.002f; } if (!ValidateSVP()) { return ray; } while ((x <= max_x) && (reflectionLoss_dB < 20.0f) && (ray.data.size() < 100)) { tcSonarRay::RayPoint point; point.x = x; point.y = y; // find the SVP segment we're in size_t currentSegment = GetSVPSegment(angle, y, reflectionLoss_dB); float R = svp[currentSegment].R_m; float R2 = svp[currentSegment].R2_m; float xc = x + R*sinf(angle); float yc = y - R*cosf(angle); float y_next = (angle >= 0) ? svp[currentSegment+1].depth_m : svp[currentSegment].depth_m; float x_term = R2 - (y_next-yc)*(y_next-yc); float x_term2 = R2 - (y-yc)*(y-yc); float x_solve = 0; float y_solve = 0; if (x_term > 0) { float sqrt_x_term = sqrtf(x_term); float x_solve1 = xc + sqrt_x_term; float x_solve2 = xc - sqrt_x_term; if ((x_solve2 > x) && (x_solve2 < x_solve1)) x_solve = x_solve2; else x_solve = x_solve1; y_solve = y_next; } else if (x_term2 > 0) { x_solve = xc + sqrtf(x_term2); y_solve = y; } else { wxASSERT(false); return ray; } wxASSERT(x_solve > x); float angle_solve = atanf((xc-x_solve)/(y_solve-yc)); if (y_solve <= 0) // hit surface? { y = 0; angle_solve = (angle_solve < 0) ? -angle_solve : angle_solve; reflectionLoss_dB += surfaceLoss_dB; } x = x_solve; y = y_solve; angle = angle_solve; point.xmax = x; point.R = R; point.R2 = R2; point.xc = xc; point.yc = yc; point.reflectionLoss_dB = reflectionLoss_dB; ray.data.push_back(point); } return ray; } void tcSonarEnvironment::Clear() { ClearSVP(); beamCache.clear(); } void tcSonarEnvironment::ClearSVP() { SetDefaultSVP(); } float tcSonarEnvironment::GetAmbientNL(float freq_Hz) const { return noiseLevelBase - noiseLevelSlope * log10f(freq_Hz); } float tcSonarEnvironment::GetBottomLoss() const { return bottomLoss_dB; } unsigned int tcSonarEnvironment::GetSeaState() const { return seaState; } float tcSonarEnvironment::GetSurfaceLoss() const { return surfaceLoss_dB; } const std::vector<tcSonarEnvironment::SVPData>& tcSonarEnvironment::GetSVP() const { return svp; } size_t tcSonarEnvironment::GetSVPSegment(float& angle, float& depth, float& reflectionLoss_dB) { if (depth >= svp.back().depth_m) // hit bottom? { depth -= 0.001f; angle = -angle; reflectionLoss_dB += bottomLoss_dB; return svp.size()-2; } if (angle >= 0) { for (size_t k=0;(k<svp.size()-1); k++) { if ((depth >= svp[k].depth_m) && (depth < svp[k+1].depth_m)) { return k; } } } else { for (size_t k=0;(k<svp.size()-1); k++) { if ((depth > svp[k].depth_m) && (depth <= svp[k+1].depth_m)) { return k; } } } wxASSERT(false); fprintf(stderr, "tcSonarEnvironment::GetSVPSegment - unknown error\n"); return 0; } /** * @return transmission loss in dB (positive loss) * @param depth_m depth of sonar */ float tcSonarEnvironment::GetTL(long key, double t, float depth_m, float targetRange_m, float targetDepth_m) { if (tcOptions::Get()->useRayTracingSonar == 0) { return GetTLSimple(depth_m, targetRange_m, targetDepth_m); } std::map<long, BeamData>::iterator iter = beamCache.find(key); if (iter == beamCache.end()) { BeamData beamData; beamData.depth_m = -999.9f; // to force update beamData.t_update = t; beamCache[key] = beamData; iter = beamCache.find(key); } wxASSERT(iter != beamCache.end()); if (fabsf(iter->second.depth_m - depth_m) >= depthUpdateThreshold_m) { UpdateBeam(iter->second.beam, depth_m); iter->second.depth_m = depth_m; } float TL_min = 10.0f * log10f(targetRange_m); // cylindrical spreading ref 1 m float TL_max = 2.5f * TL_min; // cube law spreading float flux = 1e-6f; for (size_t k=0; k<iter->second.beam.size(); k++) { float reflectionLoss_dB; float dd_m = fabsf(iter->second.beam[k].CalculateDepth(targetRange_m, reflectionLoss_dB) - targetDepth_m); if (dd_m < 50.0) { float a = -fluxDecay*dd_m - 0.23026f*reflectionLoss_dB; flux += expf(a); } } float path_TL = rayCount_dB -10*log10(flux); wxASSERT(path_TL >= 0); float total_TL = path_TL + TL_min; if (total_TL < TL_max) { return total_TL; } else { return TL_max; } } float tcSonarEnvironment::GetTLSimple(float depth_m, float targetRange_m, float targetDepth_m) { float TL_dB = 20.0f * log10f(targetRange_m); // crude thermocline bool parentAbove = depth_m < 80.0; bool targetAbove = targetDepth_m < 80.0; if (parentAbove != targetAbove) TL_dB += 10.0f; // add 10 dB loss return TL_dB; } void tcSonarEnvironment::SetBottomLoss(float val_dB) { bottomLoss_dB = val_dB; } void tcSonarEnvironment::SetDefaultSVP() { svp.clear(); AddSVPPoint(0, 1515); AddSVPPoint(200, 1500); AddSVPPoint(300, 1510); AddSVPPoint(500, 1520); } void tcSonarEnvironment::SetSeaState(unsigned int val) { if (val > 7) { val = 7; wxASSERT(false); } seaState = val; noiseLevelSlope = 16.0; switch (seaState) { case 0: noiseLevelBase = 3.0f*noiseLevelSlope + 44.0f; break; case 1: noiseLevelBase = 3.0f*noiseLevelSlope + 53.0f; break; case 2: noiseLevelBase = 3.0f*noiseLevelSlope + 58.0f; break; case 3: noiseLevelBase = 3.0f*noiseLevelSlope + 62.0f; break; case 4: noiseLevelBase = 3.0f*noiseLevelSlope + 65.0f; break; case 5: noiseLevelBase = 3.0f*noiseLevelSlope + 67.0f; break; case 6: noiseLevelBase = 3.0f*noiseLevelSlope + 69.0f; break; case 7: noiseLevelBase = 3.0f*noiseLevelSlope + 73.0f; break; default: wxASSERT(false); } } void tcSonarEnvironment::SetSurfaceLoss(float val_dB) { surfaceLoss_dB = val_dB; } void tcSonarEnvironment::SetSVP(const std::vector<tcSonarEnvironment::SVPData>& svp_) { svp = svp_; } void tcSonarEnvironment::Test() { osg::Timer_t t1 = osg::Timer::instance()->tick(); float startDepth = 100.0f; std::vector<tcSonarRay> beam; UpdateBeam(beam, startDepth); osg::Timer_t t2 = osg::Timer::instance()->tick(); double elapsedTime_ms = osg::Timer::instance()->delta_m(t1, t2); WriteBeamToCSV(beam, "beam.csv"); float TL_dB = GetTL(1, 0, startDepth, 1000.0f, 300.0f); // call once to calc beam // calculate TL vs. range osg::Timer_t t3 = osg::Timer::instance()->tick(); std::vector<float> range_vect; std::vector<float> loss_vect; for (float range_m=0; range_m<100000.0f; range_m+=250.0f) { TL_dB = GetTL(1, 0, startDepth, range_m, 50.0f); range_vect.push_back(range_m); loss_vect.push_back(TL_dB); } osg::Timer_t t4 = osg::Timer::instance()->tick(); double elapsedTime2_ms = osg::Timer::instance()->delta_m(t3, t4); WriteTLToCSV(range_vect, loss_vect, "TL.csv"); wxString s; s.Printf("Elapsed time for %d rays: %.1f ms (%.1f ms/ray)\n" "TL time for %d calcs: %.1f ms (%.1f ms/calc)", beam.size(), elapsedTime_ms, elapsedTime_ms / float(beam.size()), range_vect.size(), elapsedTime2_ms, elapsedTime2_ms / float(range_vect.size())); wxMessageBox(s); } void tcSonarEnvironment::UpdateBeam(std::vector<tcSonarRay>& beam, float depth_m) { beam.clear(); for (float angle=minAngle_rad; angle<=maxAngle_rad; angle += angleStep_rad) { beam.push_back(CalculateRay(depth_m, angle)); } } /** * @return true if SVP is valid, false otherwise */ bool tcSonarEnvironment::ValidateSVP() { if (svp.size() < 2) { wxASSERT(false); fprintf(stderr, "tcSonarEnvironment::ValidateSVP - SVP must have at least 2 points\n"); return false; } if (svp[0].depth_m != 0) { wxASSERT(false); fprintf(stderr, "tcSonarEnvironment::ValidateSVP - first SVP depth must be 0 (currently = %f)\n", svp[0].depth_m); return false; } for (size_t k=1; k<svp.size(); k++) { if (svp[k].depth_m <= svp[k-1].depth_m) { wxASSERT(false); fprintf(stderr, "tcSonarEnvironment::ValidateSVP - SVP depth must monotonically increase (%d,%f <= %d,%f)\n", k, svp[k].depth_m, k-1, svp[k-1].depth_m); return false; } } return true; } void tcSonarEnvironment::WriteBeamToCSV(const std::vector<tcSonarRay>& beam, const std::string& fileName) { tcFile log; log.Open(fileName.c_str(), tcFile::modeCreate | tcFile::modeWrite | tcFile::modeText); for (float range_km=0; range_km<100.0f; range_km+=0.25f) { wxString s; s.Printf("%.1f,", range_km); log.WriteString(s.c_str()); for (size_t k=0; k<beam.size(); k+=10) { float reflectionLoss_dB; s.Printf("%.1f,", beam[k].CalculateDepth(1000.0f*range_km, reflectionLoss_dB)); log.WriteString(s.c_str()); } log.WriteString("\n"); } } void tcSonarEnvironment::WriteTLToCSV(const std::vector<float>& range_vect, const std::vector<float>& loss_vect, const std::string& fileName) { tcFile log; log.Open(fileName.c_str(), tcFile::modeCreate | tcFile::modeWrite | tcFile::modeText); for (size_t k=0; k<range_vect.size(); k++) { wxString s; s.Printf("%.1f,%.1f,%.1f,%.1f\n", range_vect[k], loss_vect[k], 10*log10(range_vect[k]), 30*log10(range_vect[k])); log.WriteString(s.c_str()); } } /** * */ tcSonarEnvironment::tcSonarEnvironment() : surfaceLoss_dB(10.0f), bottomLoss_dB(15.0f), minAngle_rad(-0.295f), maxAngle_rad(0.295f), angleStep_rad(0.01f), rayCount_dB(17.8f), depthUpdateThreshold_m(5.0f), fluxDecay(0.1), seaState(0) { SetDefaultSVP(); SetSeaState(3); } /** * */ tcSonarEnvironment::~tcSonarEnvironment() { } |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:49
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/include/sim Modified Files: tcSensorState.h Added Files: tcSonarEnvironment.h tcSonarRay.h Log Message: Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcSensorState.h 22 Mar 2006 01:23:29 -0000 1.22 --- tcSensorState.h 20 Dec 2006 00:45:45 -0000 1.23 *************** *** 112,115 **** --- 112,116 ---- static tcSimState* simState; static tcDatabase* database; + static long nextSensorId; ///< for assigning sensorId bool isHidden; ///< hidden sensors are not displayed in object control view *************** *** 117,120 **** --- 118,122 ---- long fireControlId; ///< id of platform with fire control sensor (semi-active illuminator, or command guidance sensor) unsigned char fireControlIdx; ///< sensor index of fire control sensor platform + const long sensorId; ///< unique id for this sensor (used for sonar TL cache) bool RandomDetect(float margin_dB); --- NEW FILE: tcSonarEnvironment.h --- /** ** @file tcSonarEnvironment.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #if _MSC_VER > 1000 #pragma once #endif #ifndef _TCSONARENVIRONMENT_H_ #define _TCSONARENVIRONMENT_H_ #include "simmath.h" #include <map> #include <vector> class tcSonarRay; /** * Class for sonar propagation modeling * * Initial version * - Assume bottom is always at 500 m (no bathy data yet) * - Calculate rays for sonar every 10 m depth from 0 to 500 m (50 sets of rays) * * Singleton class */ class tcSonarEnvironment { public: struct SVPData { float depth_m; float v_mps; float R_m; ///< radius of curvature for this segment float R2_m; ///< square of radius of curvature }; static tcSonarEnvironment* Get(); ///< singleton instance accessor const std::vector<SVPData>& GetSVP() const; void SetSVP(const std::vector<SVPData>& svp_); void ClearSVP(); void AddSVPPoint(float depth_m, float speed_mps); void SetDefaultSVP(); void SetSurfaceLoss(float val_dB); float GetSurfaceLoss() const; void SetBottomLoss(float val_dB); float GetBottomLoss() const; void SetSeaState(unsigned int val); unsigned int GetSeaState() const; float GetAmbientNL(float freq_Hz) const; float GetTL(long key, double t, float depth_m, float targetRange_m, float targetDepth_m); void Clear(); void Test(); private: struct BeamData { double t_update; ///< last update time float depth_m; ///< depth that rays were calculated at std::vector<tcSonarRay> beam; ///< rays over range of angles = "beam" }; std::map<long, BeamData> beamCache; float surfaceLoss_dB; ///< loss from surface reflection float bottomLoss_dB; ///< loss from bottom reflection float minAngle_rad; ///< min angle for ray calc float maxAngle_rad; ///< max angle for ray calc float angleStep_rad; ///< angle increment for ray calc float depthUpdateThreshold_m; ///< update rays if depth change exceeds const float fluxDecay; float rayCount_dB; ///< 10*log10(# rays per beam) std::vector<float> range_m; ///< ranges that TL is evaluated at std::vector<SVPData> svp; ///< sound velocity profile <depth [m], speed [m/s] points unsigned int seaState; ///< 0-7 sea state float noiseLevelBase; float noiseLevelSlope; const tcSonarRay& CalculateRay(float startDepth_m, float startAngle_rad); size_t GetSVPSegment(float& angle_rad, float& depth, float& reflectionLoss_dB); void UpdateBeam(std::vector<tcSonarRay>& beam, float depth_m); void WriteBeamToCSV(const std::vector<tcSonarRay>& beam, const std::string& filename); void WriteTLToCSV(const std::vector<float>& range_vect, const std::vector<float>& loss_vect, const std::string& fileName); float GetTLSimple(float depth_m, float targetRange_m, float targetDepth_m); bool ValidateSVP(); tcSonarEnvironment(); ~tcSonarEnvironment(); }; #endif --- NEW FILE: tcSonarRay.h --- /** ** @file tcSonarRay.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #if _MSC_VER > 1000 #pragma once #endif #ifndef _TCSONARRAY_H_ #define _TCSONARRAY_H_ #include "simmath.h" #include <vector> /** * Describes path of sonar ray calculated by ray tracing */ class tcSonarRay { public: struct RayPoint { float x; float xmax; float y; float R; float R2; float xc; float yc; float reflectionLoss_dB; ///< accumulated reflection loss up to this segment }; std::vector<RayPoint> data; float CalculateDepth(float range_m, float& reflectionLoss_dB) const; tcSonarRay(); virtual ~tcSonarRay(); private: }; #endif |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:49
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/src/common Modified Files: simmath.cpp tcOptions.cpp Log Message: Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** simmath.cpp 20 Nov 2006 00:17:39 -0000 1.35 --- simmath.cpp 20 Dec 2006 00:45:46 -0000 1.36 *************** *** 29,32 **** --- 29,45 ---- + + float Add_dB(float x_dB, float y_dB) + { + if (fabsf(x_dB - y_dB) > 17.0f) + { + return (x_dB > y_dB) ? x_dB : y_dB; + } + else + { + return 10.0f*log10f(powf(10.0f, 0.1f*x_dB) + powf(10.0f, 0.1f*y_dB)); + } + } + void ConformLonLatRad(float& lon_rad, float& lat_rad) { Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcOptions.cpp 24 Oct 2006 01:34:02 -0000 1.21 --- tcOptions.cpp 20 Dec 2006 00:45:46 -0000 1.22 *************** *** 144,147 **** --- 144,154 ---- AddOption(oi); + oi.meType = tsOptionInfo::OT_RADIOBUTTON; + oi.mnStateCount = 2; + oi.mnValue = 1; + oi.mpAssociated = &useRayTracingSonar; + oi.mzCaption[0] = "Simple sonar propagation"; + oi.mzCaption[1] = "Use ray tracing"; + AddOption(oi); |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:49
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/include/database Modified Files: tcSonarDBObject.h Log Message: Index: tcSonarDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcSonarDBObject.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcSonarDBObject.h 20 Nov 2006 00:16:27 -0000 1.7 --- tcSonarDBObject.h 20 Dec 2006 00:45:45 -0000 1.8 *************** *** 58,61 **** --- 58,62 ---- float alpha; ///< CALCULATED attenuation coefficent in dB/km float bearingResolution_rad; ///< CALCULATED + float averageFreq_Hz; ///< CALCULATED virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:49
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** GCblue.vcproj 15 Dec 2006 03:38:48 -0000 1.111 --- GCblue.vcproj 20 Dec 2006 00:45:45 -0000 1.112 *************** *** 823,826 **** --- 823,834 ---- </File> <File + RelativePath=".\src\sim\tcSonarEnvironment.cpp" + > + </File> + <File + RelativePath=".\src\sim\tcSonarRay.cpp" + > + </File> + <File RelativePath=".\src\sim\tcSonobuoy.cpp" > *************** *** 1558,1566 **** > <File ! RelativePath=".\resource.h" > </File> <File ! RelativePath=".\res\resource.h" > </File> --- 1566,1574 ---- > <File ! RelativePath=".\res\resource.h" > </File> <File ! RelativePath=".\resource.h" > </File> *************** *** 2169,2172 **** --- 2177,2188 ---- </File> <File + RelativePath=".\include\sim\tcSonarEnvironment.h" + > + </File> + <File + RelativePath=".\include\sim\tcSonarRay.h" + > + </File> + <File RelativePath=".\include\sim\tcSonobuoy.h" > |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:49
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/src/database Modified Files: tcSonarDBObject.cpp Log Message: Index: tcSonarDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSonarDBObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSonarDBObject.cpp 20 Nov 2006 00:17:40 -0000 1.6 --- tcSonarDBObject.cpp 20 Dec 2006 00:45:46 -0000 1.7 *************** *** 46,52 **** { // Thorp eqn ! float freq_avg_kHz = 0.0005 * (minFrequency_Hz + maxFrequency_Hz); ! if (freq_avg_kHz < 0) freq_avg_kHz = 2.0f; float f2 = freq_avg_kHz * freq_avg_kHz; --- 46,54 ---- { // Thorp eqn ! averageFreq_Hz = 0.5 * (minFrequency_Hz + maxFrequency_Hz); ! if (averageFreq_Hz <= 0) averageFreq_Hz = 2000.0f; + float freq_avg_kHz = 0.001f * averageFreq_Hz; + float f2 = freq_avg_kHz * freq_avg_kHz; |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:48
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/scripts Modified Files: Menu.py UnitCommands.py Log Message: Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** UnitCommands.py 15 Dec 2006 03:38:49 -0000 1.33 --- UnitCommands.py 20 Dec 2006 00:45:46 -0000 1.34 *************** *** 493,495 **** --- 493,551 ---- FP.AddAttackMission(targetId) + # Group menu functions from Ben "Mnfe" 20061217 post + def RelGroupSpeed100(GI): + unit_count = GI.GetUnitCount() + max_speed=9999 + for n in range(0,unit_count): + UI = GI.GetPlatformInterface(n) + this_speed=UI.GetMaxSpeed() + if(this_speed<max_speed): + max_speed=this_speed + for n in range(0,unit_count): + UI = GI.GetPlatformInterface(n) + UI.SetSpeed(max_speed) + + def RelGroupSpeed80(GI): + unit_count = GI.GetUnitCount() + max_speed=9999 + for n in range(0,unit_count): + UI = GI.GetPlatformInterface(n) + this_speed=UI.GetMaxSpeed() + if(this_speed<max_speed): + max_speed=this_speed + for n in range(0,unit_count): + UI = GI.GetPlatformInterface(n) + UI.SetSpeed(0.8*max_speed) + + def RelGroupSpeed50(GI): + unit_count = GI.GetUnitCount() + max_speed=9999 + for n in range(0,unit_count): + UI = GI.GetPlatformInterface(n) + this_speed=UI.GetMaxSpeed() + if(this_speed<max_speed): + max_speed=this_speed + for n in range(0,unit_count): + UI = GI.GetPlatformInterface(n) + UI.SetSpeed(0.5*max_speed) + + def RelGroupSpeed30(GI): + unit_count = GI.GetUnitCount() + max_speed=9999 + for n in range(0,unit_count): + UI = GI.GetPlatformInterface(n) + this_speed=UI.GetMaxSpeed() + if(this_speed<max_speed): + max_speed=this_speed + for n in range(0,unit_count): + UI = GI.GetPlatformInterface(n) + UI.SetSpeed(0.3*max_speed) + + def AddEngageAllOrderGroup(GI): + unit_count=GI.GetUnitCount() + for n in range(0,unit_count): + UnitInfo=GI.GetPlatformInterface(n) + if(not UnitInfo.TaskExists('EngageAll')): + AddEngageAllOrder(UnitInfo) + Index: Menu.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/Menu.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Menu.py 15 Dec 2006 03:38:49 -0000 1.31 --- Menu.py 20 Dec 2006 00:45:46 -0000 1.32 *************** *** 34,37 **** --- 34,39 ---- TrackInfo.UpdateAmbiguityList() + + # Updated with Ben "Mnfe" 20061217 post def BuildGroupMenu(GroupMenu, GroupInfo): GroupMenu.Clear() *************** *** 48,58 **** GroupMenu.EndSubMenu() ! # Group orders GroupMenu.AddItem('Tasks','') ! GroupMenu.BeginSubMenu() GroupMenu.AddItem('Zig-zag patrol','AddPatrolOrderGroup') GroupMenu.AddItemUI('Add waypoint', 'AddWaypointOrderGroup', 'Datum') GroupMenu.AddItem('Clear all tasks','ClearTasksGroup') ! GroupMenu.EndSubMenu() --- 50,70 ---- GroupMenu.EndSubMenu() ! # Group Speed relative to fastest unit ! GroupMenu.AddItem('GroupSpeed','') ! GroupMenu.BeginSubMenu() ! GroupMenu.AddItem('Group 30%','RelGroupSpeed30') ! GroupMenu.AddItem('Group 50%','RelGroupSpeed50') ! GroupMenu.AddItem('Group 80%','RelGroupSpeed80') ! GroupMenu.AddItem('Group 100%','RelGroupSpeed100') ! GroupMenu.EndSubMenu() ! ! # Group orders GroupMenu.AddItem('Tasks','') ! GroupMenu.BeginSubMenu() ! GroupMenu.AddItem('Engage all','AddEngageAllOrderGroup') GroupMenu.AddItem('Zig-zag patrol','AddPatrolOrderGroup') GroupMenu.AddItemUI('Add waypoint', 'AddWaypointOrderGroup', 'Datum') GroupMenu.AddItem('Clear all tasks','ClearTasksGroup') ! GroupMenu.EndSubMenu() |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:48
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/include/common Modified Files: simmath.h tcOptions.h Log Message: Index: tcOptions.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOptions.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcOptions.h 1 Oct 2006 21:07:40 -0000 1.14 --- tcOptions.h 20 Dec 2006 00:45:45 -0000 1.15 *************** *** 77,80 **** --- 77,81 ---- /// 0 - own-alliance only, 1 - raw track data, 2 - add true pitch roll if available, 3 - use true data if avail int mn3DCheatMode; + int useRayTracingSonar; ///< 0 - simple spherical spreading, 1 - ray tracing tsOptionInfo maOptionInfo[N_OPTIONS]; Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** simmath.h 20 Nov 2006 00:16:25 -0000 1.38 --- simmath.h 20 Dec 2006 00:45:45 -0000 1.39 *************** *** 232,235 **** --- 232,237 ---- int GeoWithinRegion(GeoPoint p, tcRect *pRegion); + float Add_dB(float x_dB, float y_dB); + inline float& degtoplusminus180(float& afDeg) { |
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:48
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/src/graphics Modified Files: ObjectUpdater.cpp tc3DModel.cpp tcMapView.cpp Log Message: Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** tcMapView.cpp 13 Dec 2006 02:10:58 -0000 1.54 --- tcMapView.cpp 20 Dec 2006 00:45:46 -0000 1.55 *************** *** 2684,2689 **** void tcTacticalMapView::OnLButtonDClick(wxMouseEvent& event) { - if (hookedId.size() != 1) return; - wxPoint pos = event.GetPosition(); --- 2684,2687 ---- Index: ObjectUpdater.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/ObjectUpdater.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ObjectUpdater.cpp 23 Mar 2006 01:11:02 -0000 1.23 --- ObjectUpdater.cpp 20 Dec 2006 00:45:46 -0000 1.24 *************** *** 199,202 **** --- 199,203 ---- } + // TODO make this more efficient osg::Matrix m = osg::Matrix::rotate(osg::inRadians(roll),0.0f,1.0f,0.0f)* Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tc3DModel.cpp 20 Nov 2006 00:17:42 -0000 1.40 --- tc3DModel.cpp 20 Dec 2006 00:45:46 -0000 1.41 *************** *** 615,640 **** { if (modelNode.valid()) return; // model already loaded const bool log3Ddetails = tcOptions::Get()->OptionStringExists("Log3DModelDetails"); ! if (log3Ddetails) ! { ! std::cout << "Loading 3D model: " << model_name << " \n"; ! } ! ! modelNode = osgDB::readNodeFile(model_name.c_str()); ! if (!modelNode.valid()) { ! std::cout << "Load of 3D model: " << model_name << " failed.\n"; ! std::cerr << "Load of 3D model: " << model_name << " failed.\n"; ! modelNode = unknownAll.get(); // use unknown model as default } ! if (useSmoothing) ! { ! osgUtil::SmoothingVisitor smoothingVisitor; ! modelNode->accept(smoothingVisitor); ! } if (log3Ddetails) --- 615,632 ---- { if (modelNode.valid()) return; // model already loaded + modelNode = new osg::Group(); const bool log3Ddetails = tcOptions::Get()->OptionStringExists("Log3DModelDetails"); ! osg::Node* mainNode = osgDB::readNodeFile(model_name.c_str()); ! if (mainNode == 0) { ! fprintf(stdout, "Load of 3D model: %s failed.\n", model_name.c_str()); ! fprintf(stderr, "Load of 3D model: %s failed.\n", model_name.c_str()); ! mainNode = unknownAll.get(); // use unknown model as default } ! modelNode->addChild(mainNode); if (log3Ddetails) *************** *** 668,672 **** delete doc; fprintf(stderr, "Error loading XML file %s\n", file_name.c_str()); ! modelNode = unknownAll.get(); // use unknown model as default return; } --- 660,665 ---- delete doc; fprintf(stderr, "Error loading XML file %s\n", file_name.c_str()); ! if (!modelNode.valid()) modelNode = new osg::Group; ! modelNode->addChild(unknownAll.get()); // use unknown model as default return; } *************** *** 674,683 **** TiXmlNode* node = doc->FirstChild("Model"); - if (!node) { delete doc; fprintf(stderr, "Model entry missing in XML file %s\n", file_name.c_str()); ! modelNode = unknownAll.get(); // use unknown model as default return; } --- 667,676 ---- TiXmlNode* node = doc->FirstChild("Model"); if (!node) { delete doc; fprintf(stderr, "Model entry missing in XML file %s\n", file_name.c_str()); ! if (!modelNode.valid()) modelNode = new osg::Group; ! modelNode->addChild(unknownAll.get()); // use unknown model as default return; } *************** *** 690,693 **** --- 683,694 ---- Load(modelFileName); + LoadXmlSubmodels(doc); + + if (useSmoothing) + { + osgUtil::SmoothingVisitor smoothingVisitor; + modelNode->accept(smoothingVisitor); + } + LoadXmlAnimationInfo(doc); *************** *** 844,847 **** --- 845,912 ---- } + + void tc3DModel::LoadXmlSubmodels(TiXmlDocument* doc) + { + if (!modelNode.valid()) + { + wxASSERT(false); + return; + } + + const bool log3Ddetails = tcOptions::Get()->OptionStringExists("Log3DModelDetails"); + + TiXmlNode* current = doc->FirstChild("Submodel"); + while (current) + { + if (TiXmlElement* elt = current->ToElement()) + { + std::string model_name; + double x = 0; + double y = 0; + double z = 0; + double yaw = 0; + double pitch = 0; + double roll = 0; + + model_name = elt->Attribute("File"); + elt->Attribute("X", &x); + elt->Attribute("Y", &y); + elt->Attribute("Z", &z); + elt->Attribute("Yaw", &yaw); + elt->Attribute("Pitch", &pitch); + elt->Attribute("Roll", &roll); + + osg::Matrix m = + osg::Matrix::rotate(osg::inDegrees(roll),0.0f,1.0f,0.0f)* + osg::Matrix::rotate(osg::inDegrees(pitch),1.0f,0.0f,0.0f)* + osg::Matrix::rotate(-osg::inDegrees(yaw),0.0f,0.0f,1.0f)* + osg::Matrix::translate(x,y,z) + ; + + osg::MatrixTransform* transform = new osg::MatrixTransform(m); + transform->setDataVariance(osg::Object::STATIC); + + osg::Node* node = osgDB::readNodeFile(model_name.c_str()); + if (node == 0) + { + fprintf(stdout, "Load of 3D model: %s failed.\n", model_name.c_str()); + fprintf(stderr, "Load of 3D model: %s failed.\n", model_name.c_str()); + } + + transform->addChild(node); + modelNode->addChild(transform); + + if (log3Ddetails) + { + fprintf(stdout, "tc3DModel--Loaded 3D submodel: %s\n", model_name.c_str()); + } + + } + + current = current->NextSibling("Submodel"); + } + } + + /** * *************** *** 1097,1101 **** engineSmokeSources = source->engineSmokeSources; ! modelNode = dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,true,0))); // add children with varying level of detail --- 1162,1166 ---- engineSmokeSources = source->engineSmokeSources; ! modelNode = dynamic_cast<osg::Group*>(source->modelNode->clone(ModelCopyOp(this,true,0))); // add children with varying level of detail |
From: Dewitt C. <ddc...@us...> - 2006-12-15 03:38:51
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32056/src/graphics Modified Files: tcOOBView.cpp Added Files: tcMapMissionObject.cpp Log Message: --- NEW FILE: tcMapMissionObject.cpp --- /** ** @file tcMapMissionObject.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" // precompiled header file #ifndef WX_PRECOMP #include "wx/wx.h" #endif // WX_PRECOMP #include "tcMapMissionObject.h" #include "tcMapView.h" #include "math_constants.h" #include "simmath.h" #include "tcSimState.h" #include "common/tcStream.h" #include "common/tcObjStream.h" #include "ai/tcMission.h" #include "ai/tcCAPMission.h" #include "ai/tcMissionManager.h" #ifdef _DEBUG #define new DEBUG_NEW #endif /** * Loads state from stream */ tcUpdateStream& tcMapMissionObject::operator<<(tcUpdateStream& stream) { tcMapObject::operator<<(stream); stream >> caption; return stream; } /** * Saves state to stream */ tcUpdateStream& tcMapMissionObject::operator>>(tcUpdateStream& stream) { tcMapObject::operator>>(stream); stream << caption; return stream; } void tcMapMissionObject::Draw(tc3DWindow* host) { if (!isActive) return; if (updateCounter++ % 4 == 0) Update(); tcPoint pscreen = GetScreenPoint(); float x = pscreen.x; float y = pscreen.y; const osg::Vec4 color(1, 1, 1, 1); // override color; host->DrawTextR(caption.c_str(), x+5.0f, y, mapView->GetDefaultFont(), color, 12.0, LEFT_BASE_LINE); if (markerEnabled) // avoids parent draw overhead this way { const float a = 4.0f; host->DrawLineR(x, y-a, x, y+a, color); host->DrawLineR(x-a, y, x+a, y, color); } if (isHooked) { const osg::Vec4 hookColor(1, 1, 1, 1); const float a = 10.0f; host->DrawLineR(x-a, y-a, x+a, y-a, hookColor); host->DrawLineR(x-a, y+a, x+a, y+a, hookColor); host->DrawLineR(x-a, y-a, x-a, y+a, hookColor); host->DrawLineR(x+a, y-a, x+a, y+a, hookColor); } } tcMission* tcMapMissionObject::GetMission() { tcGameObject* obj = tcSimState::Get()->GetObject(platformId); tcFlightOpsObject* host = dynamic_cast<tcFlightOpsObject*>(obj); if (host == 0) { return 0; } tcMissionManager* missionManager = host->GetFlightPort()->GetMissionManager(); if (missionManager == 0) { return 0; } tcMission* mission = missionManager->GetMission(missionId); return mission; } void tcMapMissionObject::MoveToScreenPoint(const wxPoint& pos) { tcMapObject::MoveToScreenPoint(pos); if (dragActive) return; // don't update during drag tcMission* mission = GetMission(); if (tcCAPMission* cap = dynamic_cast<tcCAPMission*>(mission)) { cap->SetStation(_x, _y); cap->UpdateStation(); } } /** * @return false if keyCode is valid command for this object */ bool tcMapMissionObject::ProcessKey(int keyCode) { if (keyCode == WXK_DELETE) { tcMission* mission = GetMission(); if (mission) { mission->EndMission(); } return true; } else { return false; } } void tcMapMissionObject::SetDragActive(bool state) { if (state == dragActive) return; // no change, return if (state == false) { tcMission* mission = GetMission(); if (tcCAPMission* cap = dynamic_cast<tcCAPMission*>(mission)) { cap->SetStation(_x, _y); cap->UpdateStation(); } } dragActive = state; } void tcMapMissionObject::Update() { tcGameObject* obj = tcSimState::Get()->GetObject(platformId); if (obj == 0) { FlagForDelete(); return; } if (dragActive) return; // no updates during drag tcMission* mission = GetMission(); if (tcCAPMission* cap = dynamic_cast<tcCAPMission*>(mission)) { float range_km, az_deg; cap->GetPatrolOffset(range_km, az_deg); if (range_km > 0) { tcTrack track; track.mfLon_rad = obj->mcKin.mfLon_rad; track.mfLat_rad = obj->mcKin.mfLat_rad; track.OffsetDeg(range_km, az_deg); _x = track.mfLon_rad; _y = track.mfLat_rad; caption = "CAP"; } else { _x = 0; _y = 0; caption = ""; } } else { FlagForDelete(); return; } } tcMapMissionObject::tcMapMissionObject(long platformId_, unsigned int missionId_) : tcMapObject(), platformId(platformId_), missionId(missionId_), updateCounter(0) { } tcMapMissionObject::~tcMapMissionObject() { } Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcOOBView.cpp 2 Dec 2006 02:23:48 -0000 1.16 --- tcOOBView.cpp 15 Dec 2006 03:38:49 -0000 1.17 *************** *** 661,664 **** --- 661,690 ---- } + void tcOOBView::OnLButtonDClick(wxMouseEvent& event) + { + wxPoint point = event.GetPosition(); + + if (tsOOBInfo* info = + ButtonContainingPoint(wxRealPoint((float)point.x,(float)point.y))) + { + long new_key = info->mnID; + if (new_key != -1) + { + long flags = 0; + if (event.ShiftDown()) flags += 1; + if (event.ControlDown()) flags += 2; + if (event.AltDown()) flags += 4; + + wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_DCLICKHOOK) ; + command.SetEventObject(this); + command.m_extraLong = flags; + AddPendingEvent(command); + } + mnSelectedKey = new_key; + + tcSound::Get()->PlayEffect("ShortBeep"); + } + } + void tcOOBView::OnLButtonDown(wxMouseEvent& event) |
From: Dewitt C. <ddc...@us...> - 2006-12-15 03:38:51
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32056/scripts Modified Files: AI.py Menu.py UnitCommands.py Log Message: Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** AI.py 20 Nov 2006 00:18:47 -0000 1.31 --- AI.py 15 Dec 2006 03:38:49 -0000 1.32 *************** *** 321,324 **** --- 321,405 ---- + + # shoot hostiles and unknowns within range, but do not intercept. + # Turn if necessary to position launchers + def EngageAllAir(TI): + UI = TI.GetPlatformInterface() + BB = TI.GetBlackboardInterface() + + iteration = TI.GetMemoryValue(1) # will return 0 first time + if (iteration == 0): # do initialization + TI.SetMemoryText('Description', 'Engage hostiles and unknowns within range, but do not intercept') + + iteration = iteration + 1 + TI.SetMemoryValue(1, iteration) + + # engage_mode values: + # 0 - searching, 1 - turning to place target within launch sector, 2 - keeping target within semiactive sector + engage_mode = TI.GetMemoryValue(2) + + # memory values + # 10: target id + # 11: launcher index + # 12: launch/follow sector center + # 13: launch/follow sector width + + if (engage_mode == 0): # searching + best_target, best_launcher = GetImmediateAirTarget(UI) + if (best_target != -1): + #UI.DisplayMessage('%s: targ: %d, lau: %d' % (UI.GetName(), best_target, best_launcher)) + launcher_info = UI.GetLauncherInfo(best_launcher) + if (launcher_info.IsValid()): + TI.SetMemoryValue(10, best_target) + TI.SetMemoryValue(11, best_launcher) + TI.SetMemoryValue(12, launcher_info.SectorCenter) + TI.SetMemoryValue(13, launcher_info.SectorWidth) + TI.SetMemoryValue(2, 1) + engage_mode = 1 + TI.SetUpdateInterval(10.0) + else: + TI.SetMemoryValue(2, 0) + else: + # check for nearby missiles + closest_id, closest_range = ClosestOfType(UI, 0x0040, 60) + if (closest_id == -1): + TI.SetUpdateInterval(30) + else: + if (closest_range < 20): + TI.SetUpdateInterval(1) + else: + TI.SetUpdateInterval(5) + UI.SetAllSensorState(1) + + if (engage_mode == 1): # turn to target + target_id = long(TI.GetMemoryValue(10)) + if (target_id == -1): + TI.SetMemoryValue(2, 0) + return + UI.SetTarget(target_id) + launcher = long(TI.GetMemoryValue(11)) + launcher_angle = TI.GetMemoryValue(12) + sector_width = TI.GetMemoryValue(13) + target_bearing = GetTargetBearing(UI) + #if (GetConnControl(BB)): + # UI.SetHeading(target_bearing-launcher_angle) + + engagement_angle = target_bearing - launcher_angle + if (engagement_angle > 180.0): + engagement_angle = engagement_angle - 360.0 + elif (engagement_angle < -180.0): + engagement_angle = engagement_angle + 360.0 + if (engagement_angle <= 0.5 * sector_width): + EngageTargetWithLauncher(UI, launcher) + TI.SetMemoryValue(2, 0) + TI.SetUpdateInterval(1.0) # wait 1 seconds + # ReleaseConnControl(BB) + # set for "fire and forget" this way + # add check here for semiactive guidance that requires keeping FC radar on target + # for duration of engagement + + + + # Adjust heading toward target, maintain altitude and speed to release point, # release ALL bombs at release point, and then reverse course *************** *** 518,524 **** is_air_target = track_info.IsAir() or track_info.IsMissile() if (is_air_target or track_info.IsSub()): ! max_engaged_count = 2 else: ! max_engaged_count = 6 #UI.DisplayMessage('Track %d, %.0f/%d/%d' % (track_id, staleness, bearing_only, engaged_count)) --- 599,605 ---- is_air_target = track_info.IsAir() or track_info.IsMissile() if (is_air_target or track_info.IsSub()): ! max_engaged_count = 1 else: ! max_engaged_count = 5 #UI.DisplayMessage('Track %d, %.0f/%d/%d' % (track_id, staleness, bearing_only, engaged_count)) *************** *** 557,560 **** --- 638,714 ---- + # returns id of closest target that is in-range, engageable, not already + # overwhelmingly engaged, and not a stale track + # returns -1 if none + # modified to avoid wasting all missiles on first target of stream raid + # + # version that only gets air and missile targets + def GetImmediateAirTarget(UI): + + # anAffiliation: UNKNOWN = 0, FRIENDLY = 1, NEUTRAL = 2, HOSTILE = 3 + # + # anClassMask: + # PTYPE_SURFACE 0x0010 + # PTYPE_AIR 0x0020 + # PTYPE_MISSILE 0x0040 + # PTYPE_SUBSURFACE 0x0080 + # PTYPE_FIXED 0x0100 + # int anClassMask, float afMaxRange_km, UINT8 anAffiliation + track_list = UI.GetTrackList(0x0060, 150, 3) + + current_time = UI.GetTime() + nTracks = track_list.Size() + best_range = 1e6 + best_target = -1 + best_launcher = -1 + best_engaged_count = 99 + + for n in range(0, nTracks): + track_info = track_list.GetTrack(n) + track_id = track_info.ID + staleness = current_time - track_info.Time + is_destroyed = track_info.IsDestroyed() + bearing_only = track_info.IsBearingOnly() + engaged_count = track_info.GetEngagedCount() + is_air_target = track_info.IsAir() or track_info.IsMissile() + if (is_air_target or track_info.IsSub()): + max_engaged_count = 1 + else: + max_engaged_count = 5 + #UI.DisplayMessage('Track %d, %.0f/%d/%d' % (track_id, staleness, bearing_only, engaged_count)) + + if ((engaged_count < max_engaged_count) and (staleness < 15.0) and (not bearing_only) and (not is_destroyed)): + UI.SetTarget(track_id) + launcher_info = UI.GetBestLauncher() + launcher_idx = launcher_info.Launcher + #UI.DisplayMessage('Best launcher %d' % launcher_idx) + if (launcher_idx != -1): + target_range = UI.GetRangeToTarget() + launch_range = launcher_info.Range_km # reference max range, use for launch decision + + is_better = (target_range <= launch_range) and (engaged_count < best_engaged_count) + is_better = is_better or ((engaged_count == best_engaged_count) and (target_range < best_range)) + + if (is_better): + best_range = target_range + best_target = track_id + best_launcher = launcher_idx + best_engaged_count = engaged_count + + # Clear best if there is another unengaged air target close to the launch zone + near_launch_range = (target_range > launch_range) and (target_range < 1.75*launch_range) + if (near_launch_range and is_air_target and (launcher_idx == best_launcher) and \ + (best_engaged_count > 0) and (engaged_count == 0)): + best_range = 1e6 + best_target = -1 + best_launcher = -1 + best_engaged_count = 99 + + UI.SetTarget(best_target) + + return (best_target, best_launcher) + + + *************** *** 839,843 **** def InterceptTarget(TI): UI = TI.GetPlatformInterface() ! iteration = TI.GetMemoryValue(1) # will return 0 first time --- 993,997 ---- def InterceptTarget(TI): UI = TI.GetPlatformInterface() ! BB = TI.GetBlackboardInterface() iteration = TI.GetMemoryValue(1) # will return 0 first time *************** *** 846,850 **** TI.SetMemoryValue(2, 0) # 0 if target not engaged, 1 otherwise TI.SetMemoryValue(4, 0) # launcher is fire and forget (flee after attack) ! iteration = iteration + 1 TI.SetMemoryValue(1, iteration) --- 1000,1004 ---- TI.SetMemoryValue(2, 0) # 0 if target not engaged, 1 otherwise TI.SetMemoryValue(4, 0) # launcher is fire and forget (flee after attack) ! TI.SetUpdateInterval(15.0) iteration = iteration + 1 TI.SetMemoryValue(1, iteration) *************** *** 901,904 **** --- 1055,1062 ---- UI.SetSpeedToMax() UI.SetActionText('Int %d (%3.0f s)' % (targetid, TTI)) + if (targetrange - launch_range > 2.0): + TI.SetUpdateInterval(15.0) + else: + TI.SetUpdateInterval(8.0) elif (adjust_depth): UI.SetAlt(-launcher_info.MaxDepth_m + 1) Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** UnitCommands.py 20 Nov 2006 00:18:47 -0000 1.32 --- UnitCommands.py 15 Dec 2006 03:38:49 -0000 1.33 *************** *** 35,42 **** def ToggleEngageAll(UI): ! if (UI.TaskExists('EngageAll')): UI.DeleteTask('EngageAll') else: ! UI.AddTask('EngageAll', 2.0, 0) def AddBombTargetTask(UI): --- 35,45 ---- def ToggleEngageAll(UI): ! if (UI.TaskExists('EngageAllAir')): ! UI.DeleteTask('EngageAllAir') ! UI.AddTask('EngageAll', 2.0, 0) ! elif (UI.TaskExists('EngageAll')): UI.DeleteTask('EngageAll') else: ! UI.AddTask('EngageAllAir', 2.0, 0) def AddBombTargetTask(UI): *************** *** 484,486 **** --- 487,495 ---- + def AddAttackMission(UI, targetId): + if (not UI.HasFlightPort()): + return + FP = UI.GetFlightPortInfo() + FP.AddAttackMission(targetId) + Index: Menu.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/Menu.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Menu.py 6 Dec 2006 01:20:42 -0000 1.30 --- Menu.py 15 Dec 2006 03:38:49 -0000 1.31 *************** *** 159,162 **** --- 159,163 ---- UnitMenu.BeginSubMenu() UnitMenu.AddItemUI('CAP', 'AddCAPMission', 'Datum') + UnitMenu.AddItemUI('Strike', 'AddAttackMission', 'Target') UnitMenu.EndSubMenu() |
From: Dewitt C. <ddc...@us...> - 2006-12-15 03:38:51
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32056/include/ai Added Files: tcAttackMission.h Log Message: --- NEW FILE: tcAttackMission.h --- /** ** @file tcAttackMission.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if _MSC_VER > 1000 #pragma once #endif #ifndef _TCATTACKMISSION_H_ #define _TCATTACKMISSION_H_ #include "ai/tcMission.h" #include "simmath.h" class tcFlightPort; class tcPoint; namespace ai { class tcAttackMission : public tcMission { public: void SetTarget(long id); virtual void Update(double t); const tcAttackMission& operator=(const tcAttackMission& src); tcAttackMission(const tcAttackMission& src); tcAttackMission(); virtual ~tcAttackMission(); protected: unsigned int quantity; // number aircraft for mission long targetId; int targetType; ///< derived void UpdateTargetInfo(); void MonitorMissionInProgress(); }; } // namespace #endif |
From: Dewitt C. <ddc...@us...> - 2006-12-15 03:38:51
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32056/src/ai Modified Files: tcMissionManager.cpp Added Files: tcAttackMission.cpp Log Message: --- NEW FILE: tcAttackMission.cpp --- /** ** @file tcAttackMission.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "ai/tcAttackMission.h" #include "ai/tcMissionManager.h" #include "ai/Brain.h" #include "ai/BlackboardInterface.h" #include "tcWeaponDBObject.h" #include "tcAirObject.h" #include "tcPlatformObject.h" #include "tcSimState.h" #ifdef _DEBUG #define new DEBUG_NEW #endif using namespace ai; void tcAttackMission::UpdateTargetInfo() { wxASSERT(missionManager != 0); if (missionManager == 0) return; tcGameObject* host = missionManager->GetFlightportParent(); if (host == 0) { EndMission(); return; } tcSimState* simState = tcSimState::Get(); tcSensorMapTrack targetTrack; if (!simState->GetTrack(targetId, host->GetAlliance(), targetTrack)) { EndMission(); // target doesn't exist return; } if (targetTrack.IsSurface()) { targetType = SURFACE_TARGET; } else if (targetTrack.IsAir()) { targetType = AIR_TARGET; } else if (targetTrack.IsMissile()) { targetType = MISSILE_TARGET; } else if (targetTrack.IsSub()) { targetType = SUBSURFACE_TARGET; } else if (targetTrack.IsGround()) { targetType = LAND_TARGET; } else { targetType = 0; // error, unknown target type } } /** * If no mission aircraft are in flight with an active "CAP" task, * then restart the mission */ void tcAttackMission::MonitorMissionInProgress() { tcSimState* simState = tcSimState::Get(); bool anyInFlight = false; for (size_t n=0; (n<missionAircraft.size()) && (!anyInFlight); n++) { tcPlatformObject* obj = dynamic_cast<tcPlatformObject*>(simState->GetObjectByName(missionAircraft[n].name)); if (obj != 0) { if (obj->GetBrain()->TaskExists("CAP")) anyInFlight = true; } } if (!anyInFlight) stage = "init"; // launch another patrol } void tcAttackMission::SetTarget(long id) { targetId = id; } void tcAttackMission::Update(double t) { wxASSERT(missionManager != 0); if (missionManager == 0) return; // step 1, get aircraft for mission // step 2, outfit aircraft // step 3, create tasks for mission on each aircraft // step 4, order launch of aircraft // step 5, when all aircraft launched, wait until aircraft landed // step 6, start over if target not destroyed if (stage == "init") { UpdateTargetInfo(); // query available aircraft and take first from list std::vector<MissionAircraftInfo> candidates = missionManager->GetAvailableAircraft(targetType); missionAircraft.clear(); for (size_t n=0; (n<quantity)&&(n<candidates.size()); n++) { missionAircraft.push_back(candidates[n]); } if (missionAircraft.size() == 0) return; // none available stage = "outfit"; } else if (stage == "outfit") { bool allOutfitted = true; for (size_t n=0; n<missionAircraft.size(); n++) { tcAirObject* aircraft = missionManager->GetAircraft(missionAircraft[n].id); if (aircraft != 0) { if (!aircraft->IsEquippedForTargetType(targetType)) { aircraft->EquipForTargetType(targetType); allOutfitted = false; } } } if (allOutfitted) stage = "task"; } else if (stage == "task") { wxString s; for (size_t n=0; n<missionAircraft.size(); n++) { tcAirObject* aircraft = missionManager->GetAircraft(missionAircraft[n].id); if (aircraft != 0) { aircraft->DesignateTarget(targetId); ai::Brain* brain = aircraft->GetBrain(); brain->AddTask("InterceptTarget", 2.0); } } stage = "launch"; } else if (stage == "launch") { for (size_t n=0; n<missionAircraft.size(); n++) { missionManager->LaunchAircraft(missionAircraft[n].id); } stage = "waitlaunch"; } else if (stage == "waitlaunch") { // verify all aircraft have launched and end mission if (AllMissionAircraftDeparted()) { stage = "waitland"; } } // do following at slower update double dt = t - lastUpdate; if (dt < 20.0) return; lastUpdate = t; if (stage == "waitland") { EndMission(); //MonitorMissionInProgress(); } } const tcAttackMission& tcAttackMission::operator=(const tcAttackMission& src) { tcMission::operator=(src); quantity = src.quantity; targetId = src.targetId; targetType = src.targetType; return *this; } tcAttackMission::tcAttackMission(const tcAttackMission& src) : tcMission(src), quantity(src.quantity), targetId(src.targetId), targetType(src.targetType) { } tcAttackMission::tcAttackMission() : tcMission(), quantity(2), targetId(-1), targetType(0) { } tcAttackMission::~tcAttackMission() { } Index: tcMissionManager.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/tcMissionManager.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcMissionManager.cpp 13 Dec 2006 02:10:58 -0000 1.4 --- tcMissionManager.cpp 15 Dec 2006 03:38:49 -0000 1.5 *************** *** 31,34 **** --- 31,36 ---- #include "tcPlatformObject.h" #include "tcAirObject.h" + #include "tcHeloObject.h" + #include "tcWeaponDBObject.h" #ifdef _DEBUG *************** *** 60,63 **** --- 62,67 ---- availableAircraft.clear(); + const bool subsurfaceTarget = (targetMask == SUBSURFACE_TARGET); + UpdateReserved(); *************** *** 73,77 **** tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(airState->obj); wxASSERT(platform != 0); ! if ((platform != 0) && (platform->IsCapableVsTargetType(targetMask))) { MissionAircraftInfo info; --- 77,83 ---- tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(airState->obj); wxASSERT(platform != 0); ! bool isHelo = dynamic_cast<tcHeloObject*>(platform) != 0; ! ! if ((platform != 0) && (!isHelo || subsurfaceTarget) && (platform->IsCapableVsTargetType(targetMask))) { MissionAircraftInfo info; |
From: Dewitt C. <ddc...@us...> - 2006-12-15 03:38:51
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32056/src/scriptinterface Modified Files: tcFlightPortInterface.cpp Log Message: Index: tcFlightPortInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcFlightPortInterface.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcFlightPortInterface.cpp 13 Dec 2006 02:10:59 -0000 1.14 --- tcFlightPortInterface.cpp 15 Dec 2006 03:38:49 -0000 1.15 *************** *** 38,41 **** --- 38,42 ---- #include "tcSoundConsole.h" #include "ai/tcMissionManager.h" + #include "ai/tcAttackMission.h" #include "ai/tcCAPMission.h" *************** *** 74,77 **** --- 75,79 ---- .def("LaunchID", &tcFlightPortInterface::LaunchID) .def("SetDestination", &tcFlightPortInterface::SetDestination) + .def("AddAttackMission", &tcFlightPortInterface::AddAttackMission) .def("AddCAPMission", &tcFlightPortInterface::AddCAPMission) .def("GetLocalObj",&tcFlightPortInterface::GetLocalObj) *************** *** 86,89 **** --- 88,109 ---- + void tcFlightPortInterface::AddAttackMission(long targetId) + { + if (flightport == 0) return; + + tcMissionManager* missionManager = flightport->GetOrCreateMissionManager(); + + tcAttackMission* attack = new tcAttackMission(); + attack->SetTarget(targetId); + + missionManager->AddMission(attack); + + //tcMapMissionObject* missionObj = new tcMapMissionObject(flightport->parent->mnID, cap->GetId()); + //missionObj->SetInteractive(true); + + //overlay->AddMapObject(missionObj); + } + + void tcFlightPortInterface::AddCAPMission(float lon_rad, float lat_rad) { |