You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
51 lines
1.2 KiB
/**
|
|
* \file IslandOrBridge.h
|
|
* \brief Used to convert board coordinates into usable ones
|
|
* \author Théotime Maillarbaux And Martin Rouault
|
|
* \date 06/12/2021
|
|
*/
|
|
|
|
#ifndef ISLANDORBRIDGE_H
|
|
#define ISLANDORBRIDGE_H
|
|
|
|
#include "model/Coord.h"
|
|
#include "model/Bridge.h"
|
|
#include "model/Island.h"
|
|
|
|
/**
|
|
* \enum EntityType
|
|
* \brief Indicates which entity was clicked.
|
|
*/
|
|
typedef enum {
|
|
WATER, ///< Nothing in particular was clicked
|
|
ISLAND, ///< An Island was clicked
|
|
BRIDGE, ///< A bridge was clicked
|
|
} EntityType;
|
|
|
|
/**
|
|
* \struct IslandOrBridge
|
|
* \brief Represents a set of coordinates coherent with the CoordType.
|
|
*/
|
|
typedef struct {
|
|
/**
|
|
* \union data
|
|
* \brief Either an island or a bridge
|
|
*/
|
|
union data {
|
|
Island island; ///< An island
|
|
Bridge bridge; ///< A bridge
|
|
} data; ///< Data filled in function of type
|
|
|
|
EntityType type; ///< The type of the entity clicked.
|
|
} IslandOrBridge;
|
|
|
|
/**
|
|
* \brief Converts a set of board coordinates into a usable set of coordinates.
|
|
* \param[in] c The set of board coordinates.
|
|
* \return An IslandOrBridge struct with coherent coordinates with the type of entity.
|
|
*/
|
|
IslandOrBridge coordToEntity(Coord c);
|
|
|
|
#endif // ISLANDORBRIDGE_H
|
|
|