Пример #1
0
void SampleChannel::sum(int frame, bool running) {

	if (wave == NULL || status & ~(STATUS_PLAY | STATUS_ENDING))
		return;

	if (frame != frameRewind) {

		/* volume envelope, only if seq is running */

		if (running) {
			volume_i += volume_d;
			if (volume_i < 0.0f)
				volume_i = 0.0f;
			else
			if (volume_i > 1.0f)
				volume_i = 1.0f;
		}

		/* fadein or fadeout processes. If mute, delete any signal. */

		/** TODO - big issue: fade[in/out]Vol * internal_volume might be a
		 * bad choice: it causes glitches when muting on and off during a
		 * volume envelope. */

		if (mute || mute_i) {
			vChan[frame]   = 0.0f;
			vChan[frame+1] = 0.0f;
		}
		else
		if (fadeinOn) {
			if (fadeinVol < 1.0f) {
				vChan[frame]   *= fadeinVol * volume_i;
				vChan[frame+1] *= fadeinVol * volume_i;
				fadeinVol += 0.01f;
			}
			else {
				fadeinOn  = false;
				fadeinVol = 0.0f;
			}
		}
		else
		if (fadeoutOn) {
			if (fadeoutVol > 0.0f) { // fadeout ongoing
				if (fadeoutType == XFADE) {
					vChan[frame]   *= volume_i;
					vChan[frame+1] *= volume_i;
					vChan[frame]    = pChan[frame]   * fadeoutVol * volume_i;
					vChan[frame+1]  = pChan[frame+1] * fadeoutVol * volume_i;
				}
				else {
					vChan[frame]   *= fadeoutVol * volume_i;
					vChan[frame+1] *= fadeoutVol * volume_i;
				}
				fadeoutVol -= fadeoutStep;
			}
			else {  // fadeout end
				fadeoutOn  = false;
				fadeoutVol = 1.0f;

				/* QWait ends with the end of the xfade */

				if (fadeoutType == XFADE) {
					qWait = false;
				}
				else {
					if (fadeoutEnd == DO_MUTE)
						mute = true;
					else
					if (fadeoutEnd == DO_MUTE_I)
						mute_i = true;
					else             // DO_STOP
						hardStop(frame);
				}
			}
		}
		else {
			vChan[frame]   *= volume_i;
			vChan[frame+1] *= volume_i;
		}
	}
	else {

		if (mode & (SINGLE_BASIC | SINGLE_PRESS | SINGLE_RETRIG) ||
			 (mode == SINGLE_ENDLESS && status == STATUS_ENDING)   ||
			 (mode & LOOP_ANY && !running))     // stop loops when the seq is off
		{
			status = STATUS_OFF;
		}

		/* temporary stop LOOP_ONCE not in ENDING status, otherwise they
		 * would return in wait, losing the ENDING status */

		//if (mode == LOOP_ONCE && status != STATUS_ENDING)
		if ((mode & (LOOP_ONCE | LOOP_ONCE_BAR)) && status != STATUS_ENDING)
			status = STATUS_WAIT;

		/* check for end of samples. SINGLE_ENDLESS runs forever unless
		 * it's in ENDING mode. */

		reset(frame);
	}
}
void
PlaylistModel::setColumns (const QList<QString> &new_columns)
{
	m_columns = new_columns;
	reset ();
}
Пример #3
0
 ShaderCompileDesc()
 {
     reset();
 }
void WebPageImportanceSignals::onCommitLoad()
{
    Platform::current()->histogramEnumeration("PageImportanceSignals.HadFormInteraction.OnCommitLoad", m_hadFormInteraction, 2);

    reset();
}
Пример #5
0
 virtual void remove(unsigned long items) {
     reset();
     views.clear();
     delete theModel;
     reset();
 }
