687 Commits

Author SHA1 Message Date
Pax1601
182fe294de Merge pull request #995 from Pax1601/features/v1/unit-coordinates-copy
feat(map): unit coordinates are now copied entirely. Added info poup.
2024-12-17 15:18:34 +01:00
MarcoJayUsai
95db9b5d38 feat(map): unit coordinates are now copied entirely. Added info poup. 2024-12-13 15:15:23 +01:00
Pax1601
a6e28e9064 Merge pull request #948 from Pax1601/bugfix/v1/wrong-unit-on-reconnection
Bugfix/v1/wrong unit on reconnection
2024-11-25 10:17:14 +01:00
Pax1601
116d4fa894 Merge pull request #949 from Pax1601/feature/v1/selected-unit-coords
Feature/v1/selected unit coords
2024-11-23 17:05:29 +01:00
MarcoJayUsai
8b5df691ec fix(selected unit coords): failsafe in case of absence of the navigator element 2024-11-22 15:14:57 +01:00
MarcoJayUsai
f00fce7fe7 fix(selected unit coords): added minutes indication in latlngdec coordinates format
In the coordinates panel, a lat lng with decimal minutes would appear without the ending " ' " character.
2024-11-22 15:10:44 +01:00
MarcoJayUsai
6bb150a41c feat(map): added selected air units FL in unit coordinates panel; added new coordinates system 2024-11-20 12:50:56 +01:00
MarcoJayUsai
2cadebcabd feat(map): click selected unit coordinates panel will now change location system 2024-11-20 11:43:10 +01:00
MarcoJayUsai
b61289d996 fix(mouseinfopanel): switched to right mouse button to copy coordinates, added tip 2024-11-20 11:27:40 +01:00
MarcoJayUsai
89051c3e85 refactor(unit): moved data update code from initialize to update; made initialize and update final 2024-11-19 13:58:16 +01:00
MarcoJayUsai
064c24e023 fix(map): reconnecting players will not be displayed with wrong name or wrong coalition 2024-11-18 21:56:01 +01:00
MarcoJayUsai
e273203629 feat(map): selected unit coordinates panel moved to top; coords are now copy-able 2024-11-16 18:33:59 +01:00
Pax1601
17b10bebd5 Merge pull request #943 from Pax1601/feature/human-original-callsign
feat(map): added an option to show human controlled unit original callsign
2024-11-13 09:33:51 +01:00
MarcoJayUsai
5e5ee30b8f feat(mouse info panel): added selected unit coordinates displaying
The coordinates are only shown if one unit has been selected.
2024-11-11 18:56:29 +01:00
MarcoJayUsai
5cd566c7ca feat(map): added an option to show human controlled unit original callsign 2024-11-11 12:19:05 +01:00
Pax1601
119a6f620c Merge pull request #901 from Pax1601/main
Main
2024-07-23 18:34:26 +02:00
Pax1601
3e22247f76 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2024-07-23 18:31:49 +02:00
Pax1601
854bef15e0 Update OlympusCameraControl.lua 2024-07-23 18:31:48 +02:00
Pax1601
aacf6d99bc Merge pull request #900 from Pax1601/release-candidate
Added background arcigs layer
2024-07-23 09:57:59 +02:00
Davide Passoni
a8595a97d8 Added default background arcgis layer 2024-07-23 09:57:01 +02:00
Pax1601
c630fe3045 Update logger.cpp 2024-07-22 18:46:20 +02:00
Pax1601
05c7d8166b Merge pull request #899 from Pax1601/main
Main
2024-07-22 18:35:09 +02:00
Pax1601
1d3d8ca705 Update logger.cpp 2024-07-22 18:34:39 +02:00
Pax1601
97a11d6873 Merge pull request #898 from Pax1601/release-candidate
Fixed error logger clearing file at all logs
2024-07-22 18:04:18 +02:00
Pax1601
15e23564c2 Fixed error logger clearing file at all logs 2024-07-22 17:57:16 +02:00
Pax1601
42782c60a4 Merge pull request #897 from Pax1601/release-candidate
Manager error fix
2024-07-22 16:53:19 +02:00
Pax1601
62b2b13d75 Fixed error of manager downloading wrong version 2024-07-22 16:51:59 +02:00
Pax1601
8bf2048d4d Merge pull request #896 from Pax1601/main
Main
2024-07-22 15:48:19 +02:00
Pax1601
0fee5c8e7f Update version.json 2024-07-22 15:47:57 +02:00
Pax1601
b5e47fdbe6 Merge pull request #895 from Pax1601/release-candidate
Merge release candidate to main for v1.0.4 release
2024-07-22 15:47:29 +02:00
Pax1601
c85e923899 Removed documentation workflow 2024-07-22 15:36:12 +02:00
Pax1601
a897401975 Log is truncated and no longer appended, decrease camera link status check update 2024-07-22 15:31:55 +02:00
Pax1601
2f43a84224 Update version.json 2024-07-18 12:45:46 +02:00
Pax1601
274c16851e Minor update to export scripts and added Kiowa 2024-07-18 10:57:41 +02:00
Pax1601
e77356cb61 Added Afghanistan map 2024-07-18 10:02:17 +02:00
Pax1601
f4e77b1f5b Merge pull request #894 from Pax1601/release-candidate
v1.0.4
2024-07-17 16:58:13 +02:00
Pax1601
95247062a3 Merge branch 'release-candidate' of https://github.com/Pax1601/DCSOlympus into release-candidate 2024-07-17 16:49:26 +02:00
Pax1601
959b083a60 Added auto installation of VS Redists 2024-07-17 16:49:21 +02:00
Pax1601
395409ecae Update README.md 2024-07-17 15:51:11 +02:00
Pax1601
5a2b050104 Merge pull request #892 from Pax1601/bobprofisker-patch-1
Update README.md
2024-07-17 15:50:40 +02:00
Pax1601
732b837a46 Update README.md 2024-07-17 15:44:55 +02:00
Pax1601
d60d2e78ef Update README.md 2024-07-17 15:43:50 +02:00
Davide Passoni
a15d2e2ec7 Fixed incorrect removal of airbases on map when changing layer 2024-06-27 11:40:47 +02:00
bobprofisker
df1839cee0 Update README.md 2024-06-23 23:22:16 +01:00
Pax1601
1b4d3dd832 Added configuration parameters for vcpkg 2024-06-17 17:56:33 +02:00
Davide Passoni
0e414850bd All map layers and mirrors moved to config (THANKS WIRTS) 2024-06-13 16:26:12 +02:00
Pax1601
40e984982b Merge branch 'release-candidate' of https://github.com/Pax1601/DCSOlympus into release-candidate 2024-06-11 17:55:47 +02:00
Pax1601
d7c278b034 Minor bugfix in map creator scripts 2024-06-11 17:55:44 +02:00
Pax1601
4e679344d0 Merge pull request #891 from Pax1601/automatic-map-config
Added automatic read of config file to setup map layers
2024-06-06 12:08:55 +02:00
Davide Passoni
b0ab0ae8cf Added automatic read of config file to setup map layers 2024-06-06 12:08:34 +02:00
Pax1601
6edcd8a5ce Merge pull request #889 from Pax1601/db-updates
Db updates
2024-05-29 16:12:07 +02:00
Pax1601
aa0cca67a1 Added HB F-4 to databases 2024-05-29 16:05:57 +02:00
Pax1601
c477dcd065 Updated python scripts 2024-05-29 15:49:37 +02:00
Pax1601
6db4455d5a Tony's update to unit databases 2024-05-29 09:20:37 +02:00
Pax1601
54bf19d410 Merge pull request #888 from Pax1601/kola-map
Kola map
2024-05-29 09:01:08 +02:00
Pax1601
52833cadee Added configuraiton files for caucasus 2024-05-26 19:27:52 +02:00
Davide Passoni
6a45bc9e79 Added configuration files for syria and caucasus 2024-05-26 19:15:41 +02:00
Pax1601
88d17d1cb3 Merge branch 'release-candidate' of https://github.com/Pax1601/DCSOlympus into release-candidate 2024-05-23 20:21:12 +02:00
Pax1601
8c27fdb53c Improvements in map generator script 2024-05-23 20:21:09 +02:00
Davide Passoni
e7777a2a48 Added configuration files for different maps 2024-05-23 20:17:25 +02:00
bobprofisker
fa4a0ccecb add constant.ts kola map
add constant.ts kola map
2024-05-19 13:49:06 +01:00
bobprofisker
b54aa45377 kola.json add airbases list
added the kola.json airbase list of information for runways, ils, tacan etc
2024-05-19 13:42:31 +01:00
bobprofisker
eecdcad8e7 airbases.js add kola
addedd kola theatre
2024-05-19 13:39:09 +01:00
bobprofisker
d68ac6cf2b index.d.ts kola
added kola to index
2024-05-19 13:11:42 +01:00
Pax1601
e39b6b5eea Update .gitignore 2024-05-18 17:51:59 +02:00
Pax1601
4eb1b3ef6d Update README.md 2024-05-14 21:02:03 +02:00
Pax1601
4204a4b150 Merge pull request #887 from Pax1601/Pax1601-patch-1
Update README.md
2024-05-14 21:00:16 +02:00
Pax1601
b64d336922 Update README.md 2024-05-14 21:00:05 +02:00
Pax1601
19c1ae82a2 Configurable wait period added 2024-04-06 15:47:27 +02:00
Pax1601
61dc9c8b31 Added compression step to image generation 2024-03-23 13:18:00 +01:00
Pax1601
d078105eb7 Merge pull request #886 from Pax1601/740-ships-might-not-be-able-to-shoot-at-points-anymore-ie-tomahawk-stuff
Fixed bug that stopped ships from firing at area
2024-03-20 16:58:57 +01:00
Pax1601
7ee9946f49 Fixed bug that stopped ships from firing at area 2024-03-20 16:56:25 +01:00
Pax1601
5507bca68d Merge pull request #885 from Pax1601/857-file-import-fails-if-alt-value-present-in-targetposition-entry
857 file import fails if alt value present in targetposition entry
2024-03-20 16:43:13 +01:00
Pax1601
535b95242c Made separation larger for ships 2024-03-20 16:42:46 +01:00
Pax1601
e40b79d2c4 Added fix for navy units too 2024-03-20 16:34:50 +01:00
Pax1601
ecd0581942 When spawning multiple ground units they are now arranged in square, and no longer one on top of the other 2024-03-20 16:33:51 +01:00
Pax1601
4f7c3988a0 Merge pull request #884 from Pax1601/857-file-import-fails-if-alt-value-present-in-targetposition-entry
Made target position optionally vec2 or vec3
2024-03-20 16:04:08 +01:00
Pax1601
5b7e63b02d Made target position optionally vec2 or vec3 2024-03-20 16:03:39 +01:00
Pax1601
ef99c21380 Merge pull request #883 from Pax1601/862-iads-creator-not-spawning-units
Added missing default values for skill of ground units in IADS generator
2024-03-18 08:34:23 +01:00
Pax1601
e0ad679b57 Added missing default values for skill of ground units in IADS generator 2024-03-18 08:33:57 +01:00
Pax1601
61fb80d67f Merge pull request #882 from Pax1601/856-camera-control-produces-jerky-movement-on-browsers-different-from-chrome
Fixed camera control on Firefox, added slider to control zoom level, …
2024-03-17 15:58:24 +01:00
Pax1601
a9a0332465 Fixed camera control on Firefox, added slider to control zoom level, and other improvements 2024-03-17 15:58:05 +01:00
Pax1601
4494a5ccbb Merge pull request #879 from Pax1601/https-test
Added ability to enable https in express
2024-03-13 15:06:05 +01:00
Davide Passoni
f0c4b10084 Added ability to enable https in express 2024-03-13 15:05:30 +01:00
Pax1601
0bdf362174 Improved and generalized DCS maps handling 2024-03-13 15:01:35 +01:00
Pax1601
a53cca8dda Merge pull request #877 from Pax1601/manager-improvements
Multiple manager improvements and bug fixes
2024-03-11 17:26:01 +01:00
Davide Passoni
9aad81588a Minor manager bugfixes 2024-03-11 17:25:35 +01:00
Davide Passoni
5ba1498802 Map generation improvements 2024-03-11 16:57:50 +01:00
Davide Passoni
539b183da8 Merge branch 'release-candidate' of https://github.com/Pax1601/DCSOlympus into release-candidate 2024-03-11 15:37:21 +01:00
Pax1601
396c061a3e Multiple manager improvements and bug fixes 2024-03-10 18:38:55 +01:00
Pax1601
8c7f6abb1c Added more configurability to map generator 2024-03-10 13:43:09 +01:00
Pax1601
5cc42dd9cf Embedded DCS maps directly into website 2024-03-10 10:13:25 +01:00
Pax1601
f52b5f419e Merge pull request #861 from Pax1601/855-map-generator-fails-when-a-single-put-request-is-dropped
855 map generator fails when a single put request is dropped
2024-03-08 16:28:08 +01:00
Pax1601
3b38ca5920 Merge pull request #860 from Pax1601/853-proxy-middleware-reroutes-to-address-if-backend-api-is-enabled
If address is *, proxy middleware reroutes to localhost
2024-03-08 16:27:42 +01:00
Pax1601
86cfb4fb2f Merge pull request #859 from Pax1601/858-export-to-file-files-nothing-happens-when-the-button-is-clicked
Fixed checkbox not working in export screen
2024-03-08 16:26:55 +01:00
Davide Passoni
166631d618 Increased pixel sweep when calibrating 2024-03-08 16:23:59 +01:00
Davide Passoni
013546a45b Fixed checkbox not working in export screen 2024-03-08 16:22:30 +01:00
Davide Passoni
a2c8563adf Added argpars for better control of script execution 2024-03-08 16:04:55 +01:00
Davide Passoni
0c8de2dcf3 Added retry algorithm for put request and timestamps 2024-03-08 09:24:52 +01:00
Davide Passoni
4f3491062b If address is *, proxy middleware reroutes to localhost 2024-03-07 17:36:50 +01:00
Pax1601
cc8c25a283 Merge pull request #852 from Pax1601/advanced-map-layers
Advanced map layers
2024-03-07 17:21:46 +01:00
Davide Passoni
70740233a9 Create map_generation.md 2024-03-07 13:14:50 +01:00
Pax1601
f2d4f0b0ca Fixed layer resolution 2024-03-06 16:42:58 +01:00
Davide Passoni
153ca01b96 Merge branch 'release-candidate' of https://github.com/Pax1601/DCSOlympus into release-candidate 2024-03-05 15:16:18 +01:00
Pax1601
f667410a56 Merge branch 'release-candidate' of https://github.com/Pax1601/DCSOlympus into release-candidate 2024-03-05 00:28:03 +01:00
Pax1601
f13545eae9 Edited installation message, fixed dev environment for server 2024-03-05 00:27:35 +01:00
Davide Passoni
7ee24b1c7c More work on docs 2024-03-04 18:08:06 +01:00
Davide Passoni
29784310fc Started updating docs 2024-03-04 17:38:34 +01:00
Davide Passoni
3427fcea7e Removed unnecessary dependency 2024-03-04 11:09:10 +01:00
Pax1601
c99b5ed19f Added calibration to map generator 2024-03-04 08:41:24 +01:00
Davide Passoni
2118ded496 More general handling of zoom levels 2024-02-29 17:22:29 +01:00
Davide Passoni
4401261446 Merge branch 'release-candidate' into advanced-map-layers 2024-02-29 17:11:04 +01:00
Davide Passoni
a6ec3a8cd0 Fixed error in updater code 2024-02-29 16:06:03 +01:00
Davide Passoni
6e6da64c51 Added ability to define map layers 2024-02-29 16:05:21 +01:00
Pax1601
a84e190548 Merge pull request #851 from Pax1601/camera-control
Implemented camera control from Olympus to DCS
2024-02-29 12:22:45 +01:00
Davide Passoni
e0238c2680 Removed DCS map from default json 2024-02-29 12:12:34 +01:00
Davide Passoni
a60f2e7b62 Modified website to keep camera link if dropped 2024-02-29 12:11:11 +01:00
Davide Passoni
4782596e3c Added installation/deletion of camera control plugin from manager 2024-02-29 10:54:52 +01:00
Pax1601
832568aa00 Completed camera control server in lua and more work on merging algorithm 2024-02-28 18:58:40 +01:00
Davide Passoni
05e0cc393a Complete camera control UI 2024-02-27 16:46:11 +01:00
Pax1601
c74258e3ad Completed automatic algorithm 2024-02-26 08:55:03 +01:00
Davide Passoni
2e1c3ec4b9 Added ability to add more map sources 2024-02-23 16:25:19 +01:00
Davide Passoni
9a571132c8 Refined automatic map generation script 2024-02-23 15:54:49 +01:00
Davide Passoni
acb55044d1 More work on automatic map creation 2024-02-22 17:46:34 +01:00
Pax1601
14679bd7d8 Added code for map creation and camera control 2024-02-22 08:01:13 +01:00
Pax1601
3c9af59051 Merge pull request #849 from Pax1601/848-add-zip-only-release-folder
Added script to produce zip only version
2024-02-20 11:41:20 +01:00
Davide Passoni
8390a25c50 Fixed error in elevation routes
Was hardcoded to load relative config file
2024-02-20 11:38:02 +01:00
Davide Passoni
97b277edda Added script to produce zip only version 2024-02-20 11:23:48 +01:00
Pax1601
462fa53c80 Merge pull request #847 from Pax1601/745-script-error-on-getpayload
Update mist.lua
2024-02-20 10:26:25 +01:00
Davide Passoni
945c45803b Update mist.lua 2024-02-20 10:25:49 +01:00
Pax1601
20917da437 Merge pull request #844 from Pax1601/713-number-of-selected-units
Number of selected units now shown
2024-02-20 09:36:21 +01:00
Davide Passoni
cd25509d3d Merge branch 'release-candidate' into 713-number-of-selected-units 2024-02-20 09:35:32 +01:00
Pax1601
4c3f80d7d7 Merge pull request #837 from Pax1601/673-status-bar-hit-box
Rapid controls' box now overflows un-obstructively
2024-02-20 09:35:02 +01:00
Davide Passoni
fac32476d4 Merge branch 'release-candidate' into 673-status-bar-hit-box 2024-02-20 09:33:35 +01:00
Davide Passoni
3fa88f3cdf Update .gitignore 2024-02-20 09:31:07 +01:00
Pax1601
46135f7ae0 Merge pull request #846 from Pax1601/separate-client
Separate client
2024-02-19 19:29:31 +01:00
Pax1601
f6e9503045 Removed test script 2024-02-19 18:54:25 +01:00
Davide Passoni
39c28ffb04 Added problem matchers 2024-02-19 16:45:55 +01:00
Davide Passoni
6373fd300d Fixed output for build debug 2024-02-19 15:52:20 +01:00
Davide Passoni
04f281db56 Fixed babel preset-env 2024-02-19 15:48:26 +01:00
Davide Passoni
5f2fb60e1f Added build debug step in check_setup 2024-02-19 15:41:40 +01:00
Davide Passoni
4efd48c4b9 Added check on correct setup of the environment 2024-02-19 15:34:39 +01:00
PeekabooSteam
fb6ac40af8 Number of selected units now shown 2024-02-11 15:55:13 +00:00
PeekabooSteam
9daa683b42 Rapid controls' box now overflows unobsctrutively 2024-02-11 12:58:32 +00:00
Pax1601
baffc9af49 Merge pull request #826 from Pax1601/813-fix-last-details-of-the-manager
Fixed broken guide links
2024-02-10 10:29:15 +01:00
Pax1601
bc6c70928f Updated plugin scripts to new structure
Fixed copy scripts for plugins
2024-02-08 22:55:44 +01:00
Pax1601
9e1503c106 Renamed server->backend in configuration files 2024-02-08 22:29:26 +01:00
Pax1601
57a700d2d2 Renamed client -> frontend in configuration files
Completed renaming client -> frontend
2024-02-08 22:26:36 +01:00
Pax1601
5ca6c97cbe Split client into frontend website and server 2024-02-08 22:04:23 +01:00
Pax1601
55f3bd5adb Merge pull request #823 from WoodyXP/Fix-Semicolumn-Skill
Fix semicolumn skill
2024-02-08 08:45:11 +01:00
Stefan Arsic
bf7c4beccd Update OlympusCommand.lua 2024-02-08 00:19:47 +01:00
Stefan Arsic
14d44babe7 Added missing semicolumn 2024-02-08 00:16:09 +01:00
Stefan Arsic
30a90a96d8 Merge branch 'Fix-Semicolumn-Skill' of https://github.com/WoodyXP/DCSOlympus into Fix-Semicolumn-Skill 2024-02-08 00:15:11 +01:00
Stefan Arsic
c621b5dd85 Added missing semicolumn1 2024-02-08 00:13:42 +01:00
Pax1601
63bdf44e17 Merge pull request #821 from WoodyXP/681_newest_changes_skill
681 newest changes skill
2024-02-07 18:12:11 +01:00
Pax1601
029decf969 Merge pull request #819 from Pax1601/PeekabooSteam-patch-1
Update index.ejs
2024-02-07 08:56:50 +01:00
WoodyXP
b5c7eaf36e Change the name of default livery 2024-02-06 13:36:22 +01:00
WoodyXP
99de17a858 Merge branch '681_newest_changes_skill' of https://github.com/WoodyXP/DCSOlympus into 681_newest_changes_skill 2024-02-06 11:11:40 +01:00
WoodyXP
5765ade7f8 Change the location of the skill select 2024-02-06 11:11:16 +01:00
Stefan Arsic
59a8fba14d Made unit.skill instead of just skill 2024-02-06 09:43:24 +01:00
WoodyXP
965b67b8ab Sort SkillDropdown by Skill level 2024-02-06 09:27:55 +01:00
Stefan Arsic
0ef3abbffa Merge branch 'Pax1601:release-candidate' into 681_newest_changes_skill 2024-02-03 22:42:28 +01:00
Stefan Arsic
2124e9cd42 Fixed setting skill level 2024-02-03 22:29:26 +01:00
PeekabooSteam
2f1a0ad7d3 Update index.ejs 2024-01-31 15:50:47 +00:00
Pax1601
24e6c219f5 Fixed broken guide links 2024-01-31 16:41:28 +01:00
Pax1601
daec6dab5b Merge pull request #818 from Pax1601/813-fix-last-details-of-the-manager
Fixed missing sleep in popup callback
2024-01-31 15:42:38 +01:00
Pax1601
3708d4150c Fixed missing sleep in popup callback 2024-01-31 15:40:31 +01:00
Pax1601
11518485de Merge pull request #817 from Pax1601/813-fix-last-details-of-the-manager
Fixed error in port detection and default radio buttons values
2024-01-31 14:51:59 +01:00
Pax1601
29118e1ea1 Fixed error in port detection and default radio buttons values 2024-01-31 14:51:42 +01:00
Pax1601
aa5b62c1d2 Merge pull request #816 from Pax1601/813-fix-last-details-of-the-manager
Finished manager bugfix
2024-01-31 13:00:40 +01:00
Pax1601
f320cb122c Finished manager bugfix 2024-01-31 12:59:46 +01:00
Pax1601
bb7738724f Merge pull request #815 from Pax1601/813-fix-last-details-of-the-manager
813 fix last details of the manager
2024-01-30 18:56:59 +01:00
Pax1601
df7eebed39 Added temporary message if no instances detected 2024-01-30 18:56:37 +01:00
Pax1601
21040da195 Added expert settings mode 2024-01-30 17:45:25 +01:00
Pax1601
be625fdca9 Removed autoselection of radio buttons in wizard 2024-01-29 17:52:33 +01:00
Pax1601
7ee3fb883b Added success/failure banner and fixed instance status 2024-01-29 13:24:09 +01:00
Pax1601
c2f6edfd74 Minor refactoring of css, fixed graphical inconsistencies 2024-01-28 16:37:29 +01:00
Pax1601
4f5023b45c Added fade transition between pages 2024-01-28 15:14:30 +01:00
Pax1601
f0ab43d320 Merge pull request #812 from Pax1601/manager-wizard
Bugfixing on manager
2024-01-28 10:22:19 +01:00
Pax1601
d2e803ab82 Bugfixing on manager 2024-01-28 10:21:12 +01:00
Pax1601
ca45b8b906 Merge pull request #808 from Pax1601/807-stop-search-engines-indexing-servers
Added noindex
2024-01-26 17:35:30 +01:00
Pax1601
ec020f7b5d Merge pull request #811 from Pax1601/manager-wizard
Manager wizard
2024-01-26 17:34:51 +01:00
Pax1601
f2161da162 Completed basic functionality development 2024-01-26 17:31:36 +01:00
Pax1601
613aed2d2b Added config page and loading bars 2024-01-25 17:42:16 +01:00
Pax1601
1d38bd6fea Added folder selection page and port availability checks 2024-01-24 19:08:42 +01:00
Pax1601
6f7b251094 Readded dashboard to manager 2024-01-23 08:01:34 +01:00
PeekabooSteam
a9d873a05f Added noindex 2024-01-18 06:30:56 +00:00
Pax1601
05f98b2738 Work on result page 2024-01-17 20:14:22 +01:00
Pax1601
1568c65492 Implement more wizard page, result page still wip 2024-01-17 17:51:27 +01:00
Pax1601
4a5c4ed7d7 Merge branch 'manager-wizard' of https://github.com/Pax1601/DCSOlympus into manager-wizard 2024-01-17 08:08:33 +01:00
Pax1601
ff7385cf49 Update tasks.json 2024-01-17 08:08:29 +01:00
Pax1601
a0de159234 More work on new manager design 2024-01-16 17:45:52 +01:00
Pax1601
d56a95cfa3 Added distinction between basic and advanced mode 2024-01-13 10:01:30 +01:00
Stefan Arsic
497f718e4b Added option for ground units to change skill 2024-01-12 22:33:43 +01:00
Stefan Arsic
9942ff476b Made the skill work 2024-01-11 19:41:04 +01:00
WoodyXP
c042d2b6f5 Changes 2024-01-11 17:37:28 +01:00
WoodyXP
b9201d583c Added tiny fixed 2024-01-11 14:16:19 +01:00
Pax1601
3f67125f20 Fixed missed call to copy.bat 2024-01-11 09:55:48 +01:00
WoodyXP
4f72f10642 Commiting uncommited files 2024-01-11 09:28:39 +01:00
WoodyXP
89fb0a9da1 Hopefully added something that can make the flight skill change 2024-01-11 09:10:35 +01:00
Pax1601
0e9b249bba Merge pull request #804 from Pax1601/manager-wizard
Manager wizard
2024-01-10 11:30:20 +01:00
Pax1601
0f0ba4c725 Added spinner when starting Olympus 2024-01-10 11:29:18 +01:00
Pax1601
5542109daf Merged view and update pages according to new design 2024-01-09 17:33:20 +01:00
Pax1601
ec91b597c8 Update dcsinstance.js 2024-01-04 17:11:46 +01:00
Pax1601
d0f85ae977 Merge pull request #803 from Pax1601/manager-wizard
Made instructions clearer and removed folder deletion on update
2024-01-04 16:04:22 +01:00
Pax1601
7d6930fba9 Made instructions clearer and removed folder deletion on update 2024-01-04 16:03:38 +01:00
Pax1601
2232a114b7 Merge pull request #802 from Pax1601/manager-wizard
Version is now checked on manager startup
2024-01-04 14:53:39 +01:00
Pax1601
33ce537993 Version is now checked on manager startup 2024-01-04 14:53:03 +01:00
Pax1601
1ab8e9a16f Merge pull request #801 from Pax1601/manager-wizard
Manager wizard
2024-01-04 13:04:10 +01:00
Pax1601
73b1714191 Merge branch 'release-candidate' into manager-wizard 2024-01-04 13:03:44 +01:00
Pax1601
cb793e9d0f Fixed debug scripts for client 2024-01-04 13:02:03 +01:00
Pax1601
7686a60bfd Added log file 2024-01-04 12:10:01 +01:00
Pax1601
38027b6ff3 Added debug options in package folder for manager 2024-01-04 11:05:47 +01:00
Pax1601
a512b0e405 Update package.json 2024-01-04 10:26:34 +01:00
Pax1601
46fb6a98d5 Increased version in dlls rc files 2024-01-04 10:14:46 +01:00
Pax1601
1a8a19ae5c Added ability to retain user-editable files 2024-01-04 10:13:34 +01:00
Pax1601
8865ded4bd Split increase_version file to work with build folder 2024-01-04 09:51:43 +01:00
Pax1601
7adfe9cce4 Update INSTRUCTIONS.txt 2024-01-04 09:40:23 +01:00
Pax1601
85e5a6a309 Fixed wrong url for databases api call 2024-01-03 18:50:16 +01:00
Pax1601
d681d3cee0 Fixed error in database api 2024-01-03 18:44:06 +01:00
Pax1601
c5650ba29a Moved location of databases 2024-01-03 18:20:51 +01:00
Pax1601
ef0a2d2ddc Modified increase_version.js to operate on build folder 2024-01-03 18:08:16 +01:00
Pax1601
f143e8d874 Update build_package.bat 2024-01-03 18:06:01 +01:00
Pax1601
89c1660988 Fixed errors in build scripts 2024-01-03 18:05:16 +01:00
Pax1601
4e7c8ef856 Refactoring of building scripts 2024-01-03 17:48:38 +01:00
Pax1601
8024db9579 Renamed src to backend 2024-01-03 16:19:16 +01:00
Pax1601
a0634a7f99 Documented manager code 2024-01-03 15:08:06 +01:00
Pax1601
7bf6c1bb23 Update preload.js 2024-01-03 13:33:58 +01:00
Pax1601
a62ae4e21e Added check on github api for latest release 2024-01-03 13:25:27 +01:00
Pax1601
6c466a8bb8 Implemented automatic updating 2024-01-03 13:12:04 +01:00
Pax1601
36f828acb1 Merge pull request #797 from Pax1601/manager-wizard
Added package url to version.json for autoupdate
2024-01-03 10:07:46 +01:00
Pax1601
046e096b9e Added package url to version.json for autoupdate 2024-01-03 09:44:12 +01:00
Pax1601
82df3cb316 Delete duplicate build CI step 2024-01-03 09:27:24 +01:00
Pax1601
1ba16f82e7 Merge pull request #796 from Pax1601/main
Main
2024-01-03 09:23:02 +01:00
Pax1601
72c6bb0086 Merge pull request #776 from Pax1601/739-spawn-history
739 spawn history
2024-01-03 09:19:42 +01:00
Pax1601
8bb4334187 Delete package-lock.json 2024-01-03 09:19:27 +01:00
Pax1601
59a9069d4b Merge pull request #734 from Dahlgren/feature/docker
Basic Docker image for client app
2024-01-03 09:18:28 +01:00
Pax1601
ba534f1786 Merge pull request #737 from Dahlgren/ci/github-actions-client
CI workflow for client build on PRs
2024-01-03 09:17:45 +01:00
Pax1601
72bb54bde0 Merge pull request #785 from Pax1601/722-unit-eras-in-alphabetical-order-instead-of-chronological-order
Set ordering of eras in command mode settings
2024-01-03 09:14:15 +01:00
Pax1601
cb3f46303c Merge pull request #788 from Pax1601/779-add-json-validation
779 add json validation
2024-01-03 09:13:38 +01:00
Pax1601
57f021f995 Merge pull request #790 from Pax1601/786-disable-command-mode-settings-until-enabled
Disabled options and applied faded styling
2024-01-03 09:11:10 +01:00
Pax1601
bf4b2272e4 Merge pull request #789 from SevFle/725-configurator-different-passwords
725 Add check for duplicate passwords in configurator
2024-01-01 22:05:03 +01:00
Pax1601
31999ec00c Merge pull request #793 from Pax1601/manager-wizard
Manager wizard
2024-01-01 22:03:07 +01:00
Pax1601
086b6736b0 Added desktop shortcuts 2024-01-01 18:48:31 +01:00
Pax1601
bf93b8e90a Added simplified mode and disabled not useful buttons 2024-01-01 18:19:56 +01:00
PeekabooSteam
4d6bd6c6e9 Disabled options and applied faded styling 2023-12-31 14:04:54 +00:00
Pax1601
c9dc5eb2f5 Added ability to start/stop client 2023-12-31 12:02:24 +01:00
SevFle
5fdb704d68 Add check for duplicate passwords 2023-12-30 10:43:51 +01:00
Pax1601
6d18e25232 Merge pull request #787 from Pax1601/manager-wizard
Modified manager to new design
2023-12-29 11:29:30 +01:00
Pax1601
7391006a2f Modified manager to new design 2023-12-29 11:28:28 +01:00
PeekabooSteam
9207585f5b Set ordering of eras in command mode settings 2023-12-28 17:45:21 +00:00
PeekabooSteam
cb53da3a71 More style tweakage 2023-12-28 16:56:29 +00:00
PeekabooSteam
d2ac5aeff8 Tweaked tab position to be a pinch lower 2023-12-28 16:27:28 +00:00
PeekabooSteam
b646087026 Buttons now have cute icons ^_^ 2023-12-28 16:07:04 +00:00
PeekabooSteam
82e60cd2cf Added more info for when enums aren't matched 2023-12-28 14:10:51 +00:00
Björn Dahlgren
9d46a1c73f Basic Docker image for client app 2023-12-27 23:49:54 +01:00
PeekabooSteam
955057183d Added JSON validation for imports. 2023-12-27 16:26:31 +00:00
Pax1601
0396d6bf9c Update README.md 2023-12-23 16:01:12 +01:00
Pax1601
ee1d89007c Update README.md 2023-12-23 15:59:26 +01:00
Pax1601
4245927a6c Update build_package.yml 2023-12-23 08:27:02 +01:00
Pax1601
f585828936 Merge pull request #782 from Pax1601/manager-wizard
Manager wizard
2023-12-22 21:28:47 +01:00
Pax1601
7450c9e506 Update install.bat 2023-12-22 21:28:26 +01:00
Pax1601
d957cd6655 Merge branch 'manager-wizard' of https://github.com/Pax1601/DCSOlympus into manager-wizard 2023-12-22 21:26:17 +01:00
Pax1601
ef91f840ae Update package.json 2023-12-22 21:26:12 +01:00
Pax1601
17c74fbe91 Merge pull request #781 from Pax1601/manager-wizard
Manager wizard
2023-12-22 19:23:35 +01:00
Pax1601
17a7a1889e Merge branch 'release-candidate' into manager-wizard 2023-12-22 19:23:25 +01:00
Pax1601
24ed96b348 Manager installation process completed 2023-12-22 19:22:49 +01:00
Pax1601
15e8c9e791 Completed installation procedure on wizard 2023-12-22 18:44:31 +01:00
PeekabooSteam
de14f6c738 Airbase data being validated 2023-12-22 15:11:59 +00:00
Pax1601
92b1a46e8a Started wizard implementation 2023-12-21 18:06:59 +01:00
Pax1601
cbaadb6fc9 Added fallback if powershell not installed 2023-12-21 15:33:28 +01:00
Pax1601
44295673dc Fixed typo and uninstallation error 2023-12-21 15:13:20 +01:00
Pax1601
8bf0f403e2 Updated instructions 2023-12-21 12:00:40 +01:00
Pax1601
917a0d10e5 Update package.bat 2023-12-21 11:44:58 +01:00
Pax1601
9c65411733 Updated installation method, remove installer 2023-12-21 11:44:11 +01:00
PeekabooSteam
6c315d89e1 Finished styling; menu closes on click 2023-12-20 17:08:04 +00:00
Pax1601
b5f1a459c2 Update preload.js 2023-12-20 18:05:14 +01:00
Pax1601
6b12000979 Removed wrong await 2023-12-20 18:02:05 +01:00
Pax1601
1aec7f8081 Updated copy step during compilation 2023-12-20 17:39:25 +01:00
Pax1601
5f0e96e2e6 Update version.json 2023-12-20 17:25:25 +01:00
Pax1601
678a8585a9 Update build_package.yml 2023-12-20 17:24:32 +01:00
Pax1601
e632e379b6 Merge pull request #773 from Pax1601/Pax1601-patch-1
Update documentation.yml
2023-12-20 17:03:24 +01:00
Pax1601
1a7d2b5028 Update documentation.yml 2023-12-20 17:03:16 +01:00
Pax1601
ce28d49510 Merge pull request #763 from Pax1601/747-improve-configurator-for-automatic-saved-games-folder-detection
747 improve configurator for automatic saved games folder detection
2023-12-20 16:58:32 +01:00
Pax1601
0ac632cc9b Merge branch 'main' into 747-improve-configurator-for-automatic-saved-games-folder-detection 2023-12-20 16:58:24 +01:00
Pax1601
47e4757b6e Update defines.h 2023-12-20 16:57:14 +01:00
Pax1601
d21ee2a7b6 Update olympus.vcxproj 2023-12-20 16:56:43 +01:00
Pax1601
0cec61afea Update luatools.vcxproj 2023-12-20 16:56:23 +01:00
Pax1601
ff04364178 Update logger.vcxproj 2023-12-20 16:55:20 +01:00
Pax1601
0cf2733d55 Update dcstools.vcxproj 2023-12-20 16:54:32 +01:00
Pax1601
f5319ed654 Update core.vcxproj 2023-12-20 16:52:41 +01:00
Pax1601
cfef9f4bc4 Minor refactoring 2023-12-20 16:42:30 +01:00
Pax1601
6abf7f059a Merge pull request #738 from Dahlgren/ci/build-documentation-main
Only build documentation for main branch push
2023-12-20 16:32:04 +01:00
Pax1601
c0c1ff6e17 Merge pull request #752 from Pax1601/726-flight-level-is-three-digits-should-include-leading-zeros
FL now has three digits
2023-12-20 16:31:29 +01:00
Pax1601
856dba83a5 Merge pull request #753 from Pax1601/Shredmetal-patch-1
Shredmetal patch 1
2023-12-20 16:31:06 +01:00
Pax1601
2f37916595 Merge pull request #735 from LethalsLoaded/adapt-nomenclature
Fix login screen nomenclature
2023-12-20 16:30:44 +01:00
Pax1601
f36a29570b Merge pull request #731 from Dahlgren/bugfix/case-sensitive-fs-paths
Fix wrong file paths for databases on case sensitive fs
2023-12-20 16:30:14 +01:00
Pax1601
62a3719163 Update package.json 2023-12-20 16:26:15 +01:00
Pax1601
e9511e9233 Update increase_version.js 2023-12-20 16:19:01 +01:00
Pax1601
51cf15b8cc Update notes.txt 2023-12-20 15:35:40 +01:00
Pax1601
278d0bdd3c Updated manager to allow updating 2023-12-20 15:34:55 +01:00
Pax1601
0a07f85fcf Added release notes file 2023-12-20 14:15:40 +01:00
Pax1601
7face05e12 Update logger.cpp 2023-12-20 14:08:49 +01:00
Pax1601
22ad5d5972 Small updates and moved log location to Log folder
Fixed logger error
2023-12-20 14:07:59 +01:00
Pax1601
2e194d557a Updated installations process 2023-12-20 12:41:05 +01:00
Pax1601
1a76df2056 Update increase_version.js 2023-12-20 12:35:01 +01:00
Pax1601
787bf13f3c Completed manager and moved client to common folder 2023-12-20 12:33:46 +01:00
Shredmetal
10f1c6a862 Added realistic Hornet Cap loadouts, formatted lua
Added: 2*AIM-9X, 2*AIM-120, 1*XT; 2*AIM-9X, 6*AIM-120, 2*XT.

