Ejemplo n.º 1
0
string Classement::getDescription()
{
    std::ostringstream s;
    string em = (getPlace() == 1) ? "er" : "eme";
    s<<getPlace()<<em<<" | "<<"Voilier : "<<voilier->getNom()<<" | Temps : " << getTemps();
    return s.str();
}
Ejemplo n.º 2
0
/* Remove from all containers */
Actor::~Actor() {
    /* Drop the actors items */
    for(vector<Item *>::iterator it = possessions.begin();
            it!=possessions.end();
            ++it) {
        getPlace()->getStuff().push_back(*it);
    }
    /* Remove actor from current place */
    vector<Actor*>::iterator it = find(getPlace()->getGubbar().begin(),
                                       getPlace()->getGubbar().end(),
                                       this);
    if(it==getPlace()->getGubbar().end()) {
    } else {
        getPlace()->getGubbar().erase(it);
    }

    /* Remove from thingMap */
    getThingMap().erase(name());
    /* Remove from actors */
    getActors().erase(find(getActors().begin(),
                           getActors().end(),
                           this));
}
//Sets a Cell's "Active" to true {Mouse Use}
void CheckBox::setHoverTrue(COORD& cur)
{
	//Changes the GLOBAL cursor's Y position to the objects position
	//And sets the colors to chosen scheme
	cur.Y = getPlace();
	SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cur);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), clrActive);

	//Sets the cell to "Active"
	hover = true;

	//Checks if the cell is selected ("[X]") or not and reprints the cell in "Active" colors
	if (pressed) cout << checked << " " << getName();
	else cout << unchecked << " " << getName();
}
Ejemplo n.º 4
0
void GameHighScore::insert(string strName, long int iPts)
{
	int iPlace=getPlace(iPts);
	if (iPlace>0)
	{
		iPlace--;	//Platzierung in Index umwandeln..
		for (int x=HIGH_SCORE_ENTRIES-2;x>=iPlace; x--)	// Namensliste nach unten verschieben..
		{
			iPoints[x+1]=iPoints[x];
			strNames[x+1]=strNames[x];
		}
		iPoints[iPlace]=iPts;
		strNames[iPlace]=strName;
	}
}
Ejemplo n.º 5
0
/*
	Calculates & animates trajectory, returns true if the missile reached the target location
	alters Bx, By to be where it reached (so you can tell where it wound up if blocked)
*/
void Missile::animate(int Ax, int Ay, int *Bx, int *By, int _flags, float fixedrange)
{
        int origBx = *Bx;
        int origBy = *By;
        
        hit = false;
        struck = NULL;
        flags = _flags;

        struct sprite *tmpSprite = sprite_clone(getSprite(), 0);
        mapAnimateProjectile(Ax, Ay, Bx, By, tmpSprite, getPlace(), this, fixedrange);
        sprite_del(tmpSprite);

        hit = (hit || (origBx == *Bx && origBy == *By));
}
Ejemplo n.º 6
0
void Database::reserveTicket(string eventId, string personName, int numSeats)
{
	int i,sizex,totalSeat=0,maxSeats;
	vector<Ticket> ticketList;
	bool doesExist=false;

	ticketList=getEventTickets(eventId);				//choose tickets belongs to eventId
	sizex=ticketList.size();					//get the size of list
	

	try{
		for(i=0;i<sizex;i++)
			if(personName!=ticketList[i].getOwnerName())		//if ownernames are different
				totalSeat+=ticketList[i].getNumberOfSeats();	//calculate occupied seats
			
			else throw (SystemError) 6;							//if they are same throw existence exception
				
		if(totalSeat)
		{	
			maxSeats=getPlace(getEvent(eventId).getPlaceName()).getMaxSeats();
			if(totalSeat + numSeats > maxSeats)	//if there aren't enough place throw an error
				throw (SystemError) 5;
		}
		else 
		{
			sizex=places.size();				//getting size of event vector
			for(i=0; i<sizex; i++)				//find the placeName if it exists
				if(eventId==events[i].getEventId())
				{	
					doesExist=true;		
					break;
				}
			if(!doesExist)			//if place does not exist
				throw (SystemError) 3;	//throw an existance exception
		}
		tickets.push_back(Ticket(eventId,personName,numSeats,true));	//add new ticket object

	}
	catch(SystemError x) {
		if(x==3) cout << "ERR_EVENT_NOT_EXISTS"<<endl; 
		if(x==5) cout << "ERR_NOT_ENOUGH_SEATS"<<endl;		
		if(x==6) cout << "ERR_TICKET_CUSTOMER_EXISTS"<<endl;
	
	}
	ticketList.clear();			//deleting the vector, and cleaning the buffer
}
Ejemplo n.º 7
0
int Database::getNumberOfAvailableSeats(string eventId)
{
	int maxSeats,i,sizex,occupied=0;
	vector<Ticket> ticketList;
	bool doesExist=false;

	ticketList=getEventTickets(eventId);		//choose tickets belongs to eventId
	sizex=ticketList.size();					//get the size of list
		
	try{
		if(sizex)
			for(i=0;i<sizex;i++)
				occupied+=ticketList[i].getNumberOfSeats();   //find total occupied seats
		else
		{
			sizex=events.size();
			for(i=0;i<sizex;i++)
				if(events[i].getEventId()==eventId)
				{
					doesExist=true;
					break;
				}	

			if(!doesExist)
				throw (SystemError) 3;
		}
			
	}	
	catch(SystemError x)
	{
		cout<<"ERR_EVENT_NOT_EXIST"<<endl;
		
	}

	maxSeats= getPlace(getEvent(eventId).getPlaceName()).getMaxSeats(); 
	ticketList.clear();	

	return maxSeats-occupied;
}
Ejemplo n.º 8
0
void Boolean7SegmentView::resize()
{
	CompViewSize::resize();	

	if (getViewType() == SHEET_VIEW)
	{
		#define connectors	4
		int height = getPlace().height()/gridY;
		
		int deltaPlace = (height - connectors) / (connectors + 1) + 1;
		
		int start = (height - (deltaPlace * connectors)) / 2;
		
		QPoint connPos(0, start);
		get7Seg()->getInput1()->setGridPos(connPos);
		connPos.ry() += deltaPlace;
		get7Seg()->getInput2()->setGridPos(connPos);
		connPos.ry() += deltaPlace;
		get7Seg()->getInput4()->setGridPos(connPos);
		connPos.ry() += deltaPlace;
		get7Seg()->getInput8()->setGridPos(connPos);
	}
}