View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0004361 | Spring engine | Lua | public | 2014-04-12 20:26 | 2014-04-13 15:59 | ||||
Reporter | silentwings | ||||||||
Assigned To | |||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Product Version | 96.0 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0004361: gadget:GameSetup second argument argument returned does not work correctly | ||||||||
Description | The second argument returned from (unsynced) gadget:GameSetup is a bool that (according to wiki) controls whether or not the default list of playernames is shown, coloured to indicate each players ready state. In fact, it only does so for player who are already ready - if a player is not ready then the list of playernames is shown regardless of what is returned in GameSetup. | ||||||||
Steps To Reproduce | test using: function gadget:GameSetup(state,ready,playerStates) Spring.Echo(ready) if ready then return true, false else return false, false end end Start a game where you have to choose your owns tartpoints. The list of playernames on the left side of the screen only disappears after you click ready. | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
Notes | |
cleanrock (reporter) 2014-04-13 08:31 |
I might be off here but i think you are looking at http://springrts.com/wiki/Lua:Callins which i think is incorrect, http://springrts.com/wiki/LuaCallinReturn shows what matches the code: GameSetup() --> string "state", boolean "ready", table "playerStates" return success, newReady |
silentwings (reporter) 2014-04-13 10:17 |
http://springrts.com/wiki/LuaCallinReturn is (now orphaned and ) replaced by http://springrts.com/wiki/Lua:Callins. But yes that's what I was reading. Judging by LuaHandle.cpp you are right - it says "if success then ready = newReady" BUT it's still true (and unexplained) that the example I gave above does hide the list of playernames only after "return true,false"; maybe it's the return value from CLuaHandle::GameSetup which is controlling this? |
FLOZi (reporter) 2014-04-13 10:17 |
Fixed Lua:Callins page |
silentwings (reporter) 2014-04-13 10:26 Last edited: 2014-04-13 13:25 |
Note that the success variable is actually superfluous - the callin is passed the players current ready state and a gadget could just choose return that as newReady. I would still be very grateful for the ability to hide that list of names (there is enoguh info sent to lua now to fully replace it and I have a complicated to explain reason for wanting to - "ready" in BA now means something slightly different to "green" on that list) I can submit a patch (I think) that just adds a third argument to be returned, with the third argument being a bool that hides the list of names. If I did this and it worked (1) would it get used? (2) what format do you want patches in? (I have set up code::blocks in Windows for Spring and, with some custom build flags for Cmake that behe gave me, it works beautifully!) |
Kloot (developer) 2014-04-13 14:22 Last edited: 2014-04-13 14:26 |
"I would still be very grateful for the ability to hide that list of names" as you already found out, "it's the return value from CLuaHandle::GameSetup which is controlling this" (aka the FIRST value returned from gadget:GameSetup, called "success" on the wiki) |
silentwings (reporter) 2014-04-13 14:46 Last edited: 2014-04-13 14:51 |
No - the 'success' variable only controls that if the player is set to ready. See https://github.com/spring/spring/blob/develop/rts/Lua/LuaHandle.cpp#L2250 - it can't return true unless the player is ready. I've attached a patch that adds a third value to control it, afaik without breaking existing code. Base gadgethandler would need updating to match (I don't have basecontent in my local repo) with function gadgetHandler:GameSetup(state, ready, playerStates) local success, newReady, hideList, hList for _,g in ipairs(self.GameSetupList) do success, newReady, hList = g:GameSetup(state,ready,playerStates) hideList = hideList or hList end return success, newReady, hideList end |
Kloot (developer) 2014-04-13 15:14 Last edited: 2014-04-13 15:16 |
"No - the 'success' variable only controls that if the player is set to ready" incorrect CLuaHandle::GameSetup // -2 is the index of the FIRST return value if (lua_isboolean(L, -2)) { if (lua_toboolean(L, -2)) { ... return true; GameSetupDrawer::Draw if (eventHandler.GameSetup(startState, playerHasReadied, playerStates)) { ... return; |
silentwings (reporter) 2014-04-13 15:33 Last edited: 2014-04-13 15:53 |
Oh, you are quite right! Sorry. But, without returning success==true and consequently hiding the player list, I can't change the ready state of the player. (Although I didn't need to do that anyway - since this has now become quite a convoluted ticket I suggest to close it.) |
Issue History | |||
Date Modified | Username | Field | Change |
---|---|---|---|
2014-04-12 20:26 | silentwings | New Issue | |
2014-04-13 08:31 | cleanrock | Note Added: 0013001 | |
2014-04-13 10:17 | silentwings | Note Added: 0013002 | |
2014-04-13 10:17 | FLOZi | Note Added: 0013003 | |
2014-04-13 10:26 | silentwings | Note Added: 0013004 | |
2014-04-13 10:28 | silentwings | Note Edited: 0013004 | View Revisions |
2014-04-13 10:31 | silentwings | Note Edited: 0013004 | View Revisions |
2014-04-13 13:25 | silentwings | Note Edited: 0013004 | View Revisions |
2014-04-13 14:22 | Kloot | Note Added: 0013005 | |
2014-04-13 14:26 | Kloot | Note Edited: 0013005 | View Revisions |
2014-04-13 14:46 | silentwings | Note Added: 0013006 | |
2014-04-13 14:46 | silentwings | File Added: patch.patch | |
2014-04-13 14:51 | silentwings | Note Edited: 0013006 | View Revisions |
2014-04-13 15:14 | Kloot | Note Added: 0013007 | |
2014-04-13 15:16 | Kloot | Note Edited: 0013007 | View Revisions |
2014-04-13 15:16 | Kloot | Note Edited: 0013007 | View Revisions |
2014-04-13 15:33 | silentwings | Note Added: 0013008 | |
2014-04-13 15:35 | silentwings | Note Edited: 0013008 | View Revisions |
2014-04-13 15:53 | silentwings | Note Edited: 0013008 | View Revisions |
2014-04-13 15:59 | cleanrock | Status | new => closed |
2014-04-13 15:59 | cleanrock | Resolution | open => no change required |