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

Attempt to fix #363 #364

Merged
merged 2 commits into from Jul 9, 2020
Merged

Attempt to fix #363 #364

merged 2 commits into from Jul 9, 2020

Conversation

buumi
Copy link
Contributor

@buumi buumi commented Jul 8, 2020

Attempt to fix #363. SetUnitSensorRadius("airLos" , ..) seems to also set los. Sounds like a engine bug?

buumi added 2 commits July 8, 2020 21:56
Seems that SetUnitSensorRadius(unitID, "airLos", defaultAirLos) also
sets distance for los. As a result when airLos is set after los, then
value already set for los was overwritten.

Attempts to partially fix spring1944#363 (the first issue)
Same issue as in previous commit seems to happen in transport
load / unload.

Attempt to fix problem 2 of spring1944#363
@sanguinariojoe
Copy link
Member

sanguinariojoe commented Jul 9, 2020

I'm afraid so... https://github.com/spring/spring/blob/develop/rts/Lua/LuaSyncedCtrl.cpp#L2492

Either if you call to set "los" or "airLos", both are set (note that the call to ChangeLos is always setting both at the same time):

		case hashString("los"): {
			unit->ChangeLos(unit->realLosRadius = radius, unit->realAirLosRadius);
			lua_pushnumber(L, unit->losRadius);
		} break;
		case hashString("airLos"): {
			unit->ChangeLos(unit->realAirLosRadius = radius, radius);
			lua_pushnumber(L, unit->airLosRadius);
		} break;

It seems like they did on forward purpose, but probably worths submitting an issue.

P.S. In previous version the game were ignoring defaultLos, after this PR it is ignoring defaultAirLos, right?

@buumi
Copy link
Contributor Author

buumi commented Jul 9, 2020

Actually writing 'los' is only setting 'los' based on my testing, while writing 'airLos' is setting both of them. Before the change:

[f=0000453] Setting los to: 75
[f=0000453] Setting airLos to: 480
[f=0000453] Setting radar to: 750
[f=0000453] Setting seismic to: 0
[f=0000453] airLos after writing is: 480
[f=0000453] los after writing is: 480
[f=0000453] radar after writing is: 750
[f=0000453] seismic after writing is: 0

After the change:

[f=0000549] Setting airLos to: 480
[f=0000549] Setting los to: 75
[f=0000549] Setting radar to: 750
[f=0000549] Setting seismic to: 0
[f=0000549] airLos after writing is: 480
[f=0000549] los after writing is: 75
[f=0000549] radar after writing is: 750
[f=0000549] seismic after writing is: 0

So unless there's something I missed, it should not ignore defaultAirLos.

@sanguinariojoe
Copy link
Member

Oh yes! I'm idiot!

unit->ChangeLos(unit->realAirLosRadius = radius, radius); is setting both to radius, but unit->ChangeLos(unit->realLosRadius = radius, unit->realAirLosRadius); is setting just the first one to radius.

Go ahead, merge when you want!

Shall we submit an issue to the engine, or must we assume they want it like that?

@sanguinariojoe sanguinariojoe self-requested a review July 9, 2020 08:16
@buumi
Copy link
Contributor Author

buumi commented Jul 9, 2020

No, you're not, you already got me thinking also :) This "call method and in parameters set object's instance variables" syntax is hurting my brains at the moment (if that's even what is happening there) but yes, I think you're correct.

It feels like a bug to me but can never know, I can submit ticket to engine Mantis at some point and devs can decide if it's wanted behaviour or not.

@buumi buumi merged commit d3d3459 into spring1944:master Jul 9, 2020
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.

Sight glitches with stealth infantry and vehicles
2 participants