#include "precompiled.h" #include "Formation.h" #include "ps/CLogger.h" #include "ps/CStr.h" #include "maths/MathUtil.h" #define LOG_CATEGORY "Formation" CFormation::CFormation() { m_numSlots = 0; } bool CFormation::loadXML(const CStr& filename) { CXeromyces XeroFile; if (XeroFile.Load(filename) != PSRETURN_OK) return false; #define EL(x) int el_##x = XeroFile.getElementID(#x) #define AT(x) int at_##x = XeroFile.getAttributeID(#x) EL(formation); EL(fl); EL(rk); EL(blank); AT(tag); AT(bonus); AT(bonusbase); AT(bonustype); AT(bonusval); AT(penalty); AT(penaltybase); AT(penaltytype); AT(penaltyval); AT(anglepenalty); AT(anglepenaltydivs); AT(anglepenaltytype); AT(anglepenaltyval); AT(required); AT(next); AT(prior); AT(movement); AT(filespacing); AT(rankspacing); AT(category); AT(order); #undef AT #undef EL XMBElement Root = XeroFile.getRoot(); if( Root.getNodeName() != el_formation ) { LOG( ERROR, LOG_CATEGORY, "CFormation::LoadXML: XML root was not \"Formation\" in file %s. Load failed.", filename.c_str() ); return( false ); } //Load in single attributes XMBAttributeList Attributes = Root.getAttributes(); for ( int i=0; i maxrank ) maxrank = rank; ++file; } //if el_fl else if ( ChildName == el_blank ) ++file; } float centerx = maxrank * m_rankSpacing / 2.0f; float centery = file * m_fileSpacing / 2.0f; //Here we check to make sure no order was skipped over. If so, failure, because we rely //on a linearly accessible slots in entityformation.cpp. for ( int i=0; i