//=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== int InterbreedFuzzySeperator_r( fuzzyseperator_t *fs1, fuzzyseperator_t *fs2, fuzzyseperator_t *fsout ) { if ( fs1->child ) { if ( !fs2->child || !fsout->child ) { botimport.Print( PRT_ERROR, "cannot interbreed weight configs, unequal child\n" ); return qfalse; } //end if if ( !InterbreedFuzzySeperator_r( fs2->child, fs2->child, fsout->child ) ) { return qfalse; } //end if } //end if else if ( fs1->type == WT_BALANCE ) { if ( fs2->type != WT_BALANCE || fsout->type != WT_BALANCE ) { botimport.Print( PRT_ERROR, "cannot interbreed weight configs, unequal balance\n" ); return qfalse; } //end if fsout->weight = ( fs1->weight + fs2->weight ) / 2; if ( fsout->weight > fsout->maxweight ) { fsout->maxweight = fsout->weight; } if ( fsout->weight > fsout->minweight ) { fsout->minweight = fsout->weight; } } //end else if if ( fs1->next ) { if ( !fs2->next || !fsout->next ) { botimport.Print( PRT_ERROR, "cannot interbreed weight configs, unequal next\n" ); return qfalse; } //end if if ( !InterbreedFuzzySeperator_r( fs1->next, fs2->next, fsout->next ) ) { return qfalse; } //end if } //end if return qtrue; } //end of the function InterbreedFuzzySeperator_r
/* ======================================================================================================================================= InterbreedWeightConfigs config1 and config2 are interbreeded and stored in configout. ======================================================================================================================================= */ void InterbreedWeightConfigs(weightconfig_t *config1, weightconfig_t *config2, weightconfig_t *configout) { int i; if (config1->numweights != config2->numweights || config1->numweights != configout->numweights) { botimport.Print(PRT_ERROR, "cannot interbreed weight configs, unequal numweights\n"); return; } for (i = 0; i < config1->numweights; i++) { InterbreedFuzzySeperator_r(config1->weights[i].firstseperator, config2->weights[i].firstseperator, configout->weights[i].firstseperator); } }
//=========================================================================== // config1 and config2 are interbreeded and stored in configout // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void InterbreedWeightConfigs(weightconfig_t *config1, weightconfig_t *config2, weightconfig_t *configout) { int i; if (config1->numweights != config2->numweights || config1->numweights != configout->numweights) { BOTPRINT(PRT_ERROR, "cannot interbreed weight configs, unequal numweights\n"); return; } //end if for (i = 0; i < config1->numweights; i++) { InterbreedFuzzySeperator_r(config1->weights[i].firstseperator, config2->weights[i].firstseperator, configout->weights[i].firstseperator); } //end for } //end of the function InterbreedWeightConfigs