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

Reduce code nesting in Recv() method #3241

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ChillerDragon
Copy link
Contributor

Also replace the variable name Result with Error Since UnpackPacket() returns zero on success.

This red a bit funny:

if(!Result)
{
	// do something with the result
}

It now is:

if(Error)
	continue;

// do something with the result

Also replace the variable name `Result` with `Error`
Since `UnpackPacket()` returns zero on success.

This red a bit funny:

	if(!Result)
	{
		// do something with the result
	}

It now is:

	if(Error)
		continue;

	// do something with the result
@Dune-jr
Copy link
Member

Dune-jr commented Mar 3, 2024

I don't know, this isn't a boolean. result being used to describe a return value that is an error when non zero is pretty common.
Whatever, that code is fine as well, but this sort of "let's move this code around in an arguably better or not fashion" causes a lot of unnecessary merge conflicts for a repository that has 610 forks.

@ChillerDragon
Copy link
Contributor Author

I don't know, this isn't a boolean. result being used to describe a return value that is an error when non zero is pretty common.

Oh I did not realize that. I assumed that it was objectively an improvement.

Whatever, that code is fine as well, but this sort of "let's move this code around in an arguably better or not fashion" causes a lot of unnecessary merge conflicts for a repository that has 610 forks.

I agree with that mindset in general. I am also a big fan of merge conflict driven development and caring about fork experience. I just assumed nobody touched the core networking code so it shouldn't cause any git conflicts.

offtopic:
Out of curiosity do you know any fork that is merging with teeworlds? I know @fokkonaut used to do that but he stopped doing so at some point. I assume you @Dune-jr still merge the gamer client? I was browsing the list of forks and none of them looked active but maybe they have some hidden branches or private repositories or they are not github forks. I know heinrich has a few mods in the branches of his fork but as far as I know none of those were touched in the last 10 years. I could name a few active ddnet forks but except assuming gamer client is still merging I can not come up with a single teeworlds fork that is still merging. That of course is no argument and we should still avoid introducing useless code diffs.

@heinrich5991
Copy link
Contributor

https://github.com/teeworlds/teeworlds/pull/3241/files?w=1 for reviewing a smaller diff.

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

3 participants