-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
228 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// <copyright file="CommercialAI.cs" company="dymanoid"> | ||
// Copyright (c) dymanoid. All rights reserved. | ||
// </copyright> | ||
|
||
namespace RealTime.BuildingAI | ||
{ | ||
using RealTime.GameConnection; | ||
using RealTime.Simulation; | ||
|
||
internal sealed class CommercialAI | ||
{ | ||
private readonly ITimeInfo timeInfo; | ||
|
||
public CommercialAI(ITimeInfo timeInfo, IBuildingManagerConnection buildingManager) | ||
{ | ||
this.timeInfo = timeInfo ?? throw new System.ArgumentNullException(nameof(timeInfo)); | ||
BuildingMgr = buildingManager ?? throw new System.ArgumentNullException(nameof(buildingManager)); | ||
} | ||
|
||
public IBuildingManagerConnection BuildingMgr { get; } | ||
|
||
public void Process(uint frameId) | ||
{ | ||
frameId &= 0xFF; | ||
|
||
uint buildingFrom = frameId * 192u; | ||
uint buildingTo = ((frameId + 1u) * 192u) - 1u; | ||
|
||
// We have only few customers at night - that's an inteded behavior. | ||
// To avoid commercial building from collapsing due to lack of customers, | ||
// we force the problem timer to pause at night time. | ||
if (timeInfo.IsNightTime) | ||
{ | ||
BuildingMgr.DecrementOutgoingProblemTimer((ushort)buildingFrom, (ushort)buildingTo, ItemClass.Service.Commercial); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ internal enum CityEventState | |
{ | ||
None, | ||
Upcoming, | ||
OnGoing, | ||
Ongoing, | ||
Finished | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.