Hello Andreas,

I think that what happen is that the settlers are AI-controlled by the
server. You need to free the ai data of the unit before calling
free_unit_orders(). There are some examples, notably in
handle_unit_change_activity() (server/unithand.c):
  /* Remove city spot reservations for AI settlers on city founding
   * mission, before goto_tile reset. */
  if (punit->ai.ai_role != AIUNIT_NONE) {
    ai_unit_new_role(punit, AIUNIT_NONE, NULL);
  }

  punit->ai.control = FALSE;
  punit->goto_tile = NULL;

or in handle_unit_orders() (server/unithand.c):
  /* This must be before old orders are freed. If this is is
   * settlers on city founding mission, city spot reservation
   * from goto_tile must be freed, and free_unit_orders() loses
   * goto_tile information */
  if (punit->ai.ai_role != AIUNIT_NONE) {
    ai_unit_new_role(punit, AIUNIT_NONE, NULL);
  }

  free_unit_orders(punit);
  /* If we waited on a tile, reset punit->done_moving */
  punit->done_moving = (punit->moves_left <= 0);


I am not certain about the usage of this function you are modifying. A
such client command was available in Freeciv versions before 2.1. It has
been removed because it slowing down the server (an also it was using
the old warmap design). There are no reason the client doesn't compute
the path itself in my opinion, then it is the responsability of the user
to slow down only its own side.

Regards,
Pepeto

Le mardi 21 septembre 2010 à 22:18 +0200, Andreas Røsdal a écrit :
> Hello!
> 
> I have created a patch to make the client tell the server to move a unit 
> to tile (x,y), based on the existing path-finding code in Freeciv.
> This is for usage in the Freeciv web client, where the client will tell
> the server to move a specified unit to a particular tile (x, y).
> 
> The current method works most of the time, but sometimes at random the 
> unit suddenly does some other acivity. Often this can be seen as a settler
> beggining to mine in the middle of a goto to a different tile.
> 
> Here is the current patch:
> 
> http://github.com/freecivnet/freeciv-web/blob/master/freeciv/patches/goto_1.diff
> 
> So what I'm hopeing is that someone spots a bug in the patch, or knows 
> some existing code in Freeciv which works and does server-side goto 
> perperly. What I want to do is basically to tell the server to make a
> unit goto a tile (x,y).
> 
> Thanks in advance!
> 
> 
> Regards,
> Andreas R.
> 
> _______________________________________________
> Freeciv-dev mailing list
> Freeciv-dev@gna.org
> https://mail.gna.org/listinfo/freeciv-dev



_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to