// // Reset Garden // - similar to above // void ResetGarden(CURRENT_PTR bot) { // the only thing we need to save int bot_id = bot->list_id; // I like to be extra careful ZeroMemory((CURRENT_PTR)bot, sizeof(CURRENT_OBJECT)); LoadGardParms(bot); bot->list_id = bot_id; if (USE_GARDEN_AREA) { int sel=0; int r = rand()%3; if (r == 2) sel = 2; else if (r == 1) sel = 1; else sel = 0; PlaceGardenArea(bot, food_pos[sel][0], food_pos[sel][1], food_pos[sel][2]); } else { RandomPlacement(bot); } } // end of the function
bool DoRandomPlacementIfRequired(HDesign& hd, const char* cfgOptName) { if (hd.cfg.ValueOf(cfgOptName, false)) { RandomPlacement(hd); WRITELINE(""); if (hd.CanDoTiming()) ALERT("STA after random placement:"); STA(hd); return true; } return false; }
// // Generate Nests // static void Generate_Gardens(void) { int index = 0; CURRENT_BOT.max_items = MAX_GARDENS; // create the array of pointers CURRENT_BOT.objects = (CURRENT_OBJECT **)malloc( sizeof(CURRENT_OBJECT *)*CURRENT_BOT.max_items); for (index = 0; index < CURRENT_BOT.max_items; index++) { SetGardenSize(1); // this bordering on insane // allocate an array of bot pointers, duh for nest CURRENT_BOT.objects[index] = CURRENT_BOT.create(index); if (USE_GARDEN_AREA) { int sel=0; int r = rand()%3; if (r == 2) sel = 2; else if (r == 1) sel = 1; else sel = 0; PlaceGardenArea(CURRENT_BOT.objects[index], food_pos[sel][0], food_pos[sel][1], food_pos[sel][2]); } else { RandomPlacement(CURRENT_BOT.objects[index]); } // end of if } // end of the for } // end of the function