Пример #6
0
FilterBar::FilterBar(QWidget *parent)
 : QWidget(parent)/*, m_blinkTimer(this), m_blinkedTimes(0)*/
{
	QHBoxLayout *hBox  = new QHBoxLayout(this, /*margin*/0, /*spacing*/0);

	// Create every widgets:
	// (Aaron Seigo says we don't need to worry about the 
	//	"Toolbar group" stuff anymore.)
	
	QIcon resetIconSet = KIcon("dialog-close", KIconLoader::global());
	QIcon inAllIconSet = KIcon("edit-find", KIconLoader::global());

	m_resetButton        = new QToolButton(this);
	m_resetButton->setIconSet(resetIconSet);
	m_resetButton->setTextLabel(i18n("Reset Filter"));//, /*groupText=*/"", this, SLOT(reset()), 0);
	m_resetButton->setAutoRaise(true);
			//new KToolBarButton("locationbar_erase", /*id=*/1230, this, /*name=*/0, i18n("Reset Filter"));
	m_lineEdit = new KLineEdit(this);
	QLabel *label        = new QLabel(m_lineEdit, i18n("&Filter: "), this);
	m_tagsBox = new KComboBox(this);
	QLabel *label2       = new QLabel(m_tagsBox, i18n("T&ag: "), this);
	m_inAllBasketsButton = new QToolButton(this);
	m_inAllBasketsButton->setIconSet(inAllIconSet);
	m_inAllBasketsButton->setTextLabel(i18n("Filter All Baskets"));//, /*groupText=*/"", this, SLOT(inAllBaskets()), 0);
	m_inAllBasketsButton->setAutoRaise(true);

	// Configure the Tags combobox:
	repopulateTagsCombo();

	// Configure the Serach in all Baskets button:
	m_inAllBasketsButton->setToggleButton(true);
//	m_inAllBasketsButton->setOn(true);
//	Global::bnpView->toggleFilterAllBaskets(true);

//	m_lineEdit->setMaximumWidth(150);
	m_lineEdit->setClearButtonShown(true);

	// Layout all those widgets:
//	hBox->addStretch();
	hBox->addWidget(m_resetButton);
	hBox->addSpacing(KDialog::spacingHint());
	hBox->addWidget(label);
	hBox->addWidget(m_lineEdit);
	hBox->addSpacing(KDialog::spacingHint());
	hBox->addWidget(label2);
	hBox->addWidget(m_tagsBox);
	hBox->addSpacing(KDialog::spacingHint());
	hBox->addWidget(m_inAllBasketsButton);

	m_data = new FilterData(); // TODO: Not a pointer! and return a const &  !!

//	connect( &m_blinkTimer,         SIGNAL(timeout()),                   this, SLOT(blinkBar())                  );
	connect(  m_resetButton,        SIGNAL(clicked()),                   this, SLOT(reset())                     );
	connect(  m_lineEdit,           SIGNAL(textChanged(const QString&)), this, SLOT(changeFilter()) );
	connect(  m_tagsBox,            SIGNAL(activated(int)),              this, SLOT(tagChanged(int))             );

//	connect(  m_inAllBasketsButton, SIGNAL(clicked()),                   this, SLOT(inAllBaskets())              );
	connect(  m_inAllBasketsButton, SIGNAL(toggled(bool)), Global::bnpView, SLOT(toggleFilterAllBaskets(bool)) );

	FocusWidgetFilter *lineEditF = new FocusWidgetFilter(m_lineEdit);
	m_tagsBox->installEventFilter(lineEditF);
	connect(lineEditF, SIGNAL(escapePressed()), SLOT(reset()));
	connect(lineEditF, SIGNAL(returnPressed()), SLOT(changeFilter()));
}
AP_Gimbal_Parameters::AP_Gimbal_Parameters()
{
    reset();
}
Пример #8
0
AsyncConnection::~AsyncConnection() {
  reset();
}
Пример #9
0
uint16_t ILI9341_kbv::readID(void)                          //{ return 0x9341; }
{
    if (!done_reset) reset();
	return (readcommand8(0xD3, 2) << 8) | readcommand8(0xD3, 3);
}
Пример #10
0
 any& assign(const T& x) {
     reset();
     policy = anyimpl::get_policy<T>();
     policy->copy_from_value(&x, &object);
     return *this;
 }
