-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dirty flag and integrate #1725
base: master
Are you sure you want to change the base?
Conversation
A few questions I have for this: Also, would it be good practice to include non-time based overrides for Lastly, how do I run with debugging using Visual Studio Code? I make changes to a file and run, but it ignores my breakpoints. |
Where would you need to pass the clock? You very likely only need to pass the time value but the clock is not necessary IMO.
That would kind of counteract introducing dirty flags, so I'm not sure if this is a good idea. In fact, I'm not really sure why we should just always pass a time. Initialization does not always happen at time zero.
It should just work out of the box. What is your start configuration and output? |
Perhaps that's a better question. How to get the time (or any time) into the Map subsystem. |
Co-authored-by: Christoph Heine <[email protected]>
Co-authored-by: Christoph Heine <[email protected]>
Co-authored-by: Christoph Heine <[email protected]>
The update time comes from events in the event system that will trigger a map update. However, I wouldn't worry about that right now, since it is not implemented yet. |
If you are talking about the configurations in launch.json, it says: That's probably my problem lol. What should it say? |
Something like this should work as a configuration:
|
So to clarify, I should put this in launch.json? I am used to Visual Studio with C#. |
You should put it in the |
[workspace]/bin/run does not exist |
Well, you need to build the project before running :D |
https://github.com/SFTtech/openage/blob/master/doc/building.md has info on the build procedure. |
I can't seem to get this process working on windows. I can run using python openage, following the info on this page: But I don't see a bin folder built in openage following the Windows instructions. |
I can walk you through it at matrix if you want |
Co-authored-by: Christoph Heine <[email protected]>
|
||
/** | ||
* Set the cost at a specified position. | ||
* | ||
* @param x X-coordinate of the cell. | ||
* @param y Y-coordinate of the cell. | ||
* @param cost Cost to set. | ||
* @param changed Time at which the cost value is changed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param changed Time at which the cost value is changed. | |
* @param valid_until Time at which the cost value is changed. |
|
||
/** | ||
* Set the cost at a specified position. | ||
* | ||
* @param idx Index of the cell. | ||
* @param cost Cost to set. | ||
* @param changed Time at which the cost value is changed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param changed Time at which the cost value is changed. | |
* @param valid_until Time at which the cost value is changed. |
|
||
inline void set_cost(size_t idx, cost_t cost, const time::time_t &valid_until) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to remove the newline, otherwise the docstring will not be associated with the method.
inline void set_cost(size_t idx, cost_t cost, const time::time_t &valid_until) { | |
inline void set_cost(size_t idx, cost_t cost, const time::time_t &valid_until) { |
* @param changed Time at which the cost value is changed. | ||
*/ | ||
void set_costs(std::vector<cost_t> &&cells, const time::time_t &changed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param changed Time at which the cost value is changed. | |
*/ | |
void set_costs(std::vector<cost_t> &&cells, const time::time_t &changed); | |
* @param valid_until Time at which the cost value is changed. | |
*/ | |
void set_costs(std::vector<cost_t> &&cells, const time::time_t &valid_until); |
/** | ||
* Check if the cost field is dirty at the specified time. | ||
* | ||
* @param time Cost field is dirty if the cost field is accessed after the time given in valid_until. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should always explain what time
represents/is used for. From your docstring, it's not apparent what a user of this method should pass for time
.
* @param time Cost field is dirty if the cost field is accessed after the time given in valid_until. | |
* @param time Time of access to the cost field. |
*/ | ||
void set_costs(std::vector<cost_t> &&cells); | ||
bool is_dirty(const time::time_t &time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also document what the return value does.
bool is_dirty(const time::time_t &time); | ||
|
||
/** | ||
* Cleans the dirty flag by setting it to time_MAX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal mechanism of tracking the dirty status is not really relevant for the user of this method. Therefore, you can remove it from the docstring.
* Cleans the dirty flag by setting it to time_MAX. | |
* Clear the dirty flag. |
time::Clock clock = time::Clock(); | ||
clock.start(); | ||
const time::time_t time = clock.get_time(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need a clock in this demo because you can just pass 0
as the time in all calls.
@@ -56,6 +56,7 @@ class Integrator { | |||
* @param other_sector_id Sector ID of the other side of the portal. | |||
* @param portal Portal. | |||
* @param target Coordinates of the target cell, relative to the integration field origin. | |||
* @param time The time to check is the cached cost field is dirty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description is not really useful. How should the user of this method know what time value they have to pass? Caching and dirty checks are also not controlled by the user and therefore don't have to be mentioned.
* @param time The time to check is the cached cost field is dirty. | |
* @param time Time of the path request. |
@@ -114,6 +116,7 @@ class Integrator { | |||
* @param other_sector_id Sector ID of the other side of the portal. | |||
* @param portal Portal. | |||
* @param target Coordinates of the target cell, relative to the integration field origin. | |||
* @param time The time to check is the cached cost field is dirty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
* @param time The time to check is the cached cost field is dirty. | |
* @param time Time of the path request. |
fixes #1679. First time working with c++. Been struggling to update a test and getting it to build. Any advice will be helpful. I am using Visual Studio Code.
Please offer much critique. Complain with vigor. Correct with fervor.