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

Fixup exceptions in playcontroller #191

Merged
merged 20 commits into from
Jun 8, 2014
Merged

Fixup exceptions in playcontroller #191

merged 20 commits into from
Jun 8, 2014

Commits on Jun 8, 2014

  1. add end_play_signal type and visitors

    This commit adds an "end_play_signal" type. It is meant to be used
    in play_controller classes to prevent crashes due to bad exception
    handling / collisions, and should help us to make assumptions more
    easily about when networking operations will happen
    
    It also adds some macros to avoid the proliferation of unreadable
    try catch blocks. It is expected that many of these can be
    expanded and simplified after the refactor.
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    67e7f4c View commit details
    Browse the repository at this point in the history
  2. push end_play exceptions down one level in playsingle_controller

    This uses the macros introduced to handle game end exceptions.
    It should be a strict refactor.
    
    Rebased to accomodate conflict here: 516206a
    Still a strict refactor.
    
    Note:
    If end_turn_exception propogates to the top of
    playsingle_controller, there is no handler beyond that and the
    program will terminate. If an end turn signal gets there, we
    also will terminate. This commit adds an assertion failure with
    a message clarifying what happened.
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    c11088c View commit details
    Browse the repository at this point in the history
  3. push end_play_exceptions one down in call stack, at "play_turn()"

    Continues trend of previous commit. play_turn becomes no throw
    with respect to these exceptions, and so we can switch calls to it
    to use the "PROPOGATE_END_PLAY_SIGNAL" instead of "HANDLE_...".
    
    It looks like by progressively doing this and unit testing at each
    step, we will be able to successfully convert all of the functions
    in play_controller to use PROPOGATE, which is a cheap if else and
    not an exception handler, and increase the stability of the engine
    by avoiding the use of exceptions for control flow. If we continue
    this way, we could push all the throws into the event handler
    and the replay module. Perhaps could continue from there, but
    likely at some point the exceptions might be the simpler solution
    esp. for breaking recursion in WML / lua or things like this.
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    b7c18c8 View commit details
    Browse the repository at this point in the history
  4. remove unnecessary handler macro from events::raise_draw_event

    After discussion on irc, it seems that this function doesn't
    throw end level or end turn exceptions, and some play testing
    suggests that removing the handler macros here is alright.
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    554af4b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cb9a84b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    570e0a4 View commit details
    Browse the repository at this point in the history
  7. remove handler from finish_side_done

    This function won't throw end level or end turn. game_event pump
    will not throw these, although the SDL event pump may throw them
    in response to keyboard / menu events.
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    7c20ca5 View commit details
    Browse the repository at this point in the history
  8. push end play exceptions out of replay controller top level

    This commit starts the process for replay_controller at the
    play_replay_level function.
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    22ee9bc View commit details
    Browse the repository at this point in the history
  9. push end play exceptions out of replay_controller::play_replay

    Returns a "possible_end_play_signal" now instead. This also
    required changes to the header in hotkey/command_executor. This
    seems pretty minor, and could perhaps be refactored later.
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    6eb71ad View commit details
    Browse the repository at this point in the history
  10. remove unnecessary pure virtual function definition

    This is overrided differently in playsingle, playmp, and replay
    controllers, and never is it called abstractly, which is what
    this virtual declaration would suggest.
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    fed87a9 View commit details
    Browse the repository at this point in the history
  11. push end play exceptions out of play_side()

    This changes both the playsingle and playmp implementations,
    but not the replay_controller implementation which is separate.
    
    ( squashed: fixup an oversight in replay_controller::play_side )
    cbeck88 committed Jun 8, 2014
    Configuration menu
    Copy the full SHA
    051b204 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    34d294e View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    ccbe0b5 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    08edc77 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    2034f06 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    de026e6 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    154f3db View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    13f5b27 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    29ad76c View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    5e0f420 View commit details
    Browse the repository at this point in the history