Пример #11
0
Authenticator::~Authenticator() {
	reset();
}
Пример #12
0
 /// Assignment function from another any. 
 any& assign(const any& x) {
     reset();
     policy = x.policy;
     policy->clone(&x.object, &object);
     return *this;
 }
void PreviewMatrix::clear()
{
	d_matrix_model->clear();
	reset();
}
Пример #14
0
void SampleChannel::start(int frame, bool doQuantize) {

	switch (status)	{
		case STATUS_EMPTY:
		case STATUS_MISSING:
		case STATUS_WRONG:
		{
			return;
		}

		case STATUS_OFF:
		{
			if (mode & LOOP_ANY) {
				status = STATUS_WAIT;
			}
			else {
				if (G_Mixer.quantize > 0 && G_Mixer.running && doQuantize)
					qWait = true;
				else {
					
					/* fillChan only if frame != 0. If you call fillChan on frame == 0
					 * a duplicate call to fillChan occurs with loss of data. */
					
					status = STATUS_PLAY;
					if (frame != 0)
						tracker = fillChan(vChan, tracker, frame); 
				}
			}
			break;
		}

		case STATUS_PLAY:
		{
			if (mode == SINGLE_BASIC)
				setFadeOut(DO_STOP);
			else
			if (mode == SINGLE_RETRIG) {
				if (G_Mixer.quantize > 0 && G_Mixer.running && doQuantize)
					qWait = true;
				else
					reset(frame);
			}
			else
			if (mode & (LOOP_ANY | SINGLE_ENDLESS))
				status = STATUS_ENDING;
			break;
		}

		case STATUS_WAIT:
		{
			status = STATUS_OFF;
			break;
		}

		case STATUS_ENDING:
		{
			status = STATUS_PLAY;
			break;
		}
	}
}
Пример #15
0
 hashtable() :
   itable(new std::array< std::pair<uint64_t, uint32_t>, TABLE_SIZE >),
   table(*itable)
   {
   reset();
   }
/* Construct a MD5 object with a file. */
MD5::MD5(ifstream &in) {
	reset();
	update(in);
}
Пример #17
0
 hashtable() :
   table(new std::pair<uint64_t, uint32_t>[TABLE_SIZE]),
   table2(new std::pair<uint64_t, uint32_t>[TABLE_SIZE])
   {
   reset();
   }
/* Default construct. */
MD5::MD5() {
	reset();
}
Пример #19
0
 virtual void remove(Container& theContainer) {
     reset();
     theContainer.clear();
     reset();
 }
/* Construct a MD5 object with a input buffer. */
MD5::MD5(const void *input, size_t length) {
	reset();
	update(input, length);
}
Пример #21
0
//! constructor
ZWW::ZWW(){
    reset();
}
/* Construct a MD5 object with a string. */
MD5::MD5(const string &str) {
	reset();
	update(str);
}
Пример #23
0
 ~PatternReseter() {
     reset();
 }
