This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 9666 for ps


Ignore:
Timestamp:
06/26/11 09:47:03 (14 years ago)
Author:
kennethalong
Message:

Post code review version - previous commit was pre code review version.

Location:
ps/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/simulation/data/pathfinder.xml

    r9665 r9666  
    11<?xml version="1.0" encoding="utf-8"?>
    22<Pathfinder>
    3 
    4   <!--
    5     Previously all move commands during a turn were
    6     queued up and processed asynchronously at the start
    7     of the next turn.  Now we are processing queued up
    8     events several times duing the turn.  This improves
    9     responsiveness and units move more smoothly especially.
    10     when in formation.  There is still a call at the
    11     beginning of a turn to process all outstanding moves -
    12     this will handle any moves above the MaxSameTurnMoves
    13     threshold. 
    14    
    15     TODO - The moves processed at the beginning of the
    16     turn do not count against the maximum moves per turn
    17     currently.  The thinking is that this will eventually
    18     happen in another thread.  Either way this probably
    19     will require some adjustment and rethinking.
    20   -->
     3  <!-- Sets limit on the number of same turns moves we will process -->
     4  <!-- Setting the value to 0 disable this functionality -->
    215  <MaxSameTurnMoves>64</MaxSameTurnMoves>
    226 
  • ps/trunk/source/simulation2/components/CCmpPathfinder.cpp

    r9665 r9666  
    5353    m_DebugPath = NULL;
    5454
     55    m_SameTurnMovesCount = 0;
     56
    5557    // Since this is used as a system component (not loaded from an entity template),
    5658    // we can't use the real paramNode (it won't get handled properly when deserializing),
     
    5961    CParamNode::LoadXML(externalParamNode, L"simulation/data/pathfinder.xml");
    6062
     63    // Previously all move commands during a turn were
     64    // queued up and processed asynchronously at the start
     65    // of the next turn.  Now we are processing queued up
     66    // events several times duing the turn.  This improves
     67    // responsiveness and units move more smoothly especially.
     68    // when in formation.  There is still a call at the
     69    // beginning of a turn to process all outstanding moves -
     70    // this will handle any moves above the MaxSameTurnMoves
     71    // threshold. 
     72    //
     73    // TODO - The moves processed at the beginning of the
     74    // turn do not count against the maximum moves per turn
     75    // currently.  The thinking is that this will eventually
     76    // happen in another thread.  Either way this probably
     77    // will require some adjustment and rethinking.
    6178    const CParamNode pathingSettings = externalParamNode.GetChild("Pathfinder");
    6279    m_MaxSameTurnMoves = pathingSettings.GetChild("MaxSameTurnMoves").ToInt();
     
    176193    SerializeVector<SerializeShortRequest>()(serialize, "short requests", m_AsyncShortPathRequests);
    177194    serialize.NumberU32_Unbounded("next ticket", m_NextAsyncTicket);
     195    serialize.NumberU16_Unbounded("same turn moves count", m_SameTurnMovesCount);
    178196}
    179197
     
    185203    SerializeVector<SerializeShortRequest>()(deserialize, "short requests", m_AsyncShortPathRequests);
    186204    deserialize.NumberU32_Unbounded("next ticket", m_NextAsyncTicket);
     205    deserialize.NumberU16_Unbounded("same turn moves count", m_SameTurnMovesCount);
    187206}
    188207
     
    477496    u32 moveCount;
    478497
    479     if (m_AsyncLongPathRequests.size() > 0)
     498    if (!m_AsyncLongPathRequests.empty())
    480499    {
    481500        // Figure out how many moves we can do this time
     
    504523    }
    505524   
    506     if (m_AsyncShortPathRequests.size() > 0)
     525    if (!m_AsyncShortPathRequests.empty())
    507526    {
    508527        // Figure out how many moves we can do now
  • ps/trunk/source/simulation2/components/CCmpPathfinder_Common.h

    r9665 r9666  
    182182    std::vector<AsyncShortPathRequest> m_AsyncShortPathRequests;
    183183    u32 m_NextAsyncTicket; // unique IDs for asynchronous path requests
     184    u16 m_SameTurnMovesCount; // current number of same turn moves we have processed this turn
    184185
    185186    // Lazily-constructed dynamic state (not serialized):
     
    190191    bool m_TerrainDirty; // indicates if m_Grid has been updated since terrain changed
    191192   
    192     // For responsiveness we will procees some moves in the same turn they were generated in
     193    // For responsiveness we will process some moves in the same turn they were generated in
    193194   
    194195    u16 m_MaxSameTurnMoves; // max number of moves that can be created and processed in the same turn
    195     u16 m_SameTurnMovesCount; // current number of same turn moves we have processed this turn
    196196
    197197    // Debugging - output from last pathfind operation:
     
    250250    virtual void FinishAsyncRequests();
    251251
    252     virtual void ProcessLongRequests(const std::vector<AsyncLongPathRequest>& longRequests);
     252    void ProcessLongRequests(const std::vector<AsyncLongPathRequest>& longRequests);
    253253   
    254     virtual void ProcessShortRequests(const std::vector<AsyncShortPathRequest>& shortRequests);
     254    void ProcessShortRequests(const std::vector<AsyncShortPathRequest>& shortRequests);
    255255
    256256    virtual void ProcessSameTurnMoves();
Note: See TracChangeset for help on using the changeset viewer.