[Freeciv-Dev] [patch #4693] Utility to determine if a unit is transported by another, directly or indirectly

2014-05-16 Thread pepeto
URL:
  http://gna.org/patch/?4693

 Summary: Utility to determine if a unit is transported by
another, directly or indirectly
 Project: Freeciv
Submitted by: pepeto
Submitted on: Fri 16 May 2014 08:36:53 PM CEST
Category: general
Priority: 5 - Normal
  Status: Ready For Test
 Privacy: Public
 Assigned to: pepeto
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 2.4.3,2.5.0,2.6.0

___

Details:

The function is named unit_transported_by(). I need it for resolving bug
#21899.




___

File Attachments:


---
Date: Fri 16 May 2014 08:36:53 PM CEST  Name: S2_4_unit_transported_by.patch 
Size: 2kB   By: pepeto

http://gna.org/patch/download.php?file_id=20741
---
Date: Fri 16 May 2014 08:36:53 PM CEST  Name:
trunk_S2_5_unit_transported_by.patch  Size: 2kB   By: pepeto

http://gna.org/patch/download.php?file_id=20742

___

Reply to this item at:

  http://gna.org/patch/?4693

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


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


[Freeciv-Dev] [bug #21899] Crash on clicking unit that was moved out of city

2014-05-16 Thread pepeto
Update of bug #21899 (project freeciv):

  Status:   Confirmed = Ready For Test 
 Planned Release: = 2.4.3,2.5.0,2.6.0  

___

Follow-up Comment #3:

Summary:
Diplomatic state is canceled (alliance to peace). The units inside cities are
thrown outside. But when a transport is bounced, then it loses vision of the
city tile. Cargo units are still there when the server send out of sight
signal (removing unit for owned units).

1) The server shouldn't send out of sight signal because the cargo units will
follow the transport.
2) The client refuses to unload units which aren't at same tile of their
transport. It results that freed pointers are still in usage in the cargo
list. This is what why the client crashes when opening the unit selection
dialog.

Attached fix for both bugs, separately.


(file #20743, file #20744)
___

Additional Item Attachment:

File name: transported_units_not_out_of_sight.patch Size:0 KB
File name: unit_transport_unload.patchSize:0 KB


___

Reply to this item at:

  http://gna.org/bugs/?21899

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


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


[Freeciv-Dev] [bug #21899] Crash on clicking unit that was moved out of city

2014-05-16 Thread pepeto
Update of bug #21899 (project freeciv):

  Depends on: = patch #4693


___

Reply to this item at:

  http://gna.org/bugs/?21899

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


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


[Freeciv-Dev] [patch #4693] Utility to determine if a unit is transported by another, directly or indirectly

2014-05-16 Thread Marko Lindqvist
Follow-up Comment #1, patch #4693 (project freeciv):

I've been thinking similar functions, but with different naming. I'd propose
such semantics that in our codebase *transported* means directly transported,
and anything recursively transported is *contained* (or *within*). This
would make it easy to see from the function call if it's about recursive
transportation or not.

___

Reply to this item at:

  http://gna.org/patch/?4693

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


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


[Freeciv-Dev] [bug #21899] Crash on clicking unit that was moved out of city

2014-05-16 Thread Marko Lindqvist
Follow-up Comment #4, bug #21899 (project freeciv):

Do the units being transported belong to (another) allied player? Otherwise I
don't understand how one would lose vision when trasnport is moved out but the
cargo units, and their vision, still remain.

___

Reply to this item at:

  http://gna.org/bugs/?21899

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


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


[Freeciv-Dev] [bug #21899] Crash on clicking unit that was moved out of city

2014-05-16 Thread pepeto
Follow-up Comment #5, bug #21899 (project freeciv):

Actually, the player doesn't lose vision, but the server seems to assume it
did.

In server/unittools.c, unit_move():

  if (TILE_KNOWN_SEEN == tile_get_known(tile1, pplayer)) {
unit_list_iterate(tile1-units, punit2) {
  if (punit2 != punit  !can_player_see_unit(pplayer, punit2)) {
unit_goes_out_of_sight(pplayer, punit2);
  }
} unit_list_iterate_end;
  }


can_player_see_unit() returns FALSE because can_player_see_units_in_city()
does. unit_goes_out_of_sight() is called whereas it shouldn't for the cargo
units.


___

Reply to this item at:

  http://gna.org/bugs/?21899

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


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


[Freeciv-Dev] [patch #4693] Utility to determine if a unit is transported by another, directly or indirectly

2014-05-16 Thread pepeto
Update of patch #4693 (project freeciv):

  Status:  Ready For Test = In Progress

___

Follow-up Comment #2:

Should it be unit_contained_in(), unit_contained_by(),
unit_contained_within()?


___

Reply to this item at:

  http://gna.org/patch/?4693

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


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


[Freeciv-Dev] [patch #4694] Remove game_unit_by_number() usage in unit_transport_get()

2014-05-16 Thread pepeto
URL:
  http://gna.org/patch/?4694

 Summary: Remove game_unit_by_number() usage in
unit_transport_get()
 Project: Freeciv
Submitted by: pepeto
Submitted on: Fri 16 May 2014 09:22:44 PM CEST
Category: general
Priority: 5 - Normal
  Status: Ready For Test
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 

___

Details:

Comment says Need this as the return value is not 'const'! to justify the
usage of game_unit_by_number(), but actually the pointer doesn't have the
'const' flag.

Note there is something similar in unit_transport_check() but I failed to
understand what this function is supposed to do, so I didn't touch it.




___

File Attachments:


---
Date: Fri 16 May 2014 09:22:44 PM CEST  Name: unit_transport_get.patch  Size:
548B   By: pepeto

http://gna.org/patch/download.php?file_id=20745

___

Reply to this item at:

  http://gna.org/patch/?4694

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


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


[Freeciv-Dev] [patch #4693] Utility to determine if a unit is transported by another, directly or indirectly

2014-05-16 Thread David Lowe
Follow-up Comment #3, patch #4693 (project freeciv):

'within' might be semantically correct, but i prefer the shorter 'in'.  I
can't yet imagine how that could be misunderstood as anything else.

___

Reply to this item at:

  http://gna.org/patch/?4693

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


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