biquadris / specialAction.cc
specialAction.cc
Raw
#include "specialAction.h"
#include "model.h"

const int HEAVY_AMOUNT = 2;

Blind::Blind(std::shared_ptr<Board> component, BiquadrisModel *model):
    BoardDecorator{component, model} {
    notifyObservers(SubscriptionType::BoardModified);
}

char Blind::getType(int row, int col) { 
    if ((col >= 2 && col <= 8) && (row <= component->getHeight() - 3 
        && row >= component->getHeight() - 12)) {
        return '?';
    }
    return component->getType(row, col);
};

Heavy::Heavy(std::shared_ptr<Board> component, BiquadrisModel *model):
    BoardDecorator{component, model} {}

void Heavy::move(char direction, int n, int weight) {
    component->move(direction, n, weight + HEAVY_AMOUNT);
}

void Heavy::rotate(bool isClockwise, int n, int weight) {
    component->rotate(isClockwise, n, weight + HEAVY_AMOUNT);
}