FAForever / FAForever/fa

Inconsistent naming/usage of sessionInfo and scenarioInfo

Abierto
#4,875 0 comentarios 0 reacciones 0 asignados Ver en GitHub
area: code style
Lenguaje dominante
Lua
Estrellas
264
Forks
260
Merge medio
3 d 2 h
PR fusionados (30 d)
21

Descripción

### TLDR:
The `scenario` or `scenarioInfo` variable name seems to be mixed up with the `sessionInfo` variable name in a number of places.

### Problem description
The intended naming convention (as I interpret it) is to call the results of [`SessionGetScenarioInfo()`](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/engine/User.lua#L840) one of `scenario` of `scenarioInfo`.

This seems indicated by the naming of the engine function (get the ScenarioInfo from the Session, aligning with other calls prefixed by Session), as well as [disconnect.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/dialogs/disconnect.lua#L15), [depth.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/cursor/depth.lua#L93), and [hover.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/cursor/hover.lua#L59). In addition these are explicitely different variables in [SinglePlayerLaunch.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/SinglePlayerLaunch.lua#L247).

The examples I could find where this convention is not respected are [performance.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/system/performance.lua#L544), [AIUtilitiesView.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/dialogs/AIUtilitiesView.lua#L8), [diplomacy.lua 1](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/diplomacy.lua#L292)[+2](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/diplomacy.lua#L400), [gameresult.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/gameresult.lua#L10), [MapUtilities.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/MapUtilities.lua#L12), [Profiler.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/Profiler.lua#L17), [score.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/score.lua#L32), and [tabs.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/tabs.lua#L12).

Weirdly [objectiveDetail.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/objectiveDetail.lua#L601) also calls it something else entirely.

### Proposed solution
Rename all instances of variables being incorrectly called `sessionInfo` to `scenarioInfo` (although an argument could be made for `scenario`).

I'd be happy to make a PR for this if there's agreement for it.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.