예제 #1
0
System::System(int xp, int yp, int nump, int minl, int atmosl, int pl)
	: SObject(this) {
  name = dict[rand()%dict_size];
  for(int ctr=0; ctr<nump; ++ctr) {
    Planet *plan;
    if(pl >= 0 && ctr == 2) {
      plan = new Planet(this, ctr, (rand()%10000)+1, 30, 30);
      objects.push_back(plan);
      plan->colonies.push_back(new Colony(pl, plan, 1));
      }
    else {
      int at=0, mi=0;
      if(atmosl == 3) at = int(double(sqrt(double(rand()%901))));
      else if(atmosl == 2) at = rand()%30;
      else if(atmosl == 1) at = (rand()%30)*(rand()%30)/30;
      if(minl == 3) mi = int(double(sqrt(double(rand()%901))));
      else if(minl == 2) mi = rand()%30;
      else if(minl == 1) mi = (rand()%30)*(rand()%30)/30;
      plan = new Planet(this, ctr, (rand()%10000)+1, mi, at);
      objects.push_back(plan);
      }
    }
  if(pl >= 0) Know(pl);
  gxloc = xp;
  gyloc = yp;
  gxpos = (xp+10)/20;
  gypos = (yp+10)/20;
  }
예제 #2
0
void System::FleetArrives(Fleet *f) {
  vector<SObject*>::iterator cur = objects.begin();
  while(cur < objects.end()) {
    if(*cur == f) return;
    ++cur;
    }
  objects.push_back(f);
  Know(f->Owner());
  }
SonnetXVIII HereBeDragons::LoveIsTooYoungToKnowWhatConscienceIs(const IntensityImage &Love, const int Is, const int Too, const int Young, const int To){
	SonnetXVIII Know(Young);
	int What = 0;
	for (int x = Is; x < (Is + Young); x++){
		for (int y = Too; y < (Too + To); y++){
			if (Love.getPixel(x, y) == 0){
				Know[What]++;
			}
		}
		What++;
	}
	return Know;
}