Description:
Don't allow towers to overlap other towers, water, or trees.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r631:5bc0c18d4ff5 -

@@ -25,7 +25,8
25 typeof(PreserveComponent),
25 typeof(PreserveComponent),
26 typeof(SelectedComponent),
26 typeof(SelectedComponent),
27 typeof(ToolComponent),
27 typeof(ToolComponent),
28 typeof(PointComponent))]
28 typeof(PointComponent),
29 typeof(StructureComponent))]
29 [Sends(typeof(ChangeContractStatusMessage),
30 [Sends(typeof(ChangeContractStatusMessage),
30 typeof(PlaySoundMessage),
31 typeof(PlaySoundMessage),
31 typeof(SingleExpenseMessage))]
32 typeof(SingleExpenseMessage))]
@@ -234,6 +235,13
234 occupied.AddRange(entitySquares);
235 occupied.AddRange(entitySquares);
235 }
236 }
236
237
238 foreach (var (entity, point) in ReadEntities<StructureComponent>()
239 .WhereF((e) => HasComponent<PointComponent>(e))
240 .Select((e) => (e, GetComponent<PointComponent>(e)))) {
241
242 occupied.Add(point.Square);
243 }
244
237 foreach (ref readonly var message in ReadMessages<AdjustSelection>()) {
245 foreach (ref readonly var message in ReadMessages<AdjustSelection>()) {
238 foreach (ref readonly var entity in ReadEntities<SelectedComponent>()) {
246 foreach (ref readonly var entity in ReadEntities<SelectedComponent>()) {
239 var selection = GetComponent<SelectedComponent>(entity);
247 var selection = GetComponent<SelectedComponent>(entity);
@@ -246,9 +254,10
246 else if(message.Type == AdjustmentType.Complete) {
254 else if(message.Type == AdjustmentType.Complete) {
247 var point = GetComponent<PointComponent>(entity);
255 var point = GetComponent<PointComponent>(entity);
248 var structure_entity = CreateEntity();
256 var structure_entity = CreateEntity();
257 var cell = this.Map.cells[(int)point.Square.X][(int)point.Square.Y];
249 //Verify square is free:
258 //Verify square is free:
250 //
259 //
251 if (!occupied.Contains(point.Square)) {
260 if (!occupied.Contains(point.Square) && !cell.HasTree && !cell.HasWater) {
252
261
253 AddComponent(structure_entity, new PointComponent {Square = point.Square,
262 AddComponent(structure_entity, new PointComponent {Square = point.Square,
254 Tool = point.Tool} );
263 Tool = point.Tool} );
You need to be logged in to leave comments. Login now