Skip to content

Commit fcb2bca

Browse files
committed
Documenting unit constructions
1 parent 1b26ce5 commit fcb2bca

File tree

3 files changed

+49
-5
lines changed

3 files changed

+49
-5
lines changed

docs/features/regiment-recruitment.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# US1. Regiment recruitment
2+
3+
**As a Nation,**
4+
**I want to recruit a regiment,**
5+
**So that it appears in my army.**
6+
7+
**Acceptance Criteria:**
8+
| AC1 | Regiment of a particular type is recruited in a province by a nation |
9+
| AC2 | Regiment can be recruited only if one of the province pops allow new recruitment |
10+
| AC3 | Regiment of a type can be recruited only if that type is available to the nation |
11+
| AC4 | Regiment recruitment finishes when all goods for the recruitment have been purchased and consumed by the construction |
12+
| AC5 | Regiment recruitment cannot be finished faster than unit construction time |
13+
| AC7 | When several regiment constructions happen in a province simultaneously, they all progress simultaneously |
14+
15+
**Definition of Done:**
16+
- [X] All acceptance criteria are met.
17+
- [X] Code is reviewed and approved.
18+
- [ ] Necessary tests are written and pass.
19+
- [X] Documentation is updated, if applicable.
20+
- [x] Feature is available in release versions of PA.

docs/features/ship-construction.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# US2. Ship construction
2+
3+
**As a Nation,**
4+
**I want to construct a ship,**
5+
**So that it appears in my navy.**
6+
7+
**Acceptance Criteria:**
8+
| AC1 | Ship of a particular type is recruited in a province by a nation |
9+
| AC2 | Ship can be recruited only in coastal provinces |
10+
| AC3 | Ship of a type can be recruited only if that type is available to the nation |
11+
| AC4 | Ship recruitment finishes when all goods for the recruitment have been purchased and consumed by the construction |
12+
| AC5 | Ship recruitment cannot be finished faster than unit construction time |
13+
| AC6 | Big ships can be recruited only in provinces with appropriate naval base level |
14+
| AC7 | When several ship constructions happen in a province simultaneously, they progress one at a time |
15+
16+
**Definition of Done:**
17+
- [X] All acceptance criteria are met.
18+
- [X] Code is reviewed and approved.
19+
- [ ] Necessary tests are written and pass.
20+
- [X] Documentation is updated, if applicable.
21+
- [x] Feature is available in release versions of PA.

src/economy/economy.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6094,7 +6094,8 @@ void change_factory_type_in_province(sys::state& state, dcon::province_id p, dco
60946094
}
60956095

60966096
void resolve_constructions(sys::state& state) {
6097-
// Regiment construction
6097+
// US1. Regiment construction
6098+
// US1AC7.
60986099
for(auto c : state.world.in_province_land_construction) {
60996100
auto pop = state.world.province_land_construction_get_pop(c);
61006101
auto province = state.world.pop_get_province_from_pop_location(pop);
@@ -6104,7 +6105,7 @@ void resolve_constructions(sys::state& state) {
61046105
auto& current_purchased = c.get_purchased_goods();
61056106
auto construction_time = state.military_definitions.unit_base_definitions[c.get_type()].build_time;
61066107

6107-
// All goods costs must be built
6108+
// US1AC4. All goods costs must be built
61086109
bool ready_for_deployment = true;
61096110
if(!(c.get_nation().get_is_player_controlled() && state.cheat_data.instant_army)) {
61106111
for(uint32_t j = 0; j < commodity_set::set_size && ready_for_deployment; ++j) {
@@ -6118,7 +6119,7 @@ void resolve_constructions(sys::state& state) {
61186119
}
61196120
}
61206121

6121-
// But no faster than construction_time
6122+
// US1AC5. But no faster than construction_time
61226123
if(!state.cheat_data.instant_army) {
61236124
if(state.current_date < c.get_start_date() + construction_time) {
61246125
ready_for_deployment = false;
@@ -6151,7 +6152,8 @@ void resolve_constructions(sys::state& state) {
61516152
}
61526153
}
61536154

6154-
// Ships construction
6155+
// US2 Ships construction
6156+
// US2AC7
61556157
province::for_each_land_province(state, [&](dcon::province_id p) {
61566158
auto rng = state.world.province_get_province_naval_construction(p);
61576159
if(rng.begin() != rng.end()) {
@@ -6164,6 +6166,7 @@ void resolve_constructions(sys::state& state) {
61646166
auto& current_purchased = c.get_purchased_goods();
61656167
auto construction_time = state.military_definitions.unit_base_definitions[c.get_type()].build_time;
61666168

6169+
// US2AC4.
61676170
bool ready_for_deployment = true;
61686171
if(!(c.get_nation().get_is_player_controlled() && state.cheat_data.instant_navy)) {
61696172
for(uint32_t i = 0; i < commodity_set::set_size && ready_for_deployment; ++i) {
@@ -6177,7 +6180,7 @@ void resolve_constructions(sys::state& state) {
61776180
}
61786181
}
61796182

6180-
// But no faster than construction_time
6183+
// US2AC5. But no faster than construction_time
61816184
if(!state.cheat_data.instant_army) {
61826185
if(state.current_date < c.get_start_date() + construction_time) {
61836186
ready_for_deployment = false;

0 commit comments

Comments
 (0)