#include <QApplication>#include <QAction>#include "map.h"#include "map_background.h"#include "map_object.h"#include "wall.h"#include "../generators/box_generator.h"#include "../generators/creature_generator.h"#include "../generators/bonus_generator.h"#include "../resource_handlers/map_resource_handler.h"#include "../main_window.h"Definice maker | |
| #define | GENERATOR(className, fieldSetMember) |
| #define | PREPARE_WALL_AND_RECT(situation, moveMethod, getMethod) |
| #define | CORNER(situation, moveMethod, getMethod) |
| #define | SIDE(situation, moveMethod, getMethod, stepX, stepY) |
| #define CORNER | ( | situation, | |||
| moveMethod, | |||||
| getMethod | ) |
Hodnota:
do { \ PREPARE_WALL_AND_RECT(situation, moveMethod, getMethod) \ /* insert wall (by the top left corner of wall rect) */ \ insert(wall->createCopy(), wallRect.topLeft() ); \ } while(0)
| #define GENERATOR | ( | className, | |||
| fieldSetMember | ) |
Hodnota:
do { \ fields_[x][y].fieldSetMember = \ new className(Field(x, y)); \ connect(fields_[x][y].fieldSetMember, \ SIGNAL(allowanceChanged()), \ this, SLOT(setModified()) ); \ } while(0)
| #define PREPARE_WALL_AND_RECT | ( | situation, | |||
| moveMethod, | |||||
| getMethod | ) |
Hodnota:
BombicWall * wall = background_->getWall( \ BombicMapBackground::situation); \ /* create wall rect with right size (anywhere) */ \ QRect wallRect(QPoint(0,0), wall->size()); \ /* move the wall rect to the corner of map */ \ wallRect.moveMethod(fieldsRect_.getMethod());
| #define SIDE | ( | situation, | |||
| moveMethod, | |||||
| getMethod, | |||||
| stepX, | |||||
| stepY | ) |
Hodnota:
do { \ PREPARE_WALL_AND_RECT(situation, moveMethod, getMethod) \ /* along whole side */ \ for(BombicMap::Field field = wallRect.topLeft() ; \ fieldsRect_.contains(field) ; \ field += BombicMap::Field(stepX, stepY) ) { \ /* insert wall if it is possible */ \ if(canInsert(wall, field)) { \ insert(wall->createCopy(), field); \ } \ } \ } while(0)
1.5.6