stolk / GPGOAP

General Purpose Goal Oriented Action Planning
564 stars 65 forks source link

MAXATOMS and MAXACTIONS are misleading #3

Closed metiscus closed 9 years ago

metiscus commented 9 years ago

actionplanner_t should be able to support up to MAXATOMS of atoms and MAXACTIONS of actions but it can only actually support MAXATOMS-1 and MAXACTIONS-1 of each before returning false.

This comes from how the lookup functions are written: static int idx_for_atomname( actionplanner_t* ap, const char* atomname ) { int idx; for ( idx=0; idx < ap->numatoms; ++idx ) if ( !strcmp( ap->atm_names[ idx ], atomname ) ) return idx;

if ( idx < MAXATOMS-1 )

static int idx_for_actionname( actionplanner_t* ap, const char* actionname ) { int idx; for ( idx=0; idx < ap->numactions; ++idx ) if ( !strcmp( ap->act_names[ idx ], actionname ) ) return idx;

if ( idx < MAXACTIONS-1 )
stolk commented 9 years ago

Thank you, I've checked the code, and there does not seem to be a reason for not using bit 63. Fixed in master branch.