From f86133527a8a45946f228c7d0a7672e865b69f77 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 14 Dec 2023 15:41:36 +0100 Subject: [PATCH] move all games into specific directories --- Makefile | 7 +++++-- includes/{ => Butin}/Butin.hpp | 4 ++-- includes/{ => Butin}/PieceButin.hpp | 2 +- includes/{ => Butin}/PlateauButin.hpp | 2 +- includes/{ => Dames}/Dames.hpp | 4 ++-- includes/{ => Dames}/PieceDames.hpp | 2 +- includes/{ => Safari}/PieceSafari.hpp | 2 +- includes/{ => Safari}/PlateauSafari.hpp | 2 +- includes/{ => Safari}/Safari.hpp | 6 +++--- src/{ => Butin}/Butin.cpp | 2 +- src/{ => Butin}/PieceButin.cpp | 2 +- src/{ => Butin}/PlateauButin.cpp | 4 ++-- src/{ => Dames}/Dames.cpp | 2 +- src/{ => Dames}/PieceDames.cpp | 2 +- src/Plateau.cpp | 2 +- src/{ => Safari}/PieceSafari.cpp | 2 +- src/{ => Safari}/PlateauSafari.cpp | 2 +- src/{ => Safari}/Safari.cpp | 2 +- 18 files changed, 27 insertions(+), 24 deletions(-) rename includes/{ => Butin}/Butin.hpp (87%) rename includes/{ => Butin}/PieceButin.hpp (85%) rename includes/{ => Butin}/PlateauButin.hpp (88%) rename includes/{ => Dames}/Dames.hpp (91%) rename includes/{ => Dames}/PieceDames.hpp (87%) rename includes/{ => Safari}/PieceSafari.hpp (83%) rename includes/{ => Safari}/PlateauSafari.hpp (82%) rename includes/{ => Safari}/Safari.hpp (85%) rename src/{ => Butin}/Butin.cpp (92%) rename src/{ => Butin}/PieceButin.cpp (85%) rename src/{ => Butin}/PlateauButin.cpp (91%) rename src/{ => Dames}/Dames.cpp (96%) rename src/{ => Dames}/PieceDames.cpp (74%) rename src/{ => Safari}/PieceSafari.cpp (74%) rename src/{ => Safari}/PlateauSafari.cpp (63%) rename src/{ => Safari}/Safari.cpp (95%) diff --git a/Makefile b/Makefile index 57693fe..ff24a65 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ MKDIR = mkdir -p SRC_DIR = src INC_DIR = includes -SOURCES = $(wildcard $(SRC_DIR)/*.cpp) +SOURCES = $(wildcard $(SRC_DIR)/*.cpp) $(wildcard $(SRC_DIR)/**/*.cpp) OBJETS = $(patsubst %.cpp,%.cpp.o,$(notdir $(SOURCES))) CXXFLAGS = --std=c++11 @@ -22,6 +22,9 @@ PDF_DIR = report %.cpp.o: $(SRC_DIR)/%.cpp $(CXX) -c -o $@ $< $(CXXFLAGS) +%.cpp.o: $(SRC_DIR)/**/%.cpp + $(CXX) -c -o $@ $< $(CXXFLAGS) + main: CXXFLAGS += -O3 main: compilation @@ -30,7 +33,7 @@ dev: CXXFLAGS += -Wold-style-cast -Wsign-conversion dev: compilation compilation: $(OBJETS) - $(CXX) -o $(EXE).$(EXE_EXT) $(OBJETS) $(LIBS) + $(CXX) -o $(EXE).$(EXE_EXT) $^ $(LIBS) all: main diff --git a/includes/Butin.hpp b/includes/Butin/Butin.hpp similarity index 87% rename from includes/Butin.hpp rename to includes/Butin/Butin.hpp index 5c946bc..fa3d559 100644 --- a/includes/Butin.hpp +++ b/includes/Butin/Butin.hpp @@ -2,8 +2,8 @@ #include -#include "../includes/Joueur.hpp" -#include "../includes/PlateauButin.hpp" +#include "../Joueur.hpp" +#include "PlateauButin.hpp" class Butin { friend std::ostream &operator<<(std::ostream &, const Butin &); diff --git a/includes/PieceButin.hpp b/includes/Butin/PieceButin.hpp similarity index 85% rename from includes/PieceButin.hpp rename to includes/Butin/PieceButin.hpp index 16189d3..d2a4307 100644 --- a/includes/PieceButin.hpp +++ b/includes/Butin/PieceButin.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Piece.hpp" +#include "../Piece.hpp" class PieceButin : public Piece { int points; diff --git a/includes/PlateauButin.hpp b/includes/Butin/PlateauButin.hpp similarity index 88% rename from includes/PlateauButin.hpp rename to includes/Butin/PlateauButin.hpp index 33c14d3..d4419eb 100644 --- a/includes/PlateauButin.hpp +++ b/includes/Butin/PlateauButin.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Plateau.hpp" +#include "../Plateau.hpp" class PlateauButin : public Plateau { public: diff --git a/includes/Dames.hpp b/includes/Dames/Dames.hpp similarity index 91% rename from includes/Dames.hpp rename to includes/Dames/Dames.hpp index ae0cdab..9765739 100644 --- a/includes/Dames.hpp +++ b/includes/Dames/Dames.hpp @@ -2,8 +2,8 @@ #include -#include "../includes/Joueur.hpp" -#include "../includes/Plateau.hpp" +#include "../Joueur.hpp" +#include "../Plateau.hpp" class Dames { friend std::ostream &operator<<(std::ostream &, const Dames &); diff --git a/includes/PieceDames.hpp b/includes/Dames/PieceDames.hpp similarity index 87% rename from includes/PieceDames.hpp rename to includes/Dames/PieceDames.hpp index 4829f93..68d37ba 100644 --- a/includes/PieceDames.hpp +++ b/includes/Dames/PieceDames.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Piece.hpp" +#include "../Piece.hpp" class PieceDames : public Piece { // True si la piece est une dame diff --git a/includes/PieceSafari.hpp b/includes/Safari/PieceSafari.hpp similarity index 83% rename from includes/PieceSafari.hpp rename to includes/Safari/PieceSafari.hpp index 67312bd..912e80f 100644 --- a/includes/PieceSafari.hpp +++ b/includes/Safari/PieceSafari.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Piece.hpp" +#include "../Piece.hpp" class PieceSafari : public Piece { public: diff --git a/includes/PlateauSafari.hpp b/includes/Safari/PlateauSafari.hpp similarity index 82% rename from includes/PlateauSafari.hpp rename to includes/Safari/PlateauSafari.hpp index 6b6b64d..28b5e65 100644 --- a/includes/PlateauSafari.hpp +++ b/includes/Safari/PlateauSafari.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Plateau.hpp" +#include "../Plateau.hpp" class PlateauSafari : public Plateau { public: diff --git a/includes/Safari.hpp b/includes/Safari/Safari.hpp similarity index 85% rename from includes/Safari.hpp rename to includes/Safari/Safari.hpp index adbf4df..736afe2 100644 --- a/includes/Safari.hpp +++ b/includes/Safari/Safari.hpp @@ -2,9 +2,9 @@ #include -#include "../includes/Joueur.hpp" -#include "../includes/PieceSafari.hpp" -#include "../includes/PlateauSafari.hpp" +#include "../Joueur.hpp" +#include "PieceSafari.hpp" +#include "PlateauSafari.hpp" class Safari { friend std::ostream &operator<<(std::ostream &, const Safari &); diff --git a/src/Butin.cpp b/src/Butin/Butin.cpp similarity index 92% rename from src/Butin.cpp rename to src/Butin/Butin.cpp index 219669e..6b2e0ad 100644 --- a/src/Butin.cpp +++ b/src/Butin/Butin.cpp @@ -1,4 +1,4 @@ -#include "../includes/Butin.hpp" +#include "../../includes/Butin/Butin.hpp" Butin::Butin(Joueur &j1, Joueur &j2) : plateau(PlateauButin()), joueur1{j1}, joueur2{j2}, joueurCourant{j1} { diff --git a/src/PieceButin.cpp b/src/Butin/PieceButin.cpp similarity index 85% rename from src/PieceButin.cpp rename to src/Butin/PieceButin.cpp index 7ef3941..fd19348 100644 --- a/src/PieceButin.cpp +++ b/src/Butin/PieceButin.cpp @@ -1,4 +1,4 @@ -#include "../includes/PieceButin.hpp" +#include "../../includes/Butin/PieceButin.hpp" PieceButin::PieceButin(const std::string cat) : Piece(cat) { std::cout << "pièce - " << cat << "\n"; diff --git a/src/PlateauButin.cpp b/src/Butin/PlateauButin.cpp similarity index 91% rename from src/PlateauButin.cpp rename to src/Butin/PlateauButin.cpp index 13554b4..989b102 100644 --- a/src/PlateauButin.cpp +++ b/src/Butin/PlateauButin.cpp @@ -1,5 +1,5 @@ -#include "../includes/PlateauButin.hpp" -#include "../includes/PieceButin.hpp" +#include "../../includes/Butin/PlateauButin.hpp" +#include "../../includes/Butin/PieceButin.hpp" #include #include diff --git a/src/Dames.cpp b/src/Dames/Dames.cpp similarity index 96% rename from src/Dames.cpp rename to src/Dames/Dames.cpp index 3d42656..978e0de 100644 --- a/src/Dames.cpp +++ b/src/Dames/Dames.cpp @@ -1,4 +1,4 @@ -#include "../includes/Dames.hpp" +#include "../../includes/Dames/Dames.hpp" Dames::Dames(Joueur &j1, Joueur &j2) : plateau(Plateau(10)), joueur1(j1), joueur2(j2), joueurCourant(j1) { diff --git a/src/PieceDames.cpp b/src/Dames/PieceDames.cpp similarity index 74% rename from src/PieceDames.cpp rename to src/Dames/PieceDames.cpp index 6522f0f..bc93fb6 100644 --- a/src/PieceDames.cpp +++ b/src/Dames/PieceDames.cpp @@ -1,4 +1,4 @@ -#include "../includes/PieceDames.hpp" +#include "../../includes/Dames/PieceDames.hpp" PieceDames::PieceDames(const std::string cat) : Piece(cat) { std::cout << "pièce - " << cat << "\n"; diff --git a/src/Plateau.cpp b/src/Plateau.cpp index 41c8000..5945fe7 100644 --- a/src/Plateau.cpp +++ b/src/Plateau.cpp @@ -1,6 +1,6 @@ #include "../includes/Plateau.hpp" +#include "../includes/Dames/PieceDames.hpp" #include "../includes/Ecran.hpp" -#include "../includes/PieceDames.hpp" Plateau::Plateau(int t) : plateau(new Piece **[t]), taille(t) { // Création du plateau vide diff --git a/src/PieceSafari.cpp b/src/Safari/PieceSafari.cpp similarity index 74% rename from src/PieceSafari.cpp rename to src/Safari/PieceSafari.cpp index 58f1b3f..f363514 100644 --- a/src/PieceSafari.cpp +++ b/src/Safari/PieceSafari.cpp @@ -1,4 +1,4 @@ -#include "../includes/PieceSafari.hpp" +#include "../../includes/Safari/PieceSafari.hpp" PieceSafari::PieceSafari(const std::string cat) : Piece(cat) { std::cout << "pièce - " << cat << "\n"; diff --git a/src/PlateauSafari.cpp b/src/Safari/PlateauSafari.cpp similarity index 63% rename from src/PlateauSafari.cpp rename to src/Safari/PlateauSafari.cpp index 4d7c1b2..da4035c 100644 --- a/src/PlateauSafari.cpp +++ b/src/Safari/PlateauSafari.cpp @@ -1,4 +1,4 @@ -#include "../includes/PlateauSafari.hpp" +#include "../../includes/Safari/PlateauSafari.hpp" PlateauSafari::PlateauSafari(int t) : Plateau(t) {} diff --git a/src/Safari.cpp b/src/Safari/Safari.cpp similarity index 95% rename from src/Safari.cpp rename to src/Safari/Safari.cpp index 2272f22..cb756db 100644 --- a/src/Safari.cpp +++ b/src/Safari/Safari.cpp @@ -1,4 +1,4 @@ -#include "../includes/Safari.hpp" +#include "../../includes/Safari/Safari.hpp" Safari::Safari(Joueur &j1, Joueur &j2, Joueur &j3) : plateau(PlateauSafari(8)), joueur1{j1}, joueur2{j2}, joueur3{j3},