[Freeciv-tickets] [freeciv] #44738: Split create_unit_full() in two functons

アーカイブの一覧に戻る
OSDN Ticket System norep****@osdn*****
Wed Jun 8 15:17:48 JST 2022


#44738: Split create_unit_full() in two functons

  Open Date: 2022-05-31 23:55
Last Update: 2022-06-08 09:17

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/44738
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=44738

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2022-06-08 09:17 Updated by: ihnatus

Comment:

Reply To cazfi
Some parts seem like unrelated bugfixes worth their own tickets, such as using unit_list_iterate_safe() in do_capture_units() and api_edit_create_unit_full() checks. Those fixes should go to all branches, but the main change is very complicated (-> high risk of introducing bugs in some corner cases), so I don't think it belongs to a mature release branch.
Ok, I'll rework it only for 3.12. The script-safe call of d_c_u actually might get its own ticket as it goes a bit beyound #44312. Rewriting the mechanism completely for HRM874201 is unlikely before 3.2 due to compatibility issues.
 -  bool bounce;
 +  bool bounce = FALSE;

At least in the patch context this initialization value is not used. (We have several reasons *not* to set initialization value when it's not meant to be used. For one, it masks the fact that the value is not 'correct' from valgrind. Also clang analyzer is likely to complain about "dead assignment")
Compiler required me to do this.There is a use in the end of the function, out of the "if".

---------------------------------------------------------------------
Ticket Status:

      Reporter: ihnatus
         Owner: (None)
          Type: Feature Requests
        Status: Open
      Priority: 5 - Medium
     MileStone: 3.0.3
     Component: Server
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

For consistency, we should have an option to do separately two things that create_unit_full() does together and mixes up:
Create a virtual unit, supply all necessary parameters to it and
Put a preset virtual unit into the game, recording it in all the lists and structures.
The downside of what is now is that in e.g. unit_change_owner() we create a unit, put it into the game and then make some raw adjustments, e.g. set its nationality and movepoints. We call AI callbacks before we do it; if now they don't interest these parameters, afterwards they may.
Actually, I have in mind a pair of patches for later versions that need it, but even for 3.0 it would be better.

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/44738
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=44738



More information about the Freeciv-tickets mailing list
アーカイブの一覧に戻る