Added indentations to lua file for readability
2023-12-20 15:36:52 +08:00
Shredmetal
0366cc38e2 Added realistic AA hornet loadouts to db
Added: 2*AIM-9X, 2*AIM-120, 1*XT; 2*AIM-9X, 6*AIM-120, 2*XT.
2023-12-20 15:35:32 +08:00
Pax1601
603018d1ef Added argument to vbs script 2023-12-19 18:39:35 +01:00
Pax1601
66ae06056b Created client app with electronc 2023-12-19 18:20:07 +01:00
Pax1601
17486ab40c Update increase_version.js
Update increase_version.js

Replaced back version
2023-12-19 14:49:32 +01:00
Pax1601
6cae91b06f Installer modified to not required DCS folder 2023-12-19 14:27:11 +01:00
Pax1601
9c055e0d71 Added olympus manager 2023-12-19 13:21:19 +01:00
Shredmetal
db4aeca47d Update mod_ac_loadout_puller.py
removed extraneous comment
2023-12-19 18:48:13 +08:00
Shredmetal
c29a368e5a Update mod_ac_loadout_puller.py 2023-12-19 18:44:01 +08:00
PeekabooSteam
dbe2442bb7 Added data, set list size limit 2023-12-18 20:52:15 +00:00
Shredmetal
2108fc4b26 mod aircraft loadout puller
python script to pull out loadouts from all installed mod aircraft into a lua file understandable by Olympus
2023-12-18 22:54:59 +08:00
PeekabooSteam
48f962ca4b Spawn history is functional 2023-12-18 12:57:44 +00:00
Pax1601
e80a5e8ca1 Added proxy middleware and demo backend app 2023-12-18 12:44:56 +01:00
PeekabooSteam
fb2ecc75eb FL now has three digits 2023-12-17 19:42:30 +00:00
Björn Dahlgren
ee95291418 Only build documentation for main branch push 2023-12-17 19:49:25 +01:00
Björn Dahlgren
46796fce13 CI workflow for client build on PRs 2023-12-17 19:46:32 +01:00
Andrzej Odwald
ee08f57abe - Fix nomenclature 2023-12-17 17:27:16 +00:00
Björn Dahlgren
eb86d8dfca Fix wrong file paths for databases on case sensitive fs 2023-12-17 17:28:57 +01:00
Pax1601
c75e20e58f Update README.md 2023-12-17 08:58:05 +01:00
Pax1601
2c403a9283 Fixed versioning tag 2023-12-14 17:39:42 +01:00
Pax1601
27c78d6a67 Update increase_version.js
Update increase_version.js

Update increase_version.js
2023-12-14 11:24:40 +01:00
Pax1601
e0d33760e0 Update increase_version.js 2023-12-14 11:11:16 +01:00
Pax1601
2d339d7161 Added version tag
Update increase_version.js

Update increase_version.js

Update increase_version.js

Create increase_version.js

Updated workflows

Update .gitignore

Update build.bat

Change hash string

Update increase_version.js

Added commit hash

v1.0.3
2023-12-14 11:04:22 +01:00
Pax1601
243f58ecf3 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-13 22:07:09 +01:00
Pax1601
378dbfc085 Fixed excessively high CPU load 2023-12-13 22:06:51 +01:00
Pax1601
cee6839b5d Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-13 17:47:24 +01:00
Pax1601
f1a836c222 Update olympus.iss 2023-12-13 17:47:13 +01:00
Pax1601
cbf4b56ecb Update msbuild.yml 2023-12-13 17:39:18 +01:00
Pax1601
e2e3da6a0f Update msbuild.yml 2023-12-13 17:37:11 +01:00
Pax1601
3a96808aa5 Update msbuild.yml 2023-12-13 17:36:05 +01:00
Pax1601
d1ccccae18 Update package.bat 2023-12-13 17:35:55 +01:00
Pax1601
d31242124f Update msbuild.yml 2023-12-13 17:14:37 +01:00
Pax1601
8c4996f466 Update msbuild.yml 2023-12-13 17:02:09 +01:00
Pax1601
59b89dc638 Update msbuild.yml 2023-12-13 16:54:56 +01:00
Pax1601
f54ac5c3d8 Update msbuild.yml 2023-12-13 16:53:02 +01:00
Pax1601
666b3e0383 Update msbuild.yml 2023-12-13 16:47:32 +01:00
Pax1601
d8893e21a1 Update msbuild.yml 2023-12-13 16:45:43 +01:00
Pax1601
5391b567b9 Updated workflows 2023-12-13 16:37:37 +01:00
Pax1601
ad7ea014f2 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-13 16:36:04 +01:00
Pax1601
ceb00a239f Added vcpkg manifest 2023-12-13 16:35:42 +01:00
Pax1601
81ab1aa05d Update msbuild.yml 2023-12-13 16:13:19 +01:00
Pax1601
7bf232f146 Update msbuild.yml 2023-12-13 16:10:21 +01:00
Pax1601
3f07271931 Update msbuild.yml 2023-12-13 16:07:54 +01:00
Pax1601
1c30bb006b Merge pull request #711 from Pax1601/CI-tests
Create msbuild.yml
2023-12-13 16:04:45 +01:00
Pax1601
34594ac836 Create msbuild.yml 2023-12-13 16:02:53 +01:00
Pax1601
cee58800e1 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-13 15:18:32 +01:00
Pax1601
ab3b487024 Added doxygen info 2023-12-13 15:18:23 +01:00
Pax1601
91b393eb35 Update ci.yml 2023-12-13 15:00:21 +01:00
Pax1601
edb4ddc287 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-13 15:00:11 +01:00
Pax1601
f9fd5caa9f Updated Doxygen config 2023-12-13 14:59:48 +01:00
Pax1601
d5653a9b1d Added doxygen config file 2023-12-13 14:51:31 +01:00
Pax1601
ec5ff1bf0c Merge pull request #710 from Pax1601/change-LEGAL-extension
Rename LEGAL to LEGAL.txt
2023-12-13 14:47:21 +01:00
Shredmetal
41912d1057 Rename LEGAL to LEGAL.txt 2023-12-13 02:45:30 +08:00
Pax1601
228452fd17 More installer upgrades 2023-12-12 17:34:43 +01:00
Pax1601
484d3dd28f Removed node bundling 2023-12-12 15:02:39 +01:00
Pax1601
a52e7e7b1a Added resource files 2023-12-12 11:39:28 +01:00
Pax1601
92a08f6278 Updated installer 2023-12-12 11:35:15 +01:00
Pax1601
8e3da65433 Added missing bat 2023-12-12 11:04:02 +01:00
Pax1601
3f625c03b9 Compilation scripts updated 2023-12-12 10:45:44 +01:00
Pax1601
4423d5f3d5 v1.0.2 2023-12-12 10:34:25 +01:00
Pax1601
d0fc286c43 v1.0.1 2023-12-11 20:28:38 +01:00
Pax1601
b5443ab0a8 Removed python configurator 2023-12-11 19:48:19 +01:00
Pax1601
e6c34306c9 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-11 19:45:03 +01:00
Pax1601
532a83fe91 Added c++ configurator 2023-12-11 19:44:58 +01:00
Pax1601
293b928764 Update README.md 2023-12-11 10:23:35 +01:00
Pax1601
38d62df75d Update README.md 2023-12-11 10:22:53 +01:00
Pax1601
fbd42ade6e Added window icon 2023-12-10 20:56:19 +01:00
Pax1601
9af1cffe08 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-10 20:36:33 +01:00
Pax1601
b0d92906e5 Fixed incorrect target management for mop and sff 2023-12-10 20:36:28 +01:00
Pax1601
0329e27713 Added ability to force coalition unit in IADS spawner 2023-12-10 20:33:13 +01:00
Pax1601
2d39862b1b Merge pull request #702 from Pax1601/691-pg-missing-airbase-data
691 pg missing airbase data
2023-12-10 20:26:06 +01:00
PeekabooSteam
5c1782ec7f Airbase tweaks, added thechannel.json 2023-12-10 17:53:23 +00:00
Pax1601
6c6117aee3 Fixed minor UI problems 2023-12-10 18:36:25 +01:00
Pax1601
1798e62315 v1.0.0 2023-12-10 18:36:03 +01:00
Pax1601
2b2ed76aa3 Updated databases 2023-12-10 18:35:23 +01:00
PeekabooSteam
38d72a5cd0 Allowed new theatres in API 2023-12-10 17:25:52 +00:00
PeekabooSteam
14ec4a8610 Added Normandy. 2023-12-10 17:23:39 +00:00
PeekabooSteam
bdc7a5bb46 Added Falklands map and Sinaimap map. 2023-12-10 16:29:47 +00:00
Pax1601
131f30405c Merge pull request #693 from Pax1601/ArtificialDogma-patch-1
Update README.md
2023-12-10 11:07:49 +01:00
Pax1601
dbf21e0af9 Merge pull request #694 from Pax1601/684-add-the-spitfire-and-loadouts
684 add the spitfire and loadouts
2023-12-10 11:07:27 +01:00
bobprofisker
9094f8fdc6 forgot to remove stupid wing colour BF-109 2023-12-09 20:49:17 +00:00
bobprofisker
aa0b0a585c Updated databases for spitfire, misc units and helos
Updated databases for spitfire, misc units and helos
2023-12-09 20:34:10 +00:00
bobprofisker
ad61037452 New unit payloads for spit
New unit payloads for spit, also includes clipped wing version
2023-12-09 20:32:52 +00:00
PeekabooSteam
66ed1a99e0 Corrected airbase names for PG 2023-12-09 19:52:00 +00:00
Pax1601
d7dc5769a8 Bugfixing, switched to human name for humans 2023-12-09 18:06:47 +01:00
Pax1601
b0ee653bff Fixed unabled to copy humans 2023-12-09 15:51:16 +01:00
Dogma
5a950e22ce Update README.md 2023-12-09 21:24:34 +11:00
Pax1601
0459d5c625 v0.4.13-alpha-rc5 2023-12-08 15:38:56 +01:00
Pax1601
43d28ebe19 Removed notify and added warning follow roads 2023-12-08 14:27:16 +01:00
Pax1601
187b9be57a Added ability to add mods 2023-12-08 11:54:12 +01:00
Pax1601
564a650403 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-07 15:49:31 +01:00
Pax1601
0e403e8b74 v0.4.12-alpha-rc4 2023-12-07 15:49:27 +01:00
Pax1601
840cdd9049 Update README.md 2023-12-07 15:39:48 +01:00
Pax1601
e5e7e9be14 Added increased load for onRoad movement 2023-12-07 15:22:59 +01:00
Pax1601
e677968ba7 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-07 15:08:01 +01:00
Pax1601
d24b955d52 Multiple bugfixes 2023-12-07 15:07:57 +01:00
Pax1601
48860ff514 Merge pull request #677 from Pax1601/674-airbases-visibility-button-still-dark-when-off
Fixed incorrect colour
2023-12-06 20:39:37 +01:00
PeekabooSteam
0e78b7559b Robots are no longer considered for waypoints 2023-12-06 15:27:05 +00:00
PeekabooSteam
25edfc45e5 Added coalition visibility tooltips 2023-12-06 15:03:15 +00:00
PeekabooSteam
885825e5cc Fixed incorrect colour 2023-12-06 14:54:36 +00:00
Pax1601
344413ae74 Undone wrong change in pcall 2023-12-06 13:08:52 +01:00
Pax1601
fa0643987b Remove need for path variable 2023-12-06 12:37:59 +01:00
Pax1601
dcff462b32 v0.4.11-alpha-rc3 2023-12-06 09:15:44 +01:00
Pax1601
fa04e5f8bb Merge pull request #670 from Pax1601/650-robots-can-be-sent-to-refuel-while-protected
Added extra protection for robots
2023-12-06 08:17:21 +01:00
Pax1601
c8d5f9ce0e Formatted file 2023-12-06 08:17:01 +01:00
Pax1601
55642a89b1 Merge pull request #671 from Pax1601/651-control-tips-quick-options-shown-but-nothing-happens
Removed Quick Options option
2023-12-06 08:12:00 +01:00
PeekabooSteam
f305aa3929 Removed Quick Options option 2023-12-05 21:51:32 +00:00
PeekabooSteam
47ee88c339 Added extra protection for robots 2023-12-05 20:44:26 +00:00
Pax1601
022e041f68 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-05 19:30:50 +01:00
Pax1601
0cc53890c1 v0.4.10-alpha-rc2 2023-12-05 19:30:34 +01:00
Pax1601
e37f7a4977 v0.4.10-alpha-rc1 2023-12-05 19:18:37 +01:00
Pax1601
8d03c6a767 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-05 15:59:25 +01:00
Pax1601
e29fdfd8c7 Fixed typo in map attribution 2023-12-05 15:59:19 +01:00
Pax1601
af619c3687 Merge pull request #666 from Pax1601/rc1-fixes
Rc1 fixes
2023-12-05 15:44:29 +01:00
Pax1601
6afb6682ea Fixed IADS creation, no longer clogs the server 2023-12-05 15:43:48 +01:00
Pax1601
9c2c7f45c6 Demo mode disabled 2023-12-05 11:35:10 +01:00
Pax1601
7fbc19e90a Merge pull request #665 from Pax1601/rc1-fixes
RC1 fixes
2023-12-05 11:31:14 +01:00
Pax1601
8f2f73dc0e RC1 fixes 2023-12-05 11:26:18 +01:00
Pax1601
24a1681337 Merge pull request #663 from Pax1601/task-optimization
Task optimization
2023-12-05 10:07:09 +01:00
Pax1601
304e8ba3a0 Fixed compilation warnings 2023-12-05 10:06:47 +01:00
Pax1601
45b840fa72 Changed default multiplier value 2023-12-05 09:24:13 +01:00
Pax1601
82704f042b Added check on negative speed 2023-12-05 09:22:22 +01:00
Pax1601
87d71da55e Small tweak to multiplier 2023-12-05 09:14:06 +01:00
Pax1601
71cf7c67f7 Fixed change altitude and speed for helicopters 2023-12-05 09:11:36 +01:00
Pax1601
62142ed976 Version 2 of tasking optimization 2023-12-04 21:06:13 +01:00
Pax1601
f56bd514dc Fixed tab order in installer 2023-12-03 21:30:16 +01:00
Pax1601
e30f161d1d Removed unnecessary file 2023-12-03 21:11:14 +01:00
Pax1601
720bfb3118 Added git clean command 2023-12-03 21:06:05 +01:00
Pax1601
4100a3cc67 v0.4.9-alpha-rc1 2023-12-03 21:04:19 +01:00
Pax1601
942993ff6d Added ranges for SAM Sites 2023-12-03 21:00:32 +01:00
Pax1601
fbf435c799 Added missing images, changed mop to da aaa 2023-12-03 20:46:26 +01:00
Pax1601
8fdb0d82e8 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-03 19:54:36 +01:00
Pax1601
dcbebab61b Updated databases 2023-12-03 19:54:33 +01:00
Pax1601
7b10afae43 Merge pull request #644 from Pax1601/639-create-boilerplate-plugin
Added boilerplate plugin
2023-12-03 19:51:32 +01:00
PeekabooSteam
81d8a88abd Removed old definition file 2023-12-03 18:48:51 +00:00
Pax1601
cb14158a0f Merge pull request #645 from WoodyXP/main
Example script to set airbase to a certain coalition
2023-12-03 19:32:13 +01:00
PeekabooSteam
38fc60352a Fixed typo 2023-12-03 18:12:18 +00:00
PeekabooSteam
3748f0d6e3 Added extensive documentation. 2023-12-03 14:23:08 +00:00
Stefan Arsic
edd626d5e5 Example script to set airbase to a certain coalition 2023-12-03 14:38:58 +01:00
PeekabooSteam
f785e75686 Corrected package name 2023-12-03 12:28:19 +00:00
PeekabooSteam
9a46ed70b7 Added boilerplate plugin 2023-12-03 12:24:52 +00:00
Pax1601
532c09a815 Fixed merge error 2023-12-03 11:49:39 +01:00
Pax1601
e430d38c63 Merge pull request #643 from Pax1601/525-ships-spawn-with-0-health-indicated
Health correctly computed for ships too
2023-12-03 11:35:55 +01:00
Pax1601
289b36de6d Health correctly computed for ships too 2023-12-03 11:35:37 +01:00
Pax1601
7e01f40e5c Merge pull request #642 from Pax1601/537-cannot-copy-paste-robots
It's now possible to copy robots
2023-12-03 11:10:17 +01:00
Pax1601
cac4bb5f13 It's now possible to copy robots
Know limitation: it's not possible to copy payloads of units spawned by other scripts. They must be in the .miz file. Don't think we can do much about this.
2023-12-03 11:09:50 +01:00
Pax1601
c8bb041887 Merge pull request #635 from Pax1601/633-unable-to-hide-olympus-controlled-units
633 unable to hide olympus controlled units
2023-12-02 18:32:40 +01:00
PeekabooSteam
9302c5c6d1 Merge branch '633-unable-to-hide-olympus-controlled-units' of https://github.com/Pax1601/DCSOlympus into 633-unable-to-hide-olympus-controlled-units 2023-12-02 16:05:51 +00:00
PeekabooSteam
84a3313f2c TS declarations 2023-12-02 16:04:12 +00:00
PeekabooSteam
1eb3beeb2e Merge branch 'main' into 633-unable-to-hide-olympus-controlled-units 2023-12-02 15:58:37 +00:00
PeekabooSteam
d0e6ef8c6c Changed order 2023-12-02 12:57:58 +00:00
PeekabooSteam
5da1df7e20 Added Olympus unit toggle 2023-12-02 12:47:00 +00:00
Pax1601
16fa6d9805 Updated databases 2023-12-02 13:25:46 +01:00
Pax1601
0ca7766689 Merge pull request #634 from Pax1601/minor-refactoring
Minor refactoring
2023-12-02 12:37:55 +01:00
Pax1601
4342575418 Merge pull request #632 from Pax1601/631-alignment-of-second-bar-in-visibility-options-is-too-tall
Fixed bar height
2023-12-02 12:37:41 +01:00
Pax1601
4cdb73a60d Fixed error in address for configuration 2023-12-02 12:36:42 +01:00
PeekabooSteam
a23c53bcb8 Fixed bar height 2023-12-02 11:04:37 +00:00
Pax1601
19ac4f92e0 Merge branch 'main' into minor-refactoring 2023-12-02 11:20:38 +01:00
Pax1601
0b8f48b4fd Merge pull request #615 from Pax1601/602-attack-mode-not-working-on-ground-and-navy-units
Added ATTACK state for ground and navy units
2023-12-02 11:19:05 +01:00
Pax1601
d2fa94a6cb Minor graphical tweak 2023-12-02 11:17:30 +01:00
Pax1601
da1c674911 Merge branch 'main' into 602-attack-mode-not-working-on-ground-and-navy-units 2023-12-02 10:53:24 +01:00
Pax1601
7184bc1eb2 Merge branch 'main' into 602-attack-mode-not-working-on-ground-and-navy-units 2023-12-02 10:49:28 +01:00
Pax1601
37f30a0f1a Merge pull request #629 from Pax1601/Shredmetal-patch-1
Update LEGAL
2023-12-02 10:48:43 +01:00
Pax1601
04f4b3e78a Merge pull request #626 from Pax1601/609-update-top-menu-ui
Styled top bar, fixed IADS toggle.
2023-12-02 10:48:12 +01:00
Pax1601
dbdc162fae Merge pull request #630 from Pax1601/read-config-location-with-lfs.writedir()
Read config location with lfs.writedir()
2023-12-02 10:47:33 +01:00
Pax1601
563f673fb3 Minor tweak 2023-12-02 10:46:59 +01:00
Pax1601
423e799a82 Completed reading from current instance 2023-12-02 10:40:03 +01:00
Shredmetal
4734b89414 Update LEGAL
Amended unilateral modification term to state explicitly that parties agree to be bound by such terms as modified from time to time
2023-12-02 14:33:27 +08:00
Shredmetal
6f708e7733 update LEGAL
added unilateral modification term so we can change the agreement at will without informing users beyond updating the repo
2023-12-02 14:21:38 +08:00
PeekabooSteam
f0c3f95189 Merge and fix conflict 2023-12-01 16:55:14 +00:00
Pax1601
93ca0e3f22 Added read from lfs 2023-12-01 17:44:03 +01:00
PeekabooSteam
d94432636f Styled top bar, fixed IADS toggle. 2023-12-01 15:51:02 +00:00
Pax1601
60fca35d80 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-12-01 14:12:50 +01:00
Pax1601
db71462d1c Update sample.png 2023-12-01 14:12:10 +01:00
Pax1601
86f522176a Update README.md 2023-12-01 14:08:41 +01:00
Pax1601
94ee71c48f A couple of comments 2023-12-01 13:02:18 +01:00
Pax1601
fda0b21fb0 Minor refactoring 2023-12-01 13:00:02 +01:00
Pax1601
775148cec8 Merge pull request #621 from Pax1601/610-update-spawn-menu-ui
Unit spawn menu restyled
2023-11-30 17:29:30 +01:00
Pax1601
f2dc4a1a00 Unit spawn menu restyled 2023-11-30 17:29:11 +01:00
Pax1601
eda5723a3c Merge pull request #620 from Pax1601/617-check-iads-respects-requested-units-and-add-unit-preview-on-spawn
617 check iads respects requested units and add unit preview on spawn
2023-11-30 15:55:36 +01:00
Pax1601
b044d9a6c0 Minor comments 2023-11-30 15:46:48 +01:00
Pax1601
125d5396b9 Fixed IADS creation
It now also considers airbases when creating the IADS. Fixed styling and unit types. Currently SAM Sites ranges are incorrect but will be fixed when database is updated
2023-11-30 15:36:31 +01:00
Pax1601
17b8b35a43 Added ATTACK state for ground and navy units 2023-11-30 13:08:43 +01:00
Pax1601
4bd017e3c7 Merge pull request #612 from Pax1601/542-spawn-menu-dropdowns-overlap-menu
Alignment fixed, spelling corrected
2023-11-30 11:12:52 +01:00
Pax1601
37447a7fd3 Merge pull request #613 from Pax1601/592-detect-if-installing-olympus-again-and-dont-prompt-to-set-olympusjson-properties
592 detect if installing olympus again and dont prompt to set olympusjson properties
2023-11-30 11:09:34 +01:00
Pax1601
1ed1dec65e Added full stop for Peekaboo 2023-11-30 11:08:48 +01:00
Pax1601
5e2e465813 Installer updated to allow preservation of old config 2023-11-30 11:01:45 +01:00
PeekabooSteam
335655406e Alignment fixed, spelling corrected 2023-11-30 09:41:43 +00:00
Pax1601
bf12d6330c Merge pull request #606 from Pax1601/566-ground-and-naval-units-have-roe-only-designated-option
Added a warning message for ground and navy units ROE
2023-11-29 12:57:41 +01:00
Pax1601
3cca3187ad Added a warning message for ground and navy units ROE 2023-11-29 12:57:17 +01:00
Pax1601
f4388a2cff Merge pull request #605 from Pax1601/594-bounds-for-normandy-map-are-missing
Bounds added for Normandy theatre
2023-11-29 11:54:33 +01:00
Pax1601
7cf5d324eb Bounds added for Normandy theatre 2023-11-29 11:54:16 +01:00
Pax1601
ec9ef2b0fb Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-11-29 11:06:34 +01:00
Pax1601
6c852d93a9 Minor tweak on splash screen when screen is very small 2023-11-29 11:06:31 +01:00
Pax1601
290067932e Merge pull request #604 from Pax1601/596-add-a-way-for-users-to-know-there-is-a-new-version-available
Added latest version number
2023-11-29 10:49:04 +01:00
Pax1601
4aa3a43604 Added latest version number
It pulses if a newer version is available
2023-11-29 10:46:43 +01:00
Pax1601
3c33696452 Create version.json
Added version file
2023-11-29 09:58:16 +01:00
Pax1601
3ea1ab8f30 Added link to wiki 2023-11-28 17:36:55 +01:00
Pax1601
76801f773d Merge pull request #601 from Pax1601/412-improve-importexport
412 improve importexport
2023-11-28 17:31:34 +01:00
Pax1601
de7eeec94a Completed import/export page 2023-11-28 17:30:59 +01:00
Pax1601
0723a3ab95 Merge branch 'main' into 412-improve-importexport 2023-11-28 17:15:41 +01:00
Pax1601
8ef48ad977 Implemented filename selector 2023-11-28 16:59:23 +01:00
Pax1601
ed24d1af60 Merge pull request #600 from Pax1601/fix-aim-errors
Fixed error in lead calculation code
2023-11-28 16:42:45 +01:00
Pax1601
e3dffb8245 Fixed error in lead calculation code 2023-11-28 16:41:43 +01:00
Pax1601
74310a5ad3 Fixed installation prompt about passwords 2023-11-27 21:26:48 +01:00
Pax1601
a2223165e8 Merge branch 'main' into 412-improve-importexport 2023-11-26 21:13:24 +01:00
Pax1601
a879761dc2 Installation fixes 2023-11-24 21:38:55 +01:00
Pax1601
124b909aa4 v0.4.8 2023-11-24 19:43:24 +01:00
Pax1601
858e9eb066 Merge pull request #591 from Pax1601/584-add-state-icon-for-scenic-aaa-functions
Added state icons for scenic functions
2023-11-24 17:53:02 +01:00
Pax1601
7415e0cb97 Added state icons for scenic functions
And fixed dropdowns in case of duplicate labels
2023-11-24 17:52:48 +01:00
Pax1601
915020ddc3 Merge pull request #590 from Pax1601/532-stop-any-previous-connection-requests-before-connecting-again
Added code to clear any previous connection attempt
2023-11-24 11:50:32 +01:00
Pax1601
95915489b2 Added code to clear any previous connection attempt 2023-11-24 11:49:09 +01:00
Pax1601
3e39c3351a Merge pull request #589 from Pax1601/520-south-atlantic-initial-viewpoint
Added bounds for South Atlantic map
2023-11-24 11:43:41 +01:00
Pax1601
244d32e7d2 Added bounds for South Atlantic map 2023-11-24 11:43:26 +01:00
Pax1601
16a79827b7 Merge pull request #588 from Pax1601/586-spawn-toggle-background-missing
Fixed toggles
2023-11-24 10:05:13 +01:00
Pax1601
bd6a36e9ea Merge pull request #587 from Pax1601/487-improve-simulated-firefights
Added indirect fire mode
2023-11-23 23:45:20 +01:00
Pax1601
771695af59 Added indirect fire mode 2023-11-23 23:45:00 +01:00
PeekabooSteam
e811c7bd46 Fixed toggles 2023-11-23 22:44:24 +00:00
Pax1601
20f99c287f Minor change in unit label dropdown
It now expands to fill the space, but it still overflows with long unit names as per #542
2023-11-23 20:32:42 +01:00
Pax1601
f464c9ae76 Merge pull request #585 from Pax1601/511-jf-17-isnt-assigned-to-any-roles-other-than-cap
Added JF-17 loadouts
2023-11-23 20:12:27 +01:00
Pax1601
15ccb3dc04 Added JF-17 loadouts 2023-11-23 20:11:54 +01:00
Pax1601
defe40d48f Merge pull request #583 from Pax1601/miss-on-purpose-tweaks
Added effect of acquisition range to wake units up
2023-11-23 20:09:43 +01:00
Pax1601
0f2622e821 Merge pull request #560 from Pax1601/524-units-will-not-perform-scenic-aaa-until-the-operate-as-toggle-is-toggled
Fixed missing reset of expected value of operateAs toggle
2023-11-23 20:09:09 +01:00
Pax1601
b442d238cd Fixed error in getUnitsVariable function 2023-11-23 20:08:37 +01:00
Pax1601
00f2a3c19d Merge branch 'main' into 524-units-will-not-perform-scenic-aaa-until-the-operate-as-toggle-is-toggled 2023-11-23 19:57:09 +01:00
Pax1601
dcbfdf8666 Added effect of acquisition range to wake units up
Note: alertness time constant suppressed
2023-11-23 16:40:18 +01:00
Pax1601
6e84423032 Merge pull request #577 from Pax1601/576-toggles-gone-walkabout
Fixed UCP toggles, added copy-paste control for plugins
2023-11-23 10:29:23 +01:00
PeekabooSteam
912ab75a96 Moved Database Manager Link 2023-11-22 17:55:39 +00:00
PeekabooSteam
1022fc2f0c Fixed UCP toggles, added copy-paste control for plugins 2023-11-22 17:15:23 +00:00
Pax1601
65edce855b Merge pull request #568 from Pax1601/loading-screen
Loading screen
2023-11-22 15:13:11 +01:00
Pax1601
0ba05d5795 Merge pull request #572 from Pax1601/540-grouped-units-cant-be-selected
Grouped units can be deleted now
2023-11-22 15:13:02 +01:00
Pax1601
1b17e17290 Added some TODO comments
And very minor refactoring
2023-11-22 15:12:28 +01:00
Pax1601
87957df1fb Fixed incorrect behaviour when rotating unit destinations
And a minor map code refactoring
2023-11-22 15:04:09 +01:00
Pax1601
d3f8d4eff7 Grouped units can be deleted now
Also added some performance optimizations on drawing of selected units and removed destination preview icon for single unit selection
2023-11-22 13:12:35 +01:00
Pax1601
3ffeed3b39 Merge pull request #569 from Pax1601/533-allow-users-to-edit-the-config-json-during-the-installation-process
533 allow users to edit the config json during the installation process
2023-11-22 11:35:06 +01:00
Pax1601
4197e4402c Relative paths for nwjs and node folders 2023-11-22 11:33:13 +01:00
Pax1601
1cfe6f5583 Added simple loading screen 2023-11-22 11:32:13 +01:00
Pax1601
ad5cb83abf Completed server version 2023-11-21 17:35:09 +01:00
Pax1601
f4a4882dbc Merge pull request #564 from Pax1601/563-map-icon-disappears-after-changing-map-type
We no longer LOSE the icon
2023-11-21 14:38:34 +01:00
Pax1601
ecb2cf182a Merge pull request #561 from Pax1601/Shredmetal-patch-1
Update LEGAL
2023-11-21 14:38:20 +01:00
Pax1601
6aea839e04 Added configurator GUI 2023-11-21 14:34:51 +01:00
PeekabooSteam
e20d2fa95a We no longer LOSE the icon 2023-11-20 20:33:41 +00:00
Pax1601
806d0cc52f Added ability for users to edit configuration during installation 2023-11-20 18:19:41 +01:00
Shredmetal
2a2baaf324 Update LEGAL 2023-11-21 01:02:03 +08:00
Pax1601
74989ec015 Fixed missing reset of expected value of operateAs toggle 2023-11-20 12:30:44 +01:00
Pax1601
31af3a53ce Merge pull request #559 from Pax1601/528-unknown-units-have-no-icons
Added default marker for unkown units
2023-11-20 11:43:42 +01:00
Pax1601
361d51b55d Merge pull request #545 from Pax1601/531-november-ui-cleanup
531 november UI cleanup
2023-11-20 09:45:36 +01:00
Pax1601
a12c09eba5 Minor refactoring 2023-11-20 09:44:59 +01:00
Pax1601
bcfe0653bd Merge pull request #544 from Pax1601/543-duplicated-categories-due-to-misspelling
Fixed typos
2023-11-20 09:35:10 +01:00
PeekabooSteam
c43bc763f3 Fixed typos 2023-11-19 13:47:24 +00:00
PeekabooSteam
85325c17ac More styling, added pulse to scenic actions from (?) 2023-11-19 11:17:00 +00:00
PeekabooSteam
178706f8de Finalised styling for UCP 2023-11-18 22:02:59 +00:00
Pax1601
51defbb8b2 Added default marker for unkown units 2023-11-18 19:01:47 +01:00
PeekabooSteam
84cf9aa27a More changes from the list 2023-11-17 22:44:15 +00:00
PeekabooSteam
a66098e080 Merge branch 'main' into 531-november-ui-cleanup 2023-11-17 21:46:58 +00:00
Pax1601
283b9e682e v0.4.7 2023-11-17 22:04:21 +01:00
Pax1601
8b5956e76b Merge pull request #536 from Pax1601/489-show-all-the-action-options-of-the-selected-units-even-if-some-units-dont-have-them
489 show all the action options of the selected units even if some units dont have them
2023-11-17 22:02:51 +01:00
Pax1601
017a89b945 getDesc().category reimplemented
unit:getCategory() reports "Airplane" for Helicopters
2023-11-17 22:02:32 +01:00
Pax1601
5bc685182b Merge branch 'main' into 489-show-all-the-action-options-of-the-selected-units-even-if-some-units-dont-have-them 2023-11-17 21:40:09 +01:00
Pax1601
f47fc2fb19 Merge pull request #535 from Pax1601/534-olympus-not-sending-data-with-dcs-open-beta-29148111
Changed unit:getCategory to Object.getCategory(unit)
2023-11-17 21:35:20 +01:00
Pax1601
11d6f25606 Changed unit:getCategory to Object.getCategory(unit)
And added some isExist guards
2023-11-17 21:34:50 +01:00
Pax1601
331692e3d3 Merge branch '489-show-all-the-action-options-of-the-selected-units-even-if-some-units-dont-have-them' of https://github.com/Pax1601/DCSOlympus into 489-show-all-the-action-options-of-the-selected-units-even-if-some-units-dont-have-them 2023-11-17 21:10:49 +01:00
Pax1601
7483225e0d Small tweak to login page 2023-11-17 21:10:46 +01:00
PeekabooSteam
f00df5ca3f Some changes done 2023-11-17 17:07:56 +00:00
Pax1601
22ae882032 Unit gets forcefully deselected when hidden 2023-11-17 17:45:10 +01:00
Pax1601
fbab82e4de Merge branch 'main' into 489-show-all-the-action-options-of-the-selected-units-even-if-some-units-dont-have-them 2023-11-17 17:26:56 +01:00
Pax1601
ca81d1c4ce Merge pull request #530 from Pax1601/529-add-favicon
Favicons
2023-11-17 17:24:03 +01:00
Pax1601
a1884ab19f Merge pull request #527 from Pax1601/522-flashpulse-robot-lock-when-trying-to-give-orders-to-protected-units
Lock flashes on protected robot interaction
2023-11-17 17:23:18 +01:00
Pax1601
8905cd5e85 Merge pull request #526 from Pax1601/523-selected-units-dont-get-hidden
Selected units now hidden on request
2023-11-17 17:22:36 +01:00
PeekabooSteam
8d5ed33ad8 Favicons 2023-11-17 11:35:55 +00:00
Pax1601
b747752b76 Fixed error in follow command 2023-11-17 07:59:04 +01:00
PeekabooSteam
4e13daa270 Lock flashes on protected robot interaction 2023-11-16 23:08:01 +00:00
PeekabooSteam
c00096bd9a Selected units now hidden on request 2023-11-16 22:26:09 +00:00
PeekabooSteam
210c1fbecf Added a selective interface for import and export 2023-11-16 21:44:40 +00:00
Pax1601
4a54011aac Large rework of context menus for units and map 2023-11-16 15:31:07 +01:00
PeekabooSteam
b89c5142b6 Merge and fix 2023-11-16 11:28:32 +00:00
PeekabooSteam
0421f6b8fe Fixed regex undefined 2023-11-16 11:16:54 +00:00
Pax1601
0c50141be6 v0.4.6 2023-11-15 16:42:24 +01:00
Pax1601
a71b8806e7 Update groundunitdatabase.json 2023-11-15 16:06:52 +01:00
Pax1601
e0a27c574f Merge pull request #519 from Pax1601/493-for-ground-units-add-marker-symbol-in-database
493 for ground units add marker symbol in database
2023-11-15 15:38:59 +01:00
Pax1601
8d7a49a31f Created group handlers 2023-11-15 15:38:16 +01:00
Pax1601
25e2c50438 Added unit marker to database and implemented better grouping 2023-11-14 17:43:24 +01:00
Pax1601
e3423ea9a3 Merged new databases 2023-11-14 07:53:01 +01:00
Pax1601
812112858c Merge branch 'main' into 493-for-ground-units-add-marker-symbol-in-database 2023-11-13 19:27:41 +01:00
Pax1601
8db1357904 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-11-13 18:55:19 +01:00
Pax1601
bba0aa9f52 Fixed databasemanager overflow 2023-11-13 18:54:11 +01:00
Pax1601
1cc549b24a Added entry to databases 2023-11-13 18:02:08 +01:00
Pax1601
7cafeb73ca Added tags to unit spawn menu 2023-11-13 16:04:53 +01:00
Pax1601
772f082913 Tweaked installer message 2023-11-13 09:08:40 +01:00
Pax1601
9f7efe3018 Merge pull request #517 from Pax1601/437-f-14b-not-spawning-with-weapons
Fixed errors in loadouts scripts
2023-11-12 18:44:18 +01:00
Pax1601
a28584b08b Fixed errors in loadouts scripts 2023-11-12 18:43:49 +01:00
Pax1601
5cba46a482 Merge pull request #516 from Pax1601/437-f-14b-not-spawning-with-weapons
Fixed loadout generator adding exceptions for Tomcats
2023-11-12 17:43:37 +01:00
Pax1601
a15b7620eb Fixed loadout generator adding exceptions for Tomcats 2023-11-12 17:42:54 +01:00
PeekabooSteam
9ef6efa3e0 Mid-way commit 2023-11-12 16:18:31 +00:00
Pax1601
49bff88c4e Radio and TACAN frequencies are now clamped 2023-11-12 17:18:18 +01:00
Pax1601
80af34fa3e Merge pull request #515 from Pax1601/265-cloning-a-dead-unit-fails
Dead units can now be cloned
2023-11-12 16:36:04 +01:00
Pax1601
1d6f2644aa Dead units can now be cloned 2023-11-12 16:35:31 +01:00
Pax1601
dc61d364d1 Merge pull request #514 from Pax1601/448-on-chrome-fps-drops-to-single-digits-when-zoomed-in
Implemented custom fast renderer for range circles
2023-11-12 15:50:44 +01:00
Pax1601
78de9dd538 Implemented custom fast renderer for range circles
It's a bit hacky since I had to override a default leaflet renderer function. Works well but may be injected in a more elegant way.
2023-11-12 15:49:46 +01:00
Pax1601
ccaea5b9d1 Better unit explosion buttons design 2023-11-12 14:08:10 +01:00
Pax1601
e02e9de55d Updated databases 2023-11-09 19:27:32 +01:00
Pax1601
40da192dbb Merge pull request #512 from Pax1601/486-add-more-advanced-effects
486 add more advanced effects
2023-11-09 08:27:06 +01:00
Pax1601
c8254238c7 Scrollable unit control panel tweak 2023-11-09 08:26:43 +01:00
Pax1601
9caee0c77c Implemented buttons to apply advanced controls directly to units 2023-11-08 23:33:27 +01:00
Pax1601
b9830f0190 Merge branch 'main' into 486-add-more-advanced-effects 2023-11-08 22:04:52 +01:00
Pax1601
02a0a9b783 Merge pull request #504 from Pax1601/484-add-life-meter-to-ground-units
484 add life meter to ground units
2023-11-08 21:57:27 +01:00
Pax1601
ea1758a1a9 Added backend code for health display
And fixed the issue of ground units not being deleted correctly
2023-11-08 21:56:39 +01:00
PeekabooSteam
b43afd4e9c Export customisation working - but ugly. 2023-11-08 14:09:35 +00:00
PeekabooSteam
7700aa2030 Merge branch 'main' into 412-improve-importexport 2023-11-08 12:52:27 +00:00
Pax1601
d5d8391f63 Merge pull request #508 from Pax1601/494-make-the-installer-more-clear-specify-that-olympus-must-be-installed-in-savedgames
Changed message and fixed wrong installation folder after user selection
2023-11-08 10:17:40 +01:00
Pax1601
b508d2301b Changed message and fixed wrong installation folder after user selection 2023-11-08 10:16:33 +01:00
Pax1601
01b3336709 Merge pull request #507 from Pax1601/495-make-ui-port-configurable-from-olympusjson
Added port selection to config
2023-11-08 09:59:50 +01:00
Pax1601
6ba37aefd6 Added port selection to config 2023-11-08 09:59:21 +01:00
PeekabooSteam
e68683acb7 Export matrix reads from data 2023-11-07 22:04:09 +00:00
Pax1601
a804904ff5 Merge pull request #506 from Pax1601/dynamic-resizing
Dynamic resizing
2023-11-07 19:36:08 +01:00
Pax1601
eacb89176c Completed new resizable design 2023-11-07 17:37:19 +01:00
PeekabooSteam
ec971aa822 Merge branch 'main' into 484-add-life-meter-to-ground-units 2023-11-06 22:29:23 +00:00
PeekabooSteam
e1f404c647 Added some doc comments 2023-11-06 22:28:44 +00:00
PeekabooSteam
5f1e32d610 Conflict fix 2023-11-06 21:51:45 +00:00
PeekabooSteam
732ee2bbb9 Added + for naval and ground units 2023-11-06 21:49:54 +00:00
Pax1601
1e461250d5 Added advanced effects 2023-11-06 19:26:15 +01:00
Pax1601
f727174044 Testing of dynamic resizing 2023-11-06 18:30:59 +01:00
Pax1601
7edc687f7b Merge pull request #501 from Pax1601/499-spawn-menu-reorganisation
Air defence has its own spawn icon
2023-11-06 11:13:12 +01:00
Pax1601
596fbf0b87 Merge branch 'main' into 499-spawn-menu-reorganisation 2023-11-06 11:12:46 +01:00
PeekabooSteam
8dc48c10c3 Added dialog 2023-11-05 22:35:00 +00:00
PeekabooSteam
5db90e5896 Changed air defence form to extend ground units' form 2023-11-05 19:24:23 +00:00
PeekabooSteam
dd811def07 Added health bar 2023-11-05 19:11:42 +00:00
Pax1601
5273291e9a Merge pull request #503 from Pax1601/485-improve-miss-on-purpose
485 improve miss on purpose
2023-11-05 17:35:03 +01:00
Pax1601
130dbda499 Merge branch 'main' into 485-improve-miss-on-purpose 2023-11-05 17:34:56 +01:00
Pax1601
769aea7e4e Merge pull request #502 from Pax1601/500-log-in-form-needs-to-submit-when-pressing-enterreturn
500 log in form needs to submit when pressing enterreturn
2023-11-05 17:28:42 +01:00
Pax1601
fa3d65bde6 Completed miss on purpose functionality 2023-11-05 17:26:39 +01:00
PeekabooSteam
073281135c Fixed odd 'undefined' bug 2023-11-05 13:15:41 +00:00
PeekabooSteam
4c7f979e56 Merge branch '498-set-ucp-and-uip-toggles-into-olympus-context' into 500-log-in-form-needs-to-submit-when-pressing-enterreturn 2023-11-05 13:08:24 +00:00
PeekabooSteam
a5bfb4f8d2 Form submits on return press 2023-11-05 13:05:46 +00:00
PeekabooSteam
a04780f311 Merge branch 'main' into 500-log-in-form-needs-to-submit-when-pressing-enterreturn 2023-11-05 12:37:36 +00:00
PeekabooSteam
aad0fd22ad Air defence has its own spawn icon 2023-11-05 10:57:53 +00:00
Pax1601
bc1c3994d3 Merge branch 'main' into 485-improve-miss-on-purpose 2023-11-04 10:21:37 +01:00
Pax1601
840033aa6a Merge pull request #496 from Pax1601/468-robot-protection-toggle
468 robot protection toggle
2023-11-04 10:10:09 +01:00
Pax1601
9cc6e9e790 More work on miss on purpose 2023-11-04 09:57:18 +01:00
PeekabooSteam
b1ad2f409e Controlling panels and spawn menu from context 2023-11-03 22:36:35 +00:00
PeekabooSteam
7106646042 Updated landAtPoint logic 2023-11-03 18:28:05 +00:00
PeekabooSteam
31405119f0 Enabled mixed-group actions, fixed some helicopter messages. 2023-11-03 18:17:40 +00:00
PeekabooSteam
2e5ee93361 Tweaked colours. 2023-11-03 14:05:39 +00:00
PeekabooSteam
f981a661d5 Added lock image and tooltip/titles. 2023-11-03 13:29:09 +00:00
Pax1601
7e05bbf5e3 Improved scheduler logging 2023-11-03 11:37:09 +01:00
PeekabooSteam
4465f4a3bb PoC of robot protection 2023-11-02 23:03:17 +00:00
PeekabooSteam
ade4f183cd Commit so I can switch to another branch. 2023-11-02 18:22:42 +00:00
Pax1601
99dc61799f Merge branch 'main' of https://github.com/Pax1601/DCSOlympus 2023-11-02 17:24:39 +01:00
Pax1601
a213b94606 Minor fixes 2023-11-02 17:24:35 +01:00
Pax1601
6600ed8cbb Merge pull request #473 from Pax1601/357-map-context-switching
357 map context switching
2023-11-02 09:46:09 +01:00
PeekabooSteam
826bf12bd6 Merge branch 'main' into 357-map-context-switching 2023-10-31 20:30:18 +00:00
Pax1601
528e0db79c Updated demo.js 2023-10-31 17:48:09 +01:00
Pax1601
11a5fec195 Added effect of vertical velocity and of scatter and intensity 2023-10-30 15:56:10 +01:00
Pax1601
c0f3f3a40a Added scatter and intensity selectors in UI 2023-10-30 12:46:49 +01:00
Pax1601
88844db23a Added shots scatter and intensity variables to backend 2023-10-30 10:09:49 +01:00
Pax1601
31710b4e28 Updated legal text 2023-10-30 09:56:07 +01:00
Pax1601
42d2f6400b Merge pull request #476 from Pax1601/edits_legal
Update and rename COPYING to LEGAL
2023-10-28 14:42:03 +02:00
Pax1601
2701d6adc0 Merge pull request #472 from Pax1601/464-proposed-hot-group-behaviour-tweak-to-be-like-lakecraft-shift-+-1-appends-to-group
464 proposed hot group behaviour tweak to be like lakecraft shift + 1 appends to group
2023-10-28 14:40:06 +02:00
Pax1601
5a4b203937 Merge pull request #477 from Pax1601/463-delete-needs-three-buttons
Added new delete method dialog
2023-10-28 14:38:42 +02:00
Pax1601
74cb7877cb Merge pull request #474 from Pax1601/460-sam-threat-rings-appear-when-they-shouldnt
460 sam threat rings appear when they shouldnt
2023-10-28 14:36:24 +02:00
PeekabooSteam
f954338c27 Added new delete method dialog 2023-10-27 17:26:41 +01:00
Shredmetal
cc729b1d25 Update and rename COPYING to LEGAL
Cleaned up the legal text
2023-10-26 16:45:58 +08:00
PeekabooSteam
4a4b1d6b00 Merge branch 'main' of https://github.com/Pax1601/DCSOlympus into main 2023-10-20 11:04:24 +01:00
Pax1601
d14741f3b1 Merge pull request #471 from Pax1601/470-spawn-menu-qty-sorted-alphabetically-not-numerically
Unit spawn qty now sorted numerically.
2023-10-19 01:29:45 +02:00
PeekabooSteam
94684fff9f More spacing tweaking 2023-10-18 13:54:33 +01:00
PeekabooSteam
44deef4a5a Tweaked spacing 2023-10-18 13:23:25 +01:00
PeekabooSteam
67079e1c0b Munitions constrained to a scrollable 2023-10-18 13:20:54 +01:00
PeekabooSteam
005ffc55ce var => let 2023-10-18 12:15:59 +01:00
PeekabooSteam
1691b0b30c Range rings only showing when necessary 2023-10-18 12:13:51 +01:00
PeekabooSteam
e4e55430ca Optimised quantity option generator 2023-10-18 11:17:05 +01:00
PeekabooSteam
4d31d9d748 Unit spawn qty now sorted numerically. 2023-10-18 10:23:50 +01:00
PeekabooSteam
1413f596fb Improved filter logic 2023-10-17 11:27:21 +01:00
PeekabooSteam
c0aee94da5 Hotgroup logic updated 2023-10-16 19:45:51 +01:00
PeekabooSteam
8e545346e6 Exploratory tweaks 2023-10-16 09:13:44 +01:00
PeekabooSteam
2b1272c70d Removed needless [] 2023-10-15 11:53:12 +01:00
PeekabooSteam
121f9b6ec3 Tweaked string functions 2023-10-15 11:51:49 +01:00
PeekabooSteam
6f9722143e Took shift and alt requirements from T key for demo data 2023-10-15 10:59:39 +01:00
PeekabooSteam
5bf62f4b93 Removed needless context.ts ref 2023-10-15 10:24:41 +01:00
PeekabooSteam
79319dd006 Shortcuts can be set to a context 2023-10-15 10:22:03 +01:00
PeekabooSteam
fdcff53697 Shortcuts now settable to a context. 2023-10-15 09:43:26 +01:00
1076 changed files with 106904 additions and 41212 deletions

