widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #03068
Re: send_player_* commands
Yes, sounds like a good solution.
12/11/2014 08:13, sgrìobh Tibor Bamhor:
> I wanted to avoid notifications because the ship returns its state and I
> hoped this should be enough. But if there is a send_player_* command
> waiting in a queue, the actual ship's state might be changed soon. And
> from time to time it led to a crash.
>
> But now I added notifications saying that ship is waiting for command
> and for AI these are to be trust and not actual state of the ship.
>
> I think that it works fine....
>
> 2014-11-12 8:59 GMT+01:00 Fòram na Gàidhlig <fios@xxxxxxxxxxxxxxxxxxx
> <mailto:fios@xxxxxxxxxxxxxxxxxxx>>:
>
> > is it possible to know that previous send_player_* command was
> processed
> > yet?
>
> send_player_command returns void, so I don't think so.
>
>
> > My AI can send these commands every 5 seconds, and it seems that first
> > one is not executed and AI (not knowing this) sends another command.
> > Then first one is executed, state of ship is changed and second one
> > crashes the game, because f.e. ship is not in 'expedition' mode
> anymore.
> > At least this might be one explanation of what is going on.
>
> Can you query the state of the ship? The ship has a get_task function
> which might do the trick.
>
> Failing this, the ship sends messages to the player when a coast has
> been reached etc, maybe you can add a notification there like we did for
> the mines. And you coud try to track if it has moved around the map.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~widelands-dev
> Post to : widelands-dev@xxxxxxxxxxxxxxxxxxx
> <mailto:widelands-dev@xxxxxxxxxxxxxxxxxxx>
> Unsubscribe : https://launchpad.net/~widelands-dev
> More help : https://help.launchpad.net/ListHelp
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2015.0.5557 / Virus Database: 4213/8558 - Release Date: 11/12/14
>
References