This repository has been archived by the owner. It is now read-only.
CRoadBlocks complete #403
Merged
CRoadBlocks complete #403
Conversation
| pCopPed->m_wRoadblockNode = roadBlockNode; | ||
| pCopPed->bCrouchWhenShooting = roadBlockType != 2; | ||
| if (pEntityToAttack) { |
Comment on lines
+105
to
+107
ghost
Apr 11, 2020
Author
I wanted to use an enum here, but I didn't know the roadblock type.
I wanted to use an enum here, but I didn't know the roadblock type.
src/control/RoadBlocks.cpp
Outdated
| for (; nRoadblockNode < numRoadBlocks; nRoadblockNode++) { | ||
| CTreadable *mapObject = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[nRoadblockNode]]; | ||
| CVector2D direction = FindPlayerCoors() - mapObject->GetPosition(); | ||
| if ((direction.x <= -80.0f || direction.x < 80.0f) || (direction.y <= -80.0f || direction.y < 80.0f)) { |
ghost
Apr 11, 2020
I believe it's:
(direction.x <= -80.0f || direction.x >= 80.0f)
and :
(direction.y <= -80.0f || direction.y >= 80.0f)
I believe it's:
(direction.x <= -80.0f || direction.x >= 80.0f)
and :
(direction.y <= -80.0f || direction.y >= 80.0f)
Nick007J
Apr 11, 2020
•
Contributor
Yeah, probably was > && < originally with inverted conditions, but <= || >= is ok too.
Yeah, probably was > && < originally with inverted conditions, but <= || >= is ok too.
aap
Apr 12, 2020
Member
I wouldn't say it's ok. I can't understand it. It's clearly x > -80 && x < 80.
I wouldn't say it's ok. I can't understand it. It's clearly x > -80 && x < 80.
src/control/RoadBlocks.cpp
Outdated
| CRoadBlocks::InOrOut[nRoadblockNode] = false; | ||
| continue; | ||
| } | ||
| if (direction.Magnitude() < 80.0f) { |
src/control/RoadBlocks.cpp
Outdated
| pVehicle->bExtendedRange = true; | ||
| if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1) | ||
| pVehicle->m_bSirenOrAlarm = true; | ||
| if (pVehicle->m_matrix.GetForward().z <= 0.94f) { |
ghost
Apr 11, 2020
•
>
>
|
Thanks for the review. I'll improve the code tomorrow. |
This pull request was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Tested the code. It seems to work fine. I flipped many if-else statements in CRoadBlocks::GenerateRoadBlocks, so it's possible I messed up. I went through the code multiple times, and I couldn't find any bugs.