45
.github/workflows/build_package.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Build & package
on:
push:
branches: [ "main", "release-candidate" ]
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Setup vcpkg
run: |
bootstrap-vcpkg
vcpkg integrate install
- name: Setup Node.js
uses: actions/setup-node@v2
- name: Build
working-directory: .
run: "./build_package.bat"
shell: cmd
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.3
with:
name: development_build_not_a_release
path: ./package
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.3
with:
name: zip_only_package
path: ./zip

View File

@@ -1,33 +0,0 @@
# ci.yml file for GitHub Actions
name: CI
on: [push]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
- name: Install dependencies
run: npm ci
working-directory: ./client
- name: Create the docs directory locally in CI
run: npx typedoc --out ../docs/client @types/*.d.ts src/**/*.ts
working-directory: ./client
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs

46
.gitignore vendored
View File

@@ -1,16 +1,42 @@
bin bin
/scripts/old
.vs .vs
x64 x64
core.user
core.vcxproj.user
*.user
Output Output
node_modules node_modules
/client/TODO.txt
/client/public/javascripts/bundle.js
!client/bin
/client/public/plugins
/client/plugins/controltips/index.js
hgt hgt
/client/public/databases/units/old
/backend/vcpkg_installed
/frontend/server/TODO.txt
/frontend/server/public/javascripts/bundle.js
/frontend/server/public/plugins
/frontend/server/plugins/controltips/index.js
/frontend/server/public/databases/units/old
/frontend/server/plugins/databasemanager/index.js
/src/html
/src/latex
/package
/build
/DCS Olympus backups
/zip
*.user
*.aps
L.Path.Drag.js
leaflet-gesture-handling.css
leaflet.nauticscale.js
leaflet.css
package-lock.json
!frontend/server/bin
/mock-dcs
/frontend/setup
frontend/server/public/plugins/controltipsplugin/index.js
frontend/website/plugins/controltips/index.js
/frontend/server/public/maps
*.pyc
/scripts/**/*.jpg
manager/manager.log

BIN
DCS Olympus Manager.lnk Normal file

Binary file not shown.

59
INSTRUCTIONS.txt Normal file
View File

@@ -0,0 +1,59 @@
_____ _____ _____ ____ _
| __ \ / ____|/ ____| / __ \| |
| | | | | | (___ | | | | |_ _ _ __ ___ _ __ _ _ ___
| | | | | \___ \ | | | | | | | | '_ ` _ \| '_ \| | | / __|
| |__| | |____ ____) | | |__| | | |_| | | | | | | |_) | |_| \__ \
|_____/ \_____|_____/ \____/|_|\__, |_| |_| |_| .__/ \__,_|___/
__/ | | |
|___/ |_|
{{OLYMPUS_VERSION_NUMBER}}
==========================================
INSTALLATION INSTRUCTIONS
1) Close any applications which may interfere with installation, including Digital Combat Simulator (DCS) and previous versions of Olympus.
2) If you DO NOT have Olympus already installed, SKIP THIS STEP. If you have already installed Olympus, do the following:
NOTE: If you made any changes to your unit databases or mods.lua file (e.g. to support a third party mod) make a backup of the edited files before proceeding or changes will be lost;
a) If you installed DCS Olympus v1.0.3 using the installer, simply remove it using Windows's "Add or remove programs" application.
b) If you installed DCS Olympus v1.0.3 using the archived version, remove it by deleting the "...<DCS Saved Games folder>\Mods\Services\Olympus" folder. Do this for every DCS instance you installed Olympus in.
Remember to delete any shortcuts you created. Don't worry, they will be created automatically again by the installation script provided in this package.
3) Create a folder named "DCS Olympus" in your "Saved Games" directory and extract all the contents of the downloaded package into it.
NOTE:
a) Do not extract the contents of the package directly in your Saved Games folder or in your DCS Saved Games folder.
b) Unlike previous version of Olympus, it is no longer necessary to copy the packaged files into each DCS instance folder.
4) Execute the "installer.bat" script by double-clicking on it. It is located in the folder you created in step 3. Wait for the installation script to complete. Installation may take a couple of minutes, after which the Manager will start automatically.
NOTE: depending on your Windows configuration, the script may be called "installer" (without .bat at the end).
5) The Olympus Manager will open. This will allow you to add/remove Olympus to individual DCS instances.
Use the Olympus Manager and follow the instructions to install and setup Olympus.
6) Start DCS and run a mission. Make sure it is UNPAUSED.
7) Open Olympus via the shortcut and login using any username and the Game Master password set using the Manager. (NOTE: not your DCS server password).
Local installation: run the client from the provided desktop shortcut or start it using the "View and manage instances" page of the Manager.
Dedicated server: users must first start the Olympus server from the provided desktop shortcut or using the "View and manage instances" page of the Manager.
Then log in using any browser and visiting "http:\\<server IP>:<frontend port>" (frontend port is 3000 by default, but can be edited using the Manager)
8) You can use the manager at any time to change the ports and/or passwords. If you do, REMEMBER TO RESTART OLYMPUS AND DCS.
NOTES:
a) when launching the Manager you will be prompted to allow Electron to create a firewall rule. This is optional and can be denied without effect on the operation of the Manager;
b) if you are using Olympus on a dedicated server with a router, you must enable port forwarding on the frontend port (3000 by default);
c) unlike Olympus v1.0.3, running the netsh command is no longer required. It is also no longer required to create firewall rules or port forwarding for the backend port. (Optional) If you already performed this steps in the past you can delete the firewall and netsh rules.
==========================================
UPDATING INSTRUCTIONS
IF YOU ARE UPDATING FROM DCS OLYMPUS v1.0.3, FOLLOW THE "INSTALLATION INSTRUCTIONS".
To update your Olympus installation you have two options:
a) download the new package from the GitHub releases page, delete the old unpacked package folder, then follow the INSTALLATION INSTRUCTIONS;
b) run the Olympus Manager. If an update is available you will be given the option to automatically update Olympus from there.
For either options a) or b), remember to close any applications which may interfere with installation, including Digital Combat Simulator (DCS) and previous versions of Olympus.

View File

@@ -1,4 +1,34 @@
GNU GENERAL PUBLIC LICENSE DCS Olympus
A real-time AI unit control mod for DCS World
Copyright (C) 2023 Veltro & Gang (the "DCS Olympus Team" or the
"Rightsholders")
DCS Olympus (the "MATERIAL" or "Software") is provided completely free
to users subject to the it under both the terms of version 3 of the GNU
General Public License ("GPLv3") as published by the Free Software Foundation,
and the additional terms set out below (the "Additional Terms"). In the event
that the terms of GPLv3 conflict with the Additional Terms, the
Additional Terms shall prevail.
The authors and/or copyright holders of the Software have not received any
financial benefit in connection with the Software. In any event, the
Software is provided “as is”, without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
fitness for a particular purpose and non-infringement. In no event shall
the authors and/or copyright holders be liable for any claim, damages or
other liability, whether in an action of contract, tort or otherwise,
arising from, out of or in connection with the Software or the use or
other dealings in the Software.
THIS MATERIAL IS NOT MADE OR SUPPORTED BY EAGLE DYNAMICS SA.
Any party making use of the Software in any manner agrees to be bound by
the entirety of this document.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
@@ -618,57 +648,31 @@ an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee. copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS END OF GNU GENERAL PUBLIC LICENCE
How to Apply These Terms to Your New Programs ADDITIONAL TERMS & CONDITIONS
If you develop a new program, and you want it to be of the greatest 1. Governing Law
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest Save where specifically provided for otherwise, the provisions of the
to attach them to the start of each source file to most effectively GNU General Public Licence Version 3 above shall be governed by and
state the exclusion of warranty; and each file should have at least interpreted in accordance with English Law and the parties submit to the
the "copyright" line and a pointer to where the full notice is found. exclusive jurisdiction of the English Courts.
<one line to give the program's name and a brief idea of what it does.> 2. Entire Agreement
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify The text of this document contains the entire understanding between
it under the terms of the GNU General Public License as published by you, the licensee, and the authors and/or copyright holders of the
the Free Software Foundation, either version 3 of the License, or Software with respect to the subject matter to which it pertains.
(at your option) any later version. It supersedes all prior agreements and understandings (if applicable),
oral or written, with respect to such matters.
This program is distributed in the hope that it will be useful, 3. Unilateral Modification
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 The parties agree that the DCS Olympus Team shall have the right to
along with this program. If not, see <https://www.gnu.org/licenses/>. unilaterally modify these terms (i.e. the agreement between you and the
DCS Olympus Team for the use of the Software), and that parties shall
Also add information on how to contact you by electronic and paper mail. be bound by such terms as modified from time to time. The DCS Olympus Team
shall not have an obligation to inform you of such modification, save that
If the program does terminal interaction, make it output a short such changes will be published on the DCS Olympus Github Repository located at
notice like this when it starts in an interactive mode: https://github.com/Pax1601/DCSOlympus.
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

103
README.md
View File

@@ -1,40 +1,85 @@
# Important note: DCS Olympus is in alpha state. No official release has been produced yet. The first public version is planned for Q4 2023. <img align="left" width="30" src="https://github.com/Pax1601/DCSOlympus/assets/103559271/0ecff279-a87c-4e2d-a4c7-da98c74adf38">
[**Join our Discord**](https://discord.gg/kNAQkhUHnQ)
<img align="left" width="30" src="https://github.com/Pax1601/DCSOlympus/assets/103559271/1c0dd3fd-339c-4b03-94da-3e5215b0358a">
[**YouTube**](https://www.youtube.com/@DCSOlympus)
# DCS Olympus # DCS Olympus
*A real-time web interface to spawn and control units in DCS World*
![alt text](https://github.com/Pax1601/DCSOlympus/blob/main/client/sample.png?raw=true)
### What is this? ### What is this?
DCS Olympus is a mod for DCS World. It allows users to spawn, control, task, group, and remove units from a DCS World server using a real-time map interface, similarly to Real Time Strategy games. The user interface also provides useful informations units, like loadouts, fuel, tasking, and so on. In the future, more features for DCS World GCI and JTAC will be available. DCS: Olympus is a free and open-source mod for DCS that enables dynamic real-time control through a map interface. The user is able to spawn units/groups, deploy a variety of effects such as smoke, flares, or explosions, and waypoints/tasks can be given to AI units in real-time in a way similar to a classic RTS game.
### Features and how to use it Additionally Olympus is able to run several effects and unit behaviours beyond the core DCS offerings. This includes such things as napalm and white phosphosous explosions, or setting up AA units to fire at players and miss, and more.
- Spawn air and ground units, with preset loadouts
- Double click on the map to spawn a blue and red units, both in the air and in the ground, with preset loadouts for air-to-air or air-to-ground tasks; It even includes Red and Blue modes which limit your view and powers to just seeing what your coalition sees, with a spawning budget you could play against your friends even with no-one in the game piloting, or have a Red commander working against a squadron of blue pilots, and/or a blue commander working with them.
- Control units
- Select one ore more units to move them around. Hold down ctrl and click to create a route for the unit to follow; Even better it requires no client mods be installed if used on a server
- Attack other units
- After selecting one ore more units, double click on another unit and select "Attack" to attack it, depending on the available weapons. The full feature list is simply too long to enumerate in a short summary but needless to say Olympus offers up a lot of unique gameplay that has previously not existed, and enhances many other elements of DCS in exciting ways
### Installing DCS Olympus ### Installing DCS Olympus
A prebuilt installer will soon be released and available here Check the [Wiki](https://github.com/Pax1601/DCSOlympus/wiki) for installation instructions
### Building DCS Olympus # Frequently Asked Questions
DCS Olympus is comprised of two modules:
A "core" c++ .dll module, which is run by DCS and exposes all the necessary data, and provides endpoints for commands from a REST server. A Visual Studio 2017/2019/2022 solution is provided, and requires no additional configuration. The core dll solution has two dependencies, both can be installed using vcpkg (https://vcpkg.io/en/getting-started.html): ### I need troubleshooting guidance, please help? ###
- cpprestsdk: `vcpkg install cpprestsdk:x64-windows` Read through the [Installation Guide](https://github.com/Pax1601/DCSOlympus/wiki) to ensure you have setup Olympus correctly.
- geographiclib: `vcpkg install geographiclib:x64-windows`
Read through [Setup Troubleshooting](https://github.com/Pax1601/DCSOlympus/wiki/Setup-Troubleshooting) for common issues and solutions.
A "client" node.js typescript web app, which can be hosted on the server using express.js. A Visual Studio Code configuration is provided for debugging. The client requires node.js to be installed for building (https://nodejs.org/en/). After installing node.js, move in the client folder and run the following commands: Read through the [Olympus User Guide](https://github.com/Pax1601/DCSOlympus/wiki/2.-User-Guide) to learn how to use Olympus.
- `npm install`
- `npm -g install` If you're still having issues after trying the steps above, please post in the community-support channel with the following:
After installing all the necessary dependencies you can start a development server executing the *client/debug.bat* batch file, and visiting http:\\localhost:3000 with any modern browser (tested with updated Chrome, Firefox and Edge). However, it is highly suggested to simply run the `Launch Chrome against localhost` debug configuration in Visual Studio Code. A detailed description of your issue
Your Olympus log file \user home folder\AppData\Local\Temp\Olympus_log.txt for some it might be in \DCS Saved Games folder\Logs\Olympus_log.txt
Your DCS log file \DCS Saved Games folder\Logs\dcs.log
Screenshots of any relevant screens or issues and any other pertinent information.
### Can I join up and help out with the project? ###
Absolutely, join the discord and ping any of the developers to get briefed.
### Can I be a beta/alpha-tester? ###
Same as above!
### Do you have a roadmap? ###
We do not have a roadmap no, we have a laundry list of things we are hoping to do.
These include but are not limited to:
1) Enhancements to helicopter play
2) More features around use of ground units
3) More unique effects and behaviours
4) ATC/AIC features
5) Usability features like unit painters etc
However we cannot commit to specific features, feature release order, or timelines, please remember this isn't our job and we work on it in our free time because we love DCS
### Does Olympus support mods? ###
Generally OIympus will not have any issues with other mods, however you may need to tell olympus about modded units in order to be able to dynamically spawn them etc
Keep in mind that any mods you do choose to spawn your players will need to have, some mod unit just appear as a su27 or leo2 etc. When a player is missing them, others can cause client crashes. So be smart about how you use them.
### Is Olympus compatible with mission scripts? ###
We have tried hard to keep Olympus from interfering with other scripts, we have tested with a variety of new and old mission scripts and generally expect it will not be an issue.
However we cannot foresee everything people come up with so we suggest testing with what you have in mind once olympus releases
### How does it work? ###
The quick answer is magic.
The long answer is well all the code is there for you to read.
The middle answer is a bit like SRS does. Olympus consists of two parts.
(A) Olympus back end: A dll, run by DCS, that sends data out and gets commands in via a REST API;
(B) Webserver exe: The one you start when starting the server via the desktop shortcut.
A and B never communicate when you connect the client you download the web page and some other minor stuff from B, and you get the DCS data from and send commands to A.
### How much does Olympus impact performance? ###
Olympus by itself should not have a noticeable impact on server performance, however the ability for the user to spawn arbitrary units and command engagements means Olympus can be used in such a way that brings the game to it's knees.
Be cognizant of how you play, whether it's done through Olympus or the mission editor 500 MLRS units firing at once is not going to go over well with most servers

12
backend/DCSOlympus.props Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest>
<VcpkgAutoLink>true</VcpkgAutoLink>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup />
</Project>

110
backend/core/core.rc Normal file
View File

@@ -0,0 +1,110 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "InternalName", "core.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "core.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -37,7 +37,6 @@
<ClInclude Include="include\airunit.h" /> <ClInclude Include="include\airunit.h" />
<ClInclude Include="include\commands.h" /> <ClInclude Include="include\commands.h" />
<ClInclude Include="include\datatypes.h" /> <ClInclude Include="include\datatypes.h" />
<ClInclude Include="include\measure.h" />
<ClInclude Include="include\groundunit.h" /> <ClInclude Include="include\groundunit.h" />
<ClInclude Include="include\helicopter.h" /> <ClInclude Include="include\helicopter.h" />
<ClInclude Include="include\navyunit.h" /> <ClInclude Include="include\navyunit.h" />
@@ -48,6 +47,7 @@
<ClInclude Include="include\unitsmanager.h" /> <ClInclude Include="include\unitsmanager.h" />
<ClInclude Include="include\weapon.h" /> <ClInclude Include="include\weapon.h" />
<ClInclude Include="include\weaponsmanager.h" /> <ClInclude Include="include\weaponsmanager.h" />
<ClInclude Include="resource.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\aircraft.cpp" /> <ClCompile Include="src\aircraft.cpp" />
@@ -55,7 +55,6 @@
<ClCompile Include="src\commands.cpp" /> <ClCompile Include="src\commands.cpp" />
<ClCompile Include="src\core.cpp" /> <ClCompile Include="src\core.cpp" />
<ClCompile Include="src\datatypes.cpp" /> <ClCompile Include="src\datatypes.cpp" />
<ClCompile Include="src\measure.cpp" />
<ClCompile Include="src\groundunit.cpp" /> <ClCompile Include="src\groundunit.cpp" />
<ClCompile Include="src\helicopter.cpp" /> <ClCompile Include="src\helicopter.cpp" />
<ClCompile Include="src\navyunit.cpp" /> <ClCompile Include="src\navyunit.cpp" />
@@ -67,6 +66,9 @@
<ClCompile Include="src\weapon.cpp" /> <ClCompile Include="src\weapon.cpp" />
<ClCompile Include="src\weaponsmanager.cpp" /> <ClCompile Include="src\weaponsmanager.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="core.rc" />
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion> <VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
@@ -108,22 +110,26 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>.\..\..\bin\$(Platform)\$(Configuration)\</OutDir> <OutDir>.\..\..\bin\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>.\..\..\bin\</OutDir> <OutDir>.\..\..\build\backend\bin\</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@@ -176,6 +182,7 @@
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalDependencies>lua.lib; GeographicLib-i.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>lua.lib; GeographicLib-i.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\third-party\lua</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\..\third-party\lua</AdditionalLibraryDirectories>
<Version>{{OLYMPUS_VERSION_NUMBER}}.{{OLYMPUS_COMMIT_HASH}}</Version>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

View File

@@ -45,15 +45,13 @@
<ClInclude Include="include\weapon.h"> <ClInclude Include="include\weapon.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="include\measure.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\datatypes.h"> <ClInclude Include="include\datatypes.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="include\weaponsmanager.h"> <ClInclude Include="include\weaponsmanager.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\aircraft.cpp"> <ClCompile Include="src\aircraft.cpp">
@@ -95,9 +93,6 @@
<ClCompile Include="src\weapon.cpp"> <ClCompile Include="src\weapon.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\measure.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\datatypes.cpp"> <ClCompile Include="src\datatypes.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@@ -105,4 +100,7 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="core.rc" />
</ItemGroup>
</Project> </Project>

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include "airunit.h" #include "airunit.h"
#define AIRCRAFT_DEST_DIST_THR 2000 // Meters
class Aircraft : public AirUnit class Aircraft : public AirUnit
{ {
public: public:
@@ -11,6 +13,8 @@ public:
virtual void changeSpeed(string change); virtual void changeSpeed(string change);
virtual void changeAltitude(string change); virtual void changeAltitude(string change);
virtual double getDestinationReachedThreshold() { return AIRCRAFT_DEST_DIST_THR; }
protected: protected:
static json::value database; static json::value database;
}; };

View File

@@ -17,6 +17,7 @@ public:
virtual void changeSpeed(string change) = 0; virtual void changeSpeed(string change) = 0;
virtual void changeAltitude(string change) = 0; virtual void changeAltitude(string change) = 0;
virtual double getDestinationReachedThreshold() { return AIR_DEST_DIST_THR; }
protected: protected:
virtual void AIloop(); virtual void AIloop();

View File

@@ -113,7 +113,7 @@ class Move : public Command
{ {
public: public:
Move(string groupName, Coords destination, double speed, string speedType, double altitude, Move(string groupName, Coords destination, double speed, string speedType, double altitude,
string altitudeType, string taskOptions, string category, function<void(void)> callback = []() {}) : string altitudeType, string taskOptions, string category, bool onRoad, function<void(void)> callback = []() {}) :
Command(callback), Command(callback),
groupName(groupName), groupName(groupName),
destination(destination), destination(destination),
@@ -122,12 +122,13 @@ public:
altitude(altitude), altitude(altitude),
altitudeType(altitudeType), altitudeType(altitudeType),
taskOptions(taskOptions), taskOptions(taskOptions),
category(category) category(category),
onRoad(onRoad)
{ {
priority = CommandPriority::HIGH; priority = CommandPriority::MEDIUM;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return 2; } virtual unsigned int getLoad() { return onRoad? 45: 5; }
private: private:
const string groupName; const string groupName;
@@ -138,6 +139,7 @@ private:
const string altitudeType; const string altitudeType;
const string taskOptions; const string taskOptions;
const string category; const string category;
const bool onRoad;
}; };
/* Smoke command */ /* Smoke command */
@@ -173,7 +175,7 @@ public:
priority = immediate? CommandPriority::IMMEDIATE: CommandPriority::LOW; priority = immediate? CommandPriority::IMMEDIATE: CommandPriority::LOW;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return immediate? 1: 30; } virtual unsigned int getLoad() { return immediate? 5: 30; }
private: private:
const string coalition; const string coalition;
@@ -196,7 +198,7 @@ public:
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW; priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return immediate ? 1 : 30; } virtual unsigned int getLoad() { return immediate ? 5 : 60; }
private: private:
const string coalition; const string coalition;
@@ -220,7 +222,7 @@ public:
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW; priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return immediate ? 1 : 30; } virtual unsigned int getLoad() { return immediate ? 5 : 45; }
private: private:
const string coalition; const string coalition;
@@ -245,7 +247,7 @@ public:
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW; priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return immediate ? 1 : 30; } virtual unsigned int getLoad() { return immediate ? 5 : 45; }
private: private:
const string coalition; const string coalition;
@@ -278,21 +280,23 @@ private:
class Delete : public Command class Delete : public Command
{ {
public: public:
Delete(unsigned int ID, bool explosion, bool immediate, function<void(void)> callback = [](){}) : Delete(unsigned int ID, bool explosion, string explosionType, bool immediate, function<void(void)> callback = [](){}) :
Command(callback), Command(callback),
ID(ID), ID(ID),
explosion(explosion), explosion(explosion),
explosionType(explosionType),
immediate(immediate) immediate(immediate)
{ {
priority = CommandPriority::HIGH; priority = CommandPriority::HIGH;
immediate = immediate; immediate = immediate;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return immediate? 1: 5; } virtual unsigned int getLoad() { return immediate? 1: 30; }
private: private:
const unsigned int ID; const unsigned int ID;
const bool explosion; const bool explosion;
const string explosionType;
const bool immediate; const bool immediate;
}; };
@@ -308,7 +312,7 @@ public:
priority = CommandPriority::MEDIUM; priority = CommandPriority::MEDIUM;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return 1; } virtual unsigned int getLoad() { return 5; }
private: private:
const string groupName; const string groupName;
@@ -326,7 +330,7 @@ public:
priority = CommandPriority::HIGH; priority = CommandPriority::HIGH;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return 1; } virtual unsigned int getLoad() { return 5; }
private: private:
const string groupName; const string groupName;
@@ -344,7 +348,7 @@ public:
priority = CommandPriority::HIGH; priority = CommandPriority::HIGH;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return 1; } virtual unsigned int getLoad() { return 5; }
private: private:
const string groupName; const string groupName;
@@ -377,7 +381,7 @@ public:
priority = CommandPriority::HIGH; priority = CommandPriority::HIGH;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return 1; } virtual unsigned int getLoad() { return 5; }
private: private:
const string groupName; const string groupName;
@@ -399,7 +403,7 @@ public:
priority = CommandPriority::HIGH; priority = CommandPriority::HIGH;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return 1; } virtual unsigned int getLoad() { return 5; }
private: private:
const string groupName; const string groupName;
@@ -410,17 +414,19 @@ private:
class Explosion : public Command class Explosion : public Command
{ {
public: public:
Explosion(unsigned int intensity, Coords location, function<void(void)> callback = [](){}) : Explosion(unsigned int intensity, string explosionType, Coords location, function<void(void)> callback = [](){}) :
Command(callback), Command(callback),
location(location), location(location),
intensity(intensity) intensity(intensity),
explosionType(explosionType)
{ {
priority = CommandPriority::MEDIUM; priority = CommandPriority::MEDIUM;
}; };
virtual string getString(); virtual string getString();
virtual unsigned int getLoad() { return 4; } virtual unsigned int getLoad() { return 5; }
private: private:
const Coords location; const Coords location;
const unsigned int intensity; const unsigned int intensity;
const string explosionType;
}; };

