Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug 732411: Fix a rare case where a mob stuck on top of a player woul…

…d slow the game down
  • Loading branch information...
commit 5c10b3a0a0f5b2c54da6d29115bd9f04116a68ae 1 parent 749fc5a
Franck Lecollinet authored March 26, 2012

Showing 1 changed file with 15 additions and 8 deletions. Show diff stats Hide diff stats

  1. 23  client/js/game.js
23  client/js/game.js
@@ -1150,15 +1150,22 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT
1150 1150
                                     });
1151 1151
 
1152 1152
                                     entity.onRequestPath(function(x, y) {
1153  
-                                        var ignored = [entity]; // Always ignore self
1154  
-
  1153
+                                        var ignored = [entity], // Always ignore self
  1154
+                                            ignoreTarget = function(target) {
  1155
+                                                ignored.push(target);
  1156
+
  1157
+                                                // also ignore other attackers of the target entity
  1158
+                                                target.forEachAttacker(function(attacker) {
  1159
+                                                    ignored.push(attacker);
  1160
+                                                });
  1161
+                                            };
  1162
+                                        
1155 1163
                                         if(entity.hasTarget()) {
1156  
-                                            ignored.push(entity.target);
1157  
-                                            
1158  
-                                            // also ignore other attackers of the target entity
1159  
-                                            entity.target.forEachAttacker(function(attacker) {
1160  
-                                                ignored.push(attacker);
1161  
-                                            });
  1164
+                                            ignoreTarget(entity.target);
  1165
+                                        } else if(entity.previousTarget) {
  1166
+                                            // If repositioning before attacking again, ignore previous target
  1167
+                                            // See: tryMovingToADifferentTile()
  1168
+                                            ignoreTarget(entity.previousTarget);
1162 1169
                                         }
1163 1170
                                         
1164 1171
                                         return self.findPath(entity, x, y, ignored);

0 notes on commit 5c10b3a

Please sign in to comment.
Something went wrong with that request. Please try again.