5a6
> #include <vector>
7,10c8,9
< #include <cassert>
< //#include <map>
< //#include <vector>
< //#include <fstream>
---
> #include <map>
> #include <iostream>
12d10
< #include "FssimApp.h"
13a12,13
> 
> #include "AUStruct.h"
15d14
< #include "Group.h"
25c24,25
<     enum { LABEL_SIZE = FssimApp::MAX_LABEL_LENGTH };
---
>     Au(Zone* pParentZone, AUStruct* pAUStruct = 0) // constructor
>     : m_pStruct(pAUStruct), m_pParentZone(pParentZone) {}
27,32c27
<     // constructor
<     Au(AU* pAUStruct = 0, Zone* pParentZone = 0) : m_pStruct(pAUStruct), m_pParentZone(pParentZone)
<     {
<         /*
<         if(0 != m_pStruct)
<         {
---
>     virtual ~Au() {} // destructor
34,44d28
<             // initialize null members from struct
<             if(0 != m_pStruct->parent_zone && 0 == m_pParentZone)
<             {
<                 m_pParentZone = m_pStruct->parent_zone;
<             }
< 
<         }
<         */
<     }
<     virtual ~Au(); // destructor
< 
48,52c32,36
<     bool hasTimberClasses() { return (0 != m_pStruct->classlist); }
<     bool hasRegens() { return (0 != m_pStruct->regenlist); }
<     bool hasEligibleGroups() { return (0 != m_pStruct->EligibleGroupList); }
<     bool hasRoadRec() { return (0 != m_pStruct->RoadRec); }
<     AU* getStruct() { return m_pStruct; }
---
>     bool hasTimberClasses() { return !(m_pStruct->classlist.empty()); }
>     bool hasRegens() { return !(m_pStruct->regenlist.empty()); }
>     bool hasEligibleGroups() { return !(m_pStruct->m_eligibleGroupList.empty()); }
>     bool hasRoadRec() { return ( 0 != m_pStruct->RoadRec ); } // single roadrec, not list
>     AUStruct* getStruct() { return m_pStruct; }
54,56c38,39
<     // an Au has custody of its REGENs, but its parent zone must re-establish
<     // all regenlists of all au's after all au's have been re-created
<     void lookupRegenListAUs();
---
>     // an Au has custody of its REGENs
> 
69c52
<     void recreateStruct(Zone *zone, char *label, int id);
---
>     void recreateStruct(Zone *zone, const char *label, const int id, const int labelIndex);
71,72d53
<     void createEligibleGroupIndexList();
<     void recreateEligibleGroupList();
74c55,57
<     AU* m_pStruct;
---
>     AUStruct* m_pStruct;
>     Zone* m_pParentZone;
> 
76a60,61
>     // RoadRec is serialized by serializeRoadRec
> 
78,79c63
<     // and read using lookup by id of new ZONE struct address
<     Zone* m_pParentZone;
---
>     // and read using lookup by id of new ZoneStruct struct address
83,84c67,68
<     // table is not serialized : it is set by init_make_au on recreation of struct
<     // (this is dependent on correct serial read of table.dat info)
---
>     // tables are serialized directly from FssimApp::m_tableList
>     // association is re-set by init_make_au on recreation of AUStruct struct
86,88d69
<     // RoadRec is 0 until re-set on serial read of road.dat info
<     //road rec should be serialized!!!
< 
90,92d70
< 
<     list<int> m_eligibleGroupIndices;
<     list<Regen> m_regens;
95,161d72
< inline void Au::createEligibleGroupIndexList() // called before binary write
< {
< #ifdef _TSB_ELIGIBLE_GROUP_DEBUG
<     cout << "AU " << m_pStruct->id << " has "
<          << m_pStruct->EligibleGroupList->size << " eligible groups" << endl;
< #endif
<     m_pStruct->EligibleGroupList = (LIST_PTR *)List::reset(m_pStruct->EligibleGroupList);
<     GROUP* pEligibleGroup = 0;
<     do
<     {
<         pEligibleGroup = static_cast<GROUP*>(List::next(m_pStruct->EligibleGroupList));
<         if (0 != pEligibleGroup)
<         {
< #ifdef _TSB_ELIGIBLE_GROUP_DEBUG
<             //cout << "au id of eligible group list: " << m_pStruct->id << endl;
<             cout << "group index: " << pEligibleGroup->id << endl;
<             //cout << "AU address: " << m_pStruct << endl;
<             //cout << "Group address: " << pEligibleGroup << endl;
< #endif
<             m_eligibleGroupIndices.push_back(pEligibleGroup->id);
<         }
< 
<     } while (0 != pEligibleGroup);
< }
< 
< inline void Au::recreateEligibleGroupList() // called before binary write
< {
< #ifdef _TSB_ELIGIBLE_GROUP_DEBUG
<     cout << "AU " << m_pStruct->id << " has "
<          << m_eligibleGroupIndices.size() << " eligible groups" << endl;
< #endif
<     m_pStruct->EligibleGroupList = (LIST_PTR *)List::reset(m_pStruct->EligibleGroupList);
<     GROUP* pEligibleGroup = 0;
<     list<int>::iterator iter = m_eligibleGroupIndices.begin();
<     while (iter != m_eligibleGroupIndices.end())
<     {
<         pEligibleGroup = Group::lookupGROUPAddress(*iter);
< #ifdef _TSB_ELIGIBLE_GROUP_DEBUG
<         //cout << "au id of eligible group list: " << m_pStruct->id << endl;
<         cout << "group index: " << (*iter) << endl;
<         //cout << "AU address: " << m_pStruct << endl;
<         //cout << "GROUP address: " << pEligibleGroup << endl;
< #endif
<         assert (0 != pEligibleGroup);
< 
<         m_pStruct->EligibleGroupList =
<             static_cast<LIST_PTR*>( List::insert(m_pStruct->EligibleGroupList,
<                                     pEligibleGroup, (*iter)) );
<         ++iter;
<     }
< }
< 
< inline void Au::lookupRegenListAUs() // called before binary write
< {
< #ifdef _TSB_SERIALIZER_DEBUG
<     cout << "AU " << m_pStruct->id << " has "
<          << m_regens.size() << " REGENs" << endl;
< #endif
<     list<Regen>::iterator iter = m_regens.begin();
<     while (iter != m_regens.end())
<     {
<         // reset regen->au with address from parent zone's lookup vector
<         iter->getStruct()->au = m_pParentZone->lookupAUAddress(iter->getAuID());
<         ++iter;
<     }
< }
< 