View File

@@ -13,13 +13,17 @@ namespace DataIndex {
country, country,
name, name,
unitName, unitName,
callsign,
groupName, groupName,
state, state,
task, task,
hasTask, hasTask,
position, position,
speed, speed,
horizontalVelocity,
verticalVelocity,
heading, heading,
track,
isActiveTanker, isActiveTanker,
isActiveAWACS, isActiveAWACS,
onOff, onOff,
@@ -44,6 +48,9 @@ namespace DataIndex {
activePath, activePath,
isLeader, isLeader,
operateAs, operateAs,
shotsScatter,
shotsIntensity,
health,
lastIndex, lastIndex,
endOfData = 255 endOfData = 255
}; };
@@ -73,6 +80,28 @@ namespace State
}; };
}; };
namespace ShotsScatter
{
enum ShotsScatters
{
NONE = 0,
HIGH,
MEDIUM,
LOW
};
};
namespace ShotsIntensity
{
enum ShotsIntensities
{
NONE = 0,
LOW,
MEDIUM,
HIGH
};
};
#pragma pack(push, 1) #pragma pack(push, 1)
namespace DataTypes { namespace DataTypes {
struct TACAN struct TACAN
@@ -124,6 +153,7 @@ struct SpawnOptions {
string unitType; string unitType;
Coords location; Coords location;
string loadout; string loadout;
string skill;
string liveryID; string liveryID;
}; };

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "unit.h" #include "unit.h"
#define GROUND_DEST_DIST_THR 100 #define GROUND_DEST_DIST_THR 10
class GroundUnit : public Unit class GroundUnit : public Unit
{ {
@@ -17,6 +17,8 @@ public:
virtual void setOnOff(bool newOnOff, bool force = false); virtual void setOnOff(bool newOnOff, bool force = false);
virtual void setFollowRoads(bool newFollowRoads, bool force = false); virtual void setFollowRoads(bool newFollowRoads, bool force = false);
void aimAtPoint(Coords aimTarget);
protected: protected:
virtual void AIloop(); virtual void AIloop();
static json::value database; static json::value database;

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include "airunit.h" #include "airunit.h"
#define HELICOPTER_DEST_DIST_THR 500 // Meters
class Helicopter : public AirUnit class Helicopter : public AirUnit
{ {
public: public:
@@ -11,6 +13,8 @@ public:
virtual void changeSpeed(string change); virtual void changeSpeed(string change);
virtual void changeAltitude(string change); virtual void changeAltitude(string change);
virtual double getDestinationReachedThreshold() { return HELICOPTER_DEST_DIST_THR; }
protected: protected:
static json::value database; static json::value database;
}; };

View File

@@ -24,7 +24,7 @@ public:
void setEras(vector<string> newEras) { eras = newEras; } void setEras(vector<string> newEras) { eras = newEras; }
void setCommandModeOptions(json::value newOptions); void setCommandModeOptions(json::value newOptions);
int getFrameRate() { return frameRate; }; int getFrameRate() { return static_cast<int>(round(frameRate)); };
int getLoad(); int getLoad();
bool getRestrictSpawns() { return restrictSpawns; } bool getRestrictSpawns() { return restrictSpawns; }
bool getRestrictToCoalition() { return restrictToCoalition; } bool getRestrictToCoalition() { return restrictToCoalition; }
@@ -37,8 +37,8 @@ public:
private: private:
list<Command*> commands; list<Command*> commands;
list<string> executedCommandsHashes; list<string> executedCommandsHashes;
unsigned int load; unsigned int load = 0;
double frameRate; double frameRate = 0;
bool restrictSpawns = false; bool restrictSpawns = false;
bool restrictToCoalition = false; bool restrictToCoalition = false;

View File

@@ -5,7 +5,11 @@
function Olympus.protectedCall(...)\n\n \ function Olympus.protectedCall(...)\n\n \
local status, retval = pcall(...)\n \ local status, retval = pcall(...)\n \
if not status then\n \ if not status then\n \
trigger.action.outText(\"ERROR: \" ..retval, 20)\n \ if Olympus.log ~= nil then\n \
Olympus.log:error(retval)\n \
else\n \
trigger.action.outText(\"Olympus critical error: \" ..retval, 20)\n \
end\n \
end\n \ end\n \
end\n \ end\n \
trigger.action.outText(\"Olympus.protectedCall registered successfully\", 10)\n" trigger.action.outText(\"Olympus.protectedCall registered successfully\", 10)\n"

View File

@@ -3,7 +3,6 @@
#include "utils.h" #include "utils.h"
#include "dcstools.h" #include "dcstools.h"
#include "luatools.h" #include "luatools.h"
#include "measure.h"
#include "logger.h" #include "logger.h"
#include "commands.h" #include "commands.h"
#include "datatypes.h" #include "datatypes.h"
@@ -20,12 +19,12 @@ public:
~Unit(); ~Unit();
/********** Methods **********/ /********** Methods **********/
void initialize(json::value json); virtual void initialize(json::value json) final;
virtual void setDefaults(bool force = false); virtual void setDefaults(bool force = false);
void runAILoop(); void runAILoop();
void update(json::value json, double dt); virtual void update(json::value json, double dt) final;
void refreshLeaderData(unsigned long long time); void refreshLeaderData(unsigned long long time);
unsigned int getID() { return ID; } unsigned int getID() { return ID; }
@@ -55,6 +54,8 @@ public:
bool checkTaskFailed(); bool checkTaskFailed();
void resetTaskFailedCounter(); void resetTaskFailedCounter();
void setHasTaskAssigned(bool newHasTaskAssigned); void setHasTaskAssigned(bool newHasTaskAssigned);
void setEnableTaskCheckFailed(bool newEnableTaskCheckFailed) { enableTaskFailedCheck = newEnableTaskCheckFailed; }
bool getEnableTaskCheckFailed() { return enableTaskFailedCheck; }
void triggerUpdate(unsigned char datumIndex); void triggerUpdate(unsigned char datumIndex);
@@ -70,13 +71,17 @@ public:
virtual void setCountry(unsigned char newValue) { updateValue(country, newValue, DataIndex::country); } virtual void setCountry(unsigned char newValue) { updateValue(country, newValue, DataIndex::country); }
virtual void setName(string newValue) { updateValue(name, newValue, DataIndex::name); } virtual void setName(string newValue) { updateValue(name, newValue, DataIndex::name); }
virtual void setUnitName(string newValue) { updateValue(unitName, newValue, DataIndex::unitName); } virtual void setUnitName(string newValue) { updateValue(unitName, newValue, DataIndex::unitName); }
virtual void setCallsign(string newValue) { updateValue(callsign, newValue, DataIndex::callsign); }
virtual void setGroupName(string newValue) { updateValue(groupName, newValue, DataIndex::groupName); } virtual void setGroupName(string newValue) { updateValue(groupName, newValue, DataIndex::groupName); }
virtual void setState(unsigned char newValue) { updateValue(state, newValue, DataIndex::state); }; virtual void setState(unsigned char newValue) { updateValue(state, newValue, DataIndex::state); };
virtual void setTask(string newValue) { updateValue(task, newValue, DataIndex::task); } virtual void setTask(string newValue) { updateValue(task, newValue, DataIndex::task); }
virtual void setHasTask(bool newValue) { updateValue(hasTask, newValue, DataIndex::hasTask); } virtual void setHasTask(bool newValue);
virtual void setPosition(Coords newValue) { updateValue(position, newValue, DataIndex::position); } virtual void setPosition(Coords newValue) { updateValue(position, newValue, DataIndex::position); }
virtual void setSpeed(double newValue) { updateValue(speed, newValue, DataIndex::speed); } virtual void setSpeed(double newValue) { updateValue(speed, newValue, DataIndex::speed); }
virtual void setHorizontalVelocity(double newValue) { updateValue(horizontalVelocity, newValue, DataIndex::horizontalVelocity); }
virtual void setVerticalVelocity(double newValue) { updateValue(verticalVelocity, newValue, DataIndex::verticalVelocity); }
virtual void setHeading(double newValue) { updateValue(heading, newValue, DataIndex::heading); } virtual void setHeading(double newValue) { updateValue(heading, newValue, DataIndex::heading); }
virtual void setTrack(double newValue) { updateValue(track, newValue, DataIndex::track); }
virtual void setIsActiveTanker(bool newValue); virtual void setIsActiveTanker(bool newValue);
virtual void setIsActiveAWACS(bool newValue); virtual void setIsActiveAWACS(bool newValue);
virtual void setOnOff(bool newValue, bool force = false) { updateValue(onOff, newValue, DataIndex::onOff); }; virtual void setOnOff(bool newValue, bool force = false) { updateValue(onOff, newValue, DataIndex::onOff); };
@@ -101,6 +106,9 @@ public:
virtual void setActivePath(list<Coords> newValue); virtual void setActivePath(list<Coords> newValue);
virtual void setIsLeader(bool newValue) { updateValue(isLeader, newValue, DataIndex::isLeader); } virtual void setIsLeader(bool newValue) { updateValue(isLeader, newValue, DataIndex::isLeader); }
virtual void setOperateAs(unsigned char newValue) { updateValue(operateAs, newValue, DataIndex::operateAs); } virtual void setOperateAs(unsigned char newValue) { updateValue(operateAs, newValue, DataIndex::operateAs); }
virtual void setShotsScatter(unsigned char newValue) { updateValue(shotsScatter, newValue, DataIndex::shotsScatter); }
virtual void setShotsIntensity(unsigned char newValue) { updateValue(shotsIntensity, newValue, DataIndex::shotsIntensity); }
virtual void setHealth(unsigned char newValue) { updateValue(health, newValue, DataIndex::health); }
/********** Getters **********/ /********** Getters **********/
virtual string getCategory() { return category; }; virtual string getCategory() { return category; };
@@ -110,6 +118,7 @@ public:
virtual unsigned char getCoalition() { return coalition; } virtual unsigned char getCoalition() { return coalition; }
virtual unsigned char getCountry() { return country; } virtual unsigned char getCountry() { return country; }
virtual string getName() { return name; } virtual string getName() { return name; }
virtual string getCallsign() { return callsign; }
virtual string getUnitName() { return unitName; } virtual string getUnitName() { return unitName; }
virtual string getGroupName() { return groupName; } virtual string getGroupName() { return groupName; }
virtual unsigned char getState() { return state; } virtual unsigned char getState() { return state; }
@@ -117,7 +126,10 @@ public:
virtual bool getHasTask() { return hasTask; } virtual bool getHasTask() { return hasTask; }
virtual Coords getPosition() { return position; } virtual Coords getPosition() { return position; }
virtual double getSpeed() { return speed; } virtual double getSpeed() { return speed; }
virtual double getHorizontalVelocity() { return horizontalVelocity; }
virtual double getVerticalVelocity() { return verticalVelocity; }
virtual double getHeading() { return heading; } virtual double getHeading() { return heading; }
virtual double getTrack() { return track; }
virtual bool getIsActiveTanker() { return isActiveTanker; } virtual bool getIsActiveTanker() { return isActiveTanker; }
virtual bool getIsActiveAWACS() { return isActiveAWACS; } virtual bool getIsActiveAWACS() { return isActiveAWACS; }
virtual bool getOnOff() { return onOff; }; virtual bool getOnOff() { return onOff; };
@@ -138,10 +150,13 @@ public:
virtual DataTypes::Radio getRadio() { return radio; } virtual DataTypes::Radio getRadio() { return radio; }
virtual DataTypes::GeneralSettings getGeneralSettings() { return generalSettings; } virtual DataTypes::GeneralSettings getGeneralSettings() { return generalSettings; }
virtual vector<DataTypes::Ammo> getAmmo() { return ammo; } virtual vector<DataTypes::Ammo> getAmmo() { return ammo; }
virtual vector<DataTypes::Contact> getTargets() { return contacts; } virtual vector<DataTypes::Contact> getContacts() { return contacts; }
virtual list<Coords> getActivePath() { return activePath; } virtual list<Coords> getActivePath() { return activePath; }
virtual bool getIsLeader() { return isLeader; } virtual bool getIsLeader() { return isLeader; }
virtual unsigned char getOperateAs() { return operateAs; } virtual unsigned char getOperateAs() { return operateAs; }
virtual unsigned char getShotsScatter() { return shotsScatter; }
virtual unsigned char getShotsIntensity() { return shotsIntensity; }
virtual unsigned char getHealth() { return health; }
protected: protected:
unsigned int ID; unsigned int ID;
@@ -154,13 +169,17 @@ protected:
unsigned char country = NULL; unsigned char country = NULL;
string name = ""; string name = "";
string unitName = ""; string unitName = "";
string callsign = "";
string groupName = ""; string groupName = "";
unsigned char state = State::NONE; unsigned char state = State::NONE;
string task = ""; string task = "";
bool hasTask = false; bool hasTask = false;
Coords position = Coords(NULL); Coords position = Coords(NULL);
double speed = NULL; double speed = NULL;
double horizontalVelocity = NULL;
double verticalVelocity = NULL;
double heading = NULL; double heading = NULL;
double track = NULL;
bool isActiveTanker = false; bool isActiveTanker = false;
bool isActiveAWACS = false; bool isActiveAWACS = false;
bool onOff = true; bool onOff = true;
@@ -186,20 +205,25 @@ protected:
bool isLeader = false; bool isLeader = false;
unsigned char operateAs = 2; unsigned char operateAs = 2;
Coords activeDestination = Coords(NULL); Coords activeDestination = Coords(NULL);
unsigned char shotsScatter = 2;
unsigned char shotsIntensity = 2;
unsigned char health = 100;
/********** Other **********/ /********** Other **********/
unsigned int taskCheckCounter = 0; unsigned int taskCheckCounter = 0;
unsigned int internalCounter = 0; unsigned int internalCounter = 0;
Unit* missOnPurposeTarget = nullptr;
bool hasTaskAssigned = false; bool hasTaskAssigned = false;
double initialFuel = 0; double initialFuel = 0;
map<unsigned char, unsigned long long> updateTimeMap; map<unsigned char, unsigned long long> updateTimeMap;
unsigned long long lastLoopTime = 0; unsigned long long lastLoopTime = 0;
bool enableTaskFailedCheck = false;
/********** Private methods **********/ /********** Private methods **********/
virtual void AIloop() = 0; virtual void AIloop() = 0;
void appendString(stringstream& ss, const unsigned char& datumIndex, const string& datumValue) { void appendString(stringstream& ss, const unsigned char& datumIndex, const string& datumValue) {
const unsigned short size = datumValue.size(); const unsigned short size = static_cast<unsigned short>(datumValue.size());
ss.write((const char*)&datumIndex, sizeof(unsigned char)); ss.write((const char*)&datumIndex, sizeof(unsigned char));
ss.write((const char*)&size, sizeof(unsigned short)); ss.write((const char*)&size, sizeof(unsigned short));
ss << datumValue; ss << datumValue;
@@ -224,7 +248,7 @@ protected:
template <typename T> template <typename T>
void appendVector(stringstream& ss, const unsigned char& datumIndex, vector<T>& datumValue) { void appendVector(stringstream& ss, const unsigned char& datumIndex, vector<T>& datumValue) {
const unsigned short size = datumValue.size(); const unsigned short size = static_cast<unsigned short>(datumValue.size());
ss.write((const char*)&datumIndex, sizeof(unsigned char)); ss.write((const char*)&datumIndex, sizeof(unsigned char));
ss.write((const char*)&size, sizeof(unsigned short)); ss.write((const char*)&size, sizeof(unsigned short));
@@ -234,7 +258,7 @@ protected:
template <typename T> template <typename T>
void appendList(stringstream& ss, const unsigned char& datumIndex, list<T>& datumValue) { void appendList(stringstream& ss, const unsigned char& datumIndex, list<T>& datumValue) {
const unsigned short size = datumValue.size(); const unsigned short size = static_cast<unsigned short>(datumValue.size());;
ss.write((const char*)&datumIndex, sizeof(unsigned char)); ss.write((const char*)&datumIndex, sizeof(unsigned char));
ss.write((const char*)&size, sizeof(unsigned short)); ss.write((const char*)&size, sizeof(unsigned short));

View File

@@ -20,10 +20,11 @@ public:
void update(json::value& missionData, double dt); void update(json::value& missionData, double dt);
void runAILoop(); void runAILoop();
void getUnitData(stringstream &ss, unsigned long long time); void getUnitData(stringstream &ss, unsigned long long time);
void deleteUnit(unsigned int ID, bool explosion, bool immediate); void deleteUnit(unsigned int ID, bool explosion, string explosionType, bool immediate);
void acquireControl(unsigned int ID); void acquireControl(unsigned int ID);
void loadDatabases(); void loadDatabases();
Unit* getClosestUnit(Unit* unit, unsigned char coalition, vector<string> categories, double &distance); Unit* getClosestUnit(Unit* unit, unsigned char coalition, vector<string> categories, double &distance);
map<Unit*, double> getUnitsInRange(Unit* unit, unsigned char coalition, vector<string> categories, double range);
private: private:
map<unsigned int, Unit*> units; map<unsigned int, Unit*> units;

View File

@@ -3,7 +3,6 @@
#include "utils.h" #include "utils.h"
#include "dcstools.h" #include "dcstools.h"
#include "luatools.h" #include "luatools.h"
#include "measure.h"
#include "logger.h" #include "logger.h"
#include "commands.h" #include "commands.h"
#include "datatypes.h" #include "datatypes.h"
@@ -60,7 +59,7 @@ protected:
/********** Private methods **********/ /********** Private methods **********/
void appendString(stringstream& ss, const unsigned char& datumIndex, const string& datumValue) { void appendString(stringstream& ss, const unsigned char& datumIndex, const string& datumValue) {
const unsigned short size = datumValue.size(); const unsigned short size = static_cast<unsigned short>(datumValue.size());
ss.write((const char*)&datumIndex, sizeof(unsigned char)); ss.write((const char*)&datumIndex, sizeof(unsigned char));
ss.write((const char*)&size, sizeof(unsigned short)); ss.write((const char*)&size, sizeof(unsigned short));
ss << datumValue; ss << datumValue;

14
backend/core/resource.h Normal file
View File

@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by core.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -12,24 +12,18 @@ using namespace GeographicLib;
extern Scheduler* scheduler; extern Scheduler* scheduler;
extern UnitsManager* unitsManager; extern UnitsManager* unitsManager;
json::value Aircraft::database = json::value(); json::value Aircraft::database = json::value();
extern string instancePath;
void Aircraft::loadDatabase(string path) { void Aircraft::loadDatabase(string path) {
char* buf = nullptr; std::ifstream ifstream(instancePath + path);
size_t sz = 0; std::stringstream ss;
if (_dupenv_s(&buf, &sz, "DCSOLYMPUS_PATH") == 0 && buf != nullptr) ss << ifstream.rdbuf();
{ std::error_code errorCode;
std::ifstream ifstream(string(buf) + path); database = json::value::parse(ss.str(), errorCode);
std::stringstream ss; if (database.is_object())
ss << ifstream.rdbuf(); log("Aircrafts database loaded correctly from " + instancePath + path);
std::error_code errorCode; else
database = json::value::parse(ss.str(), errorCode); log("Error reading Aircrafts database file");
if (database.is_object())
log("Aircrafts database loaded correctly");
else
log("Error reading Aircrafts database file");
free(buf);
}
} }
/* Aircraft */ /* Aircraft */
@@ -40,7 +34,6 @@ Aircraft::Aircraft(json::value json, unsigned int ID) : AirUnit(json, ID)
setCategory("Aircraft"); setCategory("Aircraft");
setDesiredSpeed(knotsToMs(300)); setDesiredSpeed(knotsToMs(300));
setDesiredAltitude(ftToM(20000)); setDesiredAltitude(ftToM(20000));
}; };
void Aircraft::changeSpeed(string change) void Aircraft::changeSpeed(string change)
@@ -54,11 +47,6 @@ void Aircraft::changeSpeed(string change)
if (getDesiredSpeed() < knotsToMs(50)) if (getDesiredSpeed() < knotsToMs(50))
setDesiredSpeed(knotsToMs(50)); setDesiredSpeed(knotsToMs(50));
if (state == State::IDLE)
resetTask();
else
goToDestination(); /* Send the command to reach the destination */
} }
void Aircraft::changeAltitude(string change) void Aircraft::changeAltitude(string change)
@@ -75,14 +63,9 @@ void Aircraft::changeAltitude(string change)
if (getDesiredAltitude() > 5000) if (getDesiredAltitude() > 5000)
setDesiredAltitude(getDesiredAltitude() + ftToM(2500)); setDesiredAltitude(getDesiredAltitude() + ftToM(2500));
else if (getDesiredAltitude() >= 0) else if (getDesiredAltitude() >= 0)
setDesiredAltitude(getDesiredAltitude() + ftToM(500)); setDesiredAltitude(getDesiredAltitude() + ftToM(500));
} }
if (getDesiredAltitude() < 0) if (getDesiredAltitude() < 0)
setDesiredAltitude(0); setDesiredAltitude(0);
if (state == State::IDLE)
resetTask();
else
goToDestination(); /* Send the command to reach the destination */
} }

View File

@@ -40,6 +40,8 @@ void AirUnit::setDefaults(bool force)
void AirUnit::setState(unsigned char newState) void AirUnit::setState(unsigned char newState)
{ {
Coords currentTargetPosition = getTargetPosition();
/************ Perform any action required when LEAVING a state ************/ /************ Perform any action required when LEAVING a state ************/
if (newState != state) { if (newState != state) {
switch (state) { switch (state) {
@@ -80,15 +82,18 @@ void AirUnit::setState(unsigned char newState)
/************ Perform any action required when ENTERING a state ************/ /************ Perform any action required when ENTERING a state ************/
switch (newState) { switch (newState) {
case State::IDLE: { case State::IDLE: {
setEnableTaskCheckFailed(false);
clearActivePath(); clearActivePath();
resetActiveDestination(); resetActiveDestination();
break; break;
} }
case State::REACH_DESTINATION: { case State::REACH_DESTINATION: {
setEnableTaskCheckFailed(true);
resetActiveDestination(); resetActiveDestination();
break; break;
} }
case State::ATTACK: { case State::ATTACK: {
setEnableTaskCheckFailed(true);
if (isTargetAlive()) { if (isTargetAlive()) {
Unit* target = unitsManager->getUnit(targetID); Unit* target = unitsManager->getUnit(targetID);
Coords targetPosition = Coords(target->getPosition().lat, target->getPosition().lng, 0); Coords targetPosition = Coords(target->getPosition().lat, target->getPosition().lng, 0);
@@ -99,36 +104,34 @@ void AirUnit::setState(unsigned char newState)
break; break;
} }
case State::FOLLOW: { case State::FOLLOW: {
setEnableTaskCheckFailed(true);
clearActivePath(); clearActivePath();
resetActiveDestination(); resetActiveDestination();
break; break;
} }
case State::LAND: { case State::LAND: {
setEnableTaskCheckFailed(false);
resetActiveDestination(); resetActiveDestination();
break; break;
} }
case State::REFUEL: { case State::REFUEL: {
setEnableTaskCheckFailed(true);
initialFuel = fuel; initialFuel = fuel;
clearActivePath(); clearActivePath();
resetActiveDestination(); resetActiveDestination();
break; break;
} }
case State::BOMB_POINT: { case State::BOMB_POINT:
clearActivePath(); case State::CARPET_BOMB:
resetActiveDestination();
break;
}
case State::CARPET_BOMB: {
clearActivePath();
resetActiveDestination();
break;
}
case State::BOMB_BUILDING: { case State::BOMB_BUILDING: {
setTargetPosition(currentTargetPosition);
setEnableTaskCheckFailed(true);
clearActivePath(); clearActivePath();
resetActiveDestination(); resetActiveDestination();
break; break;
} }
case State::LAND_AT_POINT: { case State::LAND_AT_POINT: {
setEnableTaskCheckFailed(true);
resetActiveDestination(); resetActiveDestination();
break; break;
} }
@@ -136,16 +139,21 @@ void AirUnit::setState(unsigned char newState)
break; break;
} }
resetTask(); setHasTask(false);
resetTaskFailedCounter();
log(unitName + " setting state from " + to_string(state) + " to " + to_string(newState)); log(unitName + " setting state from " + to_string(state) + " to " + to_string(newState));
state = newState; state = newState;
triggerUpdate(DataIndex::state); triggerUpdate(DataIndex::state);
AIloop();
} }
void AirUnit::AIloop() void AirUnit::AIloop()
{ {
srand(static_cast<unsigned int>(time(NULL)) + ID);
/* State machine */ /* State machine */
switch (state) { switch (state) {
case State::IDLE: { case State::IDLE: {
@@ -208,7 +216,7 @@ void AirUnit::AIloop()
goToDestination(enrouteTask); goToDestination(enrouteTask);
} }
else { else {
if (isDestinationReached(AIR_DEST_DIST_THR)) { if (isDestinationReached(getDestinationReachedThreshold())) {
if (updateActivePath(looping) && setActiveDestination()) if (updateActivePath(looping) && setActiveDestination())
goToDestination(enrouteTask); goToDestination(enrouteTask);
else else

View File

@@ -9,7 +9,6 @@ extern UnitsManager* unitsManager;
/* Move command */ /* Move command */
string Move::getString() string Move::getString()
{ {
std::ostringstream commandSS; std::ostringstream commandSS;
commandSS.precision(10); commandSS.precision(10);
commandSS << "Olympus.move, " commandSS << "Olympus.move, "
@@ -47,7 +46,9 @@ string SpawnGroundUnits::getString()
<< "unitType = " << "\"" << spawnOptions[i].unitType << "\"" << ", " << "unitType = " << "\"" << spawnOptions[i].unitType << "\"" << ", "
<< "lat = " << spawnOptions[i].location.lat << ", " << "lat = " << spawnOptions[i].location.lat << ", "
<< "lng = " << spawnOptions[i].location.lng << ", " << "lng = " << spawnOptions[i].location.lng << ", "
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << " }, "; << "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << ", "
<< "skill = \"" << spawnOptions[i].skill << "\"" << "}, ";
} }
std::ostringstream commandSS; std::ostringstream commandSS;
@@ -71,7 +72,8 @@ string SpawnNavyUnits::getString()
<< "unitType = " << "\"" << spawnOptions[i].unitType << "\"" << ", " << "unitType = " << "\"" << spawnOptions[i].unitType << "\"" << ", "
<< "lat = " << spawnOptions[i].location.lat << ", " << "lat = " << spawnOptions[i].location.lat << ", "
<< "lng = " << spawnOptions[i].location.lng << ", " << "lng = " << spawnOptions[i].location.lng << ", "
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << " }, "; << "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << ", "
<< "skill = \"" << spawnOptions[i].skill << "\"" << "}, ";
} }
std::ostringstream commandSS; std::ostringstream commandSS;
@@ -96,7 +98,8 @@ string SpawnAircrafts::getString()
<< "lng = " << spawnOptions[i].location.lng << ", " << "lng = " << spawnOptions[i].location.lng << ", "
<< "alt = " << spawnOptions[i].location.alt << ", " << "alt = " << spawnOptions[i].location.alt << ", "
<< "loadout = \"" << spawnOptions[i].loadout << "\"" << ", " << "loadout = \"" << spawnOptions[i].loadout << "\"" << ", "
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << " }, "; << "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << ", "
<< "skill = \"" << spawnOptions[i].skill << "\"" << "}, ";
} }
std::ostringstream commandSS; std::ostringstream commandSS;
@@ -123,7 +126,8 @@ string SpawnHelicopters::getString()
<< "lng = " << spawnOptions[i].location.lng << ", " << "lng = " << spawnOptions[i].location.lng << ", "
<< "alt = " << spawnOptions[i].location.alt << ", " << "alt = " << spawnOptions[i].location.alt << ", "
<< "loadout = \"" << spawnOptions[i].loadout << "\"" << ", " << "loadout = \"" << spawnOptions[i].loadout << "\"" << ", "
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << " }, "; << "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << ", "
<< "skill = \"" << spawnOptions[i].skill << "\"" << "}, ";
} }
std::ostringstream commandSS; std::ostringstream commandSS;
@@ -165,7 +169,8 @@ string Delete::getString()
commandSS.precision(10); commandSS.precision(10);
commandSS << "Olympus.delete, " commandSS << "Olympus.delete, "
<< ID << ", " << ID << ", "
<< (explosion ? "true" : "false"); << (explosion ? "true" : "false") << ", "
<< "\"" << explosionType << "\"";
return commandSS.str(); return commandSS.str();
} }
@@ -244,6 +249,7 @@ string Explosion::getString()
commandSS.precision(10); commandSS.precision(10);
commandSS << "Olympus.explosion, " commandSS << "Olympus.explosion, "
<< intensity << ", " << intensity << ", "
<< "\"" << explosionType << "\"" << ", "
<< location.lat << ", " << location.lat << ", "
<< location.lng; << location.lng;
return commandSS.str(); return commandSS.str();

View File

@@ -25,6 +25,7 @@ json::value missionData = json::value::object();
mutex mutexLock; mutex mutexLock;
string sessionHash; string sessionHash;
string instancePath;
bool initialized = false; bool initialized = false;
@@ -51,9 +52,16 @@ extern "C" DllExport int coreDeinit(lua_State* L)
} }
/* Called when DCS simulation starts. All singletons are instantiated, and the custom Lua functions are registered in the Lua state. */ /* Called when DCS simulation starts. All singletons are instantiated, and the custom Lua functions are registered in the Lua state. */
extern "C" DllExport int coreInit(lua_State* L) extern "C" DllExport int coreInit(lua_State* L, const char* path)
{ {
instancePath = path;
log("Initializing core.dll with instance path " + instancePath);
sessionHash = random_string(16); sessionHash = random_string(16);
log("Random session hash " + sessionHash);
unitsManager = new UnitsManager(L); unitsManager = new UnitsManager(L);
weaponsManager = new WeaponsManager(L); weaponsManager = new WeaponsManager(L);
server = new Server(L); server = new Server(L);
@@ -80,7 +88,7 @@ extern "C" DllExport int coreFrame(lua_State* L)
frameCounter++; frameCounter++;
const std::chrono::duration<double> executionDuration = std::chrono::system_clock::now() - lastExecution; const std::chrono::duration<double> executionDuration = std::chrono::system_clock::now() - lastExecution;
if (executionDuration.count() > FRAMERATE_TIME_INTERVAL) { if (executionDuration.count() > (20 * FRAMERATE_TIME_INTERVAL)) {
if (executionDuration.count() > 0) { if (executionDuration.count() > 0) {
scheduler->setFrameRate(frameCounter / executionDuration.count()); scheduler->setFrameRate(frameCounter / executionDuration.count());
frameCounter = 0; frameCounter = 0;

View File

@@ -0,0 +1,566 @@
#include "groundunit.h"
#include "utils.h"
#include "logger.h"
#include "commands.h"
#include "scheduler.h"
#include "defines.h"
#include "unitsmanager.h"
#include <GeographicLib/Geodesic.hpp>
using namespace GeographicLib;
extern Scheduler* scheduler;
extern UnitsManager* unitsManager;
json::value GroundUnit::database = json::value();
extern string instancePath;
#define RANDOM_ZERO_TO_ONE (double)(rand()) / (double)(RAND_MAX)
#define RANDOM_MINUS_ONE_TO_ONE (((double)(rand()) / (double)(RAND_MAX) - 0.5) * 2)
void GroundUnit::loadDatabase(string path) {
std::ifstream ifstream(instancePath + path);
std::stringstream ss;
ss << ifstream.rdbuf();
std::error_code errorCode;
database = json::value::parse(ss.str(), errorCode);
if (database.is_object())
log("GroundUnits database loaded correctly from " + instancePath + path);
else
log("Error reading GroundUnits database file");
}
/* Ground unit */
GroundUnit::GroundUnit(json::value json, unsigned int ID) : Unit(json, ID)
{
log("New Ground Unit created with ID: " + to_string(ID));
setCategory("GroundUnit");
setDesiredSpeed(10);
};
void GroundUnit::setDefaults(bool force)
{
if (!getAlive() || !getControlled() || getHuman() || !getIsLeader()) return;
/* Set the default IDLE state */
setState(State::IDLE);
/* Set the default options */
setROE(ROE::WEAPON_FREE, force);
setOnOff(onOff, force);
setFollowRoads(followRoads, force);
}
void GroundUnit::setState(unsigned char newState)
{
Coords currentTargetPosition = getTargetPosition();
/************ Perform any action required when LEAVING a state ************/
if (newState != state) {
switch (state) {
case State::IDLE: {
break;
}
case State::REACH_DESTINATION: {
break;
}
case State::ATTACK: {
setTargetID(NULL);
break;
}
case State::FIRE_AT_AREA:
case State::SIMULATE_FIRE_FIGHT:
case State::SCENIC_AAA:
case State::MISS_ON_PURPOSE: {
setTargetPosition(Coords(NULL));
break;
}
default:
break;
}
}
/************ Perform any action required when ENTERING a state ************/
switch (newState) {
case State::IDLE: {
setEnableTaskCheckFailed(false);
clearActivePath();
resetActiveDestination();
break;
}
case State::REACH_DESTINATION: {
setEnableTaskCheckFailed(true);
resetActiveDestination();
break;
}
case State::ATTACK: {
setEnableTaskCheckFailed(true);
clearActivePath();
resetActiveDestination();
break;
}
case State::FIRE_AT_AREA: {
setTargetPosition(currentTargetPosition);
setEnableTaskCheckFailed(true);
clearActivePath();
resetActiveDestination();
break;
}
case State::SIMULATE_FIRE_FIGHT: {
setTargetPosition(currentTargetPosition);
setEnableTaskCheckFailed(false);
clearActivePath();
resetActiveDestination();
break;
}
case State::SCENIC_AAA: {
setEnableTaskCheckFailed(false);
clearActivePath();
resetActiveDestination();
break;
}
case State::MISS_ON_PURPOSE: {
setEnableTaskCheckFailed(false);
clearActivePath();
resetActiveDestination();
break;
}
default:
break;
}
setHasTask(false);
resetTaskFailedCounter();
log(unitName + " setting state from " + to_string(state) + " to " + to_string(newState));
state = newState;
triggerUpdate(DataIndex::state);
AIloop();
}
void GroundUnit::AIloop()
{
srand(static_cast<unsigned int>(time(NULL)) + ID);
switch (state) {
case State::IDLE: {
setTask("Idle");
if (getHasTask())
resetTask();
break;
}
case State::REACH_DESTINATION: {
setTask("Reaching destination");
string enrouteTask = "";
bool looping = false;
std::ostringstream taskSS;
taskSS << "{ id = 'FollowRoads', value = " << (getFollowRoads() ? "true" : "false") << " }";
enrouteTask = taskSS.str();
if (activeDestination == NULL || !getHasTask())
{
if (!setActiveDestination())
setState(State::IDLE);
else
goToDestination(enrouteTask);
}
else {
if (isDestinationReached(GROUND_DEST_DIST_THR)) {
if (updateActivePath(looping) && setActiveDestination())
goToDestination(enrouteTask);
else
setState(State::IDLE);
}
}
break;
}
case State::ATTACK: {
Unit* target = unitsManager->getUnit(getTargetID());
if (target != nullptr) {
setTask("Attacking " + target->getUnitName());
if (!getHasTask()) {
/* Send the command */
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'AttackUnit', unitID = " << target->getID() << " }";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
}
}
else {
setState(State::IDLE);
}
break;
}
case State::FIRE_AT_AREA: {
setTask("Firing at area");
if (!getHasTask()) {
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'FireAtPoint', lat = " << targetPosition.lat << ", lng = " << targetPosition.lng << ", radius = 100}";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
}
break;
}
case State::SIMULATE_FIRE_FIGHT: {
setTask("Simulating fire fight");
if (internalCounter == 0 && targetPosition != Coords(NULL) && scheduler->getLoad() < 30) {
/* Get the distance and bearing to the target */
Coords scatteredTargetPosition = targetPosition;
double distance;
double bearing1;
double bearing2;
Geodesic::WGS84().Inverse(getPosition().lat, getPosition().lng, scatteredTargetPosition.lat, scatteredTargetPosition.lng, distance, bearing1, bearing2);
/* Compute the scattered position applying a random scatter to the shot */
double scatterDistance = distance * tan(10 /* degs */ * (ShotsScatter::LOW - shotsScatter) / 57.29577 + 2 / 57.29577 /* degs */) * RANDOM_MINUS_ONE_TO_ONE;
Geodesic::WGS84().Direct(scatteredTargetPosition.lat, scatteredTargetPosition.lng, bearing1 + 90, scatterDistance, scatteredTargetPosition.lat, scatteredTargetPosition.lng);
/* Recover the data from the database */
double aimTime = 2; /* s */
bool indirectFire = false;
double shotsBaseInterval = 15; /* s */
if (database.has_object_field(to_wstring(name))) {
json::value databaseEntry = database[to_wstring(name)];
if (databaseEntry.has_number_field(L"aimTime"))
aimTime = databaseEntry[L"aimTime"].as_number().to_double();
if (databaseEntry.has_boolean_field(L"indirectFire"))
indirectFire = databaseEntry[L"indirectFire"].as_bool();
if (databaseEntry.has_number_field(L"shotsBaseInterval"))
shotsBaseInterval = databaseEntry[L"shotsBaseInterval"].as_number().to_double();
}
/* If the unit is of the indirect fire type, like a mortar, simply shoot at the target */
if (indirectFire) {
log(unitName + "(" + name + ")" + " simulating fire fight with indirect fire");
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'FireAtPoint', lat = " << scatteredTargetPosition.lat << ", lng = " << scatteredTargetPosition.lng << ", radius = 100}";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
}
/* Otherwise use the aim method */
else {
log(unitName + "(" + name + ")" + " simulating fire fight with aim at point method");
aimAtPoint(scatteredTargetPosition);
}
/* Wait an amout of time depending on the shots intensity */
internalCounter = static_cast<unsigned int>(((ShotsIntensity::HIGH - shotsIntensity) * shotsBaseInterval + aimTime) / FRAMERATE_TIME_INTERVAL);
}
if (targetPosition == Coords(NULL))
setState(State::IDLE);
/* Fallback if something went wrong */
if (internalCounter == 0)
internalCounter = static_cast<unsigned int>(3 / FRAMERATE_TIME_INTERVAL);
internalCounter--;
break;
}
case State::SCENIC_AAA: {
setTask("Scenic AAA");
/* Only perform scenic functions when the scheduler is "free" */
if (((!getHasTask() && scheduler->getLoad() < 30) || internalCounter == 0)) {
double distance = 0;
unsigned char unitCoalition = coalition == 0 ? getOperateAs() : coalition;
unsigned char targetCoalition = unitCoalition == 2 ? 1 : 2;
Unit* target = unitsManager->getClosestUnit(this, targetCoalition, { "Aircraft", "Helicopter" }, distance);
/* Recover the data from the database */
double aimTime = 2; /* s */
double shotsBaseInterval = 15; /* s */
if (database.has_object_field(to_wstring(name))) {
json::value databaseEntry = database[to_wstring(name)];
if (databaseEntry.has_number_field(L"aimTime"))
aimTime = databaseEntry[L"aimTime"].as_number().to_double();
if (databaseEntry.has_number_field(L"shotsBaseInterval"))
shotsBaseInterval = databaseEntry[L"shotsBaseInterval"].as_number().to_double();
}
/* Only run if an enemy air unit is closer than 20km to avoid useless load */
if (target != nullptr && distance < 20000 /* m */) {
double r = 15; /* m */
double barrelElevation = r * tan(acos(((double)(rand()) / (double)(RAND_MAX))));
double lat = 0;
double lng = 0;
double randomBearing = ((double)(rand()) / (double)(RAND_MAX)) * 360;
Geodesic::WGS84().Direct(position.lat, position.lng, randomBearing, r, lat, lng);
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'FireAtPoint', lat = " << lat << ", lng = " << lng << ", alt = " << position.alt + barrelElevation << ", radius = 0.001}";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
/* Wait an amout of time depending on the shots intensity */
internalCounter = static_cast<unsigned int>(((ShotsIntensity::HIGH - shotsIntensity) * shotsBaseInterval + aimTime) / FRAMERATE_TIME_INTERVAL);
}
}
if (internalCounter == 0)
internalCounter = static_cast<unsigned int>(3 / FRAMERATE_TIME_INTERVAL);
internalCounter--;
break;
}
case State::MISS_ON_PURPOSE: {
setTask("Missing on purpose");
/* Check that the unit can perform AAA duties */
bool canAAA = false;
if (database.has_object_field(to_wstring(name))) {
json::value databaseEntry = database[to_wstring(name)];
if (databaseEntry.has_boolean_field(L"canAAA"))
canAAA = databaseEntry[L"canAAA"].as_bool();
}
if (canAAA) {
/* Only perform scenic functions when the scheduler is "free" */
/* Only run this when the internal counter reaches 0 to avoid excessive computations when no nearby target */
if (scheduler->getLoad() < 30 && internalCounter == 0) {
double distance = 0;
unsigned char unitCoalition = coalition == 0 ? getOperateAs() : coalition;
unsigned char targetCoalition = unitCoalition == 2 ? 1 : 2;
/* Default gun values */
double barrelHeight = 1.0; /* m */
double muzzleVelocity = 860; /* m/s */
double aimTime = 10; /* s */
unsigned int shotsToFire = 10;
double shotsBaseInterval = 15; /* s */
double shotsBaseScatter = 2; /* degs */
double engagementRange = 10000; /* m */
double targetingRange = 0; /* m */
double aimMethodRange = 0; /* m */
double acquisitionRange = 0; /* m */
/* Load gun values from database */
if (database.has_object_field(to_wstring(name))) {
json::value databaseEntry = database[to_wstring(name)];
if (databaseEntry.has_number_field(L"barrelHeight"))
barrelHeight = databaseEntry[L"barrelHeight"].as_number().to_double();
if (databaseEntry.has_number_field(L"muzzleVelocity"))
muzzleVelocity = databaseEntry[L"muzzleVelocity"].as_number().to_double();
if (databaseEntry.has_number_field(L"aimTime"))
aimTime = databaseEntry[L"aimTime"].as_number().to_double();
if (databaseEntry.has_number_field(L"shotsToFire"))
shotsToFire = databaseEntry[L"shotsToFire"].as_number().to_uint32();
if (databaseEntry.has_number_field(L"engagementRange"))
engagementRange = databaseEntry[L"engagementRange"].as_number().to_double();
if (databaseEntry.has_number_field(L"shotsBaseInterval"))
shotsBaseInterval = databaseEntry[L"shotsBaseInterval"].as_number().to_double();
if (databaseEntry.has_number_field(L"shotsBaseScatter"))
shotsBaseScatter = databaseEntry[L"shotsBaseScatter"].as_number().to_double();
if (databaseEntry.has_number_field(L"targetingRange"))
targetingRange = databaseEntry[L"targetingRange"].as_number().to_double();
if (databaseEntry.has_number_field(L"aimMethodRange"))
aimMethodRange = databaseEntry[L"aimMethodRange"].as_number().to_double();
if (databaseEntry.has_number_field(L"acquisitionRange"))
acquisitionRange = databaseEntry[L"acquisitionRange"].as_number().to_double();
}
/* Get all the units in range and select one at random */
double range = max(max(engagementRange, aimMethodRange), acquisitionRange);
map<Unit*, double> targets = unitsManager->getUnitsInRange(this, targetCoalition, { "Aircraft", "Helicopter" }, range);
Unit* target = nullptr;
unsigned int index = static_cast<unsigned int>((RANDOM_ZERO_TO_ONE * (targets.size() - 1)));
for (auto const& p : targets) {
if (index-- == 0) {
target = p.first;
distance = p.second;
}
}
/* Only do if we have a valid target close enough for AAA */
if (target != nullptr) {
/* Approximate the flight time */
if (muzzleVelocity != 0)
aimTime += distance / muzzleVelocity;
/* If the target is in targeting range and we are in highest precision mode, target it */
if (distance < targetingRange && shotsScatter == ShotsScatter::LOW) {
/* Send the command */
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'AttackUnit', unitID = " << target->getID() << " }";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
internalCounter = static_cast<unsigned int>((aimTime + (ShotsIntensity::HIGH - shotsIntensity) * shotsBaseInterval + 2) / FRAMERATE_TIME_INTERVAL);
}
/* Else, do miss on purpose */
else {
/* Compute where the target will be in aimTime seconds, plus the effect of scatter. */
double scatterDistance = distance * tan(shotsBaseScatter * (ShotsScatter::LOW - shotsScatter) / 57.29577) * (RANDOM_ZERO_TO_ONE - 0.1);
double aimDistance = target->getHorizontalVelocity() * aimTime + scatterDistance;
double aimLat = 0;
double aimLng = 0;
Geodesic::WGS84().Direct(target->getPosition().lat, target->getPosition().lng, target->getTrack() * 57.29577, aimDistance, aimLat, aimLng); /* TODO make util to convert degrees and radians function */
double aimAlt = target->getPosition().alt + target->getVerticalVelocity() * aimTime + distance * tan(shotsBaseScatter * (ShotsScatter::LOW - shotsScatter) / 57.29577) * RANDOM_ZERO_TO_ONE; // Force to always miss high never low
/* Send the command */
if (distance < engagementRange) {
/* If the unit is closer than the engagement range, use the fire at point method */
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'FireAtPoint', lat = " << aimLat << ", lng = " << aimLng << ", alt = " << aimAlt << ", radius = 0.001, expendQty = " << shotsToFire << " }";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
setTargetPosition(Coords(aimLat, aimLng, target->getPosition().alt));
internalCounter = static_cast<unsigned int>((aimTime + (ShotsIntensity::HIGH - shotsIntensity) * shotsBaseInterval + 2) / FRAMERATE_TIME_INTERVAL);
}
else if (distance < aimMethodRange) {
/* If the unit is closer than the aim method range, use the aim method range */
aimAtPoint(Coords(aimLat, aimLng, aimAlt));
setTargetPosition(Coords(aimLat, aimLng, target->getPosition().alt));
internalCounter = static_cast<unsigned int>((aimTime + (ShotsIntensity::HIGH - shotsIntensity) * shotsBaseInterval + 2) / FRAMERATE_TIME_INTERVAL);
}
else {
/* Else just wake the unit up with an impossible command */
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'FireAtPoint', lat = " << 0 << ", lng = " << 0 << ", alt = " << 0 << ", radius = 0.001, expendQty = " << 0 << " }";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
setTargetPosition(Coords(NULL));
/* Don't wait too long before checking again */
internalCounter = static_cast<unsigned int>(5 / FRAMERATE_TIME_INTERVAL);
}
}
missOnPurposeTarget = target;
}
else {
if (getHasTask())
resetTask();
}
}
/* If no valid target was detected */
if (internalCounter == 0) {
double alertnessTimeConstant = 10; /* s */
if (database.has_object_field(to_wstring(name))) {
json::value databaseEntry = database[to_wstring(name)];
if (databaseEntry.has_number_field(L"alertnessTimeConstant"))
alertnessTimeConstant = databaseEntry[L"alertnessTimeConstant"].as_number().to_double();
}
internalCounter = static_cast<unsigned int>((5 + RANDOM_ZERO_TO_ONE * alertnessTimeConstant * 0 /* TODO: remove to enable alertness again */) / FRAMERATE_TIME_INTERVAL);
missOnPurposeTarget = nullptr;
setTargetPosition(Coords(NULL));
}
internalCounter--;
}
else {
setState(State::IDLE);
}
break;
}
default:
break;
}
}
void GroundUnit::aimAtPoint(Coords aimTarget) {
double dist;
double bearing1;
double bearing2;
Geodesic::WGS84().Inverse(position.lat, position.lng, aimTarget.lat, aimTarget.lng, dist, bearing1, bearing2);
/* Aim point distance */
double r = 15; /* m */
/* Default gun values */
double barrelHeight = 1.0; /* m */
double muzzleVelocity = 860; /* m/s */
double shotsBaseScatter = 5; /* degs */
if (database.has_object_field(to_wstring(name))) {
json::value databaseEntry = database[to_wstring(name)];
if (databaseEntry.has_number_field(L"barrelHeight") && databaseEntry.has_number_field(L"muzzleVelocity")) {
barrelHeight = databaseEntry[L"barrelHeight"].as_number().to_double();
muzzleVelocity = databaseEntry[L"muzzleVelocity"].as_number().to_double();
}
if (databaseEntry.has_number_field(L"shotsBaseScatter"))
shotsBaseScatter = databaseEntry[L"shotsBaseScatter"].as_number().to_double();
}
/* Compute the elevation angle of the gun*/
double deltaHeight = (aimTarget.alt - (position.alt + barrelHeight));
double alpha = 9.81 / 2 * dist * dist / (muzzleVelocity * muzzleVelocity);
double inner = dist * dist - 4 * alpha * (alpha + deltaHeight);
/* Check we can reach the target*/
if (inner > 0) {
/* Compute elevation and bearing */
double barrelElevation = r * (dist - sqrt(inner)) / (2 * alpha);
double lat = 0;
double lng = 0;
Geodesic::WGS84().Direct(position.lat, position.lng, bearing1, r, lat, lng);
log(unitName + "(" + name + ")" + " shooting with aim at point method. Barrel elevation: " + to_string(barrelElevation * 57.29577) + "°, bearing: " + to_string(bearing1) + "°");
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'FireAtPoint', lat = " << lat << ", lng = " << lng << ", alt = " << position.alt + barrelElevation + barrelHeight << ", radius = 0.001}";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
}
else {
log("Target out of range for " + unitName + "(" + name + ")");
}
}
void GroundUnit::changeSpeed(string change)
{
if (change.compare("stop") == 0)
setState(State::IDLE);
else if (change.compare("slow") == 0)
setDesiredSpeed(getDesiredSpeed() - knotsToMs(5));
else if (change.compare("fast") == 0)
setDesiredSpeed(getDesiredSpeed() + knotsToMs(5));
if (getDesiredSpeed() < 0)
setDesiredSpeed(0);
}
void GroundUnit::setOnOff(bool newOnOff, bool force)
{
if (newOnOff != onOff || force) {
Unit::setOnOff(newOnOff, force);
Command* command = dynamic_cast<Command*>(new SetOnOff(groupName, onOff));
scheduler->appendCommand(command);
}
}
void GroundUnit::setFollowRoads(bool newFollowRoads, bool force)
{
if (newFollowRoads != followRoads || force) {
Unit::setFollowRoads(newFollowRoads, force);
resetActiveDestination(); /* Reset active destination to apply option*/
}
}

View File

@@ -0,0 +1,71 @@
#include "helicopter.h"
#include "utils.h"
#include "logger.h"
#include "commands.h"
#include "scheduler.h"
#include "defines.h"
#include "unitsManager.h"
#include <GeographicLib/Geodesic.hpp>
using namespace GeographicLib;
extern Scheduler* scheduler;
extern UnitsManager* unitsManager;
json::value Helicopter::database = json::value();
extern string instancePath;
void Helicopter::loadDatabase(string path) {
std::ifstream ifstream(instancePath + path);
std::stringstream ss;
ss << ifstream.rdbuf();
std::error_code errorCode;
database = json::value::parse(ss.str(), errorCode);
if (database.is_object())
log("Helicopters database loaded correctly from " + instancePath + path);
else
log("Error reading Helicopters database file");
}
/* Helicopter */
Helicopter::Helicopter(json::value json, unsigned int ID) : AirUnit(json, ID)
{
log("New Helicopter created with ID: " + to_string(ID));
setCategory("Helicopter");
setDesiredSpeed(knotsToMs(100));
setDesiredAltitude(ftToM(5000));
};
void Helicopter::changeSpeed(string change)
{
if (change.compare("stop") == 0)
setState(State::IDLE);
else if (change.compare("slow") == 0)
setDesiredSpeed(getDesiredSpeed() - knotsToMs(10));
else if (change.compare("fast") == 0)
setDesiredSpeed(getDesiredSpeed() + knotsToMs(10));
if (getDesiredSpeed() < knotsToMs(0))
setDesiredSpeed(knotsToMs(0));
}
void Helicopter::changeAltitude(string change)
{
if (change.compare("descend") == 0)
{
if (getDesiredAltitude() > 100)
setDesiredAltitude(getDesiredAltitude() - ftToM(100));
else if (getDesiredAltitude() > 0)
setDesiredAltitude(getDesiredAltitude() - ftToM(10));
}
else if (change.compare("climb") == 0)
{
if (getDesiredAltitude() > 100)
setDesiredAltitude(getDesiredAltitude() + ftToM(100));
else if (getDesiredAltitude() >= 0)
setDesiredAltitude(getDesiredAltitude() + ftToM(10));
}
if (getDesiredAltitude() < 0)
setDesiredAltitude(0);
}

View File

@@ -12,24 +12,18 @@ using namespace GeographicLib;
extern Scheduler* scheduler; extern Scheduler* scheduler;
extern UnitsManager* unitsManager; extern UnitsManager* unitsManager;
json::value NavyUnit::database = json::value(); json::value NavyUnit::database = json::value();
extern string instancePath;
void NavyUnit::loadDatabase(string path) { void NavyUnit::loadDatabase(string path) {
char* buf = nullptr; std::ifstream ifstream(instancePath + path);
size_t sz = 0; std::stringstream ss;
if (_dupenv_s(&buf, &sz, "DCSOLYMPUS_PATH") == 0 && buf != nullptr) ss << ifstream.rdbuf();
{ std::error_code errorCode;
std::ifstream ifstream(string(buf) + path); database = json::value::parse(ss.str(), errorCode);
std::stringstream ss; if (database.is_object())
ss << ifstream.rdbuf(); log("NavyUnits database loaded correctly from " + instancePath + path);
std::error_code errorCode; else
database = json::value::parse(ss.str(), errorCode); log("Error reading NavyUnits database file");
if (database.is_object())
log("Navy Units database loaded correctly");
else
log("Error reading Navy Units database file");
free(buf);
}
} }
/* Navy Unit */ /* Navy Unit */
@@ -49,13 +43,15 @@ void NavyUnit::setDefaults(bool force)
setState(State::IDLE); setState(State::IDLE);
/* Set the default options */ /* Set the default options */
setROE(ROE::OPEN_FIRE_WEAPON_FREE, force); setROE(ROE::WEAPON_FREE, force);
setOnOff(onOff, force); setOnOff(onOff, force);
setFollowRoads(followRoads, force); setFollowRoads(followRoads, force);
} }
void NavyUnit::setState(unsigned char newState) void NavyUnit::setState(unsigned char newState)
{ {
Coords currentTargetPosition = getTargetPosition();
/************ Perform any action required when LEAVING a state ************/ /************ Perform any action required when LEAVING a state ************/
if (newState != state) { if (newState != state) {
switch (state) { switch (state) {
@@ -65,11 +61,14 @@ void NavyUnit::setState(unsigned char newState)
case State::REACH_DESTINATION: { case State::REACH_DESTINATION: {
break; break;
} }
case State::FIRE_AT_AREA: { case State::ATTACK: {
setTargetPosition(Coords(NULL)); setTargetID(NULL);
break; break;
} }
case State::SIMULATE_FIRE_FIGHT: { case State::FIRE_AT_AREA:
case State::SIMULATE_FIRE_FIGHT:
case State::SCENIC_AAA:
case State::MISS_ON_PURPOSE: {
setTargetPosition(Coords(NULL)); setTargetPosition(Coords(NULL));
break; break;
} }
@@ -81,41 +80,67 @@ void NavyUnit::setState(unsigned char newState)
/************ Perform any action required when ENTERING a state ************/ /************ Perform any action required when ENTERING a state ************/
switch (newState) { switch (newState) {
case State::IDLE: { case State::IDLE: {
setEnableTaskCheckFailed(false);
clearActivePath(); clearActivePath();
resetActiveDestination(); resetActiveDestination();
break; break;
} }
case State::REACH_DESTINATION: { case State::REACH_DESTINATION: {
setEnableTaskCheckFailed(true);
resetActiveDestination();
break;
}
case State::ATTACK: {
setEnableTaskCheckFailed(true);
clearActivePath();
resetActiveDestination(); resetActiveDestination();
break; break;
} }
case State::FIRE_AT_AREA: { case State::FIRE_AT_AREA: {
setTargetPosition(currentTargetPosition);
setEnableTaskCheckFailed(true);
clearActivePath(); clearActivePath();
resetActiveDestination(); resetActiveDestination();
resetTask();
break; break;
} }
case State::SIMULATE_FIRE_FIGHT: { case State::SIMULATE_FIRE_FIGHT: {
setTargetPosition(currentTargetPosition);
setEnableTaskCheckFailed(false);
clearActivePath();
resetActiveDestination();
break;
}
case State::SCENIC_AAA: {
setEnableTaskCheckFailed(false);
clearActivePath();
resetActiveDestination();
break;
}
case State::MISS_ON_PURPOSE: {
setEnableTaskCheckFailed(false);
clearActivePath(); clearActivePath();
resetActiveDestination(); resetActiveDestination();
resetTask();
break; break;
} }
default: default:
break; break;
} }
if (newState != state) setHasTask(false);
resetTask(); resetTaskFailedCounter();
log(unitName + " setting state from " + to_string(state) + " to " + to_string(newState)); log(unitName + " setting state from " + to_string(state) + " to " + to_string(newState));
state = newState; state = newState;
triggerUpdate(DataIndex::state); triggerUpdate(DataIndex::state);
AIloop();
} }
void NavyUnit::AIloop() void NavyUnit::AIloop()
{ {
srand(static_cast<unsigned int>(time(NULL)) + ID);
switch (state) { switch (state) {
case State::IDLE: { case State::IDLE: {
setTask("Idle"); setTask("Idle");
@@ -142,6 +167,28 @@ void NavyUnit::AIloop()
setState(State::IDLE); setState(State::IDLE);
} }
} }
break;
}
case State::ATTACK: {
Unit* target = unitsManager->getUnit(getTargetID());
if (target != nullptr) {
setTask("Attacking " + target->getUnitName());
if (!getHasTask()) {
/* Send the command */
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'AttackUnit', unitID = " << target->getID() << " }";
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
}
}
else {
setState(State::IDLE);
}
break; break;
} }
case State::FIRE_AT_AREA: { case State::FIRE_AT_AREA: {
@@ -156,19 +203,16 @@ void NavyUnit::AIloop()
scheduler->appendCommand(command); scheduler->appendCommand(command);
setHasTask(true); setHasTask(true);
} }
break;
} }
case State::SIMULATE_FIRE_FIGHT: { case State::SIMULATE_FIRE_FIGHT: {
setTask("Simulating fire fight"); setTask("Simulating fire fight");
if (!getHasTask()) { // TODO
std::ostringstream taskSS;
taskSS.precision(10);
taskSS << "{id = 'FireAtPoint', lat = " << targetPosition.lat << ", lng = " << targetPosition.lng << ", radius = 1}"; setState(State::IDLE);
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); })); break;
scheduler->appendCommand(command);
setHasTask(true);
}
} }
default: default:
break; break;

View File

@@ -7,12 +7,9 @@
extern UnitsManager* unitsManager; extern UnitsManager* unitsManager;
Scheduler::Scheduler(lua_State* L) : Scheduler::Scheduler(lua_State* L)
load(0)
{ {
LogInfo(L, "Scheduler constructor called successfully"); LogInfo(L, "Scheduler constructor called successfully");
} }
Scheduler::~Scheduler() Scheduler::~Scheduler()
@@ -20,6 +17,7 @@ Scheduler::~Scheduler()
} }
/* Appends a */
void Scheduler::appendCommand(Command* newCommand) void Scheduler::appendCommand(Command* newCommand)
{ {
for (auto command : commands) { for (auto command : commands) {
@@ -58,7 +56,13 @@ void Scheduler::execute(lua_State* L)
log("Error executing command " + commandString); log("Error executing command " + commandString);
else else
log("Command '" + commandString + "' executed correctly, current load " + to_string(getLoad())); log("Command '" + commandString + "' executed correctly, current load " + to_string(getLoad()));
load = command->getLoad();
/* Adjust the load depending on the fps */
double fpsMultiplier = 20;
if (getFrameRate() + 3 > 0)
fpsMultiplier = static_cast<unsigned int>(max(1, 60 / (getFrameRate() + 3))); /* Multiplier between 1 and 20 */
load = static_cast<unsigned int>(command->getLoad() * fpsMultiplier);
commands.remove(command); commands.remove(command);
executedCommandsHashes.push_back(command->getHash()); executedCommandsHashes.push_back(command->getHash());
command->executeCallback(); /* Execute the command callback (this is a lambda function that can be used to execute a function when the command is run) */ command->executeCallback(); /* Execute the command callback (this is a lambda function that can be used to execute a function when the command is run) */
@@ -84,7 +88,7 @@ void Scheduler::setCommandModeOptions(json::value value) {
setRedSpawnPoints(value[L"spawnPoints"][L"red"].as_number().to_int32()); setRedSpawnPoints(value[L"spawnPoints"][L"red"].as_number().to_int32());
} }
if (value.has_array_field(L"eras")) { if (value.has_array_field(L"eras")) {
int length = value[L"eras"].as_array().size(); int length = static_cast<int>(value[L"eras"].as_array().size());
vector<string> newEras; vector<string> newEras;
for (int idx = 0; idx < length; idx++) for (int idx = 0; idx < length; idx++)
newEras.push_back(to_string(value[L"eras"].as_array().at(idx))); newEras.push_back(to_string(value[L"eras"].as_array().at(idx)));
@@ -134,6 +138,8 @@ bool Scheduler::checkSpawnPoints(int spawnPoints, string coalition)
return false; return false;
} }
} }
return false;
} }
void Scheduler::handleRequest(string key, json::value value, string username, json::value& answer) void Scheduler::handleRequest(string key, json::value value, string username, json::value& answer)
@@ -143,6 +149,7 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
log("Received request with ID: " + key); log("Received request with ID: " + key);
log(L"Incoming command raw value: " + value.serialize()); log(L"Incoming command raw value: " + value.serialize());
/************************/
if (key.compare("setPath") == 0) if (key.compare("setPath") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -150,7 +157,6 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) if (unit != nullptr)
{ {
string unitName = unit->getUnitName();
json::value path = value[L"path"]; json::value path = value[L"path"];
list<Coords> newPath; list<Coords> newPath;
for (unsigned int i = 0; i < path.as_array().size(); i++) for (unsigned int i = 0; i < path.as_array().size(); i++)
@@ -164,25 +170,29 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
unit->setActivePath(newPath); unit->setActivePath(newPath);
unit->setState(State::REACH_DESTINATION); unit->setState(State::REACH_DESTINATION);
log(username + " updated destination path for unit " + unitName, true); log(username + " updated destination path for unit " + unit->getUnitName() + "(" + unit->getName() + ")", true);
} }
} }
/************************/
else if (key.compare("smoke") == 0) else if (key.compare("smoke") == 0)
{ {
string color = to_string(value[L"color"]); string color = to_string(value[L"color"]);
double lat = value[L"location"][L"lat"].as_double(); double lat = value[L"location"][L"lat"].as_double();
double lng = value[L"location"][L"lng"].as_double(); double lng = value[L"location"][L"lng"].as_double();
log(username + " added a " + color + " smoke at (" + to_string(lat) + ", " + to_string(lng) + ")", true);
Coords loc; loc.lat = lat; loc.lng = lng; Coords loc; loc.lat = lat; loc.lng = lng;
command = dynamic_cast<Command*>(new Smoke(color, loc)); command = dynamic_cast<Command*>(new Smoke(color, loc));
log(username + " added a " + color + " smoke at (" + to_string(lat) + ", " + to_string(lng) + ")", true);
} }
else if (key.compare("spawnAircrafts") == 0) /************************/
else if (key.compare("spawnAircrafts") == 0 || key.compare("spawnHelicopters") == 0)
{ {
bool immediate = value[L"immediate"].as_bool(); bool immediate = value[L"immediate"].as_bool();
string coalition = to_string(value[L"coalition"]); string coalition = to_string(value[L"coalition"]);
string airbaseName = to_string(value[L"airbaseName"]); string airbaseName = to_string(value[L"airbaseName"]);
string country = to_string(value[L"country"]); string country = to_string(value[L"country"]);
int spawnPoints = value[L"spawnPoints"].as_number().to_int32(); int spawnPoints = value[L"spawnPoints"].as_number().to_int32();
if (!checkSpawnPoints(spawnPoints, coalition)) return; if (!checkSpawnPoints(spawnPoints, coalition)) return;
@@ -195,40 +205,19 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
Coords location; location.lat = lat; location.lng = lng; location.alt = alt; Coords location; location.lat = lat; location.lng = lng; location.alt = alt;
string loadout = to_string(unit[L"loadout"]); string loadout = to_string(unit[L"loadout"]);
string liveryID = to_string(unit[L"liveryID"]); string liveryID = to_string(unit[L"liveryID"]);
string skill = to_string(unit[L"skill"]);
spawnOptions.push_back({unitType, location, loadout, liveryID}); spawnOptions.push_back({unitType, location, loadout, skill, liveryID});
log(username + " spawned a " + coalition + " " + unitType, true); log(username + " spawned a " + coalition + " " + unitType , true);
} }
command = dynamic_cast<Command*>(new SpawnAircrafts(coalition, spawnOptions, airbaseName, country, immediate)); if (key.compare("spawnAircrafts") == 0)
command = dynamic_cast<Command*>(new SpawnAircrafts(coalition, spawnOptions, airbaseName, country, immediate));
else
command = dynamic_cast<Command*>(new SpawnHelicopters(coalition, spawnOptions, airbaseName, country, immediate));
} }
else if (key.compare("spawnHelicopters") == 0) /************************/
{ else if (key.compare("spawnGroundUnits") == 0 || key.compare("spawnNavyUnits") == 0)
bool immediate = value[L"immediate"].as_bool();
string coalition = to_string(value[L"coalition"]);
string airbaseName = to_string(value[L"airbaseName"]);
string country = to_string(value[L"country"]);
int spawnPoints = value[L"spawnPoints"].as_number().to_int32();
if (!checkSpawnPoints(spawnPoints, coalition)) return;
vector<SpawnOptions> spawnOptions;
for (auto unit : value[L"units"].as_array()) {
string unitType = to_string(unit[L"unitType"]);
double lat = unit[L"location"][L"lat"].as_double();
double lng = unit[L"location"][L"lng"].as_double();
double alt = unit[L"altitude"].as_double();
Coords location; location.lat = lat; location.lng = lng; location.alt = alt;
string loadout = to_string(unit[L"loadout"]);
string liveryID = to_string(unit[L"liveryID"]);
spawnOptions.push_back({ unitType, location, loadout, liveryID });
log(username + " spawned a " + coalition + " " + unitType, true);
}
command = dynamic_cast<Command*>(new SpawnHelicopters(coalition, spawnOptions, airbaseName, country, immediate));
}
else if (key.compare("spawnGroundUnits") == 0)
{ {
bool immediate = value[L"immediate"].as_bool(); bool immediate = value[L"immediate"].as_bool();
string coalition = to_string(value[L"coalition"]); string coalition = to_string(value[L"coalition"]);
@@ -244,36 +233,18 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
double lng = unit[L"location"][L"lng"].as_double(); double lng = unit[L"location"][L"lng"].as_double();
Coords location; location.lat = lat; location.lng = lng; Coords location; location.lat = lat; location.lng = lng;
string liveryID = to_string(unit[L"liveryID"]); string liveryID = to_string(unit[L"liveryID"]);
string skill = to_string(unit[L"skill"]);
spawnOptions.push_back({ unitType, location, "", liveryID }); spawnOptions.push_back({ unitType, location, "", skill, liveryID});
log(username + " spawned a " + coalition + " " + unitType, true); log(username + " spawned a " + coalition + " " + unitType, true);
} }
command = dynamic_cast<Command*>(new SpawnGroundUnits(coalition, spawnOptions, country, immediate)); if (key.compare("spawnGroundUnits") == 0)
} command = dynamic_cast<Command*>(new SpawnGroundUnits(coalition, spawnOptions, country, immediate));
else if (key.compare("spawnNavyUnits") == 0) else
{ command = dynamic_cast<Command*>(new SpawnNavyUnits(coalition, spawnOptions, country, immediate));
bool immediate = value[L"immediate"].as_bool();
string coalition = to_string(value[L"coalition"]);
string country = to_string(value[L"country"]);
int spawnPoints = value[L"spawnPoints"].as_number().to_int32();
if (!checkSpawnPoints(spawnPoints, coalition)) return;
vector<SpawnOptions> spawnOptions;
for (auto unit : value[L"units"].as_array()) {
string unitType = to_string(unit[L"unitType"]);
double lat = unit[L"location"][L"lat"].as_double();
double lng = unit[L"location"][L"lng"].as_double();
Coords location; location.lat = lat; location.lng = lng;
string liveryID = to_string(unit[L"liveryID"]);
spawnOptions.push_back({ unitType, location, "", liveryID});
log(username + " spawned a " + coalition + " " + unitType, true);
}
command = dynamic_cast<Command*>(new SpawnNavyUnits(coalition, spawnOptions, country, immediate));
} }
/************************/
else if (key.compare("attackUnit") == 0) else if (key.compare("attackUnit") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -283,28 +254,18 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
Unit* target = unitsManager->getUnit(targetID); Unit* target = unitsManager->getUnit(targetID);
string unitName; if (unit != nullptr && target != nullptr) {
string targetName; log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to attack unit " + target->getUnitName() + "(" + target->getName() + ")", true);
unit->setTargetID(targetID);
if (unit != nullptr) unit->setState(State::ATTACK);
unitName = unit->getUnitName(); }
else
return;
if (target != nullptr)
targetName = target->getUnitName();
else
return;
log(username + " tasked unit " + unitName + " to attack unit " + targetName, true);
unit->setTargetID(targetID);
unit->setState(State::ATTACK);
} }
/************************/
else if (key.compare("followUnit") == 0) else if (key.compare("followUnit") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
unsigned int leaderID = value[L"targetID"].as_double(); unsigned int leaderID = value[L"targetID"].as_integer();
double offsetX = value[L"offsetX"].as_double(); double offsetX = value[L"offsetX"].as_double();
double offsetY = value[L"offsetY"].as_double(); double offsetY = value[L"offsetY"].as_double();
double offsetZ = value[L"offsetZ"].as_double(); double offsetZ = value[L"offsetZ"].as_double();
@@ -312,72 +273,80 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
Unit* leader = unitsManager->getUnit(leaderID); Unit* leader = unitsManager->getUnit(leaderID);
string unitName; if (unit != nullptr && leader != nullptr) {
string leaderName; log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to follow unit " + leader->getUnitName() + "(" + leader->getName() + ")", true);
unit->setFormationOffset(Offset(offsetX, offsetY, offsetZ));
if (unit != nullptr) unit->setLeaderID(leaderID);
unitName = unit->getUnitName(); unit->setState(State::FOLLOW);
else }
return;
if (leader != nullptr)
leaderName = leader->getUnitName();
else
return;
log(username + " tasked unit " + unitName + " to follow unit " + leaderName, true);
unit->setFormationOffset(Offset(offsetX, offsetY, offsetZ));
unit->setLeaderID(leaderID);
unit->setState(State::FOLLOW);
} }
/************************/
else if (key.compare("changeSpeed") == 0) else if (key.compare("changeSpeed") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) if (unit != nullptr) {
unit->changeSpeed(to_string(value[L"change"])); unit->changeSpeed(to_string(value[L"change"]));
log(username + " changed " + unit->getUnitName() + "(" + unit->getName() + ") speed: " + to_string(value[L"change"]), true);
}
} }
/************************/
else if (key.compare("changeAltitude") == 0) else if (key.compare("changeAltitude") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) if (unit != nullptr) {
unit->changeAltitude(to_string(value[L"change"])); unit->changeAltitude(to_string(value[L"change"]));
log(username + " changed " + unit->getUnitName() + "(" + unit->getName() + ") altitude: " + to_string(value[L"change"]), true);
}
} }
/************************/
else if (key.compare("setSpeed") == 0) else if (key.compare("setSpeed") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) if (unit != nullptr) {
unit->setDesiredSpeed(value[L"speed"].as_double()); unit->setDesiredSpeed(value[L"speed"].as_double());
log(username + " set " + unit->getUnitName() + "(" + unit->getName() + ") speed: " + to_string(value[L"speed"].as_double()), true);
}
} }
/************************/
else if (key.compare("setSpeedType") == 0) else if (key.compare("setSpeedType") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) if (unit != nullptr) {
unit->setDesiredSpeedType(to_string(value[L"speedType"])); unit->setDesiredSpeedType(to_string(value[L"speedType"]));
log(username + " set " + unit->getUnitName() + "(" + unit->getName() + ") speed type: " + to_string(value[L"speedType"]), true);
}
} }
/************************/
else if (key.compare("setAltitude") == 0) else if (key.compare("setAltitude") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) if (unit != nullptr) {
unit->setDesiredAltitude(value[L"altitude"].as_double()); unit->setDesiredAltitude(value[L"altitude"].as_double());
log(username + " set " + unit->getUnitName() + "(" + unit->getName() + ") altitude: " + to_string(value[L"altitude"].as_double()), true);
}
} }
/************************/
else if (key.compare("setAltitudeType") == 0) else if (key.compare("setAltitudeType") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) if (unit != nullptr) {
unit->setDesiredAltitudeType(to_string(value[L"altitudeType"])); unit->setDesiredAltitudeType(to_string(value[L"altitudeType"]));
log(username + " set " + unit->getUnitName() + "(" + unit->getName() + ") altitude type: " + to_string(value[L"altitudeType"]), true);
}
} }
/************************/
else if (key.compare("cloneUnits") == 0) else if (key.compare("cloneUnits") == 0)
{ {
vector<CloneOptions> cloneOptions; vector<CloneOptions> cloneOptions;
@@ -395,61 +364,81 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
command = dynamic_cast<Command*>(new Clone(cloneOptions, deleteOriginal)); command = dynamic_cast<Command*>(new Clone(cloneOptions, deleteOriginal));
} }
/************************/
else if (key.compare("setROE") == 0) else if (key.compare("setROE") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unsigned char ROE = value[L"ROE"].as_number().to_uint32(); if (unit != nullptr) {
unit->setROE(ROE); unsigned char ROE = value[L"ROE"].as_number().to_uint32();
log(username + " set unit " + unit->getName() + " ROE to " + to_string(ROE), true); unit->setROE(ROE);
log(username + " set unit " + unit->getUnitName() + "(" + unit->getName() + ") ROE to " + to_string(ROE), true);
}
} }
/************************/
else if (key.compare("setReactionToThreat") == 0) else if (key.compare("setReactionToThreat") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unsigned char reactionToThreat = value[L"reactionToThreat"].as_number().to_uint32(); if (unit != nullptr) {
unit->setReactionToThreat(reactionToThreat); unsigned char reactionToThreat = value[L"reactionToThreat"].as_number().to_uint32();
log(username + " set unit " + unit->getName() + " reaction to threat to " + to_string(reactionToThreat), true); unit->setReactionToThreat(reactionToThreat);
log(username + " set unit " + unit->getUnitName() + "(" + unit->getName() + ") reaction to threat to " + to_string(reactionToThreat), true);
}
} }
/************************/
else if (key.compare("setEmissionsCountermeasures") == 0) else if (key.compare("setEmissionsCountermeasures") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unsigned char emissionsCountermeasures = value[L"emissionsCountermeasures"].as_number().to_uint32(); if (unit != nullptr) {
unit->setEmissionsCountermeasures(emissionsCountermeasures); unsigned char emissionsCountermeasures = value[L"emissionsCountermeasures"].as_number().to_uint32();
log(username + " set unit " + unit->getName() + " emissions and countermeasures to " + to_string(emissionsCountermeasures), true); unit->setEmissionsCountermeasures(emissionsCountermeasures);
log(username + " set unit " + unit->getUnitName() + "(" + unit->getName() + ") emissions and countermeasures to " + to_string(emissionsCountermeasures), true);
}
} }
/************************/
else if (key.compare("landAt") == 0) else if (key.compare("landAt") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
double lat = value[L"location"][L"lat"].as_double(); if (unit != nullptr) {
double lng = value[L"location"][L"lng"].as_double(); double lat = value[L"location"][L"lat"].as_double();
Coords loc; loc.lat = lat; loc.lng = lng; double lng = value[L"location"][L"lng"].as_double();
unit->landAt(loc); Coords loc; loc.lat = lat; loc.lng = lng;
log(username + " tasked unit " + unit->getName() + " to land", true); unit->landAt(loc);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to land", true);
}
} }
/************************/
else if (key.compare("deleteUnit") == 0) else if (key.compare("deleteUnit") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
bool explosion = value[L"explosion"].as_bool(); bool explosion = value[L"explosion"].as_bool();
string explosionType = to_string(value[L"explosionType"]);
bool immediate = value[L"immediate"].as_bool(); bool immediate = value[L"immediate"].as_bool();
unitsManager->deleteUnit(ID, explosion, immediate);
Unit* unit = unitsManager->getUnit(ID); Unit* unit = unitsManager->getUnit(ID);
log(username + " deleted unit " + unit->getName(), true); if (unit != nullptr) {
unitsManager->deleteUnit(ID, explosion, explosionType, immediate);
log(username + " deleted unit " + unit->getUnitName() + "(" + unit->getName() + ")", true);
}
} }
/************************/
else if (key.compare("refuel") == 0) else if (key.compare("refuel") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::REFUEL); if (unit != nullptr) {
log(username + " tasked unit " + unit->getName() + " to refuel", true); unit->setState(State::REFUEL);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to refuel", true);
}
} }
/************************/
else if (key.compare("setAdvancedOptions") == 0) else if (key.compare("setAdvancedOptions") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -489,33 +478,46 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
}); });
unit->resetActiveDestination(); unit->resetActiveDestination();
log(username + " updated unit " + unit->getUnitName() + "(" + unit->getName() + ") advancedOptions", true);
} }
} }
/************************/
else if (key.compare("setFollowRoads") == 0) else if (key.compare("setFollowRoads") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
bool followRoads = value[L"followRoads"].as_bool(); bool followRoads = value[L"followRoads"].as_bool();
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setFollowRoads(followRoads); if (unit != nullptr) {
unit->setFollowRoads(followRoads);
log(username + " set unit " + unit->getUnitName() + "(" + unit->getName() + ") followRoads to: " + (followRoads ? "true" : "false"), true);
}
} }
/************************/
else if (key.compare("setOnOff") == 0) else if (key.compare("setOnOff") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
bool onOff = value[L"onOff"].as_bool(); bool onOff = value[L"onOff"].as_bool();
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setOnOff(onOff); if (unit != nullptr) {
unit->setOnOff(onOff);
log(username + " set unit " + unit->getUnitName() + "(" + unit->getName() + ") onOff to: " + (onOff? "true": "false"), true);
}
} }
/************************/
else if (key.compare("explosion") == 0) else if (key.compare("explosion") == 0)
{ {
unsigned int intensity = value[L"intensity"].as_integer(); unsigned int intensity = value[L"intensity"].as_integer();
string explosionType = to_string(value[L"explosionType"]);
double lat = value[L"location"][L"lat"].as_double(); double lat = value[L"location"][L"lat"].as_double();
double lng = value[L"location"][L"lng"].as_double(); double lng = value[L"location"][L"lng"].as_double();
log("Adding " + to_string(intensity) + " explosion at (" + to_string(lat) + ", " + to_string(lng) + ")"); log("Adding explosion of type " + explosionType + " at (" + to_string(lat) + ", " + to_string(lng) + ")");
Coords loc; loc.lat = lat; loc.lng = lng; Coords loc; loc.lat = lat; loc.lng = lng;
command = dynamic_cast<Command*>(new Explosion(intensity, loc)); command = dynamic_cast<Command*>(new Explosion(intensity, explosionType, loc));
} }
/************************/
else if (key.compare("bombPoint") == 0) else if (key.compare("bombPoint") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -524,10 +526,13 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
double lng = value[L"location"][L"lng"].as_double(); double lng = value[L"location"][L"lng"].as_double();
Coords loc; loc.lat = lat; loc.lng = lng; Coords loc; loc.lat = lat; loc.lng = lng;
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::BOMB_POINT); if (unit != nullptr) {
unit->setTargetPosition(loc); unit->setTargetPosition(loc);
log(username + " tasked unit " + unit->getName() + " to bomb a point", true); unit->setState(State::BOMB_POINT);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to bomb a point", true);
}
} }
/************************/
else if (key.compare("carpetBomb") == 0) else if (key.compare("carpetBomb") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -536,10 +541,14 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
double lng = value[L"location"][L"lng"].as_double(); double lng = value[L"location"][L"lng"].as_double();
Coords loc; loc.lat = lat; loc.lng = lng; Coords loc; loc.lat = lat; loc.lng = lng;
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::CARPET_BOMB); if (unit != nullptr) {
unit->setTargetPosition(loc); unit->setTargetPosition(loc);
log(username + " tasked unit " + unit->getName() + " to perform carpet bombing", true); unit->setState(State::CARPET_BOMB);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to perform carpet bombing", true);
}
} }
/************************/
/* TODO: this command does not appear to be working in DCS and has been disabled */
else if (key.compare("bombBuilding") == 0) else if (key.compare("bombBuilding") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -548,9 +557,12 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
double lng = value[L"location"][L"lng"].as_double(); double lng = value[L"location"][L"lng"].as_double();
Coords loc; loc.lat = lat; loc.lng = lng; Coords loc; loc.lat = lat; loc.lng = lng;
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::BOMB_BUILDING); if (unit != nullptr) {
unit->setTargetPosition(loc); unit->setTargetPosition(loc);
unit->setState(State::BOMB_BUILDING);
}
} }
/************************/
else if (key.compare("fireAtArea") == 0) else if (key.compare("fireAtArea") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -559,10 +571,13 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
double lng = value[L"location"][L"lng"].as_double(); double lng = value[L"location"][L"lng"].as_double();
Coords loc; loc.lat = lat; loc.lng = lng; Coords loc; loc.lat = lat; loc.lng = lng;
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::FIRE_AT_AREA); if (unit != nullptr) {
unit->setTargetPosition(loc); unit->setTargetPosition(loc);
log(username + " tasked unit " + unit->getName() + " to fire at area", true); unit->setState(State::FIRE_AT_AREA);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to fire at area", true);
}
} }
/************************/
else if (key.compare("simulateFireFight") == 0) else if (key.compare("simulateFireFight") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -572,34 +587,45 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
double alt = value[L"altitude"].as_double(); double alt = value[L"altitude"].as_double();
Coords loc; loc.lat = lat; loc.lng = lng; loc.alt = alt; Coords loc; loc.lat = lat; loc.lng = lng; loc.alt = alt;
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::SIMULATE_FIRE_FIGHT); if (unit != nullptr) {
unit->setTargetPosition(loc); unit->setTargetPosition(loc);
log(username + " tasked unit " + unit->getName() + " to simulate a fire fight", true); unit->setState(State::SIMULATE_FIRE_FIGHT);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to simulate a fire fight", true);
}
} }
/************************/
else if (key.compare("scenicAAA") == 0) else if (key.compare("scenicAAA") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::SCENIC_AAA); if (unit != nullptr) {
log(username + " tasked unit " + unit->getName() + " to enter scenic AAA state", true); unit->setState(State::SCENIC_AAA);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to enter scenic AAA state", true);
}
} }
/************************/
else if (key.compare("missOnPurpose") == 0) else if (key.compare("missOnPurpose") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::MISS_ON_PURPOSE); if (unit != nullptr) {
log(username + " tasked unit " + unit->getName() + " to enter Miss On Purpose state", true); unit->setState(State::MISS_ON_PURPOSE);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to enter Miss On Purpose state", true);
}
} }
/************************/
else if (key.compare("setOperateAs") == 0) else if (key.compare("setOperateAs") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID); unitsManager->acquireControl(ID);
unsigned char operateAs = value[L"operateAs"].as_number().to_uint32(); unsigned char operateAs = value[L"operateAs"].as_number().to_uint32();
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
unit->setOperateAs(operateAs); if (unit != nullptr)
unit->setOperateAs(operateAs);
} }
/************************/
else if (key.compare("landAtPoint") == 0) else if (key.compare("landAtPoint") == 0)
{ {
unsigned int ID = value[L"ID"].as_integer(); unsigned int ID = value[L"ID"].as_integer();
@@ -609,21 +635,50 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
Coords loc; loc.lat = lat; loc.lng = lng; Coords loc; loc.lat = lat; loc.lng = lng;
Unit* unit = unitsManager->getGroupLeader(ID); Unit* unit = unitsManager->getGroupLeader(ID);
list<Coords> newPath; if (unit != nullptr) {
newPath.push_back(loc); list<Coords> newPath;
unit->setActivePath(newPath); newPath.push_back(loc);
unit->setState(State::LAND_AT_POINT); unit->setActivePath(newPath);
unit->setState(State::LAND_AT_POINT);
log(username + " tasked unit " + unit->getName() + " to land at point", true);
log(username + " tasked unit " + unit->getUnitName() + "(" + unit->getName() + ") to land at point", true);
}
} }
/************************/
else if (key.compare("setShotsScatter") == 0)
{
unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) {
unsigned char shotsScatter = value[L"shotsScatter"].as_number().to_uint32();
unit->setShotsScatter(shotsScatter);
log(username + " set unit " + unit->getUnitName() + "(" + unit->getName() + ") shots scatter to " + to_string(shotsScatter), true);
}
}
/************************/
else if (key.compare("setShotsIntensity") == 0)
{
unsigned int ID = value[L"ID"].as_integer();
unitsManager->acquireControl(ID);
Unit* unit = unitsManager->getGroupLeader(ID);
if (unit != nullptr) {
unsigned char shotsIntensity = value[L"shotsIntensity"].as_number().to_uint32();
unit->setShotsIntensity(shotsIntensity);
log(username + " set unit " + unit->getUnitName() + "(" + unit->getName() + ") shots intensity to " + to_string(shotsIntensity), true);
}
}
/************************/
else if (key.compare("setCommandModeOptions") == 0) else if (key.compare("setCommandModeOptions") == 0)
{ {
setCommandModeOptions(value); setCommandModeOptions(value);
log(username + " updated the Command Mode Options", true); log(username + " updated the Command Mode Options", true);
} }
/************************/
else if (key.compare("reloadDatabases") == 0) { else if (key.compare("reloadDatabases") == 0) {
unitsManager->loadDatabases(); unitsManager->loadDatabases();
} }
/************************/
else else
{ {
log("Unknown command: " + key); log("Unknown command: " + key);

View File

@@ -2,9 +2,12 @@
#include "logger.h" #include "logger.h"
#include "luatools.h" #include "luatools.h"
#include "dcstools.h" #include "dcstools.h"
#include "defines.h"
#include <algorithm> #include <algorithm>
extern string instancePath;
bool executeLuaScript(lua_State* L, string path) bool executeLuaScript(lua_State* L, string path)
{ {
replace(path.begin(), path.end(), '\\', '/'); replace(path.begin(), path.end(), '\\', '/');
@@ -36,21 +39,9 @@ void registerLuaFunctions(lua_State* L)
log("protectedCall registered successfully"); log("protectedCall registered successfully");
} }
char* buf = nullptr; executeLuaScript(L, instancePath + MIST_SCRIPT);
size_t sz = 0; executeLuaScript(L, instancePath + OLYMPUS_COMMAND_SCRIPT);
if (_dupenv_s(&buf, &sz, "DCSOLYMPUS_PATH") == 0 && buf != nullptr) executeLuaScript(L, instancePath + UNIT_PAYLOADS_SCRIPT);
{ executeLuaScript(L, instancePath + TEMPLATES_SCRIPT);
modLocation = buf; executeLuaScript(L, instancePath + MODS_SCRIPT);
free(buf);
}
else
{
log("DCSOLYMPUS_PATH environment variable is missing");
return;
}
executeLuaScript(L, modLocation + "\\Scripts\\mist.lua");
executeLuaScript(L, modLocation + "\\Scripts\\OlympusCommand.lua");
executeLuaScript(L, modLocation + "\\Scripts\\unitPayloads.lua");
executeLuaScript(L, modLocation + "\\Scripts\\templates.lua");
} }

