Changes between Initial Version and Version 18 of Ticket #4015


Ignore:
Timestamp:
Dec 20, 2016, 6:35:32 PM (7 years ago)
Author:
bb
Comment:

Replying to odoaker:

Thanks for your remarks, I simplified ShouldPack which fixed the problem with "Patrol". Not sure about "Garrison" because I can't garrison a siege unit (maybe I don't have the right building). I will attach the patch right now.

Siege can be garrisoned in a Fortress f.e.

The ShouldPack function looks good now, only it actually returns wheter a unit should UnPack, but that is an easy rename. (And yes naming of the Pack/Unpack function are sometimes a bit confusing but never bad to be clear when we talk about unpacking only.) Also not all cases are solved still: imagine a unit unpacking and getting an unpack order (is not a very likely situation, but it can occur when using selection), that will now get a cancelUnpack order and directly afterwards an unpack order. Not very efficient... This can be solved with the following code structure (which also makes the code more readable imo): (You should correct me if I am messing up here though)

if (IsPacking() && type != "CancelPack" && type != "CancelUnpack")
{
    if (ShouldUnpack())
        // cancel Pack order, hold unpack order;
    else
        // cancel unPack order, hold pack order;

    // Push new order
}

Some side note: for keeping consistency throughout the code, it would be nice if the lines you add in the code (L3854-6) would look as similar as possible to lines which to almost the same (L3848-50).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #4015

    • Property Cc agoston.sipos.95@… added
    • Property Summary Stop unpacking siege on stop/move command[PATCH] Stop unpacking siege on stop/move command
    • Property Keywords rfc added
    • Property Milestone BacklogWork In Progress
    • Property Owner set to Ágoston Sipos
  • Ticket #4015 – Description

    initial v18  
    33When the stop command is issued, the packing / unpacking should stop.
    44
    5 Chaning `UnitAI.js` will likely be sufficient. `Commands.js` is used to pass player commands to the simulation.
     5Changing `UnitAI.js` will likely be sufficient. `Commands.js` is used to pass player commands to the simulation.