void CDiagramTextNode::startGrowing(const QPointF &p) { setPos(p); }
VolumeOperatorCreateSubset::VolumeOperatorCreateSubset(tgt::ivec3 pos, tgt::ivec3 size) { setPos(pos); setSize(size); }
void doComputer(int player, int target) { AI *ai; Data *data; Player *me, *him; int i, j, level, x, y; int rdist = 0, ldist = 0; me = &(game->player[ player ]); him = &(game->player[ target ]); if(me->ai == NULL) { printf("This player has no AI data!\n"); return; } data = me->data; ai = me->ai; level = game2->settingsCache.ai_level; ai->moves++; /* avoid to short turns */ if(game2->time.current - ai->lasttime < turn_time[level]) return; /* first, check if we are in danger */ /* check the highest level first! */ for(i = level; i >= 0; i++) { for(j = probe_dists[i][0]; j <= probe_dists[i][1]; j++) { setPos(data, &x, &y); getDistPoint(data->dir, j, &x, &y); if(getCol(x, y)) { ai->danger = j; break; } } if(ai->danger != 0) break; } if(ai->danger != 0 || ai->moves > max_moves[level] * game2->rules.grid_size) { ai->moves = 0; /* figure out how far it's to either side */ for(i = 1; i < MAX_PROBE_DIST; i++) { setPos(data, &x, &y); getDistPoint(LEFT(data->dir), i, &x, &y); if(getCol(x, y)) { ldist = i; break; } else { ldist = i; } } for(i = 1; i < MAX_PROBE_DIST; i++) { setPos(data, &x, &y); getDistPoint(RIGHT(data->dir), i, &x, &y); if(getCol(x, y)) { rdist = i; break; } else { rdist = i; } } /* decide where to turn */ if(ai->danger > rdist && ai->danger > ldist) { ai->danger--; return; } else if(rdist > ldist && ai->tdiff > -spiral[level] ) { createEvent(player, EVENT_TURN_RIGHT); ai->tdiff--; } else if(rdist < ldist && ai->tdiff < spiral[level] ) { createEvent(player, EVENT_TURN_LEFT); ai->tdiff++; } else { if(ai->tdiff > 0) { createEvent(player, EVENT_TURN_RIGHT); ai->tdiff--; } else { createEvent(player, EVENT_TURN_LEFT); ai->tdiff++; } } ai->danger = 0; ai->lasttime = game2->time.current; } }