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

Wrong vehicle selling on chopshop FIX #568

Merged
merged 8 commits into from Aug 4, 2019

Conversation

@Casperento
Copy link
Contributor

commented Jul 12, 2019

Resolves #567

Changes proposed in this pull request:

  • Get vehicle object by it's netId

  • fn_chopShopMenu.sqf updated

  • fn_chopShopSell.sqf updated

  • I have tested my changes and corrected any errors found

@Casperento Casperento closed this Jul 12, 2019

@Casperento Casperento reopened this Jul 12, 2019

@klmunday
Copy link
Contributor

left a comment

seems good

@klmunday klmunday requested review from BoGuu, DomT602 and Wackbatt Jul 17, 2019

@DomT602
Copy link
Member

left a comment

@Casperento happy with the changes, although while we're here, is it worth optimising the rest of the files you've changed?

@Casperento

This comment has been minimized.

Copy link
Contributor Author

commented Jul 21, 2019

Yes, I think so

@Casperento Casperento dismissed stale reviews from DomT602 and klmunday via 8bc0232 Jul 22, 2019

@BoGuu
Copy link
Member

left a comment

@@ -2,25 +2,33 @@
/*
File: fn_chopShopMenu.sqf
Author: Bryan "Tonic" Boardwine
Modified: Casperento

This comment has been minimized.

Copy link
@BoGuu

This comment has been minimized.

Copy link
@Casperento

Casperento Jul 22, 2019

Author Contributor

No problem, i'll remove these 'Modified' comments


private _control = CONTROL(39400,39402);
private _price = _control lbValue (lbCurSel _control);
private _vehicle = _control lbData (lbCurSel _control);
_vehicle = call compile format ["%1", _vehicle];

This comment has been minimized.

Copy link
@BoGuu

BoGuu Jul 22, 2019

Member

Would probably be best to remove this

This comment has been minimized.

Copy link
@Leigham

Leigham Jul 22, 2019

Contributor

i would personally use setVariable, instead of lbDate when using anything but a string.
_control setVariable [format ["lbData_%1", _index], anything];

This comment has been minimized.

Copy link
@Casperento

Casperento Jul 23, 2019

Author Contributor

Thx for suggesting

if (isNull _vehicle) exitWith {};

hint localize "STR_Shop_ChopShopSelling";
life_action_inUse = true;
_price2 = CASH + _price;
[0] call SOCK_fnc_updatePartial;

This comment has been minimized.

Copy link
@BoGuu

BoGuu Jul 22, 2019

Member

Not required anymore?

This comment has been minimized.

Copy link
@Casperento

Casperento Jul 22, 2019

Author Contributor

Nope

This comment has been minimized.

Copy link
@BoGuu

BoGuu Jul 22, 2019

Member

(talking about the updatePartial so we're on the same page - can remove that)

This comment has been minimized.

Copy link
@Casperento

Casperento Jul 22, 2019

Author Contributor

Yes, sorry my bad


if (_price > 0) then {
CASH = CASH + _price;
[1,"STR_NOTF_ChopSoldCar",true,[_displayName,[_price] call life_fnc_numberText]] call life_fnc_broadcast;

This comment has been minimized.

Copy link
@BoGuu

BoGuu Jul 22, 2019

Member

Maybe more elegant to just do this manually?

This comment has been minimized.

Copy link
@Casperento

Casperento Jul 22, 2019

Author Contributor

Yeah, sure

@Leigham

This comment has been minimized.

Copy link
Contributor

commented on 6ab739d Jul 23, 2019

you dont need str(netid) just netid

@Casperento

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2019

Yeah, that's true @Leigham...already fixed for the next commit

@Leigham

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

it just removes the need for call compile _something

@Casperento

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2019

Ya, i came up with this in the end:
private _vehicle = objectFromNetId (_control getVariable[format["lbData_%1",(lbCurSel _control)],""]);

@Leigham

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

just pass through the object

@Casperento

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2019

Yes, well reminded..but i think it's better keep lbData anyway

@klmunday
Copy link
Contributor

left a comment

Looks good, just need to make sure it passes the tests, seems CI picked up a few tabs see: here

@Leigham

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2019

just looked through, _control lbSetData [(lbSize _control)-1,(netId _x)]; might want to double check this, lbSetData only allows strings.

@DomT602

This comment has been minimized.

Copy link
Member

commented Aug 3, 2019

just looked through, _control lbSetData [(lbSize _control)-1,(netId _x)]; might want to double check this, lbSetData only allows strings.

netID returns a string so that should be fine

@DomT602
Copy link
Member

left a comment

A few changes but overall good work!

*/
params [
["_price",-1,[-1]],
"_displayName"

This comment has been minimized.

Copy link
@DomT602

DomT602 Aug 3, 2019

Member

displayName can be given a default of "" and allowed data types of "" also

@@ -6,14 +6,16 @@
Displays the pricing for the currently selected vehicle.
*/
disableSerialization;

This comment has been minimized.

Copy link
@DomT602

DomT602 Aug 3, 2019

Member

Serialization doesn't need to be disabled here

_control = CONTROL(39400,39402);
private _control = CONTROL(39400,39402);
private "_className";
private "_classNameLife";

This comment has been minimized.

Copy link
@DomT602

DomT602 Aug 3, 2019

Member

If we invert usage of _classname,
if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _classNameLife)) then {
diag_log format ["%1: LifeCfgVehicles class doesn't exist",_className];
_className = "Default"; //Use Default class if it doesn't exist
};

@DomT602
Copy link
Member

left a comment

Thanks for the updates @Casperento. Just the last 2 things from me!


private _chopable = LIFE_SETTINGS(getArray,"chopShop_vehicles");
private _nearVehicles = nearestObjects [getMarkerPos (_this select 3),_chopable,25];
private _nearUnits = (nearestObjects[player,["CAManBase"],5]) arrayIntersect playableUnits;
if (count _nearUnits > 1) exitWith {hint localize "STR_NOTF_PlayerNear"};

life_chopShop = _this select 3;
//Error check
if (count _nearVehicles isEqualTo 0) exitWith {titleText[localize "STR_Shop_NoVehNear","PLAIN"];};

This comment has been minimized.

Copy link
@DomT602

DomT602 Aug 3, 2019

Member

Slight improvement for this;
if (_nearVehicles isEqualTo []) exitWith {blah};

This comment has been minimized.

Copy link
@Casperento

Casperento Aug 3, 2019

Author Contributor

Ok

@DomT602

DomT602 approved these changes Aug 3, 2019

Copy link
Member

left a comment

Looks good! Thanks for the PR.

@BoGuu

BoGuu approved these changes Aug 3, 2019

@DomT602 DomT602 merged commit 11408d6 into AsYetUntitled:master Aug 4, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.