Skip to content

Commit

Permalink
refactor: continue work on move startCombat to Nim
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 08fd3754acaf0dd2f03e5d74fbb268fbbd8d72225c7bf8abca5aae6836858b71
  • Loading branch information
thindil committed Jul 26, 2023
1 parent 7cdab21 commit 2eda3b2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 332 deletions.
10 changes: 9 additions & 1 deletion nim/src/combat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ type
perception: cint
guns: array[10, array[3, cint]]
name: cstring
playerGuns: array[10, array[3, cint]]

proc getAdaEnemy(adaEnemy: var AdaEnemyData) {.raises: [], tags: [], exportc.} =
adaEnemy.accuracy = enemy.accuracy.cint
Expand All @@ -213,6 +214,13 @@ proc getAdaEnemy(adaEnemy: var AdaEnemyData) {.raises: [], tags: [], exportc.} =
for index, gun in enemy.guns:
adaEnemy.guns[index] = [gun[1].cint, gun[2].cint, gun[3].cint]
if enemy.guns.len < 10:
for index in enemy.guns.len - 1 .. 10:
let startIndex = (if enemy.guns.len > 0: enemy.guns.len - 1 else: 0)
for index in startIndex .. 9:
adaEnemy.guns[index] = [-1, -1, -1]
for index, gun in guns:
adaEnemy.playerGuns[index] = [gun[1].cint, gun[2].cint, gun[3].cint]
if guns.len < 10:
let startIndex = (if guns.len > 0: guns.len - 1 else: 0)
for index in startIndex .. 9:
adaEnemy.playerGuns[index] = [-1, -1, -1]
npcShip = enemy.ship
Loading

0 comments on commit 2eda3b2

Please sign in to comment.