Skip to content
This repository has been archived by the owner. It is now read-only.

CRoadBlocks complete #403

Merged
5 commits merged into from Apr 13, 2020
Merged

CRoadBlocks complete #403

5 commits merged into from Apr 13, 2020

Conversation

@ghost
Copy link

@ghost ghost commented Apr 11, 2020

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.

pCopPed->m_wRoadblockNode = roadBlockNode;
pCopPed->bCrouchWhenShooting = roadBlockType != 2;
if (pEntityToAttack) {
Comment on lines +105 to +107

This comment has been minimized.

@ghost

ghost Apr 11, 2020
Author

I wanted to use an enum here, but I didn't know the roadblock type.

src/control/RoadBlocks.cpp Outdated Show resolved Hide resolved
src/control/RoadBlocks.cpp Outdated Show resolved Hide resolved
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)) {

This comment has been minimized.

@ghost

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)

This comment has been minimized.

@Nick007J

Nick007J Apr 11, 2020
Contributor

Yeah, probably was > && < originally with inverted conditions, but <= || >= is ok too.

This comment has been minimized.

@aap

aap Apr 12, 2020
Member

I wouldn't say it's ok. I can't understand it. It's clearly x > -80 && x < 80.

CRoadBlocks::InOrOut[nRoadblockNode] = false;
continue;
}
if (direction.Magnitude() < 80.0f) {

This comment has been minimized.

pVehicle->bExtendedRange = true;
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
pVehicle->m_bSirenOrAlarm = true;
if (pVehicle->m_matrix.GetForward().z <= 0.94f) {

This comment has been minimized.

@ghost

ghost Apr 11, 2020

>

src/control/RoadBlocks.cpp Outdated Show resolved Hide resolved
src/control/RoadBlocks.cpp Outdated Show resolved Hide resolved
@ghost
Copy link
Author

@ghost ghost commented Apr 11, 2020

Thanks for the review. I'll improve the code tomorrow.

@ghost ghost merged commit 2e20e04 into GTAmodding:master Apr 13, 2020
1 check passed
1 check passed
@appveyor
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants