Code center > Bugs and fixes
Fixing Stores in 2.4
(1/1)
Numsgil:
THis is in the DNAExecution module:
--- Code: --- Private Sub ExecuteStores(n As Integer)
Select Case n
Case 1 'store
DNAstore
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE)
Case 2 'inc
DNAinc
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE) / 10
Case 3 'dec
DNAdec
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE) / 10
Case 4 '+=
Case 5 '-=
Case 6 '*=
Case 7 '/=
End Select
End Sub
Private Sub DNAstore()
Dim b As Long
b = PopIntStack
If b > 0 And b <= MaxMem Then
rob(currbot).mem(b) = PopIntStack Mod 32000
End If
End Sub
Private Sub DNAinc()
Dim a As Long, b As Long
a = PopIntStack
If a >= 1 And a <= 1000 Then
b = (rob(currbot).mem(a) + 1) Mod 32000
rob(currbot).mem(a) = b
End If
End Sub
Private Sub DNAdec()
Dim a As Long, b As Long
a = PopIntStack
If a >= 1 And a <= 1000 Then
b = (rob(currbot).mem(a) - 1) Mod 32000
rob(currbot).mem(a) = b
End If
End Sub
--- End code ---
change this to:
--- Code: --- Private Sub ExecuteStores(n As Integer)
Select Case n
Case 1 'store
DNAstore
Case 2 'inc
DNAinc
Case 3 'dec
DNAdec
Case 4 '+=
Case 5 '-=
Case 6 '*=
Case 7 '/=
End Select
End Sub
Private Sub DNAstore()
Dim b As Long
b = PopIntStack
If b > 0 And b <= MaxMem Then
rob(currbot).mem(b) = PopIntStack Mod 32000
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE)
End If
End Sub
Private Sub DNAinc()
Dim a As Long, b As Long
a = PopIntStack
If a >= 1 And a <= 1000 Then
b = (rob(currbot).mem(a) + 1) Mod 32000
rob(currbot).mem(a) = b
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE) / 10
End If
End Sub
Private Sub DNAdec()
Dim a As Long, b As Long
a = PopIntStack
If a >= 1 And a <= 1000 Then
b = (rob(currbot).mem(a) - 1) Mod 32000
rob(currbot).mem(a) = b
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE) / 10
End If
End Sub
--- End code ---
BTW, does anyone know if there's a way I could just post code and highlight changes in like red? THe color tags won't work if I have the code tags on.
EricL:
This change will be in 2.42.3. Stores to locations outside valid memory will cease to cost anything.
Elite:
Yey Now my conditionless bots will work efficiently again
PurpleYouko:
--- Quote ---BTW, does anyone know if there's a way I could just post code and highlight changes in like red? THe color tags won't work if I have the code tags on.
--- End quote ---
Not without modding the php code somewhat.
try putting the code in quote tags. They look pretty similar these days and color tags work in them
Numsgil:
Ah, quotes, there's an idea.
Navigation
[0] Message Index
Go to full version