-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
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
updated gitignore
The program will now start by launching the parsing code. If anything goes wrong during this step, the program now exit properly.
Je pense qu'il serait plus simple de passer la libft dans le projet sous forme de fichiers et non de submodule |
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 |
srcs/parsing/parsing.c
Outdated
int i; | ||
|
||
i = ft_strlen(map); | ||
if (map[i - 1] != 'b' || map[i - 2] != 'u' |
There was a problem hiding this comment.
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.
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.