Пример #24
0
/* loads the game from save.dat */
char load()
{
   //LOAD FILE
   int loadversion;
   int l;
   bool dummy_b;
   int dummy;
   long dummy_l;
   FILE *h;

   h=LCSOpenFile("save.dat", "rb", LCSIO_PRE_HOME);
   if(h!=NULL)
   {
      fread(&loadversion,sizeof(int),1,h);

      //NUKE INVALID SAVE GAMES
      if(loadversion<lowestloadversion)
      {
         LCSCloseFile(h);

         reset();

         return 0;
      }

      fread(seed,sizeof(unsigned long),RNG_SIZE,h);

      fread(&mode,sizeof(short),1,h);
      fread(&wincondition,sizeof(short),1,h);
      fread(&fieldskillrate,sizeof(short),1,h);

      fread(&day,sizeof(int),1,h);
      fread(&month,sizeof(int),1,h);
      fread(&year,sizeof(int),1,h);
      fread(&execterm,sizeof(short),1,h);
      fread(&presparty,sizeof(short),1,h);
      fread(&amendnum,sizeof(int),1,h);

      fread(&multipleCityMode,sizeof(bool),1,h);
      fread(&termlimits,sizeof(bool),1,h);
      fread(&deagle,sizeof(bool),1,h);
      fread(&m249,sizeof(bool),1,h);
      fread(&notermlimit,sizeof(bool),1,h);
      fread(&nocourtpurge,sizeof(bool),1,h);
      fread(&stalinmode,sizeof(bool),1,h);

      fread(&stat_recruits,sizeof(int),1,h);
      fread(&stat_dead,sizeof(int),1,h);
      fread(&stat_kills,sizeof(int),1,h);
      fread(&stat_kidnappings,sizeof(int),1,h);
      fread(&stat_buys,sizeof(int),1,h);
      fread(&stat_burns,sizeof(int),1,h);

      fread(&endgamestate,sizeof(char),1,h);
      fread(&ccsexposure,sizeof(char),1,h);
      fread(&ccs_kills,sizeof(char),1,h);

      fread(&Vehicle::curcarid,sizeof(long),1,h);
      fread(&curcreatureid,sizeof(long),1,h);
      fread(&cursquadid,sizeof(long),1,h);
      fread(&police_heat,sizeof(int),1,h);
      fread(&offended_corps,sizeof(short),1,h);
      fread(&offended_cia,sizeof(short),1,h);
      fread(&offended_amradio,sizeof(short),1,h);
      fread(&offended_cablenews,sizeof(short),1,h);
      fread(&offended_firemen,sizeof(short),1,h);
      fread(attorneyseed,sizeof(unsigned long),RNG_SIZE,h);
      //fread(&selectedsiege,sizeof(long),1,h);
      fread(lcityname,sizeof(char),CITY_NAMELEN,h);
      fread(&newscherrybusted,sizeof(char),1,h);

      fread(slogan,sizeof(char),SLOGAN_LEN,h);
      fread(&ledger,sizeof(class Ledger),1,h);
      fread(&party_status,sizeof(short),1,h);

      fread(attitude,sizeof(short),VIEWNUM,h);
      fread(law,sizeof(short),LAWNUM,h);
      fread(house,sizeof(short),HOUSENUM,h);
      fread(senate,sizeof(short),SENATENUM,h);
      fread(court,sizeof(short),COURTNUM,h);
      fread(courtname,sizeof(char)*POLITICIAN_NAMELEN,COURTNUM,h);
      fread(exec,sizeof(char),EXECNUM,h);
      fread(execname,sizeof(char)*POLITICIAN_NAMELEN,EXECNUM,h);
      fread(oldPresidentName,sizeof(char),POLITICIAN_NAMELEN,h);

      //LOCATIONS
      fread(&dummy,sizeof(int),1,h);
      location.resize(dummy);
      for(l=0;l<len(location);l++)
      {
         location[l]=new Location;

         fread(&dummy,sizeof(int),1,h);
         location[l]->loot.resize(dummy);
         for(int l2=0;l2<len(location[l]->loot);l2++)
         {
            int itemLen;
            fread(&itemLen, sizeof(int), 1, h);
            vector<char> vec = vector<char>(itemLen + 1);
            fread(&vec[0], itemLen, 1, h);
            vec[itemLen] = '\0';

            Item* it = create_item(&vec[0]);
            if(it!=NULL)
               location[l]->loot[l2] = it;
         }
         //Remove items of unknown type.
         for(int l2=len(location[l]->loot)-1; l2>=0; l2--)
         {
            bool del = false;
            if(location[l]->loot[l2]->is_loot())
               del = (getloottype(location[l]->loot[l2]->get_itemtypename()) == -1);
            else if(location[l]->loot[l2]->is_clip())
               del = (getcliptype(location[l]->loot[l2]->get_itemtypename()) == -1);
            else if(location[l]->loot[l2]->is_weapon())
               del = (getweapontype(location[l]->loot[l2]->get_itemtypename()) == -1);
            else if(location[l]->loot[l2]->is_armor())
               del = (getarmortype(location[l]->loot[l2]->get_itemtypename()) == -1);

            if(del)
            {
               addstr("Item type ");
               addstr(location[l]->loot[l2]->get_itemtypename());
               addstr(" does not exist. Deleting item.");
               delete_and_remove(location[l]->loot,l2);
            }
         }
         consolidateloot(location[l]->loot); // consolidate loot after loading

         fread(&dummy,sizeof(int),1,h);
         location[l]->changes.resize(dummy);
         for(int l2=0;l2<len(location[l]->changes);l2++)
            fread(&location[l]->changes[l2],sizeof(sitechangest),1,h);

         fread(location[l]->name,sizeof(char),LOCATION_NAMELEN,h);
         fread(location[l]->shortname,sizeof(char),LOCATION_SHORTNAMELEN,h);
         fread(&location[l]->type,sizeof(char),1,h);
         fread(&location[l]->city,sizeof(int),1,h);
         fread(&location[l]->area,sizeof(int),1,h);
         fread(&location[l]->parent,sizeof(int),1,h);
         fread(&location[l]->id,sizeof(int),1,h);

         fread(&location[l]->renting,sizeof(int),1,h);
         fread(&location[l]->newrental,sizeof(char),1,h);
         fread(&location[l]->needcar,sizeof(char),1,h);
         fread(&location[l]->closed,sizeof(int),1,h);
         fread(&location[l]->hidden,sizeof(bool),1,h);
         fread(&location[l]->mapped,sizeof(bool),1,h);
         fread(&location[l]->upgradable,sizeof(bool),1,h);
         fread(&location[l]->highsecurity,sizeof(int),1,h);
         fread(&location[l]->siege,sizeof(siegest),1,h);
         fread(&location[l]->heat,sizeof(int),1,h);
         fread(&location[l]->heat_protection,sizeof(int),1,h);
         fread(&location[l]->compound_walls,sizeof(int),1,h);
         fread(&location[l]->compound_stores,sizeof(int),1,h);
         fread(&location[l]->front_business,sizeof(char),1,h);
         fread(location[l]->front_name,sizeof(char),LOCATION_NAMELEN,h);
         fread(location[l]->front_shortname,sizeof(char),LOCATION_SHORTNAMELEN,h);
         fread(&location[l]->haveflag,sizeof(bool),1,h);

         fread(location[l]->mapseed,sizeof(unsigned long),RNG_SIZE,h);
      }

      //VEHICLES
      fread(&dummy,sizeof(int),1,h);
      vehicle.resize(dummy);
      for(l=0;l<len(vehicle);l++)
      {
         int vehicleLen;
         fread (&vehicleLen, sizeof(int), 1, h);
         vector<char> vec = vector<char> (vehicleLen + 1);
         fread (&vec[0], vehicleLen, 1, h);
         vec[vehicleLen] = '\0';
         vehicle[l] = new Vehicle (&vec[0]);
      }

      //POOL
      fread(&dummy,sizeof(int),1,h);
      pool.resize(dummy);
      for(int pl=0;pl<len(pool);pl++)
      {
         int creatureLen;
         fread (&creatureLen, sizeof(int), 1, h);
         vector<char> vec = vector<char> (creatureLen + 1);
         fread (&vec[0], creatureLen, 1, h);
         vec[creatureLen] = '\0';
         pool[pl] = new Creature(&vec[0]);
         //pool[pl]=new Creature;
         //fread(pool[pl],sizeof(Creature),1,h);
         //read extra interrogation data if applicable
         if(pool[pl]->align==-1 && pool[pl]->alive)
         {
            interrogation* &intr = pool[pl]->activity.intr();
            intr = new interrogation;
            fread(intr->techniques,sizeof(bool[6]),1,h);
            fread(&intr->druguse,sizeof(int),1,h);

            intr->rapport.clear();
            int size;
            fread(&size,sizeof(int),1,h);
            for(int i=0;i<size;i++)
            {
               long id;
               float_zero value;
               fread(&id,sizeof(long),1,h);
               fread(&value,sizeof(float_zero),1,h);
               intr->rapport[id]=value;
            }
         }
         /*
         //read equipment
         vector<Item*> dump; //Used to catch invalid pointers from creature so they aren't deleted.
         pool[pl]->drop_weapon(&dump);
         pool[pl]->strip(&dump);
         pool[pl]->clips = deque<Clip*>();
         pool[pl]->extra_throwing_weapons = deque<Weapon*>();
         int itemLen;
         fread(&itemLen, sizeof(int), 1, h);
         if(itemLen != 0)
         {
            vector<char> vec = vector<char>(itemLen + 1);
            fread(&vec[0], itemLen, 1, h);
            vec[itemLen] = '\0';

            Weapon w(&vec[0]);
            if(getweapontype(w.get_itemtypename())!=-1) //Check it is a valid weapon type.
               pool[pl]->give_weapon(w,&dump);
         }
         //pool[pl]->clips.clear();
         fread(&dummy,sizeof(int),1,h);
         for(int nc=0; nc<dummy; nc++)
         {
            fread(&itemLen, sizeof(itemLen), 1, h);
            vector<char> vec = vector<char>(itemLen + 1);
            fread(&vec[0], itemLen, 1, h);
            vec[itemLen] = '\0';

            Clip c(&vec[0]);
            if(getcliptype(c.get_itemtypename())!=-1) //Check it is a valid clip type.
               pool[pl]->take_clips(c,len(c));
         }
         //pool[pl]->extra_throwing_weapons.clear();
         fread(&dummy,sizeof(int),1,h);
         for(int ne=0; ne<dummy; ne++)
         {
            fread(&itemLen, sizeof(itemLen), 1, h);
            vector<char> vec = vector<char>(itemLen + 1);
            fread(&vec[0], itemLen, 1, h);
            vec[itemLen] = '\0';

            Weapon w(&vec[0]);
            if(getweapontype(w.get_itemtypename())!=-1) //Check it is a valid weapon type.
               pool[pl]->give_weapon(w,NULL);
         }
         fread(&itemLen, sizeof(itemLen), 1, h);
         if(itemLen != 0)
         {
            vector<char> vec = vector<char>(itemLen + 1);
            fread(&vec[0], itemLen, 1, h);
            vec[itemLen] = '\0';

            Armor a(&vec[0]);
            if(getarmortype(a.get_itemtypename())!=-1) //Check it is a valid armor type.
               pool[pl]->give_armor(a,&dump);
         }*/
      }

      //Unique Creatures
      {
         int uniquecreaturesLen;
         fread (&uniquecreaturesLen, sizeof(int), 1, h);
         vector<char> vec = vector<char> (uniquecreaturesLen + 1);
         fread (&vec[0], uniquecreaturesLen, 1, h);
         vec[uniquecreaturesLen] = '\0';
         uniqueCreatures = UniqueCreatures(&vec[0]);
         //fread(&uniqueCreatures,sizeof(UniqueCreatures),1,h);
      }

      //SQUADS
      fread(&dummy,sizeof(int),1,h);
      squad.resize(dummy);
      for(int sq=0;sq<len(squad);sq++)
      {
         squad[sq]=new squadst;

         fread(squad[sq]->name,sizeof(char),SQUAD_NAMELEN,h);
         fread(&squad[sq]->activity,sizeof(activityst),1,h);
         fread(&squad[sq]->id,sizeof(int),1,h);

         for(int pos=0;pos<6;pos++)
         {
            //REBUILD SQUAD FROM POOL
            squad[sq]->squad[pos]=NULL;
            fread(&dummy_b,sizeof(bool),1,h);
            if(dummy_b)
            {
               int dummy_i;
               fread(&dummy_i,sizeof(int),1,h);
               for(int pl=0;pl<len(pool);pl++)
                  if(pool[pl]->id==dummy_i)
                     squad[sq]->squad[pos]=pool[pl];
            }
         }

         fread(&dummy,sizeof(int),1,h);
         squad[sq]->loot.resize(dummy);
         for(int l2=0;l2<len(squad[sq]->loot);l2++)
         {
            int itemLen;
            fread(&itemLen, sizeof(int), 1, h);
            vector<char> vec = vector<char>(itemLen + 1);
            fread(&vec[0], itemLen, 1, h);
            vec[itemLen] = '\0';

            Item* it = create_item(&vec[0]);
            //if(it!=NULL) //Assume save file is correct? -XML
               squad[sq]->loot[l2] = it;
            /*else
               squad[sq]->loot.erase(loot.begin()+l2--);*/
         }
         //Remove items of unknown type.
         for(int l2=len(squad[sq]->loot)-1; l2>=0; l2--)
         {
            bool del = false;
            if(squad[sq]->loot[l2]->is_loot())
               del = (getloottype(squad[sq]->loot[l2]->get_itemtypename()) == -1);
            else if(squad[sq]->loot[l2]->is_clip())
               del = (getcliptype(squad[sq]->loot[l2]->get_itemtypename()) == -1);
            else if(squad[sq]->loot[l2]->is_weapon())
               del = (getweapontype(squad[sq]->loot[l2]->get_itemtypename()) == -1);
            else if(squad[sq]->loot[l2]->is_armor())
               del = (getarmortype(squad[sq]->loot[l2]->get_itemtypename()) == -1);

            if(del)
            {
               addstr("Item type ");
               addstr(squad[sq]->loot[l2]->get_itemtypename());
               addstr(" does not exist. Deleting item.");
               delete_and_remove(squad[sq]->loot,l2);
            }
         }
         consolidateloot(squad[sq]->loot); // consolidate loot after loading
      }

      activesquad=NULL;
      fread(&dummy_b,sizeof(bool),1,h);
      if(dummy_b)
      {
         int dummy_i;
         fread(&dummy_i,sizeof(int),1,h);
         for(int sq=0;sq<len(squad);sq++)
            if(squad[sq]->id==dummy_i)
            {
               activesquad=squad[sq];
               break;
            }
      }

      //DATES
      fread(&dummy,sizeof(int),1,h);
      date.resize(dummy);
      for(int dt=0;dt<len(date);dt++)
      {
         date[dt]=new datest;

         fread(&date[dt]->mac_id,sizeof(long),1,h);
         fread(&date[dt]->timeleft,sizeof(short),1,h);
         fread(&date[dt]->city,sizeof(int),1,h);

         fread(&dummy,sizeof(int),1,h);
         date[dt]->date.resize(dummy);
         for(int dt2=0;dt2<len(date[dt]->date);dt2++)
         {
            int creatureLen;
            fread (&creatureLen, sizeof(int), 1, h);
            vector<char> vec = vector<char> (creatureLen + 1);
            fread (&vec[0], creatureLen, 1, h);
            vec[creatureLen] = '\0';
            date[dt]->date[dt2] = new Creature(&vec[0]);

            //date[dt]->date[dt2]=new Creature;
            //fread(date[dt]->date[dt2],sizeof(Creature),1,h);
         }
      }

      //RECRUITS
      fread(&dummy,sizeof(int),1,h);
      recruit.resize(dummy);
      for(int rt=0;rt<len(recruit);rt++)
      {
         recruit[rt]=new recruitst;
         fread(&recruit[rt]->recruiter_id,sizeof(long),1,h);
         fread(&recruit[rt]->timeleft,sizeof(short),1,h);
         fread(&recruit[rt]->level,sizeof(char),1,h);
         fread(&recruit[rt]->eagerness1,sizeof(char),1,h);
         fread(&recruit[rt]->task,sizeof(char),1,h);

         int creatureLen;
         fread (&creatureLen, sizeof(int), 1, h);
         vector<char> vec = vector<char> (creatureLen + 1);
         fread (&vec[0], creatureLen, 1, h);
         vec[creatureLen] = '\0';
         recruit[rt]->recruit = new Creature(&vec[0]);
         //recruit[rt]->recruit = new Creature;
         //fread(recruit[rt]->recruit,sizeof(Creature),1,h);
      }

      //NEWS STORIES
      fread(&dummy,sizeof(int),1,h);
      newsstory.resize(dummy);
      for(int ns=0;ns<len(newsstory);ns++)
      {
         newsstory[ns]=new newsstoryst;

         fread(&newsstory[ns]->type,sizeof(short),1,h);
         fread(&newsstory[ns]->view,sizeof(short),1,h);

         fread(&newsstory[ns]->loc,sizeof(long),1,h);
         fread(&newsstory[ns]->priority,sizeof(long),1,h);
         fread(&newsstory[ns]->page,sizeof(long),1,h);
         fread(&newsstory[ns]->positive,sizeof(char),1,h);
         fread(&newsstory[ns]->siegetype,sizeof(short),1,h);

         newsstory[ns]->cr=NULL;
         fread(&dummy_b,sizeof(bool),1,h);
         if(dummy_b)
         {
            fread(&dummy_l,sizeof(long),1,h);
            for(int pl=0;pl<len(pool);pl++)
               if(pool[pl]->id==dummy_l)
               {
                  newsstory[ns]->cr=pool[pl];
                  break;
               }
         }

         fread(&dummy,sizeof(int),1,h);
         newsstory[ns]->crime.resize(dummy);
         for(int dt2=0;dt2<len(newsstory[ns]->crime);dt2++)
            fread(&newsstory[ns]->crime[dt2],sizeof(int),1,h);
      }

      // Liberal Media
      fread(public_interest,sizeof(public_interest),1,h);
      fread(background_liberal_influence,sizeof(background_liberal_influence),1,h);

      // Site mode options
      fread(&encounterwarnings,sizeof(bool),1,h);
      bool musicenabled;
      fread(&musicenabled,sizeof(bool),1,h);
      music.enableIf(musicenabled);

      LCSCloseFile(h);

      // Check that vehicles are of existing types.
      for(int v=0;v<len(vehicle);v++)
      {
         if(getvehicletype(vehicle[v]->vtypeidname())==-1)
         { //Remove vehicle of non-existing type.
            addstr("Vehicle type "+vehicle[v]->vtypeidname()+" does not exist. Deleting vehicle.");
            delete_and_remove(vehicle,v--);
         }
      }

      return 1;
   }

   return 0;
}
Пример #25
0
TreeView::~TreeView()
{
    m_pModel->clear();
    reset();
};
Пример #26
0
InspectorLayerTreeAgent::~InspectorLayerTreeAgent()
{
    reset();
}
Пример #27
0
void
PlaylistModel::setColumnFallback (const QList<QString> &new_columns)
{
	m_colfallback = new_columns;
	reset ();
}
MonsterGenerator::~MonsterGenerator()
{
    reset();
}
Пример #29
0
CameraView::~CameraView()
{
    if(camera_)
        reset();
}
Пример #30
0
void SampleChannel::hardStop(int frame) {
	if (frame != 0)        // clear data in range [frame, bufferSize-1]
		clearChan(vChan, frame);
	status = STATUS_OFF;
	reset(frame);
}