typedef struct
{
const char* atm_names[ MAXATOMS ]; //!< Names associated with all world state atoms.
int numatoms; //!< Number of world state atoms.
const char* act_names[ MAXACTIONS ]; //!< Names of all actions in repertoire.
worldstate_t act_pre[ MAXACTIONS ]; //!< Preconditions for all actions.
worldstate_t act_pst[ MAXACTIONS ]; //!< Postconditions for all actions (action effects).
int act_costs[ MAXACTIONS ]; //!< Cost for all actions.
int numactions; //!< The number of actions in out repertoire.
} actionplanner_t;
void goap_actionplanner_clear( actionplanner_t* ap )
{
ap->numatoms = 0;
ap->numactions = 0;
for ( int i=0; i<MAXATOMS; ++i )
{
ap->atm_names[ i ] = 0;
ap->act_names[ i ] = 0;
ap->act_costs[ i ] = 0;
goap_worldstate_clear( ap->act_pre+i );
goap_worldstate_clear( ap->act_pst+i );
}
}
const char* act_names[ MAXACTIONS ]; yet the loop only clears for for ( int i=0; i<MAXATOMS; ++i )
Although in your example MAXACTIONS==MAXATOMS, maybe this would not always be the case. I hope this is useful. Thank you for your time.
const char* act_names[ MAXACTIONS ];
yet the loop only clears forfor ( int i=0; i<MAXATOMS; ++i )
Although in your example MAXACTIONS==MAXATOMS, maybe this would not always be the case. I hope this is useful. Thank you for your time.