Beispiel #1
0
void Tetris::checkGameFieldForFullLine(){
	for(int y = 0; y < gameFieldHeight - 1; ++y){
		bool fullLine = true;
		for(int x = borderThickness; x < gameFieldWidth - borderThickness; ++x){
			if(this->gameField[y][x] == 0){
				fullLine = false;
				break;
			}
		}
		if(fullLine){
			incrementCurrentScore(10 * this->tetrominoFallingSpeed);

			if(checkLevelForIncrement())
				incrementLevel();

			for(int y2 = y; y2 > 0; --y2){
				for(int x = borderThickness; x < gameFieldWidth - borderThickness; ++x){
					this->gameField[y2][x] = this->gameField[y2 - 1][x];
				}
			}
		}
	}
}
Beispiel #2
0
void JSONHandler::handle(const JSONEntity& value)
{
	switch(value.type())
	{
	case JSONEntity::JSON_T_ARRAY_BEGIN:    
		handleArrayBegin();
		setKey(false);
		incrementLevel();
		break;

	case JSONEntity::JSON_T_ARRAY_END:
		poco_assert(!isKey());
		if (level() > 0)
			decrementLevel();
		handleArrayEnd();
		break;

	case JSONEntity::JSON_T_OBJECT_BEGIN:
		handleObjectBegin();
		setKey(false);
		incrementLevel();
		break;

	case JSONEntity::JSON_T_OBJECT_END:
		poco_assert(!isKey());
		if (level() > 0)
			decrementLevel();
		handleObjectEnd();
		break;

	case JSONEntity::JSON_T_VALUE_SEPARATOR:
		handleValueSeparator();
		setKey(false);
		break;

	case JSONEntity::JSON_T_INTEGER:
		handleInteger(value);
		setKey(false);
		break;

	case JSONEntity::JSON_T_FLOAT:
		handleFloat(value);
		setKey(false);
		break;

	case JSONEntity::JSON_T_NULL:
		handleNull();
		setKey(false);
		break;

	case JSONEntity::JSON_T_TRUE:
		handleTrue();
		setKey(false);
		break;

	case JSONEntity::JSON_T_FALSE:
		handleFalse();
		setKey(false);
		break;

	case JSONEntity::JSON_T_KEY:
		setKey(true);
		handleKey(value);
		break;   

	case JSONEntity::JSON_T_STRING:
		handleString(value);
		setKey(false);
		break;

	default:
		poco_assert (false);
		break;
	}
}