From b07f7b28941ebc9c8dfa4bfdf383fba297a1762c Mon Sep 17 00:00:00 2001 From: Jeff Sparkes Date: Sun, 21 Aug 2022 16:29:14 -0400 Subject: [PATCH] Fix warnings by converting some functions to subs --- AIFunctions.vb | 4 ++-- Functions.vb | 24 ++++++++++++------------ main.vb | 17 +++++++++-------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/AIFunctions.vb b/AIFunctions.vb index cb8e1ee..ea8f829 100644 --- a/AIFunctions.vb +++ b/AIFunctions.vb @@ -448,7 +448,7 @@ Module AIFunctions #End If End Function - Public Function save_game() As Object + Public Sub save_game() #If VERBOSE Then Call Main_Renamed.append_simple("In save_game() writing to \save.txt ++++++") #End If @@ -462,7 +462,7 @@ Module AIFunctions Next i FileClose(1) - End Function + End Sub Public Function load_game() As Object #If VERBOSE Then diff --git a/Functions.vb b/Functions.vb index f04af45..38287c8 100644 --- a/Functions.vb +++ b/Functions.vb @@ -188,7 +188,7 @@ Module ArrayFunctions Next i End Sub - Public Function copy_array(ByRef arr_from As Object, ByRef arr_to As Object) As Object + Public Sub copy_array(ByRef arr_from As Object, ByRef arr_to As Object) Dim i As Short 'UPGRADE_WARNING: Couldn't resolve default property of object size(arr_from). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' For i = 0 To size(arr_from) @@ -196,9 +196,9 @@ Module ArrayFunctions 'UPGRADE_WARNING: Couldn't resolve default property of object arr_to(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' arr_to(i) = arr_from(i) Next i - End Function + End Sub - Public Function copy_array2(ByRef arr_from As Object, ByRef arr_to As Object, ByVal index As Short) As Object + Public Sub copy_array2(ByRef arr_from As Object, ByRef arr_to As Object, ByVal index As Short) Dim i As Integer 'UPGRADE_WARNING: Couldn't resolve default property of object size2(arr_from, index). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' For i = 0 To size2(arr_from, index) @@ -206,9 +206,9 @@ Module ArrayFunctions 'UPGRADE_WARNING: Couldn't resolve default property of object arr_to(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' arr_to(index, i) = arr_from(index, i) Next i - End Function + End Sub - Public Function copy_array3(ByRef arr_from As Object, ByRef arr_to As Object, ByVal index1 As Short, ByVal index2 As Short) As Object + Public Sub copy_array3(ByRef arr_from As Object, ByRef arr_to As Object, ByVal index1 As Short, ByVal index2 As Short) Dim i As Integer ' Not used Dim j As Short 'UPGRADE_WARNING: Couldn't resolve default property of object size3(arr_from, index1, index2). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' @@ -217,7 +217,7 @@ Module ArrayFunctions 'UPGRADE_WARNING: Couldn't resolve default property of object arr_to(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' arr_to(index1, index2, i) = arr_from(index1, index2, i) Next i - End Function + End Sub Public Function size(ByRef arr As Object) As Object Dim i As Short @@ -260,7 +260,7 @@ Module ArrayFunctions size3 = i End Function - Public Function sort(ByRef arr As Object) As Object + Public Sub sort(ByRef arr As Object) ' Dim k, i, j, temp As Object Dim k, i, j, temp, v As Short 'UPGRADE_WARNING: Couldn't resolve default property of object size(arr). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' @@ -281,9 +281,9 @@ Module ArrayFunctions End If Next j Next i - End Function + End Sub - Public Function rsort(ByRef arr As Object) As Object + Public Sub rsort(ByRef arr As Object) ' Dim k, i, j, temp As Object Dim k, i, j, temp, value As Short 'UPGRADE_WARNING: Couldn't resolve default property of object size(arr). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' @@ -304,7 +304,7 @@ Module ArrayFunctions End If Next j Next i - End Function + End Sub Public Sub sort2(ByRef arr As Object, ByVal index As Short) Dim temp_arr(500) As Object @@ -320,7 +320,7 @@ Module ArrayFunctions Call rebuild(arr, index, temp_arr) End Sub - Public Function randomize_array(ByRef arr As Object) As Object + Public Sub randomize_array(ByRef arr As Object) Dim new_array(500) As Object Dim picked(500) As Object Randomize() @@ -353,7 +353,7 @@ Module ArrayFunctions Call print_array(new_array, "Shuffled") #End If 'Call print_array(new_array, "Shuffled") - End Function + End Sub Public Sub randomize_array2(ByRef arr As Object, ByVal index As Short) Dim temp_arr(500) As Object diff --git a/main.vb b/main.vb index d73fb23..837df2a 100755 --- a/main.vb +++ b/main.vb @@ -805,7 +805,7 @@ Friend Class Main_Renamed ' Read the debug file and update the board state accordingly 'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"' Dim filename As Object - Dim str_Renamed As String + Dim str_Renamed = "" #If VERBOSE Then Call append_simple("In launch_game() ++++++ Read the debug file and update the board state accordingly /testing.txt") #End If @@ -1620,8 +1620,10 @@ Friend Class Main_Renamed Private Sub exchange_canal_building(ByVal player As Short) Dim temp(40) As Object - Dim count, high_in_hand As Object + Dim count As Object + Dim high_in_hand = -1 Dim high_in_score, i As Short + 'UPGRADE_WARNING: Couldn't resolve default property of object dogma_copied. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' If active_player <> player Then dogma_copied = 1 @@ -1770,7 +1772,6 @@ Friend Class Main_Renamed ''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Age 1 ''''''''''''''''''''''''''''''''''''''''''''''''''''' - ''' #If VERBOSE Then Call append(player, "In activate_card() AGE 1") #End If @@ -5735,7 +5736,7 @@ Friend Class Main_Renamed Private Sub end_game_10(ByRef player As Object) - If winner_found Then Exit Sub + If winner_found() Then Exit Sub Dim min As Object Dim i, winner_count As Short @@ -5780,7 +5781,7 @@ Friend Class Main_Renamed End Sub Private Sub end_game_points() - If winner_found Then Exit Sub + If winner_found() Then Exit Sub Dim i As Short For i = 0 To num_players - 1 @@ -5796,7 +5797,7 @@ Friend Class Main_Renamed 'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"' Private Sub end_game_generic(ByVal player As Short, ByVal str_Renamed As String) - If winner_found Then Exit Sub + If winner_found() Then Exit Sub winners(player) = 1 If ai_mode = 0 Then @@ -5806,11 +5807,11 @@ Friend Class Main_Renamed End Sub Private Sub end_game_ai() - If winner_found Then Exit Sub + If winner_found() Then Exit Sub Dim min As Object Dim i, winner_count As Short - Dim winner_str As String + Dim winner_str As String = "" winner_count = 0 'UPGRADE_WARNING: Couldn't resolve default property of object scores(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' 'UPGRADE_WARNING: Couldn't resolve default property of object min. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'