Re: [Widelands-dev] Fwd: can find any more resources

2014-07-30 Thread Fòram na Gàidhlig
>> 2014-07-29 20:46 GMT+02:00 Fòram na Gàidhlig > >: >> >> I've done a bit of refactoring today in this branch: >> >> https://code.launchpad.net/~widelands-dev/widelands/bug-1348795 >> >> Check out the new ProductionSite::out_of_resources function - when

Re: [Widelands-dev] Fwd: can find any more resources

2014-07-29 Thread Tibor Bamhor
This sounds very good. I just proposed my ai branch for merge, I will see how it goes, but I hope it will be merged soon and what is discussed here will be implemented next time. 2014-07-29 20:46 GMT+02:00 Fòram na Gàidhlig : > I've done a bit of refactoring today in this branch: > > https://co

Re: [Widelands-dev] Fwd: can find any more resources

2014-07-29 Thread Fòram na Gàidhlig
I've done a bit of refactoring today in this branch: https://code.launchpad.net/~widelands-dev/widelands/bug-1348795 Check out the new ProductionSite::out_of_resources function - when that function sends a message to the player would be the point where the AI should do something about the buildin

Re: [Widelands-dev] Fwd: can find any more resources

2014-07-29 Thread Tibor Bamhor
This is probably good idea, but how to implement it? In current AI I found following piece of code: // Subscribe to NoteFieldPossession. field_possession_subscriber_ = Notifications::subscribe([this](const NoteFieldPossession& note) { if (note.player != player_) { return; } if (no

Re: [Widelands-dev] Fwd: can find any more resources

2014-07-29 Thread Fòram na Gàidhlig
You could check for the code where production programs (for mines) and production sites (for other sites) send "Out of Resources" messages. The production program has a handle on the production site, so both of these could set a flag in the production site that the AI could check for, or whenever t

Re: [Widelands-dev] Fwd: can find any more resources

2014-07-29 Thread Tibor Bamhor
SirVer, I tried, spend some time, but all those namespaces, classes, virtual functions are too complicated to me. I even failed to identify a place (source file) where such function would logically belong. :( 2014-07-25 22:58 GMT+02:00 Holger Rapp : > Hooray \o/ !!! > > On 25.07.2014, at 22:

Re: [Widelands-dev] Fwd: can find any more resources

2014-07-25 Thread Holger Rapp
Hooray \o/ !!! On 25.07.2014, at 22:23, Tibor Bamhor wrote: > I will look at it...and do what I can.. > > > 2014-07-25 22:08 GMT+02:00 Holger Rapp : > Which just strengthens my argument, right? The code there is already copy and > pasted and if anything changes you have to change it twice. Wi

Re: [Widelands-dev] Fwd: can find any more resources

2014-07-25 Thread Tibor Bamhor
Hi, In the meantime I looked into particular cc file (I dont remember which one) and in AI I implemented basically the same procedure - AI counts current and starting amount of resources within radius around a mine and calculate the % of exhaustion. Seems it works fine. Also it would be usefull

Re: [Widelands-dev] Fwd: can find any more resources

2014-07-25 Thread Holger Rapp
On 25.07.2014, at 00:04, Tibor Bamhor wrote: > well, after some investigation in code it seems that mine is able to mine > some % of resources within some radius. Obviously it does not mine resources > evenly across fields, so to check one (even central) field is not enough. You could randomi