View File

@@ -19,6 +19,7 @@ extern Scheduler* scheduler;
extern json::value missionData; extern json::value missionData;
extern mutex mutexLock; extern mutex mutexLock;
extern string sessionHash; extern string sessionHash;
extern string instancePath;
void handle_eptr(std::exception_ptr eptr) void handle_eptr(std::exception_ptr eptr)
{ {
@@ -88,7 +89,7 @@ void Server::handle_get(http_request request)
try { try {
time = stoull((*(query.find(L"time"))).second); time = stoull((*(query.find(L"time"))).second);
} }
catch (const std::exception& e) { catch (...) {
time = 0; time = 0;
} }
} }
@@ -286,39 +287,32 @@ string Server::extractPassword(http_request& request) {
void Server::task() void Server::task()
{ {
string address = REST_ADDRESS; string address = REST_ADDRESS;
string modLocation; string jsonLocation = instancePath + OLYMPUS_JSON_PATH;
char* buf = nullptr;
size_t sz = 0;
if (_dupenv_s(&buf, &sz, "DCSOLYMPUS_PATH") == 0 && buf != nullptr)
{
std::ifstream ifstream(string(buf) + OLYMPUS_JSON_PATH);
std::stringstream ss;
ss << ifstream.rdbuf();
std::error_code errorCode;
json::value config = json::value::parse(ss.str(), errorCode);
if (config.is_object() && config.has_object_field(L"server") &&
config[L"server"].has_string_field(L"address") && config[L"server"].has_number_field(L"port"))
{
address = "http://" + to_string(config[L"server"][L"address"]) + ":" + to_string(config[L"server"][L"port"].as_number().to_int32());
log("Starting server on " + address);
}
else
log("Error reading configuration file. Starting server on " + address);
if (config.is_object() && config.has_object_field(L"authentication")) log("Reading configuration from " + jsonLocation);
{
if (config[L"authentication"].has_string_field(L"gameMasterPassword")) gameMasterPassword = to_string(config[L"authentication"][L"gameMasterPassword"]); std::ifstream ifstream(jsonLocation);
if (config[L"authentication"].has_string_field(L"blueCommanderPassword")) blueCommanderPassword = to_string(config[L"authentication"][L"blueCommanderPassword"]); std::stringstream ss;
if (config[L"authentication"].has_string_field(L"redCommanderPassword")) redCommanderPassword = to_string(config[L"authentication"][L"redCommanderPassword"]); ss << ifstream.rdbuf();
} std::error_code errorCode;
else json::value config = json::value::parse(ss.str(), errorCode);
log("Error reading configuration file. No password set."); if (config.is_object() && config.has_object_field(L"backend") &&
free(buf); config[L"backend"].has_string_field(L"address") && config[L"backend"].has_number_field(L"port"))
{
address = "http://" + to_string(config[L"backend"][L"address"]) + ":" + to_string(config[L"backend"][L"port"].as_number().to_int32());
log("Starting backend on " + address);
} }
else else
log("Error reading configuration file. Starting backend on " + address);
if (config.is_object() && config.has_object_field(L"authentication"))
{ {
log("DCSOLYMPUS_PATH environment variable is missing, starting server on " + address); if (config[L"authentication"].has_string_field(L"gameMasterPassword")) gameMasterPassword = to_string(config[L"authentication"][L"gameMasterPassword"]);
if (config[L"authentication"].has_string_field(L"blueCommanderPassword")) blueCommanderPassword = to_string(config[L"authentication"][L"blueCommanderPassword"]);
if (config[L"authentication"].has_string_field(L"redCommanderPassword")) redCommanderPassword = to_string(config[L"authentication"][L"redCommanderPassword"]);
} }
else
log("Error reading configuration file. No password set.");
http_listener listener(to_wstring(address + "/" + REST_URI)); http_listener listener(to_wstring(address + "/" + REST_URI));
@@ -336,7 +330,7 @@ void Server::task()
.then([&listener]() {log("RESTServer starting to listen"); }) .then([&listener]() {log("RESTServer starting to listen"); })
.wait(); .wait();
while (runListener); while (runListener) { Sleep(1000); };
listener.close() listener.close()
.then([&listener]() {log("RESTServer stopping connections"); }) .then([&listener]() {log("RESTServer stopping connections"); })

View File

@@ -27,6 +27,13 @@ Unit::~Unit()
} }
void Unit::initialize(json::value json) void Unit::initialize(json::value json)
{
update(json, 0);
setDefaults();
}
void Unit::update(json::value json, double dt)
{ {
if (json.has_string_field(L"name")) if (json.has_string_field(L"name"))
setName(to_string(json[L"name"])); setName(to_string(json[L"name"]));
@@ -37,23 +44,18 @@ void Unit::initialize(json::value json)
if (json.has_string_field(L"groupName")) if (json.has_string_field(L"groupName"))
setGroupName(to_string(json[L"groupName"])); setGroupName(to_string(json[L"groupName"]));
if (json.has_string_field(L"callsign"))
setCallsign(to_string(json[L"callsign"]));
if (json.has_number_field(L"coalitionID")) if (json.has_number_field(L"coalitionID"))
setCoalition(json[L"coalitionID"].as_number().to_int32()); setCoalition(json[L"coalitionID"].as_number().to_int32());
//if (json.has_number_field(L"Country")) //if (json.has_number_field(L"Country"))
// setCountry(json[L"Country"].as_number().to_int32()); // setCountry(json[L"Country"].as_number().to_int32());
/* All units which contain the name "Olympus" are automatically under AI control */ /* All units which contain the name "Olympus" are automatically under AI control */
if (getUnitName().find("Olympus") != string::npos) if (getUnitName().find("Olympus") != string::npos)
setControlled(true); setControlled(true);
update(json, 0);
setDefaults();
}
void Unit::update(json::value json, double dt)
{
if (json.has_object_field(L"position")) if (json.has_object_field(L"position"))
{ {
setPosition({ setPosition({
@@ -66,9 +68,18 @@ void Unit::update(json::value json, double dt)
if (json.has_number_field(L"heading")) if (json.has_number_field(L"heading"))
setHeading(json[L"heading"].as_number().to_double()); setHeading(json[L"heading"].as_number().to_double());
if (json.has_number_field(L"track"))
setTrack(json[L"track"].as_number().to_double());
if (json.has_number_field(L"speed")) if (json.has_number_field(L"speed"))
setSpeed(json[L"speed"].as_number().to_double()); setSpeed(json[L"speed"].as_number().to_double());
if (json.has_number_field(L"horizontalVelocity"))
setHorizontalVelocity(json[L"horizontalVelocity"].as_number().to_double());
if (json.has_number_field(L"verticalVelocity"))
setVerticalVelocity(json[L"verticalVelocity"].as_number().to_double());
if (json.has_boolean_field(L"isAlive")) if (json.has_boolean_field(L"isAlive"))
setAlive(json[L"isAlive"].as_bool()); setAlive(json[L"isAlive"].as_bool());
@@ -131,6 +142,9 @@ void Unit::update(json::value json, double dt)
if (json.has_boolean_field(L"hasTask")) if (json.has_boolean_field(L"hasTask"))
setHasTask(json[L"hasTask"].as_bool()); setHasTask(json[L"hasTask"].as_bool());
if (json.has_number_field(L"health"))
setHealth(static_cast<unsigned char>(json[L"health"].as_number().to_uint32()));
runAILoop(); runAILoop();
} }
@@ -146,7 +160,7 @@ void Unit::runAILoop() {
/* If the unit is alive, controlled, is the leader of the group and it is not a human, run the AI Loop that performs the requested commands and instructions (moving, attacking, etc) */ /* If the unit is alive, controlled, is the leader of the group and it is not a human, run the AI Loop that performs the requested commands and instructions (moving, attacking, etc) */
if (getAlive() && getControlled() && !getHuman() && getIsLeader()) { if (getAlive() && getControlled() && !getHuman() && getIsLeader()) {
if (checkTaskFailed() && state != State::IDLE && state != State::LAND) { if (getEnableTaskCheckFailed() && checkTaskFailed()) {
log(unitName + " has no task, switching to IDLE state"); log(unitName + " has no task, switching to IDLE state");
setState(State::IDLE); setState(State::IDLE);
} }
@@ -192,6 +206,8 @@ void Unit::refreshLeaderData(unsigned long long time) {
case DataIndex::generalSettings: updateValue(generalSettings, leader->generalSettings, datumIndex); break; case DataIndex::generalSettings: updateValue(generalSettings, leader->generalSettings, datumIndex); break;
case DataIndex::activePath: updateValue(activePath, leader->activePath, datumIndex); break; case DataIndex::activePath: updateValue(activePath, leader->activePath, datumIndex); break;
case DataIndex::operateAs: updateValue(operateAs, leader->operateAs, datumIndex); break; case DataIndex::operateAs: updateValue(operateAs, leader->operateAs, datumIndex); break;
case DataIndex::shotsScatter: updateValue(shotsScatter, leader->shotsScatter, datumIndex); break;
case DataIndex::shotsIntensity: updateValue(shotsIntensity, leader->shotsIntensity, datumIndex); break;
} }
} }
} }
@@ -233,45 +249,52 @@ void Unit::getData(stringstream& ss, unsigned long long time)
{ {
if (checkFreshness(datumIndex, time)) { if (checkFreshness(datumIndex, time)) {
switch (datumIndex) { switch (datumIndex) {
case DataIndex::category: appendString(ss, datumIndex, category); break; case DataIndex::category: appendString(ss, datumIndex, category); break;
case DataIndex::alive: appendNumeric(ss, datumIndex, alive); break; case DataIndex::alive: appendNumeric(ss, datumIndex, alive); break;
case DataIndex::human: appendNumeric(ss, datumIndex, human); break; case DataIndex::human: appendNumeric(ss, datumIndex, human); break;
case DataIndex::controlled: appendNumeric(ss, datumIndex, controlled); break; case DataIndex::controlled: appendNumeric(ss, datumIndex, controlled); break;
case DataIndex::coalition: appendNumeric(ss, datumIndex, coalition); break; case DataIndex::coalition: appendNumeric(ss, datumIndex, coalition); break;
case DataIndex::country: appendNumeric(ss, datumIndex, country); break; case DataIndex::country: appendNumeric(ss, datumIndex, country); break;
case DataIndex::name: appendString(ss, datumIndex, name); break; case DataIndex::name: appendString(ss, datumIndex, name); break;
case DataIndex::unitName: appendString(ss, datumIndex, unitName); break; case DataIndex::unitName: appendString(ss, datumIndex, unitName); break;
case DataIndex::groupName: appendString(ss, datumIndex, groupName); break; case DataIndex::callsign: appendString(ss, datumIndex, callsign); break;
case DataIndex::state: appendNumeric(ss, datumIndex, state); break; case DataIndex::groupName: appendString(ss, datumIndex, groupName); break;
case DataIndex::task: appendString(ss, datumIndex, task); break; case DataIndex::state: appendNumeric(ss, datumIndex, state); break;
case DataIndex::hasTask: appendNumeric(ss, datumIndex, hasTask); break; case DataIndex::task: appendString(ss, datumIndex, task); break;
case DataIndex::position: appendNumeric(ss, datumIndex, position); break; case DataIndex::hasTask: appendNumeric(ss, datumIndex, hasTask); break;
case DataIndex::speed: appendNumeric(ss, datumIndex, speed); break; case DataIndex::position: appendNumeric(ss, datumIndex, position); break;
case DataIndex::heading: appendNumeric(ss, datumIndex, heading); break; case DataIndex::speed: appendNumeric(ss, datumIndex, speed); break;
case DataIndex::isActiveTanker: appendNumeric(ss, datumIndex, isActiveTanker); break; case DataIndex::horizontalVelocity: appendNumeric(ss, datumIndex, horizontalVelocity); break;
case DataIndex::isActiveAWACS: appendNumeric(ss, datumIndex, isActiveAWACS); break; case DataIndex::verticalVelocity: appendNumeric(ss, datumIndex, verticalVelocity); break;
case DataIndex::onOff: appendNumeric(ss, datumIndex, onOff); break; case DataIndex::heading: appendNumeric(ss, datumIndex, heading); break;
case DataIndex::followRoads: appendNumeric(ss, datumIndex, followRoads); break; case DataIndex::track: appendNumeric(ss, datumIndex, track); break;
case DataIndex::fuel: appendNumeric(ss, datumIndex, fuel); break; case DataIndex::isActiveTanker: appendNumeric(ss, datumIndex, isActiveTanker); break;
case DataIndex::desiredSpeed: appendNumeric(ss, datumIndex, desiredSpeed); break; case DataIndex::isActiveAWACS: appendNumeric(ss, datumIndex, isActiveAWACS); break;
case DataIndex::desiredSpeedType: appendNumeric(ss, datumIndex, desiredSpeedType); break; case DataIndex::onOff: appendNumeric(ss, datumIndex, onOff); break;
case DataIndex::desiredAltitude: appendNumeric(ss, datumIndex, desiredAltitude); break; case DataIndex::followRoads: appendNumeric(ss, datumIndex, followRoads); break;
case DataIndex::desiredAltitudeType: appendNumeric(ss, datumIndex, desiredAltitudeType); break; case DataIndex::fuel: appendNumeric(ss, datumIndex, fuel); break;
case DataIndex::leaderID: appendNumeric(ss, datumIndex, leaderID); break; case DataIndex::desiredSpeed: appendNumeric(ss, datumIndex, desiredSpeed); break;
case DataIndex::formationOffset: appendNumeric(ss, datumIndex, formationOffset); break; case DataIndex::desiredSpeedType: appendNumeric(ss, datumIndex, desiredSpeedType); break;
case DataIndex::targetID: appendNumeric(ss, datumIndex, targetID); break; case DataIndex::desiredAltitude: appendNumeric(ss, datumIndex, desiredAltitude); break;
case DataIndex::targetPosition: appendNumeric(ss, datumIndex, targetPosition); break; case DataIndex::desiredAltitudeType: appendNumeric(ss, datumIndex, desiredAltitudeType); break;
case DataIndex::ROE: appendNumeric(ss, datumIndex, ROE); break; case DataIndex::leaderID: appendNumeric(ss, datumIndex, leaderID); break;
case DataIndex::reactionToThreat: appendNumeric(ss, datumIndex, reactionToThreat); break; case DataIndex::formationOffset: appendNumeric(ss, datumIndex, formationOffset); break;
case DataIndex::emissionsCountermeasures: appendNumeric(ss, datumIndex, emissionsCountermeasures); break; case DataIndex::targetID: appendNumeric(ss, datumIndex, targetID); break;
case DataIndex::TACAN: appendNumeric(ss, datumIndex, TACAN); break; case DataIndex::targetPosition: appendNumeric(ss, datumIndex, targetPosition); break;
case DataIndex::radio: appendNumeric(ss, datumIndex, radio); break; case DataIndex::ROE: appendNumeric(ss, datumIndex, ROE); break;
case DataIndex::generalSettings: appendNumeric(ss, datumIndex, generalSettings); break; case DataIndex::reactionToThreat: appendNumeric(ss, datumIndex, reactionToThreat); break;
case DataIndex::ammo: appendVector(ss, datumIndex, ammo); break; case DataIndex::emissionsCountermeasures: appendNumeric(ss, datumIndex, emissionsCountermeasures); break;
case DataIndex::contacts: appendVector(ss, datumIndex, contacts); break; case DataIndex::TACAN: appendNumeric(ss, datumIndex, TACAN); break;
case DataIndex::activePath: appendList(ss, datumIndex, activePath); break; case DataIndex::radio: appendNumeric(ss, datumIndex, radio); break;
case DataIndex::isLeader: appendNumeric(ss, datumIndex, isLeader); break; case DataIndex::generalSettings: appendNumeric(ss, datumIndex, generalSettings); break;
case DataIndex::operateAs: appendNumeric(ss, datumIndex, operateAs); break; case DataIndex::ammo: appendVector(ss, datumIndex, ammo); break;
case DataIndex::contacts: appendVector(ss, datumIndex, contacts); break;
case DataIndex::activePath: appendList(ss, datumIndex, activePath); break;
case DataIndex::isLeader: appendNumeric(ss, datumIndex, isLeader); break;
case DataIndex::operateAs: appendNumeric(ss, datumIndex, operateAs); break;
case DataIndex::shotsScatter: appendNumeric(ss, datumIndex, shotsScatter); break;
case DataIndex::shotsIntensity: appendNumeric(ss, datumIndex, shotsIntensity); break;
case DataIndex::health: appendNumeric(ss, datumIndex, health); break;
} }
} }
} }
@@ -410,7 +433,11 @@ void Unit::resetTask()
void Unit::setFormationOffset(Offset newFormationOffset) void Unit::setFormationOffset(Offset newFormationOffset)
{ {
formationOffset = newFormationOffset; formationOffset = newFormationOffset;
resetTask();
/* Apply the change */
setHasTask(false);
resetTaskFailedCounter();
AIloop();
triggerUpdate(DataIndex::formationOffset); triggerUpdate(DataIndex::formationOffset);
} }
@@ -499,7 +526,11 @@ void Unit::setIsActiveTanker(bool newIsActiveTanker)
{ {
if (isActiveTanker != newIsActiveTanker) { if (isActiveTanker != newIsActiveTanker) {
isActiveTanker = newIsActiveTanker; isActiveTanker = newIsActiveTanker;
resetTask();
/* Apply the change */
setHasTask(false);
resetTaskFailedCounter();
AIloop();
triggerUpdate(DataIndex::isActiveTanker); triggerUpdate(DataIndex::isActiveTanker);
} }
@@ -509,7 +540,11 @@ void Unit::setIsActiveAWACS(bool newIsActiveAWACS)
{ {
if (isActiveAWACS != newIsActiveAWACS) { if (isActiveAWACS != newIsActiveAWACS) {
isActiveAWACS = newIsActiveAWACS; isActiveAWACS = newIsActiveAWACS;
resetTask();
/* Apply the change */
setHasTask(false);
resetTaskFailedCounter();
AIloop();
triggerUpdate(DataIndex::isActiveAWACS); triggerUpdate(DataIndex::isActiveAWACS);
} }
@@ -522,6 +557,12 @@ void Unit::setTACAN(DataTypes::TACAN newTACAN, bool force)
TACAN = newTACAN; TACAN = newTACAN;
if (TACAN.isOn) { if (TACAN.isOn) {
std::ostringstream commandSS; std::ostringstream commandSS;
if (TACAN.channel < 0)
TACAN.channel = 0;
if (TACAN.channel > 126)
TACAN.channel = 126;
commandSS << "{" commandSS << "{"
<< "id = 'ActivateBeacon'," << "id = 'ActivateBeacon',"
<< "params = {" << "params = {"
@@ -559,6 +600,12 @@ void Unit::setRadio(DataTypes::Radio newRadio, bool force)
std::ostringstream commandSS; std::ostringstream commandSS;
Command* command; Command* command;
if (radio.frequency < 0)
radio.frequency = 0;
if (radio.frequency > 999000000)
radio.frequency = 999000000;
commandSS << "{" commandSS << "{"
<< "id = 'SetFrequency'," << "id = 'SetFrequency',"
<< "params = {" << "params = {"
@@ -612,10 +659,11 @@ void Unit::setDesiredSpeed(double newDesiredSpeed)
{ {
if (desiredSpeed != newDesiredSpeed) { if (desiredSpeed != newDesiredSpeed) {
desiredSpeed = newDesiredSpeed; desiredSpeed = newDesiredSpeed;
if (state == State::IDLE)
resetTask(); /* Apply the change */
else setHasTask(false);
goToDestination(); /* Send the command to reach the destination */ resetTaskFailedCounter();
AIloop();
triggerUpdate(DataIndex::desiredSpeed); triggerUpdate(DataIndex::desiredSpeed);
} }
@@ -625,10 +673,11 @@ void Unit::setDesiredAltitude(double newDesiredAltitude)
{ {
if (desiredAltitude != newDesiredAltitude) { if (desiredAltitude != newDesiredAltitude) {
desiredAltitude = newDesiredAltitude; desiredAltitude = newDesiredAltitude;
if (state == State::IDLE)
resetTask(); /* Apply the change */
else setHasTask(false);
goToDestination(); /* Send the command to reach the destination */ resetTaskFailedCounter();
AIloop();
triggerUpdate(DataIndex::desiredAltitude); triggerUpdate(DataIndex::desiredAltitude);
} }
@@ -638,10 +687,11 @@ void Unit::setDesiredSpeedType(string newDesiredSpeedType)
{ {
if (desiredSpeedType != (newDesiredSpeedType.compare("GS") == 0)) { if (desiredSpeedType != (newDesiredSpeedType.compare("GS") == 0)) {
desiredSpeedType = newDesiredSpeedType.compare("GS") == 0; desiredSpeedType = newDesiredSpeedType.compare("GS") == 0;
if (state == State::IDLE)
resetTask(); /* Apply the change */
else setHasTask(false);
goToDestination(); /* Send the command to reach the destination */ resetTaskFailedCounter();
AIloop();
triggerUpdate(DataIndex::desiredSpeedType); triggerUpdate(DataIndex::desiredSpeedType);
} }
@@ -651,10 +701,11 @@ void Unit::setDesiredAltitudeType(string newDesiredAltitudeType)
{ {
if (desiredAltitudeType != (newDesiredAltitudeType.compare("AGL") == 0)) { if (desiredAltitudeType != (newDesiredAltitudeType.compare("AGL") == 0)) {
desiredAltitudeType = newDesiredAltitudeType.compare("AGL") == 0; desiredAltitudeType = newDesiredAltitudeType.compare("AGL") == 0;
if (state == State::IDLE)
resetTask(); /* Apply the change */
else setHasTask(false);
goToDestination(); /* Send the command to reach the destination */ resetTaskFailedCounter();
AIloop();
triggerUpdate(DataIndex::desiredAltitudeType); triggerUpdate(DataIndex::desiredAltitudeType);
} }
@@ -664,7 +715,7 @@ void Unit::goToDestination(string enrouteTask)
{ {
if (activeDestination != NULL) if (activeDestination != NULL)
{ {
Command* command = dynamic_cast<Command*>(new Move(groupName, activeDestination, getDesiredSpeed(), getDesiredSpeedType() ? "GS" : "CAS", getDesiredAltitude(), getDesiredAltitudeType() ? "AGL" : "ASL", enrouteTask, getCategory(), [this]() { this->setHasTaskAssigned(true); })); Command* command = dynamic_cast<Command*>(new Move(groupName, activeDestination, getDesiredSpeed(), getDesiredSpeedType() ? "GS" : "CAS", getDesiredAltitude(), getDesiredAltitudeType() ? "AGL" : "ASL", enrouteTask, getCategory(), getFollowRoads(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command); scheduler->appendCommand(command);
setHasTask(true); setHasTask(true);
} }
@@ -730,6 +781,10 @@ bool Unit::updateActivePath(bool looping)
} }
} }
void Unit::setHasTask(bool newValue) {
updateValue(hasTask, newValue, DataIndex::hasTask);
}
bool Unit::checkTaskFailed() bool Unit::checkTaskFailed()
{ {
if (getHasTask()) if (getHasTask())

View File

@@ -142,11 +142,11 @@ void UnitsManager::getUnitData(stringstream &ss, unsigned long long time)
p.second->getData(ss, time); p.second->getData(ss, time);
} }
void UnitsManager::deleteUnit(unsigned int ID, bool explosion, bool immediate) void UnitsManager::deleteUnit(unsigned int ID, bool explosion, string explosionType, bool immediate)
{ {
if (getUnit(ID) != nullptr) if (getUnit(ID) != nullptr)
{ {
Command* command = dynamic_cast<Command*>(new Delete(ID, explosion, immediate)); Command* command = dynamic_cast<Command*>(new Delete(ID, explosion, explosionType, immediate));
scheduler->appendCommand(command); scheduler->appendCommand(command);
} }
} }
@@ -172,19 +172,20 @@ Unit* UnitsManager::getClosestUnit(Unit* unit, unsigned char coalition, vector<s
double bearing1; double bearing1;
double bearing2; double bearing2;
Geodesic::WGS84().Inverse(unit->getPosition().lat, unit->getPosition().lng, p.second->getPosition().lat, p.second->getPosition().lng, dist, bearing1, bearing2); Geodesic::WGS84().Inverse(unit->getPosition().lat, unit->getPosition().lng, p.second->getPosition().lat, p.second->getPosition().lng, dist, bearing1, bearing2);
double altDelta = unit->getPosition().alt - p.second->getPosition().alt;
/* If the closest unit has not been assigned yet, assign it to this unit */ /* If the closest unit has not been assigned yet, assign it to this unit */
if (closestUnit == nullptr) if (closestUnit == nullptr)
{ {
closestUnit = p.second; closestUnit = p.second;
distance = dist; distance = sqrt(dist * dist + altDelta * altDelta);
} }
else { else {
/* Check if the unit is closer than the one already selected */ /* Check if the unit is closer than the one already selected */
if (dist < distance) { if (dist < distance) {
closestUnit = p.second; closestUnit = p.second;
distance = dist; distance = sqrt(dist * dist + altDelta * altDelta);
} }
} }
} }
@@ -193,6 +194,35 @@ Unit* UnitsManager::getClosestUnit(Unit* unit, unsigned char coalition, vector<s
return closestUnit; return closestUnit;
} }
map<Unit*, double> UnitsManager::getUnitsInRange(Unit* unit, unsigned char coalition, vector<string> categories, double range) {
map<Unit*, double> unitsInRange;
for (auto const& p : units) {
/* Check if the units category is of the correct type */
bool requestedCategory = false;
for (auto const& category : categories) {
if (p.second->getCategory().compare(category) == 0) {
requestedCategory = true;
break;
}
}
/* Check if the unit belongs to the desired coalition, is alive, and is of the category requested */
if (requestedCategory && p.second->getCoalition() == coalition && p.second->getAlive()) {
/* Compute the distance from the unit to the tested unit */
double dist;
double bearing1;
double bearing2;
Geodesic::WGS84().Inverse(unit->getPosition().lat, unit->getPosition().lng, p.second->getPosition().lat, p.second->getPosition().lng, dist, bearing1, bearing2);
if (dist <= range)
unitsInRange[p.second] = dist;
}
}
return unitsInRange;
}
void UnitsManager::acquireControl(unsigned int ID) { void UnitsManager::acquireControl(unsigned int ID) {
Unit* leader = getGroupLeader(ID); Unit* leader = getGroupLeader(ID);
if (leader != nullptr) { if (leader != nullptr) {

View File

@@ -0,0 +1,110 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "InternalName", "dcstools.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "dcstools.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -23,6 +23,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="include\dcstools.h" /> <ClInclude Include="include\dcstools.h" />
<ClInclude Include="resource.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\luatools\luatools.vcxproj"> <ProjectReference Include="..\luatools\luatools.vcxproj">
@@ -32,6 +33,9 @@
<Project>{b85009ce-4a5c-4a5a-b85d-001b3a2651b2}</Project> <Project>{b85009ce-4a5c-4a5a-b85d-001b3a2651b2}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="dcstools.rc" />
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion> <VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
@@ -73,19 +77,23 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>.\..\..\bin\</OutDir> <OutDir>.\..\..\build\backend\bin\</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@@ -134,6 +142,7 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<Version>{{OLYMPUS_VERSION_NUMBER}}.{{OLYMPUS_COMMIT_HASH}}</Version>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

View File

@@ -23,5 +23,13 @@
<ClInclude Include="include\dcstools.h"> <ClInclude Include="include\dcstools.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="dcstools.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by dcstools.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -82,7 +82,7 @@ void getAllUnits(lua_State* L, map<unsigned int, json::value>& unitJSONs)
lua_pushnil(L); lua_pushnil(L);
while (lua_next(L, 2) != 0) while (lua_next(L, 2) != 0)
{ {
unsigned int ID = lua_tonumber(L, -2); unsigned int ID = static_cast<unsigned int>(lua_tonumber(L, -2));
if (unitJSONs.find(ID) == unitJSONs.end()) if (unitJSONs.find(ID) == unitJSONs.end())
unitJSONs[ID] = json::value::object(); unitJSONs[ID] = json::value::object();
luaTableToJSON(L, -1, unitJSONs[ID]); luaTableToJSON(L, -1, unitJSONs[ID]);

2579
backend/docs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "framework.h" #include "framework.h"
void DllExport setLogDirectory(std::string m_dirPath);
void DllExport log(const std::string& sMessage, bool addToJSON = false); void DllExport log(const std::string& sMessage, bool addToJSON = false);
void DllExport log(const std::wstring& sMessage, bool addToJSON = false); void DllExport log(const std::wstring& sMessage, bool addToJSON = false);
void DllExport getLogsJSON(json::value& json, unsigned long long time); void DllExport getLogsJSON(json::value& json, unsigned long long time);

View File

@@ -8,6 +8,7 @@ public:
void log(const string& sMessage, bool addToJSON); void log(const string& sMessage, bool addToJSON);
void log(const wstring& sMessage, bool addToJSON); void log(const wstring& sMessage, bool addToJSON);
void toJSON(json::value& json, unsigned long long time); void toJSON(json::value& json, unsigned long long time);
void setDirectory(string newDirPath);
static Logger* GetLogger(); static Logger* GetLogger();
@@ -20,9 +21,11 @@ private:
static Logger* m_pThis; static Logger* m_pThis;
static ofstream m_Logfile; static ofstream m_Logfile;
static std::map<unsigned long long, std::string> m_logs; static std::map<unsigned long long, std::string> m_logs;
static string m_dirPath;
mutex mutexLock; mutex mutexLock;
void Clear();
void Open(); void Open();
void Close(); void Close();
}; };

110
backend/logger/logger.rc Normal file
View File

@@ -0,0 +1,110 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "InternalName", "logger.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "logger.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -25,12 +25,16 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="include\interface.h" /> <ClInclude Include="include\interface.h" />
<ClInclude Include="include\logger.h" /> <ClInclude Include="include\logger.h" />
<ClInclude Include="resource.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\utils\utils.vcxproj"> <ProjectReference Include="..\utils\utils.vcxproj">
<Project>{b85009ce-4a5c-4a5a-b85d-001b3a2651b2}</Project> <Project>{b85009ce-4a5c-4a5a-b85d-001b3a2651b2}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="logger.rc" />
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion> <VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
@@ -72,19 +76,23 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>.\..\..\bin\</OutDir> <OutDir>.\..\..\build\backend\bin\</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@@ -133,6 +141,7 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<Version>{{OLYMPUS_VERSION_NUMBER}}.{{OLYMPUS_COMMIT_HASH}}</Version>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

View File

@@ -29,5 +29,13 @@
<ClInclude Include="include\interface.h"> <ClInclude Include="include\interface.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="logger.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

14
backend/logger/resource.h Normal file
View File

@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by logger.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -4,6 +4,11 @@
#define LOGGER Logger::GetLogger() #define LOGGER Logger::GetLogger()
void setLogDirectory(string m_dirPath)
{
LOGGER->setDirectory(m_dirPath);
}
void log(const string& message, bool addToJSON) void log(const string& message, bool addToJSON)
{ {
LOGGER->log(message, addToJSON); LOGGER->log(message, addToJSON);

View File

@@ -8,25 +8,51 @@ const string Logger::m_sFileName = LOG_NAME;
Logger* Logger::m_pThis = NULL; Logger* Logger::m_pThis = NULL;
ofstream Logger::m_Logfile; ofstream Logger::m_Logfile;
std::map<unsigned long long, std::string> Logger::m_logs; std::map<unsigned long long, std::string> Logger::m_logs;
std::string Logger::m_dirPath;
Logger::Logger() Logger::Logger()
{ {
} }
Logger* Logger::GetLogger() Logger* Logger::GetLogger()
{ {
if (m_pThis == NULL) { if (m_pThis == NULL) {
m_pThis = new Logger(); m_pThis = new Logger();
std::filesystem::path dirPath = std::filesystem::temp_directory_path(); m_pThis->Clear();
m_Logfile.open((dirPath.string() + m_sFileName).c_str(), ios::out);
} }
return m_pThis; return m_pThis;
} }
void Logger::setDirectory(string newDirPath)
{
m_dirPath = newDirPath;
Clear();
}
void Logger::Clear()
{
lock_guard<mutex> guard(mutexLock);
try {
m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | ios::trunc);
}
catch (...) {
std::filesystem::path m_dirPath = std::filesystem::temp_directory_path();
m_Logfile.open((m_dirPath.string() + m_sFileName).c_str(), ios::out | ios::trunc);
}
m_Logfile << "Creating a new log instance\n";
m_pThis->Close();
}
void Logger::Open() void Logger::Open()
{ {
std::filesystem::path dirPath = std::filesystem::temp_directory_path(); try {
m_Logfile.open((dirPath.string() + m_sFileName).c_str(), ios::out | ios::app); m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | std::ios::app);
}
catch (...) {
std::filesystem::path m_dirPath = std::filesystem::temp_directory_path();
m_Logfile.open((m_dirPath.string() + m_sFileName).c_str(), ios::out | std::ios::app);
}
} }
void Logger::Close() void Logger::Close()

View File

@@ -5,6 +5,7 @@ void DllExport stackUpdate(lua_State* L, int& stackDepth, int initialStack = 0);
void DllExport stackPop(lua_State* L, int popDepth = 1); void DllExport stackPop(lua_State* L, int popDepth = 1);
void DllExport stackClean(lua_State* L, int stackDepth); void DllExport stackClean(lua_State* L, int stackDepth);
void DllExport luaTableToJSON(lua_State* L, int index, json::value& json, bool logKeys = false); void DllExport luaTableToJSON(lua_State* L, int index, json::value& json, bool logKeys = false);
void DllExport luaLogTableKeys(lua_State* L, int index);
#define STACK_UPDATE stackUpdate(L, stackDepth, initialStack); #define STACK_UPDATE stackUpdate(L, stackDepth, initialStack);
#define STACK_INIT int stackDepth = 0; int initialStack = 0; stackUpdate(L, initialStack); #define STACK_INIT int stackDepth = 0; int initialStack = 0; stackUpdate(L, initialStack);

View File

@@ -0,0 +1,110 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "InternalName", "luatools.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "luatools.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -60,19 +60,23 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>.\..\..\bin\</OutDir> <OutDir>.\..\..\build\backend\bin\</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@@ -121,6 +125,7 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<Version>{{OLYMPUS_VERSION_NUMBER}}.{{OLYMPUS_COMMIT_HASH}}</Version>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -160,6 +165,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="include\luatools.h" /> <ClInclude Include="include\luatools.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="luatools.rc" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@@ -23,5 +23,13 @@
<ClInclude Include="include\luatools.h"> <ClInclude Include="include\luatools.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="luatools.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by luatools.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -18,6 +18,29 @@ void stackClean(lua_State* L, int stackDepth)
lua_pop(L, stackDepth); lua_pop(L, stackDepth);
} }
void luaLogTableKeys(lua_State* L, int index)
{
if (lua_istable(L, index))
{
STACK_INIT;
lua_pushvalue(L, index);
lua_pushnil(L);
while (lua_next(L, -2))
{
lua_pushvalue(L, -2);
const char* key = lua_tostring(L, -1);
log(key);
lua_pop(L, 2);
}
lua_pop(L, 1);
STACK_CLEAN;
}
}
void luaTableToJSON(lua_State* L, int index, json::value& json, bool logKeys) void luaTableToJSON(lua_State* L, int index, json::value& json, bool logKeys)
{ {
if (lua_istable(L, index)) if (lua_istable(L, index))

110
backend/olympus/olympus.rc Normal file
View File

@@ -0,0 +1,110 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "InternalName", "olympus.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "olympus.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -20,10 +20,19 @@
<ProjectReference Include="..\logger\logger.vcxproj"> <ProjectReference Include="..\logger\logger.vcxproj">
<Project>{873ecabe-fcfe-4217-ac15-91959c3cf1c6}</Project> <Project>{873ecabe-fcfe-4217-ac15-91959c3cf1c6}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\luatools\luatools.vcxproj">
<Project>{de139ec1-4f88-47d5-be73-f41915fe14a3}</Project>
</ProjectReference>
<ProjectReference Include="..\utils\utils.vcxproj"> <ProjectReference Include="..\utils\utils.vcxproj">
<Project>{b85009ce-4a5c-4a5a-b85d-001b3a2651b2}</Project> <Project>{b85009ce-4a5c-4a5a-b85d-001b3a2651b2}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="olympus.rc" />
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion> <VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
@@ -53,9 +62,11 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -64,10 +75,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>.\..\..\bin\</OutDir> <OutDir>.\..\..\build\backend\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgAutoLink>true</VcpkgAutoLink>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
@@ -87,6 +95,7 @@
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalDependencies>lua.lib</AdditionalDependencies> <AdditionalDependencies>lua.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\third-party\lua</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\..\third-party\lua</AdditionalLibraryDirectories>
<Version>{{OLYMPUS_VERSION_NUMBER}}.{{OLYMPUS_COMMIT_HASH}}</Version>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -112,6 +121,7 @@
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalDependencies>lua.lib</AdditionalDependencies> <AdditionalDependencies>lua.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\third-party\lua</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\..\third-party\lua</AdditionalLibraryDirectories>
<DelayLoadDLLs>dcstools.dll;logger.dll;utils.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@@ -13,4 +13,10 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="olympus.rc" />
</ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by olympus.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -5,7 +5,7 @@
/* Run-time linking to core dll allows for "hot swap". This is useful for development but could be removed when stable.*/ /* Run-time linking to core dll allows for "hot swap". This is useful for development but could be removed when stable.*/
HINSTANCE hGetProcIDDLL = NULL; HINSTANCE hGetProcIDDLL = NULL;
typedef int(__stdcall* f_coreInit)(lua_State* L); typedef int(__stdcall* f_coreInit)(lua_State* L, const char* path);
typedef int(__stdcall* f_coreDeinit)(lua_State* L); typedef int(__stdcall* f_coreDeinit)(lua_State* L);
typedef int(__stdcall* f_coreFrame)(lua_State* L); typedef int(__stdcall* f_coreFrame)(lua_State* L);
typedef int(__stdcall* f_coreUnitsData)(lua_State* L); typedef int(__stdcall* f_coreUnitsData)(lua_State* L);
@@ -18,25 +18,43 @@ f_coreUnitsData coreUnitsData = nullptr;
f_coreWeaponsData coreWeaponsData = nullptr; f_coreWeaponsData coreWeaponsData = nullptr;
f_coreMissionData coreMissionData = nullptr; f_coreMissionData coreMissionData = nullptr;
string modPath;
//Returns the last Win32 error, in string format. Returns an empty string if there is no error.
std::string GetLastErrorAsString()
{
//Get the error message ID, if any.
DWORD errorMessageID = ::GetLastError();
if (errorMessageID == 0) {
return std::string(); //No error message has been recorded
}
LPSTR messageBuffer = nullptr;
//Ask Win32 to give us the string version of that message ID.
//The parameters we pass in, tell Win32 to create the buffer that holds the message for us (because we don't yet know how long the message string will be).
size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
//Copy the error message into a std::string.
std::string message(messageBuffer, size);
//Free the Win32's string's buffer.
LocalFree(messageBuffer);
return message;
}
static int onSimulationStart(lua_State* L) static int onSimulationStart(lua_State* L)
{ {
LogInfo(L, "Trying to load core.dll from " + modPath);
SetDllDirectoryA(modPath.c_str());
setLogDirectory(modPath);
log("onSimulationStart callback called successfully"); log("onSimulationStart callback called successfully");
string modLocation; string dllLocation = modPath + "\\core.dll";
string dllLocation;
char* buf = nullptr;
size_t sz = 0;
if (_dupenv_s(&buf, &sz, "DCSOLYMPUS_PATH") == 0 && buf != nullptr)
{
modLocation = buf;
free(buf);
}
else
{
log("DCSOLYMPUS_PATH environment variable is missing");
goto error;
}
dllLocation = modLocation + "\\bin\\core.dll";
log("Loading core.dll"); log("Loading core.dll");
hGetProcIDDLL = LoadLibrary(to_wstring(dllLocation).c_str()); hGetProcIDDLL = LoadLibrary(to_wstring(dllLocation).c_str());
@@ -90,14 +108,14 @@ static int onSimulationStart(lua_State* L)
goto error; goto error;
} }
coreInit(L); coreInit(L, modPath.c_str());
LogInfo(L, "Module loaded and started successfully."); LogInfo(L, "Module loaded and started successfully.");
return 0; return 0;
error: error:
LogError(L, "Error while loading module, see Olympus.log in temporary folder for additional details."); LogError(L, "Error while loading module: " + GetLastErrorAsString());
return 0; return 0;
} }
@@ -144,7 +162,7 @@ static int onSimulationStop(lua_State* L)
return 0; return 0;
error: error:
LogError(L, "Error while unloading module, see Olympus.log in temporary folder for additional details."); LogError(L, "Error while unloading module: " + GetLastErrorAsString());
return 0; return 0;
} }
@@ -187,6 +205,34 @@ static const luaL_Reg Map[] = {
extern "C" DllExport int luaopen_olympus(lua_State * L) extern "C" DllExport int luaopen_olympus(lua_State * L)
{ {
lua_getglobal(L, "require");
lua_pushstring(L, "lfs");
lua_pcall(L, 1, 1, 0);
lua_getfield(L, -1, "writedir");
lua_pcall(L, 0, 1, 0);
if (lua_isstring(L, -1)) {
modPath = string(lua_tostring(L, -1)) + "Mods\\Services\\Olympus\\bin\\";
SetDllDirectoryA(modPath.c_str());
LogInfo(L, "Instance location retrieved successfully");
}
else {
/* Log without using the helper dlls because we have not loaded them yet here */
lua_getglobal(L, "log");
lua_getfield(L, -1, "ERROR");
int errorLevel = (int)lua_tointeger(L, -1);
lua_getglobal(L, "log");
lua_getfield(L, -1, "write");
lua_pushstring(L, "Olympus.dll");
lua_pushnumber(L, errorLevel);
lua_pushstring(L, "An error has occurred while trying to retrieve Olympus's instance location");
lua_pcall(L, 3, 0, 0);
return 0;
}
LogInfo(L, "Loading .dlls from " + modPath);
luaL_register(L, "olympus", Map); luaL_register(L, "olympus", Map);
return 1; return 1;
} }

View File

@@ -0,0 +1,28 @@
#pragma once
#define VERSION "{{OLYMPUS_VERSION_NUMBER}}.{{OLYMPUS_COMMIT_HASH}}"
#define LOG_NAME "..\\..\\..\\..\\Logs\\Olympus_log.txt"
#define REST_ADDRESS "http://localhost:3001"
#define REST_URI "olympus"
#define UNITS_URI "units"
#define WEAPONS_URI "weapons"
#define LOGS_URI "logs"
#define AIRBASES_URI "airbases"
#define BULLSEYE_URI "bullseyes"
#define MISSION_URI "mission"
#define COMMANDS_URI "commands"
#define FRAMERATE_TIME_INTERVAL 0.05
#define OLYMPUS_JSON_PATH "..\\..\\..\\..\\Config\\olympus.json"
#define AIRCRAFT_DATABASE_PATH "..\\databases\\units\\aircraftdatabase.json"
#define HELICOPTER_DATABASE_PATH "..\\databases\\units\\helicopterdatabase.json"
#define GROUNDUNIT_DATABASE_PATH "..\\databases\\units\\groundunitdatabase.json"
#define NAVYUNIT_DATABASE_PATH "..\\databases\\units\\navyunitdatabase.json"
#define MIST_SCRIPT "..\\Scripts\\mist.lua"
#define OLYMPUS_COMMAND_SCRIPT "..\\Scripts\\OlympusCommand.lua"
#define UNIT_PAYLOADS_SCRIPT "..\\Scripts\\unitPayloads.lua"
#define TEMPLATES_SCRIPT "..\\Scripts\\templates.lua"
#define MODS_SCRIPT "..\\Scripts\\mods.lua"

14
backend/utils/resource.h Normal file
View File

@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by utils.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -44,6 +44,7 @@ std::string to_string(const std::wstring& wstr)
std::string random_string(size_t length) std::string random_string(size_t length)
{ {
srand(static_cast<unsigned int>(time(NULL)));
auto randchar = []() -> char auto randchar = []() -> char
{ {
const char charset[] = const char charset[] =

110
backend/utils/utils.rc Normal file
View File

@@ -0,0 +1,110 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "InternalName", "utils.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "utils.dll"
VALUE "ProductName", "TODO: <Product name>"
VALUE "ProductVersion", "1.0.4.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -20,10 +20,14 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="include\utils.h" /> <ClInclude Include="include\utils.h" />
<ClInclude Include="resource.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\utils.cpp" /> <ClCompile Include="src\utils.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="utils.rc" />
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion> <VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
@@ -65,19 +69,23 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\DCSOlympus.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>.\..\..\bin\</OutDir> <OutDir>.\..\..\build\backend\bin\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>.\..\..\bin\$(Platform)\$(Configuration)\</OutDir> <OutDir>.\..\..\bin\$(Platform)\$(Configuration)\</OutDir>

View File

@@ -14,10 +14,16 @@
<ClInclude Include="include\utils.h"> <ClInclude Include="include\utils.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\utils.cpp"> <ClCompile Include="src\utils.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="utils.rc" />
</ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,14 @@
{
"default-registry": {
"kind": "git",
"baseline": "7f9f0e44db287e8e67c0e888141bfa200ab45121",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}

6
backend/vcpkg.json Normal file
View File

@@ -0,0 +1,6 @@
{
"dependencies": [
"cpprestsdk",
"geographiclib"
]
}

View File

@@ -1,17 +1,2 @@
cd src call .\scripts\batch\build.bat
msbuild olympus.sln /t:Rebuild /p:Configuration=Release call .\scripts\batch\package.bat
cd ..
cd client
call npm install
rmdir /s /q "hgt"
call npm run emit-declarations
call npm run build
cd "plugins\controltips"
call npm run build
cd "..\.."
cd "plugins\databasemanager"
call npm run build
cd "..\.."
call npm prune --production
cd ..
call "C:\Program Files (x86)\Inno Setup 6\iscc.exe" "installer\olympus.iss"

View File

@@ -1,2 +0,0 @@
{
}

View File

@@ -1,49 +0,0 @@
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var fs = require('fs');
var bodyParser = require('body-parser');
var atcRouter = require('./routes/api/atc');
var airbasesRouter = require('./routes/api/airbases');
var elevationRouter = require('./routes/api/elevation');
var databasesRouter = require('./routes/api/databases');
var indexRouter = require('./routes/index');
var uikitRouter = require('./routes/uikit');
var usersRouter = require('./routes/users');
var resourcesRouter = require('./routes/resources');
var pluginsRouter = require('./routes/plugins');
var app = express();
app.use(logger('dev'));
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter);
app.use('/api/atc', atcRouter);
app.use('/api/airbases', airbasesRouter);
app.use('/api/elevation', elevationRouter);
app.use('/api/databases', databasesRouter);
app.use('/plugins', pluginsRouter)
app.use('/users', usersRouter);
app.use('/uikit', uikitRouter);
app.use('/resources', resourcesRouter);
app.set('view engine', 'ejs');
let rawdata = fs.readFileSync('../olympus.json');
let config = JSON.parse(rawdata);
if (config["server"] != undefined)
app.get('/config', (req, res) => res.send(config["server"]));
module.exports = app;
const DemoDataGenerator = require('./demo.js');
var demoDataGenerator = new DemoDataGenerator(app);

View File

@@ -1,90 +0,0 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('client:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}

View File

@@ -1,4 +0,0 @@
copy .\\node_modules\\leaflet\\dist\\leaflet.css .\\public\\stylesheets\\leaflet\\leaflet.css
copy .\\node_modules\\leaflet-gesture-handling\\dist\\leaflet-gesture-handling.css .\\public\\stylesheets\\leaflet\\leaflet-gesture-handling.css
copy .\\node_modules\\leaflet.nauticscale\\dist\\leaflet.nauticscale.js .\\public\\javascripts\\leaflet.nauticscale.js
copy .\\node_modules\\leaflet-path-drag\\dist\\L.Path.Drag.js .\\public\\javascripts\\L.Path.Drag.js

View File

@@ -1,2 +0,0 @@
start cmd /k "npm run start"
start cmd /k "watchify .\src\index.ts --debug -o .\public\javascripts\bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ]

View File

@@ -1,516 +0,0 @@
const { random } = require('@turf/turf');
var basicAuth = require('express-basic-auth')
var enc = new TextEncoder();
const DEMO_UNIT_DATA = {
["1"]:{ category: "Aircraft", alive: true, human: false, controlled: true, coalition: 2, country: 0, name: "KC-135", unitName: "Cool guy 1-1 who also has a very long name", groupName: "Cool group 1", state: 1, task: "Being cool!",
hasTask: true, position: { lat: 37, lng: -116, alt: 1000 }, speed: 200, heading: 45, isActiveTanker: true, isActiveAWACS: false, onOff: true, followRoads: false, fuel: 50,
desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, desiredAltitudeType: 1, leaderID: 0,
formationOffset: { x: 0, y: 0, z: 0 },
targetID: 0,
targetPosition: { lat: 0, lng: 0, alt: 0 },
ROE: 1,
reactionToThreat: 1,
emissionsCountermeasures: 1,
TACAN: { isOn: false, XY: 'Y', callsign: 'TKR', channel: 40 },
radio: { frequency: 124000000, callsign: 1, callsignNumber: 1 },
generalSettings: { prohibitAA: false, prohibitAfterburner: false, prohibitAG: false, prohibitAirWpn: false, prohibitJettison: false },
ammo: [{ quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 }, { quantity: 2, name: "A cool missile with a longer name\0Ciao", guidance: 0, category: 0, missileCategory: 0 }, { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } ],
contacts: [{ID: 2, detectionMethod: 1}, {ID: 3, detectionMethod: 4}, {ID: 4, detectionMethod: 1}],
activePath: [{lat: 38, lng: -115, alt: 0}, {lat: 38, lng: -114, alt: 0}]
},
["2"]:{ category: "Aircraft", alive: true, human: false, controlled: true, coalition: 1, country: 0, name: "E-3A", unitName: "Cool guy 1-2", groupName: "Cool group 2", state: 1, task: "Being cool",
hasTask: true, position: { lat: 36.9, lng: -116, alt: 1000 }, speed: 200, heading: 315 * Math.PI / 180, isActiveTanker: false, isActiveAWACS: true, onOff: true, followRoads: false, fuel: 50,
desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, desiredAltitudeType: 1, leaderID: 0,
formationOffset: { x: 0, y: 0, z: 0 },
targetID: 0,
targetPosition: { lat: 0, lng: 0, alt: 0 },
ROE: 1,
reactionToThreat: 1,
emissionsCountermeasures: 1,
TACAN: { isOn: false, XY: 'Y', callsign: 'TKR', channel: 40 },
radio: { frequency: 124000000, callsign: 1, callsignNumber: 1 },
generalSettings: { prohibitAA: false, prohibitAfterburner: false, prohibitAG: false, prohibitAirWpn: false, prohibitJettison: false },
ammo: [{ quantity: 2, name: "A cool missile", guidance: 0, category: 0, missileCategory: 0 } ],
contacts: [{ID: 4, detectionMethod: 1}],
activePath: [ ]
}, ["3"]:{ category: "Helicopter", alive: true, human: false, controlled: false, coalition: 1, country: 0, name: "AH-64D_BLK_II", unitName: "Cool guy 1-4", groupName: "Cool group 3", state: 1, task: "Being cool",
hasTask: false, position: { lat: 37.1, lng: -116.1, alt: 1000 }, speed: 200, heading: 315 * Math.PI / 180, isActiveTanker: false, isActiveAWACS: false, onOff: true, followRoads: false, fuel: 50,
desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, desiredAltitudeType: 1, leaderID: 0,
formationOffset: { x: 0, y: 0, z: 0 },
targetID: 0,
targetPosition: { lat: 0, lng: 0, alt: 0 },
ROE: 1,
reactionToThreat: 1,
emissionsCountermeasures: 1,
TACAN: { isOn: false, XY: 'Y', callsign: 'TKR', channel: 40 },
radio: { frequency: 124000000, callsign: 1, callsignNumber: 1 },
generalSettings: { prohibitAA: false, prohibitAfterburner: false, prohibitAG: false, prohibitAirWpn: false, prohibitJettison: false },
ammo: [{ quantity: 2, name: "A cool missile", guidance: 0, category: 0, missileCategory: 0 } ],
contacts: [{ID: 1, detectionMethod: 16}],
activePath: [ ]
}, ["4"]:{ category: "GroundUnit", alive: true, human: false, controlled: true, coalition: 2, country: 0, name: "Tor 9A331", unitName: "Cool guy 2-1", groupName: "Cool group 4", state: 1, task: "Being cool",
hasTask: false, position: { lat: 37.2, lng: -116.1, alt: 1000 }, speed: 200, heading: 315 * Math.PI / 180, isActiveTanker: false, isActiveAWACS: false, onOff: false, followRoads: false, fuel: 50,
desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, desiredAltitudeType: 1, leaderID: 0,
formationOffset: { x: 0, y: 0, z: 0 },
targetID: 0,
targetPosition: { lat: 0, lng: 0, alt: 0 },
ROE: 1,
reactionToThreat: 1,
emissionsCountermeasures: 1,
TACAN: { isOn: false, XY: 'Y', callsign: 'TKR', channel: 40 },
radio: { frequency: 124000000, callsign: 1, callsignNumber: 1 },
generalSettings: { prohibitAA: false, prohibitAfterburner: false, prohibitAG: false, prohibitAirWpn: false, prohibitJettison: false },
ammo: [{ quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } ],
contacts: [{ID: 1001, detectionMethod: 16}],
activePath: [ ],
isLeader: true,
operateAs: 2
}, ["5"]:{ category: "GroundUnit", alive: true, human: false, controlled: true, coalition: 2, country: 0, name: "Gepard", unitName: "Cool guy 2-2", groupName: "Cool group 4", state: 1, task: "Being cool",
hasTask: false, position: { lat: 37.21, lng: -116.1, alt: 1000 }, speed: 200, heading: 315 * Math.PI / 180, isActiveTanker: false, isActiveAWACS: false, onOff: false, followRoads: false, fuel: 50,
desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, desiredAltitudeType: 1, leaderID: 0,
formationOffset: { x: 0, y: 0, z: 0 },
targetID: 0,
targetPosition: { lat: 0, lng: 0, alt: 0 },
ROE: 1,
reactionToThreat: 1,
emissionsCountermeasures: 1,
TACAN: { isOn: false, XY: 'Y', callsign: 'TKR', channel: 40 },
radio: { frequency: 124000000, callsign: 1, callsignNumber: 1 },
generalSettings: { prohibitAA: false, prohibitAfterburner: false, prohibitAG: false, prohibitAirWpn: false, prohibitJettison: false },
ammo: [{ quantity: 2, name: "A cool missile", guidance: 0, category: 0, missileCategory: 0 } ],
contacts: [],
activePath: [ ],
isLeader: false,
operateAs: 2
},
["6"]:{ category: "Aircraft", alive: true, human: false, controlled: false, coalition: 1, country: 0, name: "FA-18C_hornet", unitName: "Bad boi 1-2", groupName: "Bad group 1", state: 1, task: "Being bad",
hasTask: false, position: { lat: 36.8, lng: -116, alt: 1000 }, speed: 200, heading: 315 * Math.PI / 180, isActiveTanker: false, isActiveAWACS: false, onOff: true, followRoads: false, fuel: 50,
desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, desiredAltitudeType: 1, leaderID: 0,
formationOffset: { x: 0, y: 0, z: 0 },
targetID: 0,
targetPosition: { lat: 0, lng: 0, alt: 0 },
ROE: 1,
reactionToThreat: 1,
emissionsCountermeasures: 1,
TACAN: { isOn: false, XY: 'Y', callsign: 'TKR', channel: 40 },
radio: { frequency: 124000000, callsign: 1, callsignNumber: 1 },
generalSettings: { prohibitAA: false, prohibitAfterburner: false, prohibitAG: false, prohibitAirWpn: false, prohibitJettison: false },
ammo: [{ quantity: 2, name: "A cool missile", guidance: 0, category: 0, missileCategory: 0 } ],
contacts: [{ID: 1, detectionMethod: 16}],
activePath: [ ]
}, ["7"]:{ category: "GroundUnit", alive: true, human: false, controlled: true, coalition: 1, country: 0, name: "Tor 9A331", unitName: "Cool guy 2-1", groupName: "Cool group 10", state: 1, task: "Being cool",
hasTask: false, position: { lat: 37.2, lng: -116.2, alt: 1000 }, speed: 200, heading: 315 * Math.PI / 180, isActiveTanker: false, isActiveAWACS: false, onOff: true, followRoads: false, fuel: 50,
desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, desiredAltitudeType: 1, leaderID: 0,
formationOffset: { x: 0, y: 0, z: 0 },
targetID: 0,
targetPosition: { lat: 0, lng: 0, alt: 0 },
ROE: 1,
reactionToThreat: 1,
emissionsCountermeasures: 1,
TACAN: { isOn: false, XY: 'Y', callsign: 'TKR', channel: 40 },
radio: { frequency: 124000000, callsign: 1, callsignNumber: 1 },
generalSettings: { prohibitAA: false, prohibitAfterburner: false, prohibitAG: false, prohibitAirWpn: false, prohibitJettison: false },
ammo: [{ quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } ],
contacts: [{ID: 1001, detectionMethod: 16}],
activePath: [ ],
isLeader: true
},
}
const DEMO_WEAPONS_DATA = {
["1001"]:{ category: "Missile", alive: true, coalition: 2, name: "", position: { lat: 37.1, lng: -116, alt: 1000 }, speed: 200, heading: 45 * Math.PI / 180 },
}
class DemoDataGenerator {
constructor(app)
{
app.get('/demo/units', (req, res) => this.units(req, res));
app.get('/demo/weapons', (req, res) => this.weapons(req, res));
app.get('/demo/logs', (req, res) => this.logs(req, res));
app.get('/demo/bullseyes', (req, res) => this.bullseyes(req, res));
app.get('/demo/airbases', (req, res) => this.airbases(req, res));
app.get('/demo/mission', (req, res) => this.mission(req, res));
app.get('/demo/commands', (req, res) => this.command(req, res));
app.put('/demo', (req, res) => this.put(req, res));
app.use('/demo', basicAuth({
users: {
'admin': 'password',
'blue': 'bluepassword',
'red': 'redpassword'
},
}))
//for (let i = 8; i < 100; i++) {
// var randomUnit = { category: "Aircraft", alive: true, human: false, controlled: true, coalition: 2, country: 0, name: "KC-135", unitName: "Cool guy 1-1 who also has a very long name", groupName: "Cool group 1", state: 1, task: "Being cool!",
// hasTask: true, position: { lat: 37 + Math.random(), lng: -116 + Math.random(), alt: 1000 }, speed: 200, heading: 45, isActiveTanker: true, isActiveAWACS: false, onOff: true, followRoads: false, fuel: 50,
// desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, desiredAltitudeType: 1, leaderID: 0,
// formationOffset: { x: 0, y: 0, z: 0 },
// targetID: 0,
// targetPosition: { lat: 0, lng: 0, alt: 0 },
// ROE: 1,
// reactionToThreat: 1,
// emissionsCountermeasures: 1,
// TACAN: { isOn: false, XY: 'Y', callsign: 'TKR', channel: 40 },
// radio: { frequency: 124000000, callsign: 1, callsignNumber: 1 },
// generalSettings: { prohibitAA: false, prohibitAfterburner: false, prohibitAG: false, prohibitAirWpn: false, prohibitJettison: false },
// ammo: [{ quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 }, { quantity: 2, name: "A cool missile with a longer name\0Ciao", guidance: 0, category: 0, missileCategory: 0 }, { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } , { quantity: 2, name: "A cool missile\0Ciao", guidance: 0, category: 0, missileCategory: 0 } ],
// contacts: [{ID: 2, detectionMethod: 1}, {ID: 3, detectionMethod: 4}, {ID: 4, detectionMethod: 1}],
// activePath: []
// }
// DEMO_UNIT_DATA[i.toString()] = randomUnit;
//}
this.startTime = Date.now();
}
units(req, res){
var array = new Uint8Array();
var time = Date.now();
array = this.concat(array, this.uint64ToByteArray(BigInt(time)));
for (let idx in DEMO_UNIT_DATA) {
const unit = DEMO_UNIT_DATA[idx];
array = this.concat(array, this.uint32ToByteArray(idx));
array = this.appendString(array, unit.category, 1);
array = this.appendUint8(array, unit.alive, 2);
array = this.appendUint8(array, unit.human, 3);
array = this.appendUint8(array, unit.controlled, 4);
array = this.appendUint16(array, unit.coalition, 5);
array = this.appendUint8(array, unit.country, 6);
array = this.appendString(array, unit.name, 7);
array = this.appendString(array, unit.unitName, 8);
array = this.appendString(array, unit.groupName, 9);
array = this.appendUint8(array, unit.state, 10);
array = this.appendString(array, unit.task, 11);
array = this.appendUint8(array, unit.hasTask, 12);
array = this.appendCoordinates(array, unit.position, 13);
array = this.appendDouble(array, unit.speed, 14);
array = this.appendDouble(array, unit.heading, 15);
array = this.appendUint8(array, unit.isActiveTanker, 16);
array = this.appendUint8(array, unit.isActiveAWACS, 17);
array = this.appendUint8(array, unit.onOff, 18);
array = this.appendUint8(array, unit.followRoads, 19);
array = this.appendUint16(array, unit.fuel, 20);
array = this.appendDouble(array, unit.desiredSpeed, 21);
array = this.appendUint8(array, unit.desiredSpeedType, 22);
array = this.appendDouble(array, unit.desiredAltitude, 23);
array = this.appendUint8(array, unit.desiredAltitudeType, 24);
array = this.appendUint32(array, unit.leaderID, 25);
array = this.appendOffset(array, unit.formationOffset, 26);
array = this.appendUint32(array, unit.targetID, 27);
array = this.appendCoordinates(array, unit.targetPosition, 28);
array = this.appendUint8(array, unit.ROE, 29);
array = this.appendUint8(array, unit.reactionToThreat, 30);
array = this.appendUint8(array, unit.emissionsCountermeasures, 31);
array = this.appendTACAN(array, unit.TACAN, 32);
array = this.appendRadio(array, unit.radio, 33);
array = this.appendRadio(array, unit.generalSettings, 34);
array = this.appendAmmo(array, unit.ammo, 35);
array = this.appendContacts(array, unit.contacts, 36);
array = this.appendActivePath(array, unit.activePath, 37);
array = this.appendUint8(array, unit.isLeader, 38);
array = this.appendUint8(array, unit.operateAs, 39);
array = this.concat(array, this.uint8ToByteArray(255));
}
res.end(Buffer.from(array, 'binary'));
};
weapons(req, res){
var array = new Uint8Array();
var time = Date.now();
array = this.concat(array, this.uint64ToByteArray(BigInt(time)));
for (let idx in DEMO_WEAPONS_DATA) {
const weapon = DEMO_WEAPONS_DATA[idx];
array = this.concat(array, this.uint32ToByteArray(idx));
array = this.appendString(array, weapon.category, 1);
array = this.appendUint8(array, weapon.alive, 2);
array = this.appendUint16(array, weapon.coalition, 5);
array = this.appendString(array, weapon.name, 7);
array = this.appendCoordinates(array, weapon.position, 13);
array = this.appendDouble(array, weapon.speed, 14);
array = this.appendDouble(array, weapon.heading, 15);
array = this.concat(array, this.uint8ToByteArray(255));
}
res.end(Buffer.from(array, 'binary'));
};
concat(array1, array2) {
var mergedArray = new Uint8Array(array1.length + array2.length);
mergedArray.set(array1);
mergedArray.set(array2, array1.length);
return mergedArray;
}
uint8ToByteArray(number) {
var buffer = new ArrayBuffer(1);
var longNum = new Uint8Array(buffer);
longNum[0] = number;
return Array.from(new Uint8Array(buffer));
}
uint16ToByteArray(number) {
var buffer = new ArrayBuffer(2);
var longNum = new Uint16Array(buffer);
longNum[0] = number;
return Array.from(new Uint8Array(buffer));
}
uint32ToByteArray(number) {
var buffer = new ArrayBuffer(4);
var longNum = new Uint32Array(buffer);
longNum[0] = number;
return Array.from(new Uint8Array(buffer));
}
uint64ToByteArray(number) {
var buffer = new ArrayBuffer(8);
var longNum = new BigUint64Array(buffer);
longNum[0] = number;
return Array.from(new Uint8Array(buffer));
}
doubleToByteArray(number) {
var buffer = new ArrayBuffer(8);
var longNum = new Float64Array(buffer);
longNum[0] = number;
return Array.from(new Uint8Array(buffer));
}
appendUint8(array, number, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint8ToByteArray(number));
return array;
}
appendUint16(array, number, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint16ToByteArray(number));
return array;
}
appendUint32(array, number, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint32ToByteArray(number));
return array;
}
appendDouble(array, number, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.doubleToByteArray(number));
return array;
}
appendCoordinates(array, coordinates, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.doubleToByteArray(coordinates.lat));
array = this.concat(array, this.doubleToByteArray(coordinates.lng));
array = this.concat(array, this.doubleToByteArray(coordinates.alt));
return array;
}
appendOffset(array, offset, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.doubleToByteArray(offset.x));
array = this.concat(array, this.doubleToByteArray(offset.y));
array = this.concat(array, this.doubleToByteArray(offset.z));
return array;
}
appendString(array, string, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint16ToByteArray(string.length));
array = this.concat(array, enc.encode(string));
return array;
}
padString(string, length) {
while (string.length < length)
string += " ";
return string.substring(0, length);
}
appendTACAN(array, TACAN, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint8ToByteArray(TACAN.isOn));
array = this.concat(array, this.uint8ToByteArray(TACAN.channel));
array = this.concat(array, enc.encode(TACAN.XY));
array = this.concat(array, enc.encode(this.padString(TACAN.callsign, 4)));
return array;
}
appendRadio(array, radio, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint32ToByteArray(radio.frequency));
array = this.concat(array, this.uint8ToByteArray(radio.callsign));
array = this.concat(array, this.uint8ToByteArray(radio.callsignNumber));
return array;
}
appendGeneralSettings(array, generalSettings, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint8ToByteArray(generalSettings.prohibitAA));
array = this.concat(array, this.uint8ToByteArray(generalSettings.prohibitAfterburner));
array = this.concat(array, this.uint8ToByteArray(generalSettings.prohibitAG));
array = this.concat(array, this.uint8ToByteArray(generalSettings.prohibitAirWpn));
array = this.concat(array, this.uint8ToByteArray(generalSettings.prohibitJettison));
return array;
}
appendAmmo(array, ammo, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint16ToByteArray(ammo.length));
ammo.forEach((element) => {
array = this.concat(array, this.uint16ToByteArray(element.quantity));
array = this.concat(array, enc.encode(this.padString(element.name, 33)));
array = this.concat(array, this.uint8ToByteArray(element.guidance));
array = this.concat(array, this.uint8ToByteArray(element.category));
array = this.concat(array, this.uint8ToByteArray(element.missileCategory));
})
return array;
}
appendContacts(array, contacts, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint16ToByteArray(contacts.length));
contacts.forEach((element) => {
array = this.concat(array, this.uint32ToByteArray(element.ID));
array = this.concat(array, this.uint8ToByteArray(element.detectionMethod));
})
return array;
}
appendActivePath(array, activePath, datumIndex) {
array = this.concat(array, this.uint8ToByteArray(datumIndex));
array = this.concat(array, this.uint16ToByteArray(activePath.length));
activePath.forEach((element) => {
array = this.concat(array, this.doubleToByteArray(element.lat));
array = this.concat(array, this.doubleToByteArray(element.lng));
array = this.concat(array, this.doubleToByteArray(element.alt));
})
return array;
}
logs(req, res){
var ret = {logs: {"1": "I'm a log!", "2": "I'm a different log!"}};
ret.time = Date.now();
ret.frameRate = 60;
ret.load = 0;
res.send(JSON.stringify(ret));
};
airbases(req, res){
var ret = {airbases: {
["0"]: {
callsign: "Nellis",
latitude: 37.3,
longitude: -115.8,
coalition: "neutral"
},
["1"]: {
callsign: "Red",
latitude: 37.3,
longitude: -115.75,
coalition: "red"
},
["2"]: {
callsign: "Blue",
latitude: 37.3,
longitude: -115.7,
coalition: "blue"
}
}};
ret.time = Date.now();
res.send(JSON.stringify(ret));
};
bullseyes(req, res){
var ret = {bullseyes: {
"0": {
latitude: 37.25,
longitude: -115.8,
coalition: "neutral"
},
"1": {
latitude: 37.25,
longitude: -115.75,
coalition: "red"
},
"2": {
latitude: 37.25,
longitude: -115.7,
coalition: "blue"
}
}};
ret.time = Date.now();
res.send(JSON.stringify(ret));
};
mission(req, res){
var ret = {mission: {theatre: "Nevada"}};
ret.time = Date.now();
ret.mission.dateAndTime = {
time: { h: 10, m: 15, s: 34 },
date: "",
elapsedTime: (Date.now() - this.startTime) / 1000,
startTime: 0
}
ret.mission.coalitions = {
red: [
'RUSSIA',
'CHINA'
],
blue: [
'UK',
'USA'
],
neutral: [
'ITALY'
]
}
ret.mission.commandModeOptions = {
restrictSpawns: true,
restrictToCoalition: true,
setupTime: 0,
spawnPoints: {
red: 400,
blue: 400
},
eras: ["WW2", "Early Cold War", "Late Cold War", "Modern"]
}
var auth = req.get("Authorization");
if (auth) {
var username = Buffer.from(auth.replace("Basic ", ""), 'base64').toString('binary').split(":")[0];
switch (username) {
case "admin":
ret.mission.commandModeOptions.commandMode = "Game master";
break
case "blue":
ret.mission.commandModeOptions.commandMode = "Blue commander";
break;
case "red":
ret.mission.commandModeOptions.commandMode = "Red commander";
break;
}
}
res.send(JSON.stringify(ret));
}
command(req, res) {
var ret = {commandExecuted: Math.random() > 0.5};
res.send(JSON.stringify(ret));
}
put(req, res) {
var ret = {commandHash: Math.random().toString(36).slice(2, 19)}
res.send(JSON.stringify(ret));
}
}
module.exports = DemoDataGenerator;

8140
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,59 +0,0 @@
{
"name": "DCSOlympus",
"node-main": "./bin/www",
"main": "http://localhost:3000",
"version": "v0.4.5-alpha",
"private": true,
"scripts": {
"build": "browserify .\\src\\index.ts --debug -o .\\public\\javascripts\\bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] && copy.bat",
"emit-declarations": "tsc --project tsconfig.json --declaration --emitDeclarationOnly --outfile ./@types/olympus/index.d.ts",
"copy": "copy.bat",
"start": "node ./bin/www",
"debug": "npm run copy & concurrently --kill-others \"npm run watch\" \"nodemon --ignore ./public/databases/ ./bin/www\"",
"watch": "watchify .\\src\\index.ts --debug -o .\\public\\javascripts\\bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ]"
},
"dependencies": {
"@turf/turf": "^6.5.0",
"body-parser": "^1.20.2",
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"ejs": "^3.1.8",
"express": "~4.16.1",
"express-basic-auth": "^1.2.1",
"leaflet-gesture-handling": "^1.2.2",
"morgan": "~1.9.1",
"save": "^2.9.0",
"srtm-elevation": "^2.1.2"
},
"devDependencies": {
"@babel/preset-env": "^7.21.4",
"@tanem/svg-injector": "^10.1.55",
"@types/formatcoords": "^1.1.0",
"@types/geojson": "^7946.0.10",
"@types/leaflet": "^1.9.0",
"@types/node": "^18.16.1",
"@types/sortablejs": "^1.15.0",
"@types/svg-injector": "^0.0.29",
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"concurrently": "^7.6.0",
"cp": "^0.2.0",
"esmify": "^2.1.1",
"formatcoords": "^1.1.3",
"geodesy": "^1.1.2",
"leaflet": "^1.9.3",
"leaflet-control-mini-map": "^0.4.0",
"leaflet-path-drag": "*",
"leaflet.nauticscale": "^1.1.0",
"nodemon": "^2.0.20",
"requirejs": "^2.3.6",
"sortablejs": "^1.15.0",
"tsify": "^5.0.4",
"tslib": "latest",
"typedoc": "^0.24.8",
"typedoc-umlclass": "^0.7.1",
"typescript": "^4.9.4",
"usng.js": "^0.4.5",
"watchify": "^4.0.0"
}
}

View File

@@ -1,5 +0,0 @@
mkdir .\\..\\..\\public\\plugins\\controltipsplugin
copy .\\index.js .\\..\\..\\public\\plugins\\controltipsplugin\\index.js
copy .\\plugin.json .\\..\\..\\public\\plugins\\controltipsplugin\\plugin.json
copy .\\style.css .\\..\\..\\public\\plugins\\controltipsplugin\\style.css

View File

@@ -1,366 +0,0 @@
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _ControlTipsPlugin_instances, _ControlTipsPlugin_element, _ControlTipsPlugin_app, _ControlTipsPlugin_shortcutManager, _ControlTipsPlugin_cursorIsHoveringOverUnit, _ControlTipsPlugin_cursorIsHoveringOverAirbase, _ControlTipsPlugin_mouseoverElement, _ControlTipsPlugin_updateTips;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ControlTipsPlugin = void 0;
const SHOW_CONTROL_TIPS = "Show control tips";
class ControlTipsPlugin {
constructor() {
_ControlTipsPlugin_instances.add(this);
_ControlTipsPlugin_element.set(this, void 0);
_ControlTipsPlugin_app.set(this, void 0);
_ControlTipsPlugin_shortcutManager.set(this, void 0);
_ControlTipsPlugin_cursorIsHoveringOverUnit.set(this, false);
_ControlTipsPlugin_cursorIsHoveringOverAirbase.set(this, false);
_ControlTipsPlugin_mouseoverElement.set(this, void 0);
__classPrivateFieldSet(this, _ControlTipsPlugin_element, document.createElement("div"), "f");
__classPrivateFieldGet(this, _ControlTipsPlugin_element, "f").id = "control-tips-panel";
document.body.appendChild(__classPrivateFieldGet(this, _ControlTipsPlugin_element, "f"));
}
getName() {
return "Control Tips Plugin";
}
initialize(app) {
__classPrivateFieldSet(this, _ControlTipsPlugin_app, app, "f");
__classPrivateFieldSet(this, _ControlTipsPlugin_shortcutManager, __classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getShortcutManager(), "f");
__classPrivateFieldGet(this, _ControlTipsPlugin_shortcutManager, "f").onKeyDown(() => {
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
__classPrivateFieldGet(this, _ControlTipsPlugin_shortcutManager, "f").onKeyUp(() => {
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
document.addEventListener("airbaseMouseover", (ev) => {
__classPrivateFieldSet(this, _ControlTipsPlugin_cursorIsHoveringOverAirbase, true, "f");
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
document.addEventListener("airbaseMouseout", (ev) => {
__classPrivateFieldSet(this, _ControlTipsPlugin_cursorIsHoveringOverAirbase, false, "f");
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
document.addEventListener("unitDeselection", (ev) => {
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
document.addEventListener("unitMouseover", (ev) => {
__classPrivateFieldSet(this, _ControlTipsPlugin_cursorIsHoveringOverUnit, true, "f");
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
document.addEventListener("unitMouseout", (ev) => {
__classPrivateFieldSet(this, _ControlTipsPlugin_cursorIsHoveringOverUnit, false, "f");
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
document.addEventListener("unitsSelection", (ev) => {
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
document.addEventListener("mapVisibilityOptionsChanged", () => {
this.toggle(!__classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getMap().getVisibilityOptions()[SHOW_CONTROL_TIPS]);
});
document.addEventListener("mouseover", (ev) => {
if (ev.target instanceof HTMLElement) {
__classPrivateFieldSet(this, _ControlTipsPlugin_mouseoverElement, ev.target, "f");
}
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
document.addEventListener("mouseup", (ev) => {
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
});
__classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this);
__classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getMap().addVisibilityOption(SHOW_CONTROL_TIPS, true);
return true;
}
getElement() {
return __classPrivateFieldGet(this, _ControlTipsPlugin_element, "f");
}
toggle(bool) {
this.getElement().classList.toggle("hide", bool);
}
}
exports.ControlTipsPlugin = ControlTipsPlugin;
_ControlTipsPlugin_element = new WeakMap(), _ControlTipsPlugin_app = new WeakMap(), _ControlTipsPlugin_shortcutManager = new WeakMap(), _ControlTipsPlugin_cursorIsHoveringOverUnit = new WeakMap(), _ControlTipsPlugin_cursorIsHoveringOverAirbase = new WeakMap(), _ControlTipsPlugin_mouseoverElement = new WeakMap(), _ControlTipsPlugin_instances = new WeakSet(), _ControlTipsPlugin_updateTips = function _ControlTipsPlugin_updateTips() {
const combos = [
{
"keys": [],
"tips": [
{
"key": `SHIFT`,
"action": `Box select`,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": false,
"showIfUnitSelected": false
},
{
"key": `Mouse1`,
"action": `Deselect`,
"showIfUnitSelected": true
},
{
"key": `Mouse1+drag`,
"action": `Move map`,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": false,
"showIfUnitSelected": false
},
{
"key": `Mouse2`,
"action": `Spawn menu`,
"showIfUnitSelected": false,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": false
},
{
"key": `Mouse2`,
"action": `Quick options`,
"showIfUnitSelected": false,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": true
},
{
"key": `Mouse2`,
"action": `Airbase menu`,
"showIfUnitSelected": false,
"showIfHoveringOverAirbase": true,
"showIfHoveringOverUnit": false
},
{
"key": `Mouse2`,
"action": `Set first waypoint`,
"showIfHoveringOverAirbase": false,
"showIfUnitSelected": true,
"unitsMustBeControlled": true
},
{
"key": `Mouse2 (hold)`,
"action": `Interact (ground)`,
"showIfUnitSelected": true,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": false,
"unitsMustBeControlled": true
},
{
"key": `Shift`,
"action": "<em> in formation...</em>",
"showIfUnitSelected": true,
"minSelectedUnits": 2
},
{
"key": "CTRL",
"action": "<em> ... more</em>",
"showIfUnitSelected": true,
"showIfHoveringOverAirbase": false,
"unitsMustBeControlled": true
},
{
"key": "CTRL",
"action": " Pin tool",
"showIfUnitSelected": false,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": false,
"unitsMustBeControlled": true
},
{
"key": "CTRL+Mouse2",
"action": " Airbase menu",
"showIfUnitSelected": true,
"showIfHoveringOverAirbase": true,
"unitsMustBeControlled": true
},
{
"key": `Mouse1`,
"action": "Toggle Blue/Red",
"mouseoverSelector": "#coalition-switch .ol-switch-fill"
},
{
"key": `Mouse2`,
"action": "Set Neutral",
"mouseoverSelector": "#coalition-switch .ol-switch-fill"
},
{
"key": `Mouse1`,
"action": "Toggle time display",
"mouseoverSelector": "#connection-status-panel[data-is-connected] #connection-status-message abbr"
},
{
"key": `Mouse1 or Z`,
"action": "Change location system",
"mouseoverSelector": "#coordinates-tool, #coordinates-tool *"
},
{
"key": `Comma`,
"action": "Decrease precision",
"mouseoverSelector": `#coordinates-tool[data-location-system="MGRS"], #coordinates-tool[data-location-system="MGRS"] *`
},
{
"key": `Period`,
"action": "Increase precision",
"mouseoverSelector": `#coordinates-tool[data-location-system="MGRS"], #coordinates-tool[data-location-system="MGRS"] *`
}
]
},
{
"keys": ["ControlLeft"],
"tips": [
{
"key": `Mouse1`,
"action": "Toggle pin",
"showIfUnitSelected": false,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": false
},
{
"key": `Mouse1`,
"action": "Toggle selection",
"showIfUnitSelected": true,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": true
},
{
"key": `Mouse2`,
"action": `Add waypoint`,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": false,
"showIfUnitSelected": true,
"unitsMustBeControlled": true
},
{
"key": `Mouse2`,
"action": `Interact (airbase)`,
"showIfHoveringOverAirbase": true,
"showIfUnitSelected": true,
"unitsMustBeControlled": true
},
{
"key": `Mouse2`,
"action": `Interact (unit)`,
"showIfHoveringOverAirbase": false,
"showIfHoveringOverUnit": true,
"showIfUnitSelected": true,
"unitsMustBeControlled": true
},
{
"key": `Shift`,
"action": "<em> in formation...</em>",
"showIfUnitSelected": true,
"minSelectedUnits": 2
},
{
"key": `[Num 1-9]`,
"action": "Set hotgroup",
"showIfUnitSelected": true
}
]
},
{
"keys": ["ShiftLeft"],
"tips": [
{
"key": `Mouse1+drag`,
"action": "Box select",
"showIfUnitSelected": false
},
{
"key": `Mouse2`,
"action": "Set first formation waypoint",
"showIfUnitSelected": true,
"minSelectedUnits": 2
},
{
"key": "CTRL",
"action": "<em> ... more</em>",
"minSelectedUnits": 2,
"showIfUnitSelected": true,
"showIfHoveringOverAirbase": false,
"unitsMustBeControlled": true
}
]
},
{
"keys": ["ControlLeft", "ShiftLeft"],
"tips": [
{
"key": `Mouse2`,
"action": "Add formation waypoint",
"showIfUnitSelected": true,
"minSelectedUnits": 2,
"unitsMustBeControlled": true
}
]
}
];
const currentCombo = combos.find((combo) => __classPrivateFieldGet(this, _ControlTipsPlugin_shortcutManager, "f").keyComboMatches(combo.keys)) || combos[0];
const element = this.getElement();
element.innerHTML = "";
let numSelectedUnits = 0;
let numSelectedControlledUnits = 0;
let unitSelectionContainsControlled = false;
if (__classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getUnitsManager()) {
let selectedUnits = Object.values(__classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getUnitsManager().getSelectedUnits());
numSelectedUnits = selectedUnits.length;
numSelectedControlledUnits = selectedUnits.filter((unit) => unit.getControlled()).length;
unitSelectionContainsControlled = numSelectedControlledUnits > 0;
}
const tipsIncludesActiveMouseover = (currentCombo.tips.some((tip) => {
if (!tip.mouseoverSelector) {
return false;
}
if (__classPrivateFieldGet(this, _ControlTipsPlugin_mouseoverElement, "f") instanceof HTMLElement === false) {
return false;
}
if (!__classPrivateFieldGet(this, _ControlTipsPlugin_mouseoverElement, "f").matches(tip.mouseoverSelector)) {
return false;
}
return true;
}));
currentCombo.tips.filter((tip) => {
if (numSelectedUnits > 0) {
if (tip.showIfUnitSelected === false) {
return false;
}
if (tip.unitsMustBeControlled === true && unitSelectionContainsControlled === false) {
return false;
}
if (typeof tip.minSelectedUnits === "number" && numSelectedControlledUnits < tip.minSelectedUnits) {
return false;
}
}
if (numSelectedUnits === 0 && tip.showIfUnitSelected === true) {
return false;
}
if (typeof tip.showIfHoveringOverAirbase === "boolean") {
if (tip.showIfHoveringOverAirbase !== __classPrivateFieldGet(this, _ControlTipsPlugin_cursorIsHoveringOverAirbase, "f")) {
return false;
}
}
if (typeof tip.showIfHoveringOverUnit === "boolean") {
if (tip.showIfHoveringOverUnit !== __classPrivateFieldGet(this, _ControlTipsPlugin_cursorIsHoveringOverUnit, "f")) {
return false;
}
}
if (tipsIncludesActiveMouseover && (typeof tip.mouseoverSelector !== "string" || !__classPrivateFieldGet(this, _ControlTipsPlugin_mouseoverElement, "f").matches(tip.mouseoverSelector))) {
return false;
}
if (!tipsIncludesActiveMouseover && typeof tip.mouseoverSelector === "string") {
return false;
}
element.innerHTML += `<div><span class="key">${tip.key}</span><span class="action">${tip.action}</span></div>`;
});
};
},{}],2:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const controltipsplugin_1 = require("./controltipsplugin");
globalThis.getOlympusPlugin = () => {
return new controltipsplugin_1.ControlTipsPlugin();
};
},{"./controltipsplugin":1}]},{},[2]);

View File

@@ -1,162 +0,0 @@
{
"name": "ControlTipsPlugin",
"version": "v0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
"integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="
},
"convert-source-map": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",
"integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A=="
},
"core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
"integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
"requires": {
"is-arrayish": "^0.2.1"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
"integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg=="
},
"is-utf8": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q=="
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="
},
"parse-json": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
"integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==",
"requires": {
"error-ex": "^1.2.0"
}
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
},
"strip-bom": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==",
"requires": {
"is-utf8": "^0.2.0"
}
},
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="
},
"through2": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
"integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
"requires": {
"readable-stream": "~2.3.6",
"xtend": "~4.0.1"
}
},
"tsconfig": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-5.0.3.tgz",
"integrity": "sha512-Cq65A3kVp6BbsUgg9DRHafaGmbMb9EhAc7fjWvudNWKjkbWrt43FnrtZt6awshH1R0ocfF2Z0uxock3lVqEgOg==",
"requires": {
"any-promise": "^1.3.0",
"parse-json": "^2.2.0",
"strip-bom": "^2.0.0",
"strip-json-comments": "^2.0.0"
}
},
"tsify": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/tsify/-/tsify-5.0.4.tgz",
"integrity": "sha512-XAZtQ5OMPsJFclkZ9xMZWkSNyMhMxEPsz3D2zu79yoKorH9j/DT4xCloJeXk5+cDhosEibu4bseMVjyPOAyLJA==",
"requires": {
"convert-source-map": "^1.1.0",
"fs.realpath": "^1.0.0",
"object-assign": "^4.1.0",
"semver": "^6.1.0",
"through2": "^2.0.0",
"tsconfig": "^5.0.3"
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
}
}
}

View File

@@ -1,10 +0,0 @@
{
"name": "ControlTipsPlugin",
"version": "v0.0.1",
"private": true,
"scripts": {
"build": "browserify ./src/index.ts -p [ tsify --noImplicitAny] > index.js && copy.bat"
},
"dependencies": {},
"devDependencies": {}
}

View File

@@ -1,5 +0,0 @@
mkdir .\\..\\..\\public\\plugins\\databasemanager
copy .\\index.js .\\..\\..\\public\\plugins\\databasemanager\\index.js
copy .\\plugin.json .\\..\\..\\public\\plugins\\databasemanager\\plugin.json
copy .\\style.css .\\..\\..\\public\\plugins\\databasemanager\\style.css

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +0,0 @@
{
"name": "DatabaseManagerPlugin",
"version": "v0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "DatabaseManagerPlugin",
"version": "v0.0.1",
"devDependencies": {}
}
}
}

View File

@@ -1,13 +0,0 @@
{
"name": "DatabaseManagerPlugin",
"version": "v0.0.1",
"private": true,
"scripts": {
"build": "browserify ./src/index.ts -p [ tsify --noImplicitAny] > index.js && copy.bat",
"start": "npm run copy & concurrently --kill-others \"npm run watch\"",
"copy": "copy.bat",
"watch": "watchify ./src/index.ts --debug -o ../../public/plugins/databasemanager/index.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ]"
},
"dependencies": {},
"devDependencies": {}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,38 +0,0 @@
L.Control.ScaleNautic = L.Control.Scale.extend({
options: {
nautic: false
},
_addScales: function(options, className, container) {
L.Control.Scale.prototype._addScales.call(this, options, className, container);
L.setOptions(options);
if (this.options.nautic) {
this._nScale = L.DomUtil.create('div', className, container);
}
},
_updateScales: function (maxMeters) {
L.Control.Scale.prototype._updateScales.call(this, maxMeters);
if (this.options.nautic && maxMeters) {
this._updateNautic(maxMeters);
}
},
_updateNautic: function (maxMeters) {
var scale = this._nScale,
maxNauticalMiles = maxMeters / 1852, nauticalMiles;
if(maxMeters >= 1852) {
nauticalMiles = L.Control.Scale.prototype._getRoundNum.call(this, maxNauticalMiles);
} else {
nauticalMiles = maxNauticalMiles > 0.1 ? Math.round(maxNauticalMiles * 10) / 10 : Math.round(maxNauticalMiles * 100) / 100;
}
scale.style.width = Math.round(this.options.maxWidth * (nauticalMiles / maxNauticalMiles)) - 10 + 'px';
scale.innerHTML = nauticalMiles + ' nm';
}
});
L.control.scalenautic = function (options) {
return new L.Control.ScaleNautic(options);
};

Some files were not shown because too many files have changed in this diff Show More