Skip to content

Commit

Permalink
Fixing GroupCategory
Browse files Browse the repository at this point in the history
Motivated by work in progress with PR #111. Communicating
breaking changes and configuring to change log and updating
behavior
  • Loading branch information
justin-lovell committed Jan 15, 2022
1 parent b4817d0 commit b1d3906
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `net.proto` - `GetPlayerInfo.remote_address`
- `mission.proto` - `PlayerSendChatEvent.player_id`

### Breaking Changes
- Added `GROUP_CATEGORY_UNSPECIFIED` to `dcs.v0.common.GroupCategory`; breaking change as all indexes have changed.

## [0.3.0] - 2022-01-14
### Added
- Generated scaffolding for the `net.*` scope into `NetService`
Expand Down
5 changes: 4 additions & 1 deletion lua/DCS-gRPC/methods/coalitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,16 @@ local createGroundGroupTemplate = function(groupTemplate)
end

GRPC.methods.addGroup = function(params)
if params.groupCategory == 0 then
return GRPC.errorInvalidArgument("group category must be specified")
end
if params.country_id == 0 or params.country_id == 15 then
return GRPC.errorInvalidArgument("invalid country code")
end

local template = createGroundGroupTemplate(params.template.groundTemplate)

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

return GRPC.success({group = GRPC.exporters.group(Group.getByName(template.name))})
end
Expand Down
2 changes: 1 addition & 1 deletion protos/dcs/coalition/v0/coalition.proto
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ message AddGroupResponse {

message GetGroupsRequest {
dcs.common.v0.Coalition coalition = 1;
optional dcs.common.v0.GroupCategory category = 2;
dcs.common.v0.GroupCategory category = 2;
}

message GetGroupsResponse {
Expand Down
11 changes: 6 additions & 5 deletions protos/dcs/common/v0/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ message Group {
* Group category enumerator.
*/
enum GroupCategory {
GROUP_CATEGORY_AIRPLANE = 0;
GROUP_CATEGORY_HELICOPTER = 1;
GROUP_CATEGORY_GROUND = 2;
GROUP_CATEGORY_SHIP = 3;
GROUP_CATEGORY_TRAIN = 4;
GROUP_CATEGORY_UNSPECIFIED = 0;
GROUP_CATEGORY_AIRPLANE = 1;
GROUP_CATEGORY_HELICOPTER = 2;
GROUP_CATEGORY_GROUND = 3;
GROUP_CATEGORY_SHIP = 4;
GROUP_CATEGORY_TRAIN = 5;
}

/**
Expand Down

0 comments on commit b1d3906

Please sign in to comment.