This is driving my absolutely crazy:
VB Code:
Private cardPlayed(4) As Card ... Private Function getHighestCardOnTable() As String Dim backupCards(4) As Card For i As Int16 = 1 To 4 If cardPlayed(i) Is Nothing Then backupCards(i) = New Card(0) Else backupCards(i) = cardPlayed(i) Dim sumToAdd As Int32 = 0 If backupCards(i).SuitCard = troef.SuitCard Then sumToAdd += 5000 If backupCards(i).SuitCard = suit Then sumToAdd += 1000 backupCards(i).ValueCard += sumToAdd End If Next ... return ... End Function
The function uses an array of 4 cards to calculate which one is the highest.
If a card belongs to trumps, its value is raised by 5000.
If a card belongs to the suit that came out first, its value is raised by 1000.
I'm using backupCards(4) so I still retain the old value (without the raises).
Or at least that's what I hoped...
On this line:
VB Code:
backupCards(i).ValueCard += sumToAdd
.. where I want the value of backupCards() to raise... it raises both the values of backupCards and cardPlayed()




Reply With Quote