Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions SerialPrograms/Source/Pokemon/Navigation/Pokemon_Direction.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Direction
*
* From: https://github.com/PokemonAutomation/
*
*/

#include "Pokemon_Direction.h"

namespace PokemonAutomation{
namespace Pokemon{


std::string direction_name(Direction direction){
switch (direction){
case Direction::NORTH:
return "north";
case Direction::EAST:
return "east";
case Direction::SOUTH:
return "south";
case Direction::WEST:
return "west";
}
return "?";
}



} // namespace Pokemon
} // namespace PokemonAutomation
36 changes: 36 additions & 0 deletions SerialPrograms/Source/Pokemon/Navigation/Pokemon_Direction.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Direction
*
* From: https://github.com/PokemonAutomation/
*
* The four cardinal directions the player can face or move in.
*
*/

#ifndef PokemonAutomation_Pokemon_Direction_H
#define PokemonAutomation_Pokemon_Direction_H

#include <string>

namespace PokemonAutomation{
namespace Pokemon{


// Row 0 is the top of a map, so SOUTH increases y.
enum class Direction{
NORTH,
EAST,
SOUTH,
WEST,
};
// Array containing all four cardinal directions.
constexpr Direction ALL_DIRECTIONS[] = {
Direction::NORTH, Direction::EAST, Direction::SOUTH, Direction::WEST,
};
// Returns the lowercase name string of a cardinal direction.
std::string direction_name(Direction direction);



} // namespace Pokemon
} // namespace PokemonAutomation
#endif
15 changes: 0 additions & 15 deletions SerialPrograms/Source/Pokemon/Navigation/Pokemon_Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@ namespace PokemonAutomation{
namespace Pokemon{


std::string direction_name(Direction direction){
switch (direction){
case Direction::NORTH:
return "north";
case Direction::EAST:
return "east";
case Direction::SOUTH:
return "south";
case Direction::WEST:
return "west";
}
return "?";
}


TilePos TilePos::next(Direction direction) const{
switch (direction){
case Direction::NORTH:
Expand Down
18 changes: 2 additions & 16 deletions SerialPrograms/Source/Pokemon/Navigation/Pokemon_Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* From: https://github.com/PokemonAutomation/
*
* Tiles and directions on an overworld grid, shared by the games that
* Tiles on an overworld grid, shared by the games that
* move the player a tile at a time.
*
*/
Expand All @@ -14,26 +14,12 @@
#include <functional>
#include <string>
#include <vector>
#include "Pokemon_Direction.h"

namespace PokemonAutomation{
namespace Pokemon{


// Row 0 is the top of a map, so SOUTH increases y.
enum class Direction{
NORTH,
EAST,
SOUTH,
WEST,
};
// Array containing all four cardinal directions.
constexpr Direction ALL_DIRECTIONS[] = {
Direction::NORTH, Direction::EAST, Direction::SOUTH, Direction::WEST,
};
// Returns the lowercase name string of a cardinal direction.
std::string direction_name(Direction direction);


// Grid coordinate with integer x and y components.
struct TilePos{
int x = 0;
Expand Down
2 changes: 2 additions & 0 deletions SerialPrograms/cmake/SourceFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,8 @@ file(GLOB LIBRARY_SOURCES
Source/Pokemon/Inference/Pokemon_TrainPokemonOCR.h
Source/Pokemon/Inference/Pokemon_TypeReader.cpp
Source/Pokemon/Inference/Pokemon_TypeReader.h
Source/Pokemon/Navigation/Pokemon_Direction.cpp
Source/Pokemon/Navigation/Pokemon_Direction.h
Source/Pokemon/Navigation/Pokemon_Grid.cpp
Source/Pokemon/Navigation/Pokemon_Grid.h
Source/Pokemon/Options/Pokemon_BoxSortingTable.cpp
Expand Down
Loading