URL:
  <http://gna.org/bugs/?22050>

                 Summary: Recursive transport problems
                 Project: Freeciv
            Submitted by: pepeto
            Submitted on: Sun 18 May 2014 05:46:41 PM CEST
                Category: general
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: Need Info
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any
        Operating System: Any
         Planned Release: 

    _______________________________________________________

Details:

When I was investigating for bug #21899, I noticed some other related bugs or
strange behaviors. In patch #4694, I said I couldn't understand
unit_transport_check(). After looking to patch #2480 about recursive
transport, I now know why.

After a quick test, I noticed I was enabled to unload a "land transport" from
a "sea transport" (on land of course). I got an enigmatic server message about
tiles nativity I couldn't reproduce afterward.

But before making a fix, I have some questions I cannot answer alone.

----

Analysis:
In could_unit_load() ("common/unit.c"):
* The call to unit_transport_check() will never be effective:

  /* Only top-level transporters may be loaded or loaded into. */
  if (unit_transported(pcargo)
      || unit_transported(ptrans)) {
    return FALSE;
  }

  /* Check iff this is a valid transport. */
  if (unit_transported(pcargo)
      && !unit_transport_check(pcargo, ptrans)) {
    return FALSE;
  }

* 

In unit_transport_check() ("common/unit.c"):
* The argument _ptrans_ is totally ignored. I don't think it is intentional.
* I don't like the usage of game_unit_by_number() just to drop the _const_
flag.
* It useless to use a _unit_list_ as long as units are already chained by
pcargo->transporter->transporter->etc.

In check_units() ("server/sanitycheck.c"):

SANITY_CHECK(unit_list_search(pcargos, plevel) != NULL);

This test duplicates the test just above (+ unit iteration). It will just do
the tests^2.

----

Questions:
0 May really only top-level transporters be loaded or loaded into?
0 unit_transport_check() assumes that a unit cannot be loaded to its direct
transport if it can be transported by any indirect transport. It is not what I
would expect. What do you think?
0 A full transport loaded into another counts only for 1 occupancy. It is not
what I would expect neither. But I would like your opinions.





    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?22050>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


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

Reply via email to