[asterisk-dev] [Code Review] Adds barriers to the menuselect easter egg

jrose reviewboard at asterisk.org
Wed Nov 2 15:28:58 CDT 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1556/#review4637
-----------------------------------------------------------


I'm going to go ahead and point out that I do have a slight issue with the way we handled this, but that it's forgivable since that's how the game was already working... but basically, every time we want a type of blip to do something, we are iterating through every blip to perform those actions.  This is rather awkward, because this means that our performance takes a significant hit with each new object added.  Really, the various actions taken by objects in this game should have been handled more like this:

//main game loop
AST_LIST_TRAVERSE(...) { //traversing all the blips as 'cur' 
    switch(cur->type) {
        case BLIP_ALIEN:
            alien_action(cur);
            break;
        
        case BLIP_SHOT:
            shot_action(cur);
            break;
        //and then another case for each of the various object types that act every turn
    }
}

So yeah, you get the idea... we could basically just save a lot of iteration and only have to go through the list once.

Even better, we could maintain specific lists of individual object types and iterate through them individually, which would have been nice since there are a lot of times where we need to iterate through the objects, but we are really only looking for something like the aliens or the shots or the bombs or the barriers, but not all of them.  These are all just things to think about as optimization problems.  We are really doing a lot of unnecessary work here with the excessive nested list traversals.

- jrose


On Nov. 2, 2011, 1:26 p.m., jrose wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1556/
> -----------------------------------------------------------
> 
> (Updated Nov. 2, 2011, 1:26 p.m.)
> 
> 
> Review request for Asterisk Developers, David Vossel and jrose.
> 
> 
> Summary
> -------
> 
> Adds barriers to the cmenuselect easteregg.  They absorb shots, but fall apart quickly.  Also has support for different amounts of health on barriers, but this is currently set to one shot, one barrier killed.
> 
> Submitted by proxy for J'Len Dowdy.
> 
> 
> This addresses bug ASTERISK-18802.
>     https://issues.asterisk.org/jira/browse/ASTERISK-18802
> 
> 
> Diffs
> -----
> 
>   /trunk/menuselect_curses.c 953 
> 
> Diff: https://reviewboard.asterisk.org/r/1556/diff
> 
> 
> Testing
> -------
> 
> Played through the easteregg a number of times to make sure it didn't explode under normal use conditions.
> 
> 
> Thanks,
> 
> jrose
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111102/010df85b/attachment.htm>


More information about the asterisk-dev mailing list