From 0aa6cfc3070db0d141ba3b9aa7002fe8989a51db Mon Sep 17 00:00:00 2001 From: Chiller Dragon Date: Sun, 6 Oct 2024 17:59:21 +0800 Subject: [PATCH] deen's tweaks in CONTRIBUTING.md Co-authored-by: Dennis Felsing --- CONTRIBUTING.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2baf2f393..59babca08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,23 +1,23 @@ -# Contributing code to ddnet +# Contributing code to DDNet ## General -Please open issues first discussing the idea before starting to write code. -It would be unfortunate if you spend time working on a contribution that does not align with the ideals of the ddnet project. +Please open an issue first discussing the idea before starting to write code. +It would be unfortunate if you spend time working on a contribution that does not align with the ideals of the DDNet project. -A non exhaustive list of things that usually get rejected would be: -- Extending the dummy with new gameplay affecting features. +A non-exhaustive list of things that usually get rejected: +- Extending dummy with new gameplay-affecting features. https://github.com/ddnet/ddnet/pull/8275 https://github.com/ddnet/ddnet/pull/5443#issuecomment-1158437505 - Breaking backwards compatibility in the network protocol or file formats such as skins and demos. -- Breaking backwards compatibility in gameplay. +- Breaking backwards compatibility in gameplay: + Existing ranks should not be made impossible. + Existing maps should not break. + New gameplay should not make runs easier on already completed maps. ## Code style -There are a few style rules. Some of them are enforced by the github actions CI and some of them are manually checked by reviewers. +There are a few style rules. Some of them are enforced by CI and some of them are manually checked by reviewers. If your github pipeline shows some errors please have a look at the logs and try to fix them. Such fix commits should ideally be squashed into one big commit using ``git commit --amend`` or ``git rebase -i``. @@ -74,7 +74,7 @@ More examples can be found [here](https://github.com/ddnet/ddnet/pull/8288#issue ### Teeworlds interpretation of the hungarian notation -DDNet inherited the hungarian notation like prefixes from [teeworlds](https://www.teeworlds.com/?page=docs&wiki=nomenclature) +DDNet inherited the hungarian notation like prefixes from [Teeworlds](https://www.teeworlds.com/?page=docs&wiki=nomenclature) `m_` @@ -125,9 +125,9 @@ class CFoo }; ``` -### The usage of `goto` is strictly forbidden +### The usage of `goto` is not encouraged -Do not use the `goto` keyword. +Do not use the `goto` keyword in new code, there are better control flow constructs in C++. ### Assignments in if statements should be avoided @@ -151,7 +151,7 @@ Unless the alternative code is more complex and harder to read. ### Methods with default arguments should be avoided -Default arguments tend to break soon, if you have multiple you have to specify each even if you only want to change the last one. +Default arguments tend to break quickly, if you have multiple you have to specify each even if you only want to change the last one. ### Method overloading should be avoided @@ -198,7 +198,8 @@ class CFoo ### Modern C++ should be used instead of old C styled code DDNet balances in being portable (easy to compile on all common distributions) and using modern features. -So you are encouraged to use all modern C++ features as long as their age is older than the newest supported C++ version of ddnet. +So you are encouraged to use all modern C++ features as long as they are supported by the C++ version we use. +Still be aware that in game loop code you should avoid allocations, so static buffers on the stack can be preferable. Examples: - Use `nullptr` instead of `0` or `NULL`. @@ -228,4 +229,4 @@ src/game/foo_bar.cpp ## Commit messages -There are no strict rules for commit messages. But it would be nicer to say "Add new feature xyz" instead of "added new feature xyz". +Describe the change your contribution is making for the player/user instead of talking about what you did in a technical sense. Your PR messages will ideally be in a format that can directly be used in the [change log](https://ddnet.org/downloads/).