#include "hive.h" #include "vanillahive.h" #include "bee.h" #include "cell.h" #include "settings.h" VanillaHive::VanillaHive( int w, int h ) :Hive( w, h ) { if ( !w ) w = 100; if ( !h ) h = 100; int d = settings.launchdist; int base = settings.basesize; int rnd = settings.randsize; for ( int a = 0 ; a < settings.numcells ; a++ ) { Cell* cell = new Cell(); cells.append( cell ); cell->setRad( base + rand() % rnd ); cell->setCharge( 3 ); switch ( a % 4 ) { case 0: cell->setPos( -d, rand() % h ); break; case 1: cell->setPos( w + d, rand() % h ); break; case 2: cell->setPos( rand() % w, -d ); break; case 3: cell->setPos( rand() % w, h + d ); break; } } for ( int a = 0 ; a < settings.numbees ; a++ ) { Bee* bee = new Bee( this ); allbees.append( bee ); switch ( a % 4 ) { case 0: bee->setPos( -40, rand() % h ); break; case 1: bee->setPos( w + 40, rand() % h ); break; case 2: bee->setPos( rand() % w, -40 ); break; case 3: bee->setPos( rand() % w, h + 40 ); break; } } this->b = this->c = 0; } VanillaHive::~VanillaHive(void) { } void VanillaHive::doEvent() { Bee* bee = allbees.at(b++); Cell* cell = cells.at(c++); b %= allbees.size(); c %= cells.size(); if ( bee->inOrbit() == cell ) { cell = cells.at(c++); c %= cells.size(); } bee->setTargetCell( cell ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 5899 | Sam Stafford |
Pushed a little more information into Settings and made graphics quality configurable. Want to see if that makes it run better on old machines... |
||
#2 | 5898 | Sam Stafford |
Added a quick and dirty settings file, and with it, a bit of configurability. Still tweaking the numbers on maximum velocity and acceleration for the bees. |
||
#1 | 5893 | Sam Stafford | Check in work to date on "hive". |