Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/ICmpObstructionManager.h
/* Copyright (C) 2020 Wildfire Games. | /* Copyright (C) 2021 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | public: | ||||
* Boolean flags affecting the obstruction behaviour of a shape. | * Boolean flags affecting the obstruction behaviour of a shape. | ||||
*/ | */ | ||||
enum EFlags | enum EFlags | ||||
{ | { | ||||
FLAG_BLOCK_MOVEMENT = (1 << 0), // prevents units moving through this shape | FLAG_BLOCK_MOVEMENT = (1 << 0), // prevents units moving through this shape | ||||
FLAG_BLOCK_FOUNDATION = (1 << 1), // prevents foundations being placed on this shape | FLAG_BLOCK_FOUNDATION = (1 << 1), // prevents foundations being placed on this shape | ||||
FLAG_BLOCK_CONSTRUCTION = (1 << 2), // prevents buildings being constructed on this shape | FLAG_BLOCK_CONSTRUCTION = (1 << 2), // prevents buildings being constructed on this shape | ||||
FLAG_BLOCK_PATHFINDING = (1 << 3), // prevents the tile pathfinder choosing paths through this shape | FLAG_BLOCK_PATHFINDING = (1 << 3), // prevents the tile pathfinder choosing paths through this shape | ||||
FLAG_MOVING = (1 << 4), // indicates this unit is currently moving | FLAG_MOVING = (1 << 4), // indicates this unit is currently moving | ||||
Stan: Can't it be renamed to FLAG_WANT_TO_MOVE? | |||||
Done Inline ActionsIt's not really WANT_TO_MOVE either. I could rename it to FLAG_PUSHING_PRIVATE or something but that doesn't seem really much better to me. wraitii: It's not really WANT_TO_MOVE either. I could rename it to FLAG_PUSHING_PRIVATE or something but… | |||||
Not Done Inline ActionsThen the comment might be adjusted no to say it can do more than having intention to move? Stan: Then the comment might be adjusted no to say it can do more than having intention to move? | |||||
FLAG_DELETE_UPON_CONSTRUCTION = (1 << 5) // this entity is deleted when construction of a building placed on top of this entity starts | FLAG_DELETE_UPON_CONSTRUCTION = (1 << 5) // this entity is deleted when construction of a building placed on top of this entity starts | ||||
}; | }; | ||||
/** | /** | ||||
* Bitmask of EFlag values. | * Bitmask of EFlag values. | ||||
*/ | */ | ||||
typedef u8 flags_t; | typedef u8 flags_t; | ||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | public: | ||||
* @param z0 Z coordinate of line's first point | * @param z0 Z coordinate of line's first point | ||||
* @param x1 X coordinate of line's second point | * @param x1 X coordinate of line's second point | ||||
* @param z1 Z coordinate of line's second point | * @param z1 Z coordinate of line's second point | ||||
* @param r radius (half width) of line | * @param r radius (half width) of line | ||||
* @param relaxClearanceForUnits whether unit-unit collisions should be more permissive. | * @param relaxClearanceForUnits whether unit-unit collisions should be more permissive. | ||||
* @return true if there is a collision | * @return true if there is a collision | ||||
*/ | */ | ||||
virtual bool TestLine(const IObstructionTestFilter& filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, bool relaxClearanceForUnits) const = 0; | virtual bool TestLine(const IObstructionTestFilter& filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, bool relaxClearanceForUnits) const = 0; | ||||
/** | |||||
* Collision test a flat-ended thick line against the current set of static shapes. | |||||
* @see TestLine | |||||
* @return true if there is a collision | |||||
*/ | |||||
virtual bool TestStaticLine(const IObstructionTestFilter& filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r) const = 0; | |||||
/** | /** | ||||
* Collision test a static square shape against the current set of shapes. | * Collision test a static square shape against the current set of shapes. | ||||
* @param filter filter to restrict the shapes that are being tested against | * @param filter filter to restrict the shapes that are being tested against | ||||
* @param x X coordinate of center | * @param x X coordinate of center | ||||
* @param z Z coordinate of center | * @param z Z coordinate of center | ||||
* @param a angle of rotation (clockwise from +Z direction) | * @param a angle of rotation (clockwise from +Z direction) | ||||
* @param w width (size along X axis) | * @param w width (size along X axis) | ||||
▲ Show 20 Lines • Show All 328 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Can't it be renamed to FLAG_WANT_TO_MOVE?