Skip to content

Commit b1d3906

Browse files
committed
Fixing GroupCategory
Motivated by work in progress with PR #111. Communicating breaking changes and configuring to change log and updating behavior
1 parent b4817d0 commit b1d3906

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- `net.proto` - `GetPlayerInfo.remote_address`
1313
- `mission.proto` - `PlayerSendChatEvent.player_id`
1414

15+
### Breaking Changes
16+
- Added `GROUP_CATEGORY_UNSPECIFIED` to `dcs.v0.common.GroupCategory`; breaking change as all indexes have changed.
17+
1518
## [0.3.0] - 2022-01-14
1619
### Added
1720
- Generated scaffolding for the `net.*` scope into `NetService`

lua/DCS-gRPC/methods/coalitions.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,16 @@ local createGroundGroupTemplate = function(groupTemplate)
106106
end
107107

108108
GRPC.methods.addGroup = function(params)
109+
if params.groupCategory == 0 then
110+
return GRPC.errorInvalidArgument("group category must be specified")
111+
end
109112
if params.country_id == 0 or params.country_id == 15 then
110113
return GRPC.errorInvalidArgument("invalid country code")
111114
end
112115

113116
local template = createGroundGroupTemplate(params.template.groundTemplate)
114117

115-
coalition.addGroup(params.country - 1, params.groupCategory, template) -- Decrement for non zero-indexed gRPC enum
118+
coalition.addGroup(params.country - 1, params.groupCategory - 1, template) -- Decrement for non zero-indexed gRPC enum
116119

117120
return GRPC.success({group = GRPC.exporters.group(Group.getByName(template.name))})
118121
end

protos/dcs/coalition/v0/coalition.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ message AddGroupResponse {
112112

113113
message GetGroupsRequest {
114114
dcs.common.v0.Coalition coalition = 1;
115-
optional dcs.common.v0.GroupCategory category = 2;
115+
dcs.common.v0.GroupCategory category = 2;
116116
}
117117

118118
message GetGroupsResponse {

protos/dcs/common/v0/common.proto

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,12 @@ message Group {
231231
* Group category enumerator.
232232
*/
233233
enum GroupCategory {
234-
GROUP_CATEGORY_AIRPLANE = 0;
235-
GROUP_CATEGORY_HELICOPTER = 1;
236-
GROUP_CATEGORY_GROUND = 2;
237-
GROUP_CATEGORY_SHIP = 3;
238-
GROUP_CATEGORY_TRAIN = 4;
234+
GROUP_CATEGORY_UNSPECIFIED = 0;
235+
GROUP_CATEGORY_AIRPLANE = 1;
236+
GROUP_CATEGORY_HELICOPTER = 2;
237+
GROUP_CATEGORY_GROUND = 3;
238+
GROUP_CATEGORY_SHIP = 4;
239+
GROUP_CATEGORY_TRAIN = 5;
239240
}
240241

241242
/**

0 commit comments

Comments
 (0)