Skip to content

Commit

Permalink
- fixes null dereference when opening unit importer without dcs conne…
Browse files Browse the repository at this point in the history
…ction

- fixes aircraft selection enabled on start, even though auto is also enabled by default
- update todo
  • Loading branch information
FalcoGer committed Sep 30, 2023
1 parent d75b2b1 commit 8943008
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 12 deletions.
13 changes: 10 additions & 3 deletions CoordinateConverter/DCS/Tools/FormUnitImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ private Bullseye GetRefPointBullseye()
{
DCSMessage message = new DCSMessage() { FetchCameraPosition = true };
message = DCSConnection.SendRequest(message);

if (message == null)
{
return null;
}
refPoint = new CoordinateDataEntry(-1, message.CameraPosition.GetCoordinate());
}
else
Expand Down Expand Up @@ -275,6 +278,10 @@ private void PopulateCurrentView()
currentView.Rows.Clear(); // Delete all data

Bullseye be = GetRefPointBullseye();
if (allDCSUnits == null)
{
return;
}
foreach (DCSUnit unit in allDCSUnits)
{
CoordinateSharp.Coordinate coordinate = new CoordinateSharp.Coordinate(unit.Coordinate.Lat, unit.Coordinate.Lon);
Expand All @@ -291,8 +298,8 @@ private void PopulateCurrentView()
unit.Type.Level4,
unit.UnitName + " / " + unit.GroupName,
coordinate.ToString(options),
be.GetBRA(coordinate).Bearing,
be.GetBRA(coordinate).Range * conversionFactor,
(be == null) ? (double?)null : be.GetBRA(coordinate).Bearing,
(be == null) ? (double?)null : be.GetBRA(coordinate).Range * conversionFactor,
true
);
}
Expand Down
16 changes: 10 additions & 6 deletions CoordinateConverter/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace CoordinateConverter
/// <seealso cref="Form" />
public partial class MainForm : Form
{
private readonly GitHub.Version VERSION = new GitHub.Version(0, 5, 10);
private readonly GitHub.Version VERSION = new GitHub.Version(0, 5, 11);

private readonly Color ERROR_COLOR = Color.Pink;
private readonly Color DCS_ERROR_COLOR = Color.Yellow;
Expand Down Expand Up @@ -1821,13 +1821,14 @@ private List<ToolStripMenuItem> AircraftSelectionMenuStripItems {

private void Tsmi_Aircraft_Auto_Click(object objSender, EventArgs e)
{
lbl_Error.Visible = false;

ToolStripMenuItem sender = objSender as ToolStripMenuItem;

sender.Checked = !sender.Checked;
UpdateAircraftSelectionItemsBasedOnAutoSetting();
}

if (sender.Checked)
private void UpdateAircraftSelectionItemsBasedOnAutoSetting()
{
if (tsmi_Auto.Checked)
{
foreach (ToolStripMenuItem menuItem in AircraftSelectionMenuStripItems)
{
Expand All @@ -1838,7 +1839,7 @@ private void Tsmi_Aircraft_Auto_Click(object objSender, EventArgs e)
}
else
{
// auto was deactivated
// auto is deactivated
foreach (ToolStripMenuItem menuItem in AircraftSelectionMenuStripItems)
{
menuItem.Enabled = true;
Expand Down Expand Up @@ -2737,6 +2738,9 @@ public MainForm()
idx++;
}

// Based on the auto setting, make aircraft selection available or unavailable
UpdateAircraftSelectionItemsBasedOnAutoSetting();

// Start the timer last
tmr250ms.Start();
}
Expand Down
32 changes: 29 additions & 3 deletions CoordinateConverter/todo.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
Add support for remote (DCS) hosts
- auto switch reticle to never if ip is not localhost, because that makes no sense.


Make DataGridView faster
- switch main form data grid to use a datatable (copy from unit importer)
prevent ui freezes from connection to dcs
- have the lua script connect to this tool?
- Async connections?


rewrite networking
- one stable connection, not constant connecting and disconnecting
- lua should connect to the tool, not the tool to lua
- prevents tool to hang without connections
- binary property to check if connected before sending a message
- lua creates socket in init
- lua checks for connection every tick before trying to send/receive
- lua autosends coordinates (?)
- callback/delegate on data received?
- async receiver
- lua makes connection every x (3?) seconds using the timed export function if connection is not already established
- dcs lag?
- if so, how to make async?


When saving/loading, update the default location and file name
- add a save option that just overwrites the last file loaded/saved


Add support for selection instead of camera position when something is selected
- add option for auto listing any new unit that was clicked
- alternatively use LoGetWorldObjects("units") (Exports.lua:L426)
Expand All @@ -17,13 +35,17 @@ Add support for selection instead of camera position when something is selected
- check in DCS World install dir in `\Scripts\Export.lua` for clues
- LoGetObjectById()
- how to get ID?


Add support for importing airfields
- LoGetWorldObjects("airdromes") (Exports.lua:L426)
- create coordinate data entries for each unit to import.
- add the appropriate ah64 specific data for each unit type
- use the dcs encyclopedia data to figure out categories for unknown types
- load type database from external file?
- tool to create/edit that file?


Add aircraft support (https://github.com/aronCiucu/DCSTheWay/tree/main/src/moduleCommands)
- general
- determine keycodes with `Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\<type>\Cockpit\Scripts\clickabledata.lua`
Expand Down Expand Up @@ -51,6 +73,8 @@ Add aircraft support (https://github.com/aronCiucu/DCSTheWay/tree/main/src/modul
- Ask user for seat
- JF17
- Check of N/S and E/W is automatically set and what the source of that information is


Allow users to do tedious setups, perhaps save a sequence of commands to be played back later (low priority)
- Include DTC features, separate from points entirely
- saving/loading for each aircraft type
Expand All @@ -66,4 +90,6 @@ Allow users to do tedious setups, perhaps save a sequence of commands to be play
- D/L
- TACAN
- ILS


next waypoint bearing/range/deltaAltitude column

0 comments on commit 8943008

Please sign in to comment.