summaryrefslogtreecommitdiff |
diff options
47 files changed, 171 insertions, 171 deletions
diff --git a/src/battle/src/Comm/CharacterTurn.elm b/src/battle/src/Comm/CharacterTurn.elm index 9fd77d1..a6d32d7 100644 --- a/src/battle/src/Comm/CharacterTurn.elm +++ b/src/battle/src/Comm/CharacterTurn.elm @@ -24,9 +24,9 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = - case (Struct.CharacterTurn.try_getting_active_character model.char_turn) of +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = + case (Struct.CharacterTurn.maybe_get_active_character model.char_turn) of (Just char) -> (Just (Json.Encode.object @@ -66,8 +66,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.character_turn_handler - try_encoding + maybe_encod ) diff --git a/src/battle/src/Comm/LoadBattle.elm b/src/battle/src/Comm/LoadBattle.elm index 9099f1e..4c20b36 100644 --- a/src/battle/src/Comm/LoadBattle.elm +++ b/src/battle/src/Comm/LoadBattle.elm @@ -22,8 +22,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = (Just (Json.Encode.object [ @@ -54,8 +54,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.map_loading_handler - try_encoding + maybe_encod ) diff --git a/src/battle/src/Comm/Send.elm b/src/battle/src/Comm/Send.elm index 009b57e..0971bc8 100644 --- a/src/battle/src/Comm/Send.elm +++ b/src/battle/src/Comm/Send.elm @@ -1,4 +1,4 @@ -module Comm.Send exposing (try_sending) +module Comm.Send exposing (maybe_send) -- Elm ------------------------------------------------------------------------- import Http @@ -73,14 +73,14 @@ decode = -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_sending : ( +maybe_send : ( Struct.Model.Type -> String -> (Struct.Model.Type -> (Maybe Json.Encode.Value)) -> (Maybe (Cmd Struct.Event.Type)) ) -try_sending model recipient try_encoding_fun = - case (try_encoding_fun model) of +maybe_send model recipient maybe_encod_fun = + case (maybe_encod_fun model) of (Just serial) -> (Just (Http.post diff --git a/src/battle/src/Struct/CharacterTurn.elm b/src/battle/src/Struct/CharacterTurn.elm index 825f29a..35c1720 100644 --- a/src/battle/src/Struct/CharacterTurn.elm +++ b/src/battle/src/Struct/CharacterTurn.elm @@ -8,7 +8,7 @@ module Struct.CharacterTurn exposing has_switched_weapons, get_path, get_state, - try_getting_target, + maybe_get_target, lock_path, unlock_path, show_attack_range_navigator, @@ -16,8 +16,8 @@ module Struct.CharacterTurn exposing set_active_character, set_active_character_no_reset, set_navigator, - try_getting_active_character, - try_getting_navigator, + maybe_get_active_character, + maybe_get_navigator, encode ) @@ -73,8 +73,8 @@ new = has_switched_weapons = False } -try_getting_active_character : Type -> (Maybe Struct.Character.Type) -try_getting_active_character ct = ct.active_character +maybe_get_active_character : Type -> (Maybe Struct.Character.Type) +maybe_get_active_character ct = ct.active_character can_select_target : Type -> Bool can_select_target ct = (ct.state == MovedCharacter) @@ -157,8 +157,8 @@ show_attack_range_navigator range_min range_max ct = ) } -try_getting_navigator : Type -> (Maybe Struct.Navigator.Type) -try_getting_navigator ct = ct.navigator +maybe_get_navigator : Type -> (Maybe Struct.Navigator.Type) +maybe_get_navigator ct = ct.navigator set_navigator : Struct.Navigator.Type -> Type -> Type set_navigator navigator ct = @@ -199,8 +199,8 @@ set_target target ct = target = target } -try_getting_target : Type -> (Maybe Int) -try_getting_target ct = ct.target +maybe_get_target : Type -> (Maybe Int) +maybe_get_target ct = ct.target encode : Type -> (Json.Encode.Value) encode ct = diff --git a/src/battle/src/Struct/MessageBoard.elm b/src/battle/src/Struct/MessageBoard.elm index 4c3ad1c..08d4c75 100644 --- a/src/battle/src/Struct/MessageBoard.elm +++ b/src/battle/src/Struct/MessageBoard.elm @@ -3,7 +3,7 @@ module Struct.MessageBoard exposing Type, Message(..), display, - try_getting_current_message, + maybe_get_current_message, clear_current_message, new, clear @@ -46,8 +46,8 @@ display message board = secondary_messages = (message :: board.secondary_messages) } -try_getting_current_message : Type -> (Maybe Message) -try_getting_current_message board = +maybe_get_current_message : Type -> (Maybe Message) +maybe_get_current_message board = case board.secondary_messages of [] -> board.main_message (secondary_message :: _) -> (Just secondary_message) diff --git a/src/battle/src/Struct/Navigator.elm b/src/battle/src/Struct/Navigator.elm index bfad3d2..072f682 100644 --- a/src/battle/src/Struct/Navigator.elm +++ b/src/battle/src/Struct/Navigator.elm @@ -13,8 +13,8 @@ module Struct.Navigator exposing lock_path, unlock_path, lock_path_with_new_attack_ranges, - try_adding_step, - try_getting_path_to + maybe_add_step, + maybe_get_path_to ) -- Elm ------------------------------------------------------------------------- @@ -190,18 +190,18 @@ lock_path_with_new_attack_ranges range_min range_max navigator = locked_path = True } -try_adding_step : ( +maybe_add_step : ( BattleMap.Struct.Direction.Type -> Type -> (Maybe Type) ) -try_adding_step dir navigator = +maybe_add_step dir navigator = if (navigator.locked_path) then Nothing else case - (Struct.Path.try_following_direction + (Struct.Path.maybe_follow_direction (navigator.tile_data_fun) (Just navigator.path) dir @@ -211,12 +211,12 @@ try_adding_step dir navigator = (Just {navigator | path = path}) Nothing -> Nothing -try_getting_path_to : ( +maybe_get_path_to : ( BattleMap.Struct.Location.Ref -> Type -> (Maybe (List BattleMap.Struct.Direction.Type)) ) -try_getting_path_to loc_ref navigator = +maybe_get_path_to loc_ref navigator = case (Dict.get loc_ref navigator.range_indicators) of (Just target) -> (Just (Struct.RangeIndicator.get_path target)) diff --git a/src/battle/src/Struct/Path.elm b/src/battle/src/Struct/Path.elm index 0ae3bdf..c288103 100644 --- a/src/battle/src/Struct/Path.elm +++ b/src/battle/src/Struct/Path.elm @@ -5,7 +5,7 @@ module Struct.Path exposing get_current_location, get_remaining_points, get_summary, - try_following_direction + maybe_follow_direction ) -- Elm ------------------------------------------------------------------------- @@ -51,14 +51,14 @@ has_been_to path location = ) ) -try_moving_to : ( +maybe_mov_to : ( Type -> BattleMap.Struct.Direction.Type -> BattleMap.Struct.Location.Type -> Int -> (Maybe Type) ) -try_moving_to path dir next_loc cost = +maybe_mov_to path dir next_loc cost = let remaining_points = (path.remaining_points - cost) in @@ -81,13 +81,13 @@ try_moving_to path dir next_loc cost = else Nothing -try_backtracking_to : ( +maybe_backtrack_to : ( Type -> BattleMap.Struct.Direction.Type -> BattleMap.Struct.Location.Type -> (Maybe Type) ) -try_backtracking_to path dir location = +maybe_backtrack_to path dir location = case ( (Util.List.pop path.previous_directions), @@ -144,13 +144,13 @@ get_remaining_points path = path.remaining_points get_summary : Type -> (List BattleMap.Struct.Direction.Type) get_summary path = path.previous_directions -try_following_direction : ( +maybe_follow_direction : ( (BattleMap.Struct.Location.Type -> (Int, Int)) -> (Maybe Type) -> BattleMap.Struct.Direction.Type -> (Maybe Type) ) -try_following_direction tile_data_fun maybe_path dir = +maybe_follow_direction tile_data_fun maybe_path dir = case maybe_path of (Just path) -> let @@ -166,9 +166,9 @@ try_following_direction tile_data_fun maybe_path dir = then if (has_been_to path next_location) then - (try_backtracking_to path dir next_location) + (maybe_backtrack_to path dir next_location) else - (try_moving_to + (maybe_mov_to path dir next_location diff --git a/src/battle/src/Struct/Puppeteer.elm b/src/battle/src/Struct/Puppeteer.elm index c68f10d..76447b2 100644 --- a/src/battle/src/Struct/Puppeteer.elm +++ b/src/battle/src/Struct/Puppeteer.elm @@ -9,7 +9,7 @@ module Struct.Puppeteer exposing step, get_is_playing_forward, set_is_playing_forward, - try_getting_current_action + maybe_get_current_action ) -- Elm ------------------------------------------------------------------------- @@ -93,8 +93,8 @@ get_is_playing_forward puppeteer = puppeteer.is_playing_forward set_is_playing_forward : Bool -> Type -> Type set_is_playing_forward val puppeteer = {puppeteer | is_playing_forward = val} -try_getting_current_action : Type -> (Maybe (Struct.PuppeteerAction.Type)) -try_getting_current_action puppeteer = +maybe_get_current_action : Type -> (Maybe (Struct.PuppeteerAction.Type)) +maybe_get_current_action puppeteer = if (puppeteer.is_playing_forward) then (List.head puppeteer.forward_actions) else (List.head puppeteer.backward_actions) diff --git a/src/battle/src/Struct/UI.elm b/src/battle/src/Struct/UI.elm index ddb92ca..e1881ed 100644 --- a/src/battle/src/Struct/UI.elm +++ b/src/battle/src/Struct/UI.elm @@ -9,13 +9,13 @@ module Struct.UI exposing reset_zoom_level, mod_zoom_level, -- Tab - try_getting_displayed_tab, + maybe_get_displayed_tab, set_displayed_tab, reset_displayed_tab, to_string, get_all_tabs, -- Navigator - try_getting_displayed_nav, + maybe_get_displayed_nav, set_displayed_nav, reset_displayed_nav, -- Manual Controls @@ -83,8 +83,8 @@ mod_zoom_level : Float -> Type -> Type mod_zoom_level mod ui = {ui | zoom_level = (mod * ui.zoom_level)} -- Tab ------------------------------------------------------------------------- -try_getting_displayed_tab : Type -> (Maybe Tab) -try_getting_displayed_tab ui = ui.displayed_tab +maybe_get_displayed_tab : Type -> (Maybe Tab) +maybe_get_displayed_tab ui = ui.displayed_tab set_displayed_tab : Tab -> Type -> Type set_displayed_tab tab ui = {ui | displayed_tab = (Just tab)} @@ -105,8 +105,8 @@ get_all_tabs = [StatusTab, CharactersTab, SettingsTab, TimelineTab] -- Navigator ------------------------------------------------------------------- -try_getting_displayed_nav : Type -> (Maybe Struct.Navigator.Type) -try_getting_displayed_nav ui = ui.displayed_nav +maybe_get_displayed_nav : Type -> (Maybe Struct.Navigator.Type) +maybe_get_displayed_nav ui = ui.displayed_nav set_displayed_nav : Struct.Navigator.Type -> Type -> Type set_displayed_nav nav ui = {ui | displayed_nav = (Just nav)} diff --git a/src/battle/src/Update/EndTurn.elm b/src/battle/src/Update/EndTurn.elm index 56231a8..5cafc48 100644 --- a/src/battle/src/Update/EndTurn.elm +++ b/src/battle/src/Update/EndTurn.elm @@ -53,10 +53,10 @@ apply_to model = case ( (Struct.CharacterTurn.get_state model.char_turn), - (Struct.CharacterTurn.try_getting_active_character + (Struct.CharacterTurn.maybe_get_active_character model.char_turn ), - (Struct.CharacterTurn.try_getting_navigator model.char_turn) + (Struct.CharacterTurn.maybe_get_navigator model.char_turn) ) of ( diff --git a/src/battle/src/Update/Puppeteer.elm b/src/battle/src/Update/Puppeteer.elm index 76aa1f9..206b411 100644 --- a/src/battle/src/Update/Puppeteer.elm +++ b/src/battle/src/Update/Puppeteer.elm @@ -121,7 +121,7 @@ apply_to : ( (Struct.Model.Type, (Cmd Struct.Event.Type)) ) apply_to model = - case (Struct.Puppeteer.try_getting_current_action model.puppeteer) of + case (Struct.Puppeteer.maybe_get_current_action model.puppeteer) of Nothing -> (model, (Cmd.none)) (Just action) -> case action of diff --git a/src/battle/src/Update/RequestDirection.elm b/src/battle/src/Update/RequestDirection.elm index fc7b63b..828f78f 100644 --- a/src/battle/src/Update/RequestDirection.elm +++ b/src/battle/src/Update/RequestDirection.elm @@ -26,7 +26,7 @@ make_it_so : ( Struct.Model.Type ) make_it_so model char navigator dir = - case (Struct.Navigator.try_adding_step dir navigator) of + case (Struct.Navigator.maybe_add_step dir navigator) of (Just new_navigator) -> {model | char_turn = @@ -75,8 +75,8 @@ apply_to : ( apply_to model dir = case ( - (Struct.CharacterTurn.try_getting_navigator model.char_turn), - (Struct.CharacterTurn.try_getting_active_character model.char_turn) + (Struct.CharacterTurn.maybe_get_navigator model.char_turn), + (Struct.CharacterTurn.maybe_get_active_character model.char_turn) ) of ((Just navigator), (Just char)) -> diff --git a/src/battle/src/Update/SelectCharacter.elm b/src/battle/src/Update/SelectCharacter.elm index c18bb35..57e1317 100644 --- a/src/battle/src/Update/SelectCharacter.elm +++ b/src/battle/src/Update/SelectCharacter.elm @@ -91,7 +91,7 @@ ctrl_or_focus_character model target_char_id target_char = then let nav = - (case (Struct.UI.try_getting_displayed_nav model.ui) of + (case (Struct.UI.maybe_get_displayed_nav model.ui) of (Just dnav) -> dnav Nothing -> (get_character_navigator model.battle target_char) @@ -137,13 +137,13 @@ can_target_character model target = && ( case - (Struct.CharacterTurn.try_getting_navigator + (Struct.CharacterTurn.maybe_get_navigator model.char_turn ) of (Just nav) -> case - (Struct.Navigator.try_getting_path_to + (Struct.Navigator.maybe_get_path_to (BattleMap.Struct.Location.get_ref (Struct.Character.get_location target) ) @@ -168,10 +168,10 @@ second_click_on model target_char_id = (Just target_char) -> case ( - (Struct.CharacterTurn.try_getting_active_character + (Struct.CharacterTurn.maybe_get_active_character model.char_turn ), - (Struct.CharacterTurn.try_getting_target model.char_turn) + (Struct.CharacterTurn.maybe_get_target model.char_turn) ) of ((Just _), (Just char_turn_target_id)) -> @@ -248,7 +248,7 @@ first_click_on : ( first_click_on model target_char_id = if ( - (Struct.CharacterTurn.try_getting_target model.char_turn) + (Struct.CharacterTurn.maybe_get_target model.char_turn) == (Just target_char_id) ) diff --git a/src/battle/src/Update/SelectTab.elm b/src/battle/src/Update/SelectTab.elm index 2a41303..86ef4e7 100644 --- a/src/battle/src/Update/SelectTab.elm +++ b/src/battle/src/Update/SelectTab.elm @@ -18,7 +18,7 @@ apply_to : ( (Struct.Model.Type, (Cmd Struct.Event.Type)) ) apply_to model tab = - if ((Struct.UI.try_getting_displayed_tab model.ui) == (Just tab)) + if ((Struct.UI.maybe_get_displayed_tab model.ui) == (Just tab)) then ( {model | ui = (Struct.UI.reset_displayed_tab model.ui)}, diff --git a/src/battle/src/Update/SelectTile.elm b/src/battle/src/Update/SelectTile.elm index 4eb772a..529e956 100644 --- a/src/battle/src/Update/SelectTile.elm +++ b/src/battle/src/Update/SelectTile.elm @@ -19,15 +19,15 @@ import Struct.UI -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_autopiloting : ( +maybe_autopilot : ( BattleMap.Struct.Direction.Type -> (Maybe Struct.Navigator.Type) -> (Maybe Struct.Navigator.Type) ) -try_autopiloting dir maybe_navigator = +maybe_autopilot dir maybe_navigator = case maybe_navigator of (Just navigator) -> - (Struct.Navigator.try_adding_step dir navigator) + (Struct.Navigator.maybe_add_step dir navigator) Nothing -> Nothing @@ -77,11 +77,11 @@ go_to_another_tile : ( (Struct.Model.Type, (Cmd Struct.Event.Type)) ) go_to_another_tile model char navigator loc_ref = - case (Struct.Navigator.try_getting_path_to loc_ref navigator) of + case (Struct.Navigator.maybe_get_path_to loc_ref navigator) of (Just path) -> case (List.foldr - (try_autopiloting) + (maybe_autopilot) (Just (Struct.Navigator.clear_path navigator)) path ) @@ -165,8 +165,8 @@ apply_to : ( apply_to model loc_ref = case ( - (Struct.CharacterTurn.try_getting_navigator model.char_turn), - (Struct.CharacterTurn.try_getting_active_character model.char_turn) + (Struct.CharacterTurn.maybe_get_navigator model.char_turn), + (Struct.CharacterTurn.maybe_get_active_character model.char_turn) ) of ((Just navigator), (Just char)) -> diff --git a/src/battle/src/Update/SwitchWeapon.elm b/src/battle/src/Update/SwitchWeapon.elm index 06d3472..0b4816f 100644 --- a/src/battle/src/Update/SwitchWeapon.elm +++ b/src/battle/src/Update/SwitchWeapon.elm @@ -18,8 +18,8 @@ make_it_so : Struct.Model.Type -> Struct.Model.Type make_it_so model = case ( - (Struct.CharacterTurn.try_getting_active_character model.char_turn), - (Struct.CharacterTurn.try_getting_navigator model.char_turn) + (Struct.CharacterTurn.maybe_get_active_character model.char_turn), + (Struct.CharacterTurn.maybe_get_navigator model.char_turn) ) of ((Just char), (Just nav)) -> diff --git a/src/battle/src/Update/UndoAction.elm b/src/battle/src/Update/UndoAction.elm index 3941535..1a53adb 100644 --- a/src/battle/src/Update/UndoAction.elm +++ b/src/battle/src/Update/UndoAction.elm @@ -53,7 +53,7 @@ get_character_navigator battle char = handle_reset_character_turn : Struct.Model.Type -> Struct.CharacterTurn.Type handle_reset_character_turn model = - case (Struct.CharacterTurn.try_getting_active_character model.char_turn) of + case (Struct.CharacterTurn.maybe_get_active_character model.char_turn) of Nothing -> model.char_turn (Just current_char) -> @@ -76,7 +76,7 @@ handle_reset_character_turn model = handle_undo_switched_weapons : Struct.Model.Type -> Struct.CharacterTurn.Type handle_undo_switched_weapons model = - case (Struct.CharacterTurn.try_getting_active_character model.char_turn) of + case (Struct.CharacterTurn.maybe_get_active_character model.char_turn) of Nothing -> model.char_turn (Just char) -> diff --git a/src/battle/src/View/Controlled.elm b/src/battle/src/View/Controlled.elm index 003ec34..fe730fb 100644 --- a/src/battle/src/View/Controlled.elm +++ b/src/battle/src/View/Controlled.elm @@ -21,7 +21,7 @@ import View.Controlled.ManualControls -------------------------------------------------------------------------------- has_a_path : Struct.CharacterTurn.Type -> Bool has_a_path char_turn = - case (Struct.CharacterTurn.try_getting_navigator char_turn) of + case (Struct.CharacterTurn.maybe_get_navigator char_turn) of (Just nav) -> ((Struct.Navigator.get_path nav) /= []) Nothing -> False @@ -126,7 +126,7 @@ get_available_actions char_turn = get_html : Struct.CharacterTurn.Type -> Int -> (Html.Html Struct.Event.Type) get_html char_turn player_ix = case - (Struct.CharacterTurn.try_getting_active_character char_turn) + (Struct.CharacterTurn.maybe_get_active_character char_turn) of (Just char) -> (Html.div diff --git a/src/battle/src/View/Controlled/CharacterCard.elm b/src/battle/src/View/Controlled/CharacterCard.elm index 0d7eda1..2fea74c 100644 --- a/src/battle/src/View/Controlled/CharacterCard.elm +++ b/src/battle/src/View/Controlled/CharacterCard.elm @@ -207,7 +207,7 @@ get_movement_bar : ( (Html.Html Struct.Event.Type) ) get_movement_bar char_turn char = - case (Struct.CharacterTurn.try_getting_active_character char_turn) of + case (Struct.CharacterTurn.maybe_get_active_character char_turn) of (Just active_char) -> if ( @@ -217,7 +217,7 @@ get_movement_bar char_turn char = ) then (get_active_movement_bar - (Struct.CharacterTurn.try_getting_navigator char_turn) + (Struct.CharacterTurn.maybe_get_navigator char_turn) active_char ) else diff --git a/src/battle/src/View/MessageBoard.elm b/src/battle/src/View/MessageBoard.elm index 8a47b40..aebda2a 100644 --- a/src/battle/src/View/MessageBoard.elm +++ b/src/battle/src/View/MessageBoard.elm @@ -35,6 +35,6 @@ display model message = -------------------------------------------------------------------------------- get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) get_html model = - case (Struct.MessageBoard.try_getting_current_message model.message_board) of + case (Struct.MessageBoard.maybe_get_current_message model.message_board) of Nothing -> (Util.Html.nothing) (Just message) -> (display model message) diff --git a/src/battle/src/View/SubMenu.elm b/src/battle/src/View/SubMenu.elm index dea0a86..5cb1b84 100644 --- a/src/battle/src/View/SubMenu.elm +++ b/src/battle/src/View/SubMenu.elm @@ -54,7 +54,7 @@ get_inner_html model tab = -------------------------------------------------------------------------------- get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) get_html model = - case (Struct.UI.try_getting_displayed_tab model.ui) of + case (Struct.UI.maybe_get_displayed_tab model.ui) of (Just tab) -> (Html.div [(Html.Attributes.class "sub-menu")] @@ -62,7 +62,7 @@ get_html model = ) Nothing -> - case (Struct.CharacterTurn.try_getting_target model.char_turn) of + case (Struct.CharacterTurn.maybe_get_target model.char_turn) of (Just char_ref) -> case (Array.get char_ref model.characters) of (Just char) -> diff --git a/src/login/src/Comm/Send.elm b/src/login/src/Comm/Send.elm index 91b4177..22a4480 100644 --- a/src/login/src/Comm/Send.elm +++ b/src/login/src/Comm/Send.elm @@ -1,4 +1,4 @@ -module Comm.Send exposing (try_sending) +module Comm.Send exposing (maybe_send) -- Elm ------------------------------------------------------------------------- import Http @@ -43,14 +43,14 @@ decode = -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_sending : ( +maybe_send : ( Struct.Model.Type -> String -> (Struct.Model.Type -> (Maybe Json.Encode.Value)) -> (Maybe (Cmd Struct.Event.Type)) ) -try_sending model recipient try_encoding_fun = - case (try_encoding_fun model) of +maybe_send model recipient maybe_encod_fun = + case (maybe_encod_fun model) of (Just serial) -> (Just (Http.post diff --git a/src/login/src/Comm/SendRecovery.elm b/src/login/src/Comm/SendRecovery.elm index e9fd3a9..31b89f3 100644 --- a/src/login/src/Comm/SendRecovery.elm +++ b/src/login/src/Comm/SendRecovery.elm @@ -18,8 +18,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = (Just (Json.Encode.object [ @@ -33,8 +33,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.login_recovery_handler - try_encoding + maybe_encod ) diff --git a/src/login/src/Comm/SendSignIn.elm b/src/login/src/Comm/SendSignIn.elm index 723b8d3..4923751 100644 --- a/src/login/src/Comm/SendSignIn.elm +++ b/src/login/src/Comm/SendSignIn.elm @@ -18,8 +18,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = (Just (Json.Encode.object [ @@ -34,8 +34,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.login_sign_in_handler - try_encoding + maybe_encod ) diff --git a/src/login/src/Comm/SendSignUp.elm b/src/login/src/Comm/SendSignUp.elm index 546416c..cefa0fe 100644 --- a/src/login/src/Comm/SendSignUp.elm +++ b/src/login/src/Comm/SendSignUp.elm @@ -18,8 +18,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = (Just (Json.Encode.object [ @@ -35,8 +35,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.login_sign_up_handler - try_encoding + maybe_encod ) diff --git a/src/login/src/ElmModule/View.elm b/src/login/src/ElmModule/View.elm index f8c0d8c..f6c5c93 100644 --- a/src/login/src/ElmModule/View.elm +++ b/src/login/src/ElmModule/View.elm @@ -38,10 +38,10 @@ view model = ] [ (View.MainMenu.get_html - (Struct.UI.try_getting_displayed_tab model.ui) + (Struct.UI.maybe_get_displayed_tab model.ui) ), ( - case (Struct.UI.try_getting_displayed_tab model.ui) of + case (Struct.UI.maybe_get_displayed_tab model.ui) of (Just Struct.UI.SignInTab) -> (View.SignIn.get_html model) (Just Struct.UI.SignUpTab) -> (View.SignUp.get_html model) (Just Struct.UI.RecoveryTab) -> diff --git a/src/login/src/Struct/UI.elm b/src/login/src/Struct/UI.elm index be7eab3..4cb898d 100644 --- a/src/login/src/Struct/UI.elm +++ b/src/login/src/Struct/UI.elm @@ -4,7 +4,7 @@ module Struct.UI exposing Tab(..), default, -- Tab - try_getting_displayed_tab, + maybe_get_displayed_tab, set_displayed_tab, reset_displayed_tab, to_string, @@ -43,8 +43,8 @@ default = } -- Tab ------------------------------------------------------------------------- -try_getting_displayed_tab : Type -> (Maybe Tab) -try_getting_displayed_tab ui = ui.displayed_tab +maybe_get_displayed_tab : Type -> (Maybe Tab) +maybe_get_displayed_tab ui = ui.displayed_tab set_displayed_tab : Tab -> Type -> Type set_displayed_tab tab ui = {ui | displayed_tab = (Just tab)} diff --git a/src/login/src/Update/SelectTab.elm b/src/login/src/Update/SelectTab.elm index d15a463..71e59d3 100644 --- a/src/login/src/Update/SelectTab.elm +++ b/src/login/src/Update/SelectTab.elm @@ -19,7 +19,7 @@ apply_to : ( (Struct.Model.Type, (Cmd Struct.Event.Type)) ) apply_to model tab = - if ((Struct.UI.try_getting_displayed_tab model.ui) == (Just tab)) + if ((Struct.UI.maybe_get_displayed_tab model.ui) == (Just tab)) then ( {model | ui = (Struct.UI.reset_displayed_tab model.ui)}, diff --git a/src/main-menu/src/Comm/LoadPlayer.elm b/src/main-menu/src/Comm/LoadPlayer.elm index f93ed25..ce17b8c 100644 --- a/src/main-menu/src/Comm/LoadPlayer.elm +++ b/src/main-menu/src/Comm/LoadPlayer.elm @@ -18,8 +18,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = let player_id = (Json.Encode.string model.player_id) in @@ -38,8 +38,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.player_loading_handler - try_encoding + maybe_encod ) diff --git a/src/main-menu/src/Comm/Send.elm b/src/main-menu/src/Comm/Send.elm index 531a848..d4e36c9 100644 --- a/src/main-menu/src/Comm/Send.elm +++ b/src/main-menu/src/Comm/Send.elm @@ -1,4 +1,4 @@ -module Comm.Send exposing (try_sending) +module Comm.Send exposing (maybe_send) -- Elm ------------------------------------------------------------------------- import Http @@ -44,14 +44,14 @@ decode = -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_sending : ( +maybe_send : ( Struct.Model.Type -> String -> (Struct.Model.Type -> (Maybe Json.Encode.Value)) -> (Maybe (Cmd Struct.Event.Type)) ) -try_sending model recipient try_encoding_fun = - case (try_encoding_fun model) of +maybe_send model recipient maybe_encod_fun = + case (maybe_encod_fun model) of (Just serial) -> (Just (Http.post diff --git a/src/map-editor/src/Comm/LoadMap.elm b/src/map-editor/src/Comm/LoadMap.elm index fb6e597..7eb92c8 100644 --- a/src/map-editor/src/Comm/LoadMap.elm +++ b/src/map-editor/src/Comm/LoadMap.elm @@ -21,8 +21,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = (Just (Json.Encode.object [ @@ -46,8 +46,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.map_loading_handler - try_encoding + maybe_encod ) diff --git a/src/map-editor/src/Comm/Send.elm b/src/map-editor/src/Comm/Send.elm index 69e977d..1b4c9d9 100644 --- a/src/map-editor/src/Comm/Send.elm +++ b/src/map-editor/src/Comm/Send.elm @@ -1,4 +1,4 @@ -module Comm.Send exposing (try_sending, empty_request) +module Comm.Send exposing (maybe_send, empty_request) -- Elm ------------------------------------------------------------------------- import Http @@ -56,14 +56,14 @@ decode = -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_sending : ( +maybe_send : ( Struct.Model.Type -> String -> (Struct.Model.Type -> (Maybe Json.Encode.Value)) -> (Maybe (Cmd Struct.Event.Type)) ) -try_sending model recipient try_encoding_fun = - case (try_encoding_fun model) of +maybe_send model recipient maybe_encod_fun = + case (maybe_encod_fun model) of (Just serial) -> (Just (Http.post diff --git a/src/map-editor/src/Comm/SendMapUpdate.elm b/src/map-editor/src/Comm/SendMapUpdate.elm index d7c149d..0dc65da 100644 --- a/src/map-editor/src/Comm/SendMapUpdate.elm +++ b/src/map-editor/src/Comm/SendMapUpdate.elm @@ -65,7 +65,7 @@ encode_map model = try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.map_update_handler encode_map diff --git a/src/map-editor/src/Struct/Toolbox.elm b/src/map-editor/src/Struct/Toolbox.elm index fcd3b58..3cec795 100644 --- a/src/map-editor/src/Struct/Toolbox.elm +++ b/src/map-editor/src/Struct/Toolbox.elm @@ -145,7 +145,7 @@ get_filled_tiles : ( (List BattleMap.Struct.Location.Type) ) get_filled_tiles selection map loc = - case (BattleMap.Struct.Map.try_getting_tile_at loc map) of + case (BattleMap.Struct.Map.maybe_get_tile_at loc map) of Nothing -> [] (Just target) -> let @@ -153,7 +153,7 @@ get_filled_tiles selection map loc = (BattleMap.Struct.TileInstance.get_class_id target) map_match_fun = (\e -> - (case (BattleMap.Struct.Map.try_getting_tile_at e map) of + (case (BattleMap.Struct.Map.maybe_get_tile_at e map) of Nothing -> False (Just t) -> ( diff --git a/src/map-editor/src/Struct/UI.elm b/src/map-editor/src/Struct/UI.elm index f295e19..4d20171 100644 --- a/src/map-editor/src/Struct/UI.elm +++ b/src/map-editor/src/Struct/UI.elm @@ -9,7 +9,7 @@ module Struct.UI exposing reset_zoom_level, mod_zoom_level, -- Tab - try_getting_displayed_tab, + maybe_get_displayed_tab, set_displayed_tab, reset_displayed_tab, to_string, @@ -73,8 +73,8 @@ mod_zoom_level : Float -> Type -> Type mod_zoom_level mod ui = {ui | zoom_level = (mod * ui.zoom_level)} -- Tab ------------------------------------------------------------------------- -try_getting_displayed_tab : Type -> (Maybe Tab) -try_getting_displayed_tab ui = ui.displayed_tab +maybe_get_displayed_tab : Type -> (Maybe Tab) +maybe_get_displayed_tab ui = ui.displayed_tab set_displayed_tab : Tab -> Type -> Type set_displayed_tab tab ui = {ui | displayed_tab = (Just tab)} diff --git a/src/map-editor/src/Update/PrettifySelectedTiles.elm b/src/map-editor/src/Update/PrettifySelectedTiles.elm index a55eb67..c844ae2 100644 --- a/src/map-editor/src/Update/PrettifySelectedTiles.elm +++ b/src/map-editor/src/Update/PrettifySelectedTiles.elm @@ -31,7 +31,7 @@ neighborhood_tile_instances : ( neighborhood_tile_instances loc map = (List.map (\e -> - case (BattleMap.Struct.Map.try_getting_tile_at e map) of + case (BattleMap.Struct.Map.maybe_get_tile_at e map) of Nothing -> (BattleMap.Struct.TileInstance.error -1 -1) (Just t) -> t ) @@ -106,7 +106,7 @@ apply_to_location : ( BattleMap.Struct.Map.Type ) apply_to_location model loc map = - case (BattleMap.Struct.Map.try_getting_tile_at loc map) of + case (BattleMap.Struct.Map.maybe_get_tile_at loc map) of Nothing -> map (Just base) -> let diff --git a/src/map-editor/src/Update/SelectTab.elm b/src/map-editor/src/Update/SelectTab.elm index 2a41303..86ef4e7 100644 --- a/src/map-editor/src/Update/SelectTab.elm +++ b/src/map-editor/src/Update/SelectTab.elm @@ -18,7 +18,7 @@ apply_to : ( (Struct.Model.Type, (Cmd Struct.Event.Type)) ) apply_to model tab = - if ((Struct.UI.try_getting_displayed_tab model.ui) == (Just tab)) + if ((Struct.UI.maybe_get_displayed_tab model.ui) == (Just tab)) then ( {model | ui = (Struct.UI.reset_displayed_tab model.ui)}, diff --git a/src/map-editor/src/View/SubMenu.elm b/src/map-editor/src/View/SubMenu.elm index 7547e17..8717ac0 100644 --- a/src/map-editor/src/View/SubMenu.elm +++ b/src/map-editor/src/View/SubMenu.elm @@ -44,7 +44,7 @@ get_inner_html model tab = -------------------------------------------------------------------------------- get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) get_html model = - case (Struct.UI.try_getting_displayed_tab model.ui) of + case (Struct.UI.maybe_get_displayed_tab model.ui) of (Just tab) -> (Html.div [(Html.Attributes.class "sub-menu")] diff --git a/src/map-editor/src/View/SubMenu/TileStatus.elm b/src/map-editor/src/View/SubMenu/TileStatus.elm index eb61a2f..bc677f3 100644 --- a/src/map-editor/src/View/SubMenu/TileStatus.elm +++ b/src/map-editor/src/View/SubMenu/TileStatus.elm @@ -127,7 +127,7 @@ get_tile_info_html : ( (Html.Html Struct.Event.Type) ) get_tile_info_html model loc = - case (BattleMap.Struct.Map.try_getting_tile_at loc model.map) of + case (BattleMap.Struct.Map.maybe_get_tile_at loc model.map) of (Just tile) -> (Html.div [ diff --git a/src/roster-editor/src/Comm/JoinBattle.elm b/src/roster-editor/src/Comm/JoinBattle.elm index 90978a9..90dc0c4 100644 --- a/src/roster-editor/src/Comm/JoinBattle.elm +++ b/src/roster-editor/src/Comm/JoinBattle.elm @@ -23,8 +23,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = (Just (Json.Encode.object [ @@ -95,8 +95,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.join_battle_handler - try_encoding + maybe_encod ) diff --git a/src/roster-editor/src/Comm/LoadRoster.elm b/src/roster-editor/src/Comm/LoadRoster.elm index 062caf2..0327806 100644 --- a/src/roster-editor/src/Comm/LoadRoster.elm +++ b/src/roster-editor/src/Comm/LoadRoster.elm @@ -21,8 +21,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = (Just (Json.Encode.object [ @@ -46,8 +46,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.roster_loading_handler - try_encoding + maybe_encod ) diff --git a/src/roster-editor/src/Comm/Send.elm b/src/roster-editor/src/Comm/Send.elm index f6e9847..f0d6387 100644 --- a/src/roster-editor/src/Comm/Send.elm +++ b/src/roster-editor/src/Comm/Send.elm @@ -1,4 +1,4 @@ -module Comm.Send exposing (try_sending, empty_request) +module Comm.Send exposing (maybe_send, empty_request) -- Elm ------------------------------------------------------------------------- import Http @@ -60,14 +60,14 @@ decode = -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_sending : ( +maybe_send : ( Struct.Model.Type -> String -> (Struct.Model.Type -> (Maybe Json.Encode.Value)) -> (Maybe (Cmd Struct.Event.Type)) ) -try_sending model recipient try_encoding_fun = - case (try_encoding_fun model) of +maybe_send model recipient maybe_encod_fun = + case (maybe_encod_fun model) of (Just serial) -> (Just (Http.post diff --git a/src/roster-editor/src/Comm/UpdateRoster.elm b/src/roster-editor/src/Comm/UpdateRoster.elm index a635359..4e3ee54 100644 --- a/src/roster-editor/src/Comm/UpdateRoster.elm +++ b/src/roster-editor/src/Comm/UpdateRoster.elm @@ -26,8 +26,8 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -try_encoding : Struct.Model.Type -> (Maybe Json.Encode.Value) -try_encoding model = +maybe_encode : Struct.Model.Type -> (Maybe Json.Encode.Value) +maybe_encode model = (Just (Json.Encode.object [ @@ -63,8 +63,8 @@ try_encoding model = -------------------------------------------------------------------------------- try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) try model = - (Comm.Send.try_sending + (Comm.Send.maybe_send model Constants.IO.roster_update_handler - try_encoding + maybe_encod ) diff --git a/src/roster-editor/src/View/CharacterIcon.elm b/src/roster-editor/src/View/CharacterIcon.elm index bd91d83..52b569c 100644 --- a/src/roster-editor/src/View/CharacterIcon.elm +++ b/src/roster-editor/src/View/CharacterIcon.elm @@ -115,7 +115,7 @@ get_focus_class model char = else if ( - (Struct.CharacterTurn.try_getting_target model.char_turn) + (Struct.CharacterTurn.maybe_get_target model.char_turn) == (Just (Struct.Character.get_index char)) ) diff --git a/src/shared/battle-map/BattleMap/Struct/Map.elm b/src/shared/battle-map/BattleMap/Struct/Map.elm index cb0143e..cbab5b2 100644 --- a/src/shared/battle-map/BattleMap/Struct/Map.elm +++ b/src/shared/battle-map/BattleMap/Struct/Map.elm @@ -15,7 +15,7 @@ module BattleMap.Struct.Map exposing new, set_tile_to, solve_tiles, - try_getting_tile_at + maybe_get_tile_at ) -- Elm ------------------------------------------------------------------------- @@ -159,12 +159,12 @@ new width height tiles = markers = (Dict.empty) } -try_getting_tile_at : ( +maybe_get_tile_at : ( BattleMap.Struct.Location.Type -> Type -> (Maybe BattleMap.Struct.TileInstance.Type) ) -try_getting_tile_at loc map = +maybe_get_tile_at loc map = if (has_location loc map) then (Array.get (location_to_index loc map) map.content) else Nothing @@ -185,7 +185,7 @@ get_omnimods_at : ( Battle.Struct.Omnimods.Type ) get_omnimods_at loc dataset map = - case (try_getting_tile_at loc map) of + case (maybe_get_tile_at loc map) of Nothing -> (Battle.Struct.Omnimods.none) (Just tile_inst) -> (BattleMap.Struct.Tile.get_omnimods diff --git a/src/shared/battle-map/BattleMap/View/TileInfo.elm b/src/shared/battle-map/BattleMap/View/TileInfo.elm index 0dc57ff..3067bcb 100644 --- a/src/shared/battle-map/BattleMap/View/TileInfo.elm +++ b/src/shared/battle-map/BattleMap/View/TileInfo.elm @@ -121,7 +121,7 @@ get_html : ( ) get_html dataset loc_ref map = let loc = (BattleMap.Struct.Location.from_ref loc_ref) in - case (BattleMap.Struct.Map.try_getting_tile_at loc map) of + case (BattleMap.Struct.Map.maybe_get_tile_at loc map) of (Just tile_instance) -> let tile_data = diff --git a/src/shared/elm/Struct/Flags.elm b/src/shared/elm/Struct/Flags.elm index a9f1630..475d1f2 100644 --- a/src/shared/elm/Struct/Flags.elm +++ b/src/shared/elm/Struct/Flags.elm @@ -1,9 +1,9 @@ module Struct.Flags exposing ( Type, - maybe_get_param, - force_get_param, - get_params_as_url, + maybe_get_parameter, + force_get_parameter, + get_parameters_as_url, get_session_token, get_user_id ) @@ -21,27 +21,27 @@ type alias Type = { user_id : String, token : String, - url_params : (List (List String)) + url_parameters : (List (List String)) } -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -param_as_url : (List String) -> String -param_as_url param = - case param of +parameter_as_url : (List String) -> String +parameter_as_url parameter = + case parameter of [name, value] -> (name ++ "=" ++ value) _ -> "" -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -maybe_get_param : String -> Type -> (Maybe String) -maybe_get_param param flags = +maybe_get_parameter : String -> Type -> (Maybe String) +maybe_get_parameter parameter flags = case (Util.List.get_first - (\e -> ((List.head e) == (Just param))) - flags.url_params + (\e -> ((List.head e) == (Just parameter))) + flags.url_parameters ) of Nothing -> Nothing @@ -50,20 +50,20 @@ maybe_get_param param flags = Nothing -> Nothing (Just b) -> (List.head b) -force_get_param : String -> Type -> String -force_get_param param flags = - case (maybe_get_param param flags) of +force_get_parameter : String -> Type -> String +force_get_parameter parameter flags = + case (maybe_get_parameter parameter flags) of Nothing -> "" (Just str) -> str -get_params_as_url : Type -> String -get_params_as_url flags = +get_parameters_as_url : Type -> String +get_parameters_as_url flags = (List.foldl - (\param -> \current_params -> - (current_params ++ "&" ++ (param_as_url param)) + (\parameter -> \current_parameters -> + (current_parameters ++ "&" ++ (parameter_as_url parameter)) ) "" - flags.url_params + flags.url_parameters ) get_session_token : Type -> String |