Example #1
0
void GameManager::checkState()
{
    if(stop)
    {
        if(stop < view.getNow())
        {
            checkAfter();
            round = false;
            stop = 0;
        }
        return;
    }
    
    if (table.getCalc())
    {
        alivePlayers = 0;
        maxPoint = 0;
        maxKills = 0;
        maxMonsterKills = 0;
        for(std::vector<Player>::const_iterator i = table.getPlayers().begin(); i != table.getPlayers().end(); ++i)
        {
            if(i->isAlive()) ++alivePlayers;
            if(i->getScore() > maxPoint) maxPoint = i->getScore();
            if(i->getKill() > maxKills) maxKills = i->getKill();
            if(i->getMonsterKill() > maxMonsterKills) maxMonsterKills = i->getMonsterKill();
        }
    }
    
    if (gamePlace == SERVER || gamePlace == CLIENT)
    {
        doNetwork();
    }

    checkBefore();
}
Example #2
0
// Sistema de pontuação
	int Tela::point() {
		int maiorX = 0, cols[8], i = 0, pontuacao = 0, elemento, qtd, tam;
		bool dif, check = true;
		Ponto ponto;

		while(check){
			qtd = 0;
			tam = pontos->getSize();
			SDL_Rect my_rects[tam];
			while(pontos->getSize()) {
				ponto = pontos->pop();
				elemento = getElement(ponto.x, ponto.y);
				if(elemento-1 == bonus) 
					pontuacao += 10;
				else
					pontuacao += 5;
				if(ponto.x > maiorX) maiorX = ponto.x;
				dif = true;
				for(int j = 0; j < i; j++) {
					if(cols[j] == ponto.y) dif = false;
				}
				if(dif) cols[i++] = ponto.y;
                setElement(ponto.x, ponto.y, 8);
                apply_surface(ponto.x, ponto.y, gems, screen);
                my_rects[qtd].x = matriz[ponto.x][ponto.y].celula.x;
                my_rects[qtd].y = matriz[ponto.x][ponto.y].celula.y;
                my_rects[qtd].w = matriz[ponto.x][ponto.y].celula.w;
                my_rects[qtd++].h = matriz[ponto.x][ponto.y].celula.h;
            }
            SDL_Delay(300);
            SDL_UpdateRects(screen, tam, my_rects);
            SDL_Delay(300);
			moveElement(cols, i);
			check = checkAfter(maiorX, cols, i);
		}
		return pontuacao;

	}