Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

1.149? DEV Lambda changes? [SOLVED in 1.150 DEV]

Discussion in 'Programming (In-game)' started by Wicorel, Aug 24, 2016.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Wicorel Senior Engineer

    Messages:
    1,243
    I'm getting errors on the (previously fine) lambda for local-blocks only.

    Code:
        GridTerminalSystem.GetBlocksOfType<IMyVirtualMass>(massList, (x => x.CubeGrid == Me.CubeGrid));
    
    Results in two errors:

    (71) Error: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
    (65) Error: Not all code paths return a value in lambda expression of type 'Func<IMyVirtualMass, bool>'

    What did I miss?
     
  2. Acolyte Apprentice Engineer

    Messages:
    109
    I just swapped the lambda for a sort function in my code... which was actually your code that I swiped from this forum so it should work for you too ;)

    I heard folks liked lambdas because they avoided the games resource limiting checks - if so, then Keen (rightly) was right to nerf then IMHO.
     
  3. Malware Master Engineer

    Messages:
    9,625
    @Wicorel @Acolyte Are you still getting this error ?!? I was told it was fixed... This is a recurring bug for something that I fixed some time ago. Btw lambdas don't avoid the limiting checks.
     
    Last edited: Aug 24, 2016
  4. Acolyte Apprentice Engineer

    Messages:
    109
    I started getting the error after the ModAPI update to the stable build last week.

    I only use the stable build to minimise the chances that my savegame gets corrupted.

    So any issues with fixes that occur in dev builds will only react with what I do after the delay that occurs before they get into the stable build.
     
  5. Malware Master Engineer

    Messages:
    9,625
    Ok, so to be clear, you're getting this error in stable, and not in development?
     
  6. Acolyte Apprentice Engineer

    Messages:
    109
    I got this bug in stable last week after the update.

    I never use the development build.
     
  7. Malware Master Engineer

    Messages:
    9,625
    Ok, I see. I will try to poke someone, then... be sure, this is a bug, not intentional - and the actual bugfix already exists. It "just" needs to be pushed to stable...
     
  8. JoeTheDestroyer Junior Engineer

    Messages:
    573
    It's in dev too, I had to fixup some of my code after last week's update.

    Workaround is like:
    Code:
    GridTerminalSystem.GetBlocksOfType<IMyVirtualMass>(massList, (x => { return x.CubeGrid == Me.CubeGrid; }));
    
     
  9. Malware Master Engineer

    Messages:
    9,625
  10. JoeTheDestroyer Junior Engineer

    Messages:
    573
    That's possible, I haven't done anything w/ the game since thursday evening. I'll double check when I get home...
     
  11. Malware Master Engineer

    Messages:
    9,625
    Apparently there was a hotfix a couple of hours ago... Damn, that's fast, I let them know about this problem this morning... :p
     
  12. Moodster3137 Trainee Engineer

    Messages:
    17
    And i can report the 'Hotfix' today has crashed the server i play on, were it wont even load without crashing, according to the admin.
     
  13. Malware Master Engineer

    Messages:
    9,625
    And you're telling me this because...?
     
  14. Wicorel Senior Engineer

    Messages:
    1,243
    @Malware Just verified still occurring in 1.149.002 DEV
     
  15. Malware Master Engineer

    Messages:
    9,625
    Wth; in DEV?!?! How the heck did they manage that one...
    --- Automerge ---
    :(( :(( :((
    You're right.

    Jeez.
     
  16. gothosan Junior Engineer

    Messages:
    723
    I'm worried, is that going to break my *still* incomplete OS script?
    I need lambda there for getting the blocks from the grid on which the script run...
     
  17. Malware Master Engineer

    Messages:
    9,625
    It's a bug. It will be fixed. It has been fixed. They just keep having merging issues or _something_...
     
  18. gothosan Junior Engineer

    Messages:
    723
    In other words, after being so close to finishing the rendering class I wrote and begin to test it the main script is broken and is likely take at least a week to fix :'(
     
  19. Malware Master Engineer

    Messages:
    9,625
    Or test it on stable
     
  20. Wicorel Senior Engineer

    Messages:
    1,243
    JoeTheDestroyer's code change makes it work (compile, at least).

    (x => { return x.CubeGrid == Me.CubeGrid; })
     
  21. Malware Master Engineer

    Messages:
    9,625
    You only need to get past the compile stage, yes.
     
  22. Wicorel Senior Engineer

    Messages:
    1,243
    Code:
    	gyros = l.ConvertAll(x => (IMyGyro) x);
    
    Also gets a compile error. (1.149.002 DEV)
    --- Automerge ---
    Should I put in a bug report? Or do you have this, Malware?
     
  23. Malware Master Engineer

    Messages:
    9,625
    Yes, that is a lambda as well and lambdas are broken.
    Report it anyway. Better safe than sorry. It seems... extremely strange to me... that it hasn't been reported already...
     
  24. Wicorel Senior Engineer

    Messages:
    1,243
  25. Lynnux Junior Engineer

    Messages:
    881
    Bug report was already there for some time because it occured first in 1.148 dev where it has been hotfixed:
    http://forums.keenswh.com/threads/1-149-in-game-programming-lambda-functions-broken-again.7386374/

    Now the bug made it back into 1.149 dev and 1.144 stable but was only hotfixed in 1.144.

    It's strange that you fixed it quickly in 1.148, answered on my call in 1.149... and forgot it ;-)

    But anyways it's better to have 100 bug reports for this than to wait another week for a fix (which was obviously forgotten in 1.149).
     
  26. JoeTheDestroyer Junior Engineer

    Messages:
    573
    Looks like I didn't need to confirm, but I made a little test snippet so I'll post it anyways:
    Code:
    public void Main(string argument) 
    {
      var l=new List<IMyTerminalBlock>();
      GridTerminalSystem.GetBlocksOfType<IMyShipDrill>(l);
      var drills=l.ConvertAll(x => x as IMyTerminalBlock); //Compile fails 1.149.2
    //  var drills=l.ConvertAll(x => { return x as IMyTerminalBlock; }); //Works
    }
    
     
  27. Malware Master Engineer

    Messages:
    9,625
    I didn't forget. I forwarded the info to the best of my ability. Remember, this isn't my job. I made them the fix because it was my bug in the first place, but making sure it stays in there, that's their own responsibility.
     
  28. Lynnux Junior Engineer

    Messages:
    881
    @Malware I know that you cannot fix and release their code. That's out of question. I've been wondering about your statement "it hasn't been reported already", though it was and you've been involved in that :) Sounded kinda funny to me, like a guy who needs some vacation :p
     
  29. Malware Master Engineer

    Messages:
    9,625
    I did mean other than this... by others... in the bug report thread :)
     
    Last edited: Aug 25, 2016
Thread Status:
This last post in this thread was made more than 31 days old.