Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging parsing onto Main #1

Closed
wants to merge 10 commits into from
Closed

Merging parsing onto Main #1

wants to merge 10 commits into from

Conversation

gd-harco
Copy link
Collaborator

Parsing logic is implemented in the code, No other change has been made to the render part, it will just check if the argv[1] is a valid .cub file before continuing.

A new header file, parsing.h, was created to help organize and modularize the parsing functionality of the application. This file was included in the cub.h header to make the new parsing functions widely available across the codebase. The added files were also reflected in the Makefile and sources.mk. This change aims to enhance code readability and maintainability."
A new header file, parsing.h, was created to help organize and modularize the parsing functionality of the application. This file was included in the cub.h header to make the new parsing functions widely available across the codebase. The added files were also reflected in the Makefile and sources.mk. This change aims to enhance code readability and maintainability."
Added the libft library as a submodule and its inclusion in the header file. The libft library contains reusable C function which is already used by many projects. Their addition in the Makefile allows these functions to be compiled and linked into the executable. This will make developing new features easier and faster because we have a robust set of tools readily available. The .gitmodules file ensures that this library is cloned whenever this repository is cloned. This makes it easier for new developers to set up their development environments.
The change introduces error messages for invalid command line arguments used in the cub3D project. The error messages include definitions for wrong usage, incorrect file extension, and inaccessible map file. This improves the traceability of error sources, aiding in future debugging efforts.
Added a new parsing.c file and started implementing the logic in it. It includes some basic error checks like verifying the number of arguments and validating the file extension. This is the start of building the parsing functionality for the application. In addition, the printf.h library was added to the cub.h file to support the printf function.
# Conflicts:
#	Makefile
#	incs/parsing.h
The program will now start by launching the parsing code. If anything goes wrong during this step, the program now exit properly.
@BenoitRoux0
Copy link
Owner

Je pense qu'il serait plus simple de passer la libft dans le projet sous forme de fichiers et non de submodule

@gd-harco
Copy link
Collaborator Author

L'avantage c'est que si on a besoin de la modifie, elle est modifie globalement. Il faut juste que j'ajoute un git submodule Init --recursive dans le Makefile et ca sera transparent

int i;

i = ft_strlen(map);
if (map[i - 1] != 'b' || map[i - 2] != 'u'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense que l'utilisation d'un ft_strncmp serait plus logique et lisible en vue du contexte

The 'all' rule in the Makefile has been updated to initialize and update any git submodules before building the project. This change ensures that any dependencies managed as submodules are correctly set up before attempting the build, preventing potential build failures due to missing or outdated dependencies.
Simplified the logic used for validating the suffix of a parsed map file. Initial implementation was manually checking each character of the suffix by hardcoded indices. This was refactored to use the `ft_strncmp` function to compare the last 4 characters to the expected suffix ".cub". This simplifies the code, improves readability, and reduces the probability of off-by-one errors in the indexing.
@gd-harco gd-harco closed this Aug 31, 2023
This was referenced Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants