void THierarchicalCluster::permute(const TIntList &neworder) { if ((!branches && neworder.size()) || (branches->size() != neworder.size())) raiseError("the number of clusters does not match the lenght of the permutation vector"); int *temp = new int [last - first], *t = temp; TIntList::const_iterator pi = neworder.begin(); THierarchicalClusterList::iterator bi(branches->begin()), be(branches->end()); THierarchicalClusterList newBranches; for(; bi != be; bi++, pi++) { PHierarchicalCluster branch = branches->at(*pi); newBranches.push_back(branch); TIntList::const_iterator bei(mapping->begin() + branch->first), bee(mapping->begin() + branch->last); const int offset = (t - temp) - (branch->first - first); for(; bei != bee; *t++ = *bei++); if (offset) branch->recursiveMove(offset); } TIntList::iterator bei(mapping->begin() + first), bee(mapping->begin() + last); for(t = temp; bei!=bee; *bei++ = *t++); bi = branches->begin(); THierarchicalClusterList::const_iterator nbi(newBranches.begin()); for(; bi != be; *bi++ = *nbi++); }
int main(int argc, char* argv[]) { char check; initscr(); cbreak(); nodelay(stdscr, FALSE); scrollok(stdscr, TRUE); wprintw(stdscr, "This is the enemy adder ver. %d.%d for the Brave Quest engine.\nCopyright 2012 Mad Science Inc.\nPlease do not redistrubute.\nLoads .enm files!\nPress any key to continue!\n\n",enemytablevernum,enemytablevernum2); hang(1); while(check != ERR) { check = nbi(); } bi(); stufffilename(); wprintw(stdscr, "\nWoohoo!\n"); wrefresh(stdscr); hang(1); if(loaden(filename) == 1) { wprintw(stdscr, "File %s not Found. Would you like to make a new file?\n", filename); if(bie() == 'y') { enemynum = 0; // for(frunx = 0; frunx < 256; frunx++) // for(fruny = 0; fruny < 16; fruny++) // enemytable[frunx][fruny] = sep; if(saveen(filename) == 1) { wprintw(stdscr, "Your disk sucks.\n"); bi(); return 1; } } } charted(); return 0; };