Skip to content

Commit

Permalink
Fixing wrong binding of 'this'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerenaux committed Mar 22, 2017
1 parent d3efb52 commit 6d57ec4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<script src="js/client/Decoder.js" type="text/javascript"></script>
<script src="js/client/main.js" type="text/javascript"></script>
<script src="js/client/client.js" type="text/javascript"></script>
<script src="js/client/compressed.js" type="text/javascript"></script>
<script src="js/spaceMap.js" type="text/javascript"></script>
<script src="js/CoDec.js" type="text/javascript"></script>
<script src="js/AOIutils.js" type="text/javascript"></script>
Expand Down
10 changes: 5 additions & 5 deletions js/client/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ Game.handleClick = function(){
};

Game.handleCharClick = function(character){ // Handles what happens when clicking on an NPC
if (this.handleClick()) {
if (Game.handleClick()) {
// character is the sprite that was clicked
var end = Game.computeTileCoords(character.x, character.y);
end.y++; // So that the player walks to place himself in front of the NPC
Expand Down Expand Up @@ -1341,7 +1341,7 @@ Game.handleCharClick = function(character){ // Handles what happens when clickin
};

Game.handleChestClick = function(chest){ // Handles what happens when clicking on a chest
if (this.handleClick()) {
if (Game.handleClick()) {
// chest is the sprite that was clicked
var end = Game.computeTileCoords(chest.x, chest.y);
var action = {
Expand All @@ -1354,14 +1354,14 @@ Game.handleChestClick = function(chest){ // Handles what happens when clicking o
};

Game.handleLootClick = function(loot){ // Handles what happens when clicking on an item
if (this.handleClick()) {
if (Game.handleClick()) {
// loot is the sprite that was clicked
Game.player.prepareMovement(Game.computeTileCoords(loot.x, loot.y), 0, {action: 0}, 0, true); // true : send path to server
}
};

Game.handleMapClick = function(layer,pointer){ // Handles what happens when clicking on an empty tile to move
if (this.handleClick()) {
if (Game.handleClick()) {
// layer is the layer object that was clicked on, pointer is the mouse
if (!Game.marker.collide && Game.view.contains(pointer.worldX, pointer.worldY)) { // To avoid trigger movement to collision cells or cells below the HUD
var end = Game.computeTileCoords(Game.marker.x, Game.marker.y);
Expand All @@ -1371,7 +1371,7 @@ Game.handleMapClick = function(layer,pointer){ // Handles what happens when clic
};

Game.handleMonsterClick = function(monster){ // Handles what happens when clicking on a monster
if (this.handleClick()) {
if (Game.handleClick()) {
// monster is the sprite that was clicked on
var end = Game.computeTileCoords(monster.x, monster.y);
var action = {
Expand Down
2 changes: 1 addition & 1 deletion js/server/GameServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ GameServer.readMap = function(){

// Iterate over all tiles and work out AOIs and collisions
AOIutils.nbAOIhorizontal = Math.ceil(GameServer.map.width/GameServer.AOIwidth);
GameServer.AOIs = {};
GameServer.AOIs = {}; // Maps AOI id to AOI object
GameServer.dirtyAOIs = new Set(); // Set of AOI's whose update package have changes since last update
GameServer.AOIfromTiles = new spaceMap(); // map tiles coordinates to AOI id (e.g. the tile (3,2) is in AOI 0)
GameServer.collisionGrid = [];
Expand Down

0 comments on commit 6d57ec4

Please sign in to comment.