widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02646
Re: [Merge] lp:~widelands-dev/widelands/tibor-ai5 into lp:widelands
Human player also sees a % of production and can consider this information also... and usually is not going to upgrade the mine with first "no resources found", and usually he even does not notice the first "our of resource" label.
Maybe we dont understand each other in one thing. I can depict failed and successful mining with a line of results like this:
SSSSSSSSSSSSSSFFFFFFFFFFFFFFFFFF
This is how you seems to undestand the work of a mine; my undestanding is:
SSSSSSFSSSSFSSFSSSFFSSSFFSFFFFSSFFFFFSFFFFFFF
so first failure does not mean that there will be no more mining.
counting of failures also indicates the time expired. Alternatively, I would need another variable to track time and say "if mine is not upgraded within 5 minutes since first failure, dismantle it". So this is why I prefer "counter of failures (integer)" to bool.
I failed to find a way in production site determining that this is a "mine". BuildingObserver in AI can say this, but it quite late (message has been sent to AI in this stage). But show me the way how to implement the check in productionsite.cc, I will adopt it. (if the whole design will be adopted at the end).
My design is that every productionsite has m_no_resources_count variable, and it is increased every time a production fails = one variable and one line of code in productionsite.cc. This is some overhead (not all productionsites needs that counter) , but not that big and not that complex at all.
AI is able to read that variable. For now, it reads it for mines, but it can be used also for any other productionsites.
Suggested design (based on messages) is that ProductionSiteObserver (part of AI) has the very same variable and it is increased via messages.
--
https://code.launchpad.net/~widelands-dev/widelands/tibor-ai5/+merge/228762
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/tibor-ai5.
Follow ups
References