movement: generalize; use vectors #16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "SquirrelModeler/rogged:generalize-movement"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Generalized movement, so that all entities move the same.
refactor(movement): generalize movement and use vectorsto movement: generalize; use vectorsTwo minor comments. The former is a nitpick but I'd still like for it to be gotten out of our way since it's a trivial change
@ -444,0 +448,4 @@if (result == MOVE_RESULT_MOVED) {player_on_move(&gs->player);action = 1;} else if (result == MOVE_RESULT_BLOCKED_ENEMY) {You should probably guard against potential null target here before attacking.
Because if
try_move_entityreturnsMOVE_RESULT_BLOCKED_ENEMYbutplayer_find_enemy_atfails to find the enemy (be it due to differing lookup logic, or if the enemy was killed by effects earlier in the turn), target would beNULL, and thus lead to an ub inplayer_attack. Something like:If we move the action = 1 into the null guarded if statement, then enemy AI breaks. We can do:Which fixes that bug.Ignore this. I added an incorrect guard.
@ -8,3 +8,2 @@// Move player to (x+dx, y+dy); returns 1 if moved, 0 if blockedint player_move(Player *p, int dx, int dy, Map *map);// Apply status effect, healing ectTypo, should be "healing, etc."
movement: generalize; use vectorsto WIP: movement: generalize; use vectorsCurrently there is a bug with healing. Putting this into WIP until I've fixed it.
I am stupid. I added an incorrect guard. Fixing it now.
WIP: movement: generalize; use vectorsto movement: generalize; use vectors