Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merged requirejs addition from master

  • Loading branch information...
commit f143bffe34fd04f0b204b2c38ae274c5651cb1c7 2 parents 80616da + de16a17
@bzar authored
View
14 client/createGame.html
@@ -1,19 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="image_map.js"></script>
- <script type="text/javascript" src="theme.js"></script>
- <script type="text/javascript" src="map.js"></script>
- <script type="text/javascript" src="createGame.js"></script>
-
+ <script data-main="createGame" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Create a game</title>
</head>
View
5 client/createGame.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base", "image_map", "theme", "map"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -373,5 +374,5 @@ var wrap = function() {
});
}
-}();
+});
View
21 client/game.html
@@ -1,26 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/d3/d3.js"></script>
- <script type="text/javascript" src="/aja/lib/aja.js"></script>
- <script type="text/javascript" src="vec2d.js"></script>
-
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
-
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="image_map.js"></script>
- <script type="text/javascript" src="animatedMap.js"></script>
- <script type="text/javascript" src="theme.js"></script>
- <script type="text/javascript" src="game.js"></script>
- <script type="text/javascript" src="gamelogic.js"></script>
- <script type="text/javascript" src="ticker.js"></script>
-
+ <script data-main="game" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Game</title>
</head>
View
10 client/game.js
@@ -1,7 +1,5 @@
-var gameClient = null;
-var gameMap = null;
-
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base", "image_map", "theme", "map", "d3/d3", "gamelogic.js", "ticker.js"], function() {
var client = new GameNodeClient(Skeleton);
gameClient = client;
var session = null;
@@ -15,6 +13,8 @@ var wrap = function() {
var oldUnits = {};
var powerMap = null;
var finished = false;
+ var gameClient = null;
+ var gameMap = null;
var gameUIState = {
stateName: "select"
@@ -972,4 +972,4 @@ var wrap = function() {
}
return powerMap;
}
-}();
+});
View
13 client/gameStatistics.html
@@ -1,18 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/d3/d3.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="theme.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="gameStatistics.js"></script>
-
+ <script data-main="gameStatistics" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Game statistics</title>
</head>
View
5 client/gameStatistics.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base", "theme", "d3/d3"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
var theme = null;
@@ -185,5 +186,5 @@ var wrap = function() {
}
};
}
-}();
+});
View
11 client/home.html
@@ -1,16 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="home.js"></script>
-
+ <script data-main="home" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Home</title>
</head>
View
5 client/home.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -63,5 +64,5 @@ var wrap = function() {
}
});
}
-}();
+});
View
13 client/info.html
@@ -1,18 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="image_map.js"></script>
- <script type="text/javascript" src="theme.js"></script>
- <script type="text/javascript" src="info.js"></script>
-
+ <script data-main="info" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Info</title>
</head>
View
5 client/info.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base", "image_map", "theme"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
var theme = null;
@@ -248,4 +249,4 @@ var wrap = function() {
});
}
-}();
+});
View
11 client/join.html
@@ -1,16 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="join.js"></script>
-
+ <script data-main="join" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Open games</title>
</head>
View
5 client/join.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -95,4 +96,4 @@ var wrap = function() {
}
});
}
-}();
+});
View
9 client/login.html
@@ -1,13 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="login.js"></script>
-
+ <script data-main="login" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
<title>Wars - Login</title>
View
5 client/login.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings"], function() {
var client = new GameNodeClient();
var session = new Session(client);
@@ -32,5 +33,5 @@ var wrap = function() {
client.connect(WARS_CLIENT_SETTINGS.gameServer);
});
-}();
+});
View
17 client/manual.html
@@ -1,16 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="manual.js"></script>
-
+ <script data-main="manual" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Manual</title>
</head>
@@ -40,10 +31,12 @@
<h4>Turn actions</h4>
<p>On your turn you can move your units and build more of them. </p>
<p>Units can be built by clicking a base you own. This opens the "Build" menu. The build menu shows the available units and their prices. You can not build units that cost more than you have funds. You can move the units you build on your next turn.</p>
- <p>You can move a unit you own by clicking on it. This changes the game view to highlight the tiles that unit can move to. You can move to a highlighted tile by clicking on it, or cancel moving the unit by clicking on a tile that is not highlighted. It is possible and sometimes smart to "move in place", or remain at the current location by clicking on the tile with the unit a second time. This allows you to skip moving the unit and just perform an action. Movement range is determined by surrounding terrain and the unit's type. For example a heavy tank can only move one space per turn in a forest, because it costs four movement points to move a HeavyVehicle in a forest, and the heavy tank only has four movement points. On the other hand a scout can move three tiles in a forest, because it has the movement type "LightVehicle" and six movement points. LightVehicle movement type only has a cost of two movement points per tile in a forest, which gives us: <span class="formula">6 movement points / 2 (movement points / tile) = 3 tiles</span>.</p>
+ <p>You can move a unit you own by clicking on it. This changes the game view to highlight the tiles that unit can move to. You can move to a highlighted tile by clicking on it, or cancel moving the unit by clicking on a tile that is not highlighted. It is possible and sometimes smart to "move in place", or remain at the current location by clicking on the tile with the unit a second time. This allows you to skip moving the unit and just perform an action. Movement range is determined by surrounding terrain and the unit's type. For example a heavy tank can only move one space per turn in a forest, because it costs four movement points to move a HeavyVehicle in a forest, and the heavy tank only has four movement points. On the other hand a scout can move three tiles in a forest, because it has the movement type "LightVehicle" and six movement points. LightVehicle movement type only has a cost of two movement points per tile in a forest, which gives us: <span class="formula">6 movement points / 2 (
+movement points / tile) = 3 tiles</span>.</p>
<p>When you move to a tile, you are presented with one or more of the following options: attack, deploy, undeploy, load, unload, capture, wait and cancel. "Wait" instructs the unit to move to the specified location and stay there until the next turn. Selecting attack displays available targets with a red highlight. This means your unit can attack another unit after moving. Clicking on one of the highlighted units engages the two units in a battle. Battle mechanics are explained in the next section. "Deploy" and "undeploy" are special commands for units that have weapons which require deploying. These kind of weapons can only be fired when the unit is deployed. Deployed units are surrounded with a white rectangle and cannot move. "Load" and "unload" are used with carrier units, like APCs, transport copters and cargo ships. Using carrier units is explained below. "Capture" makes your unit attempt to capture the property in the tile it moves to.</p>
<p>Each tile has 200 capture points. If the tile can be captured, this number can be decreased by capturing. This reduces the number of capture points by the number of health points the capturing unit has. After a tile's capture points reach zero, the player that owns the capturing unit assumes ownership of the tile and the tile's capture points reset to 1. If an owned tile has less than 200 capture points in the beginning of the turn of its owner and is not currently being captured by another player's unit it receives 50 capture points. A tile can have a maximum of 200 capture points. If a tile has less than 200 capture points, the relative amount is displayed as a bar in the left side of the tile. The bar is red if the tile is being captured and light blue if it is regenerating capture points.</p>
- <p>Carrier units can transport other units from one place to another. Transportable units are determined by class. For example, an APC can transport two infantry units, but a cargo ship has room for two infantry units or vehicles. Units can be loaded to carriers by moving them to the same tile and selecting the "load" action. Loaded units are shown as small filled square symbols in the lower left corner of the unit. Several units can be loaded into a single carrier in one turn, provided the carrier has room for them. Unloading a unit from a loaded carrier is accomplished by moving the carrier normally and selecting the "unload" action. A list of units available for unloading are displayed. After selecting a unit to unload possible unload tiles are highlighted. Selecting a tile unloads the unit. Note that you can only load units on terrain that the unit can move on, and unload units only from and to such terrain. For example you can't load a tank to a cargo ship when the cargo ship is in a water tile, or unload artillery to a mountain. Warning: if the carrier unit is destroyed, all units it carries are destroyed as well. Guard them well.</p>
+ <p>Carrier units can transport other units from one place to another. Transportable units are determined by class. For example, an APC can transport two infantry units, but a cargo ship has room for two infantry units or vehicles. Units can be loaded to carriers by moving them to the same tile and selecting the "load" action. Loaded units are shown as small filled square symbols in the lower left corner of the unit. Several units can be loaded into a single carrier in one turn, provided the carrier has room for them. Unloading a unit from a loaded carrier is accomplished by moving the carrier normally and selecting the "unload" action. A list of units available for unloading are displayed. After selecting a unit to unload possible unload tiles are highlighted. Selecting a tile unloads the unit. Note that you can only load units on terrain that the unit can move on, and unload units only from and to such terrain. For example you can't load a tank to a cargo ship when the cargo ship is in a water tile,
+or unload artillery to a mountain. Warning: if the carrier unit is destroyed, all units it carries are destroyed as well. Guard them well.</p>
<p>When you want to end your turn, click on "End turn". Clicking on "Surrender" destroys all your units, disowns all your properties and ends your turn, effectively making you lose immediately.</p>
<h4>Battle mechanics</h4>
View
5 client/manual.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -8,5 +9,5 @@ var wrap = function() {
populateNavigation(session);
});
});
-}();
+});
View
14 client/mapEditor.html
@@ -1,19 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="image_map.js"></script>
- <script type="text/javascript" src="theme.js"></script>
- <script type="text/javascript" src="map.js"></script>
- <script type="text/javascript" src="mapEditor.js"></script>
-
+ <script data-main="mapEditor" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Map editor</title>
</head>
View
5 client/mapEditor.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base", "image_map", "theme", "map"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -525,5 +526,5 @@ var wrap = function() {
e.preventDefault();
});
}
-}();
+});
View
14 client/myMaps.html
@@ -1,19 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="theme.js"></script>
- <script type="text/javascript" src="image_map.js"></script>
- <script type="text/javascript" src="map.js"></script>
- <script type="text/javascript" src="myMaps.js"></script>
-
+ <script data-main="myMaps" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - My maps</title>
</head>
View
5 client/myMaps.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base", "image_map", "theme", "map"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -181,5 +182,5 @@ var wrap = function() {
filterMaps(maps);
});
}
-}();
+});
View
14 client/pregame.html
@@ -1,19 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="image_map.js"></script>
- <script type="text/javascript" src="theme.js"></script>
- <script type="text/javascript" src="map.js"></script>
- <script type="text/javascript" src="pregame.js"></script>
-
+ <script data-main="pregame" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Pregame</title>
</head>
View
5 client/pregame.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base", "image_map", "theme", "map"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -175,4 +176,4 @@ var wrap = function() {
});
}
-}();
+});
View
11 client/profile.html
@@ -1,16 +1,7 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="profile.js"></script>
-
+ <script data-main="profile" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
-
<title>Wars - Home</title>
</head>
View
5 client/profile.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -43,5 +44,5 @@ var wrap = function() {
});
});
}
-}();
+});
View
10 client/register.html
@@ -1,14 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="register.js"></script>
-
+ <script data-main="register" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
<title>Wars - Login</title>
View
5 client/register.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base"], function() {
var client = new GameNodeClient();
var session = new Session(client);
@@ -34,5 +35,5 @@ var wrap = function() {
client.connect(WARS_CLIENT_SETTINGS.gameServer);
});
-}();
+});
View
33 client/require.js
@@ -0,0 +1,33 @@
+/*
+ RequireJS 1.0.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ Available via the MIT or new BSD license.
+ see: http://github.com/jrburke/requirejs for details
+*/
+var requirejs,require,define;
+(function(r){function K(a){return O.call(a)==="[object Function]"}function G(a){return O.call(a)==="[object Array]"}function $(a,c,l){for(var j in c)if(!(j in L)&&(!(j in a)||l))a[j]=c[j];return d}function P(a,c,d){a=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+a);if(d)a.originalError=d;return a}function aa(a,c,d){var j,k,t;for(j=0;t=c[j];j++){t=typeof t==="string"?{name:t}:t;k=t.location;if(d&&(!k||k.indexOf("/")!==0&&k.indexOf(":")===-1))k=d+"/"+(k||t.name);a[t.name]={name:t.name,location:k||
+t.name,main:(t.main||"main").replace(fa,"").replace(ba,"")}}}function V(a,c){a.holdReady?a.holdReady(c):c?a.readyWait+=1:a.ready(!0)}function ga(a){function c(b,f){var g,m;if(b&&b.charAt(0)===".")if(f){q.pkgs[f]?f=[f]:(f=f.split("/"),f=f.slice(0,f.length-1));g=b=f.concat(b.split("/"));var a;for(m=0;a=g[m];m++)if(a===".")g.splice(m,1),m-=1;else if(a==="..")if(m===1&&(g[2]===".."||g[0]===".."))break;else m>0&&(g.splice(m-1,2),m-=2);m=q.pkgs[g=b[0]];b=b.join("/");m&&b===g+"/"+m.main&&(b=g)}else b.indexOf("./")===
+0&&(b=b.substring(2));return b}function l(b,f){var g=b?b.indexOf("!"):-1,m=null,a=f?f.name:null,h=b,e,d;g!==-1&&(m=b.substring(0,g),b=b.substring(g+1,b.length));m&&(m=c(m,a));b&&(m?e=(g=n[m])&&g.normalize?g.normalize(b,function(b){return c(b,a)}):c(b,a):(e=c(b,a),d=G[e],d||(d=i.nameToUrl(b,null,f),G[e]=d)));return{prefix:m,name:e,parentMap:f,url:d,originalName:h,fullName:m?m+"!"+(e||""):e}}function j(){var b=!0,f=q.priorityWait,g,a;if(f){for(a=0;g=f[a];a++)if(!s[g]){b=!1;break}b&&delete q.priorityWait}return b}
+function k(b,f,g){return function(){var a=ha.call(arguments,0),c;if(g&&K(c=a[a.length-1]))c.__requireJsBuild=!0;a.push(f);return b.apply(null,a)}}function t(b,f,g){f=k(g||i.require,b,f);$(f,{nameToUrl:k(i.nameToUrl,b),toUrl:k(i.toUrl,b),defined:k(i.requireDefined,b),specified:k(i.requireSpecified,b),isBrowser:d.isBrowser});return f}function p(b){var f,g,a,c=b.callback,h=b.map,e=h.fullName,ca=b.deps;a=b.listeners;var j=q.requireExecCb||d.execCb;if(c&&K(c)){if(q.catchError.define)try{g=j(e,b.callback,
+ca,n[e])}catch(k){f=k}else g=j(e,b.callback,ca,n[e]);if(e)(c=b.cjsModule)&&c.exports!==r&&c.exports!==n[e]?g=n[e]=b.cjsModule.exports:g===r&&b.usingExports?g=n[e]:(n[e]=g,H[e]&&(T[e]=!0))}else e&&(g=n[e]=c,H[e]&&(T[e]=!0));if(x[b.id])delete x[b.id],b.isDone=!0,i.waitCount-=1,i.waitCount===0&&(J=[]);delete M[e];if(d.onResourceLoad&&!b.placeholder)d.onResourceLoad(i,h,b.depArray);if(f)return g=(e?l(e).url:"")||f.fileName||f.sourceURL,a=f.moduleTree,f=P("defineerror",'Error evaluating module "'+e+'" at location "'+
+g+'":\n'+f+"\nfileName:"+g+"\nlineNumber: "+(f.lineNumber||f.line),f),f.moduleName=e,f.moduleTree=a,d.onError(f);for(f=0;c=a[f];f++)c(g);return r}function u(b,f){return function(g){b.depDone[f]||(b.depDone[f]=!0,b.deps[f]=g,b.depCount-=1,b.depCount||p(b))}}function o(b,f){var g=f.map,a=g.fullName,c=g.name,h=N[b]||(N[b]=n[b]),e;if(!f.loading)f.loading=!0,e=function(b){f.callback=function(){return b};p(f);s[f.id]=!0;A()},e.fromText=function(b,f){var g=Q;s[b]=!1;i.scriptCount+=1;i.fake[b]=!0;g&&(Q=!1);
+d.exec(f);g&&(Q=!0);i.completeLoad(b)},a in n?e(n[a]):h.load(c,t(g.parentMap,!0,function(b,a){var c=[],e,m;for(e=0;m=b[e];e++)m=l(m,g.parentMap),b[e]=m.fullName,m.prefix||c.push(b[e]);f.moduleDeps=(f.moduleDeps||[]).concat(c);return i.require(b,a)}),e,q)}function y(b){x[b.id]||(x[b.id]=b,J.push(b),i.waitCount+=1)}function D(b){this.listeners.push(b)}function v(b,f){var g=b.fullName,a=b.prefix,c=a?N[a]||(N[a]=n[a]):null,h,e;g&&(h=M[g]);if(!h&&(e=!0,h={id:(a&&!c?O++ +"__p@:":"")+(g||"__r@"+O++),map:b,
+depCount:0,depDone:[],depCallbacks:[],deps:[],listeners:[],add:D},B[h.id]=!0,g&&(!a||N[a])))M[g]=h;a&&!c?(g=l(a),a in n&&!n[a]&&(delete n[a],delete R[g.url]),a=v(g,!0),a.add(function(){var f=l(b.originalName,b.parentMap),f=v(f,!0);h.placeholder=!0;f.add(function(b){h.callback=function(){return b};p(h)})})):e&&f&&(s[h.id]=!1,i.paused.push(h),y(h));return h}function C(b,f,a,c){var b=l(b,c),d=b.name,h=b.fullName,e=v(b),j=e.id,k=e.deps,o;if(h){if(h in n||s[j]===!0||h==="jquery"&&q.jQuery&&q.jQuery!==
+a().fn.jquery)return;B[j]=!0;s[j]=!0;h==="jquery"&&a&&W(a())}e.depArray=f;e.callback=a;for(a=0;a<f.length;a++)if(j=f[a])j=l(j,d?b:c),o=j.fullName,f[a]=o,o==="require"?k[a]=t(b):o==="exports"?(k[a]=n[h]={},e.usingExports=!0):o==="module"?e.cjsModule=k[a]={id:d,uri:d?i.nameToUrl(d,null,c):r,exports:n[h]}:o in n&&!(o in x)&&(!(h in H)||h in H&&T[o])?k[a]=n[o]:(h in H&&(H[o]=!0,delete n[o],R[j.url]=!1),e.depCount+=1,e.depCallbacks[a]=u(e,a),v(j,!0).add(e.depCallbacks[a]));e.depCount?y(e):p(e)}function w(b){C.apply(null,
+b)}function F(b,f){var a=b.map.fullName,c=b.depArray,d=!0,h,e,i,l;if(b.isDone||!a||!s[a])return l;if(f[a])return b;f[a]=!0;if(c){for(h=0;h<c.length;h++){e=c[h];if(!s[e]&&!ia[e]){d=!1;break}if((i=x[e])&&!i.isDone&&s[e])if(l=F(i,f))break}d||(l=r,delete f[a])}return l}function z(b,a){var g=b.map.fullName,c=b.depArray,d,h,e,i;if(b.isDone||!g||!s[g])return r;if(g){if(a[g])return n[g];a[g]=!0}if(c)for(d=0;d<c.length;d++)if(h=c[d])if((e=l(h).prefix)&&(i=x[e])&&z(i,a),(e=x[h])&&!e.isDone&&s[h])h=z(e,a),b.depCallbacks[d](h);
+return n[g]}function E(){var b=q.waitSeconds*1E3,b=b&&i.startTime+b<(new Date).getTime(),a="",c=!1,l=!1,k=[],h,e;if(i.pausedCount>0)return r;if(q.priorityWait)if(j())A();else return r;for(h in s)if(!(h in L)&&(c=!0,!s[h]))if(b)a+=h+" ";else if(l=!0,h.indexOf("!")===-1){k=[];break}else(e=M[h]&&M[h].moduleDeps)&&k.push.apply(k,e);if(!c&&!i.waitCount)return r;if(b&&a)return b=P("timeout","Load timeout for modules: "+a),b.requireType="timeout",b.requireModules=a,b.contextName=i.contextName,d.onError(b);
+if(l&&k.length)for(a=0;h=x[k[a]];a++)if(h=F(h,{})){z(h,{});break}if(!b&&(l||i.scriptCount)){if((I||da)&&!X)X=setTimeout(function(){X=0;E()},50);return r}if(i.waitCount){for(a=0;h=J[a];a++)z(h,{});i.paused.length&&A();Y<5&&(Y+=1,E())}Y=0;d.checkReadyState();return r}var i,A,q={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},catchError:{}},S=[],B={require:!0,exports:!0,module:!0},G={},n={},s={},x={},J=[],R={},O=0,M={},N={},H={},T={},Z=0;W=function(b){if(!i.jQuery&&(b=b||(typeof jQuery!=="undefined"?jQuery:
+null))&&!(q.jQuery&&b.fn.jquery!==q.jQuery)&&("holdReady"in b||"readyWait"in b))if(i.jQuery=b,w(["jquery",[],function(){return jQuery}]),i.scriptCount)V(b,!0),i.jQueryIncremented=!0};A=function(){var b,a,c,l,k,h;i.takeGlobalQueue();Z+=1;if(i.scriptCount<=0)i.scriptCount=0;for(;S.length;)if(b=S.shift(),b[0]===null)return d.onError(P("mismatch","Mismatched anonymous define() module: "+b[b.length-1]));else w(b);if(!q.priorityWait||j())for(;i.paused.length;){k=i.paused;i.pausedCount+=k.length;i.paused=
+[];for(l=0;b=k[l];l++)a=b.map,c=a.url,h=a.fullName,a.prefix?o(a.prefix,b):!R[c]&&!s[h]&&((q.requireLoad||d.load)(i,h,c),c.indexOf("empty:")!==0&&(R[c]=!0));i.startTime=(new Date).getTime();i.pausedCount-=k.length}Z===1&&E();Z-=1;return r};i={contextName:a,config:q,defQueue:S,waiting:x,waitCount:0,specified:B,loaded:s,urlMap:G,urlFetched:R,scriptCount:0,defined:n,paused:[],pausedCount:0,plugins:N,needFullExec:H,fake:{},fullExec:T,managerCallbacks:M,makeModuleMap:l,normalize:c,configure:function(b){var a,
+c,d;b.baseUrl&&b.baseUrl.charAt(b.baseUrl.length-1)!=="/"&&(b.baseUrl+="/");a=q.paths;d=q.pkgs;$(q,b,!0);if(b.paths){for(c in b.paths)c in L||(a[c]=b.paths[c]);q.paths=a}if((a=b.packagePaths)||b.packages){if(a)for(c in a)c in L||aa(d,a[c],c);b.packages&&aa(d,b.packages);q.pkgs=d}if(b.priority)c=i.requireWait,i.requireWait=!1,A(),i.require(b.priority),A(),i.requireWait=c,q.priorityWait=b.priority;if(b.deps||b.callback)i.require(b.deps||[],b.callback)},requireDefined:function(b,a){return l(b,a).fullName in
+n},requireSpecified:function(b,a){return l(b,a).fullName in B},require:function(b,c,g){if(typeof b==="string"){if(K(c))return d.onError(P("requireargs","Invalid require call"));if(d.get)return d.get(i,b,c);c=l(b,c);b=c.fullName;return!(b in n)?d.onError(P("notloaded","Module name '"+c.fullName+"' has not been loaded yet for context: "+a)):n[b]}(b&&b.length||c)&&C(null,b,c,g);if(!i.requireWait)for(;!i.scriptCount&&i.paused.length;)A();return i.require},takeGlobalQueue:function(){U.length&&(ja.apply(i.defQueue,
+[i.defQueue.length-1,0].concat(U)),U=[])},completeLoad:function(b){var a;for(i.takeGlobalQueue();S.length;)if(a=S.shift(),a[0]===null){a[0]=b;break}else if(a[0]===b)break;else w(a),a=null;a?w(a):w([b,[],b==="jquery"&&typeof jQuery!=="undefined"?function(){return jQuery}:null]);d.isAsync&&(i.scriptCount-=1);A();d.isAsync||(i.scriptCount-=1)},toUrl:function(b,a){var c=b.lastIndexOf("."),d=null;c!==-1&&(d=b.substring(c,b.length),b=b.substring(0,c));return i.nameToUrl(b,d,a)},nameToUrl:function(b,a,g){var l,
+k,h,e,j=i.config,b=c(b,g&&g.fullName);if(d.jsExtRegExp.test(b))a=b+(a?a:"");else{l=j.paths;k=j.pkgs;g=b.split("/");for(e=g.length;e>0;e--)if(h=g.slice(0,e).join("/"),l[h]){g.splice(0,e,l[h]);break}else if(h=k[h]){b=b===h.name?h.location+"/"+h.main:h.location;g.splice(0,e,b);break}a=g.join("/")+(a||".js");a=(a.charAt(0)==="/"||a.match(/^[\w\+\.\-]+:/)?"":j.baseUrl)+a}return j.urlArgs?a+((a.indexOf("?")===-1?"?":"&")+j.urlArgs):a}};i.jQueryCheck=W;i.resume=A;return i}function ka(){var a,c,d;if(C&&C.readyState===
+"interactive")return C;a=document.getElementsByTagName("script");for(c=a.length-1;c>-1&&(d=a[c]);c--)if(d.readyState==="interactive")return C=d;return null}var la=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ma=/require\(\s*["']([^'"\s]+)["']\s*\)/g,fa=/^\.\//,ba=/\.js$/,O=Object.prototype.toString,u=Array.prototype,ha=u.slice,ja=u.splice,I=!!(typeof window!=="undefined"&&navigator&&document),da=!I&&typeof importScripts!=="undefined",na=I&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,
+ea=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",L={},D={},U=[],C=null,Y=0,Q=!1,ia={require:!0,module:!0,exports:!0},d,u={},J,y,v,E,o,w,F,B,z,W,X;if(typeof define==="undefined"){if(typeof requirejs!=="undefined")if(K(requirejs))return;else u=requirejs,requirejs=r;typeof require!=="undefined"&&!K(require)&&(u=require,require=r);d=requirejs=function(a,c,d){var j="_",k;!G(a)&&typeof a!=="string"&&(k=a,G(c)?(a=c,c=d):a=[]);if(k&&k.context)j=k.context;d=D[j]||(D[j]=ga(j));k&&d.configure(k);
+return d.require(a,c)};d.config=function(a){return d(a)};require||(require=d);d.toUrl=function(a){return D._.toUrl(a)};d.version="1.0.8";d.jsExtRegExp=/^\/|:|\?|\.js$/;y=d.s={contexts:D,skipAsync:{}};if(d.isAsync=d.isBrowser=I)if(v=y.head=document.getElementsByTagName("head")[0],E=document.getElementsByTagName("base")[0])v=y.head=E.parentNode;d.onError=function(a){throw a;};d.load=function(a,c,l){d.resourcesReady(!1);a.scriptCount+=1;d.attach(l,a,c);if(a.jQuery&&!a.jQueryIncremented)V(a.jQuery,!0),
+a.jQueryIncremented=!0};define=function(a,c,d){var j,k;typeof a!=="string"&&(d=c,c=a,a=null);G(c)||(d=c,c=[]);!c.length&&K(d)&&d.length&&(d.toString().replace(la,"").replace(ma,function(a,d){c.push(d)}),c=(d.length===1?["require"]:["require","exports","module"]).concat(c));if(Q&&(j=J||ka()))a||(a=j.getAttribute("data-requiremodule")),k=D[j.getAttribute("data-requirecontext")];(k?k.defQueue:U).push([a,c,d]);return r};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(a){return eval(a)};
+d.execCb=function(a,c,d,j){return c.apply(j,d)};d.addScriptToDom=function(a){J=a;E?v.insertBefore(a,E):v.appendChild(a);J=null};d.onScriptLoad=function(a){var c=a.currentTarget||a.srcElement,l;if(a.type==="load"||c&&na.test(c.readyState))C=null,a=c.getAttribute("data-requirecontext"),l=c.getAttribute("data-requiremodule"),D[a].completeLoad(l),c.detachEvent&&!ea?c.detachEvent("onreadystatechange",d.onScriptLoad):c.removeEventListener("load",d.onScriptLoad,!1)};d.attach=function(a,c,l,j,k,o){var p;
+if(I)return j=j||d.onScriptLoad,p=c&&c.config&&c.config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),p.type=k||c&&c.config.scriptType||"text/javascript",p.charset="utf-8",p.async=!y.skipAsync[a],c&&p.setAttribute("data-requirecontext",c.contextName),p.setAttribute("data-requiremodule",l),p.attachEvent&&!(p.attachEvent.toString&&p.attachEvent.toString().indexOf("[native code]")<0)&&!ea?(Q=!0,o?p.onreadystatechange=function(){if(p.readyState===
+"loaded")p.onreadystatechange=null,p.attachEvent("onreadystatechange",j),o(p)}:p.attachEvent("onreadystatechange",j)):p.addEventListener("load",j,!1),p.src=a,o||d.addScriptToDom(p),p;else da&&(importScripts(a),c.completeLoad(l));return null};if(I){o=document.getElementsByTagName("script");for(B=o.length-1;B>-1&&(w=o[B]);B--){if(!v)v=w.parentNode;if(F=w.getAttribute("data-main")){if(!u.baseUrl)o=F.split("/"),w=o.pop(),o=o.length?o.join("/")+"/":"./",u.baseUrl=o,F=w.replace(ba,"");u.deps=u.deps?u.deps.concat(F):
+[F];break}}}d.checkReadyState=function(){var a=y.contexts,c;for(c in a)if(!(c in L)&&a[c].waitCount)return;d.resourcesReady(!0)};d.resourcesReady=function(a){var c,l;d.resourcesDone=a;if(d.resourcesDone)for(l in a=y.contexts,a)if(!(l in L)&&(c=a[l],c.jQueryIncremented))V(c.jQuery,!1),c.jQueryIncremented=!1};d.pageLoaded=function(){if(document.readyState!=="complete")document.readyState="complete"};if(I&&document.addEventListener&&!document.readyState)document.readyState="loading",window.addEventListener("load",
+d.pageLoaded,!1);d(u);if(d.isAsync&&typeof setTimeout!=="undefined")z=y.contexts[u.context||"_"],z.requireWait=!0,setTimeout(function(){z.requireWait=!1;z.scriptCount||z.resume();d.checkReadyState()},0)}})();
View
10 client/spectate.html
@@ -1,14 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="settings.js"></script>
- <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="/socket.io/socket.io.js"></script>
- <script type="text/javascript" src="/gamenode/gameNodeClient.js"></script>
- <script type="text/javascript" src="/gamenode/session.js"></script>
- <script type="text/javascript" src="skeleton.js"></script>
- <script type="text/javascript" src="base.js"></script>
- <script type="text/javascript" src="spectate.js"></script>
-
+ <script data-main="spectate" src="require.js"></script>
<link rel="stylesheet" href="wars.css" type="text/css"/>
<title>Wars - Spectate</title>
View
5 client/spectate.js
@@ -1,4 +1,5 @@
-var wrap = function() {
+require(["jquery-1.6.2.min.js", "/socket.io/socket.io.js", "/gamenode/gameNodeClient.js", "/gamenode/session.js",
+ "skeleton", "settings", "base"], function() {
var client = new GameNodeClient(Skeleton);
var session = null;
@@ -101,4 +102,4 @@ var wrap = function() {
}
});
}
-}();
+});
View
2  server/game/actions.js
@@ -599,7 +599,7 @@ GameActions.prototype.startTurn = function(game, callback) {
tile.unit = unit;
if(unit.unitId == tile.unitId) {
// Heal units
- if(unit.owner == nextPlayer.playerNumber && tileType.canRepair(unit.unitType().unitClass) && unit.health < 100) {
+ if(unit.owner == nextPlayer.playerNumber && tileType.canRepair(unit.type) && unit.health < 100) {
nextPlayer.score += unit.heal(settings.defaultRepairRate);
events.repair(tile, unit, unit.health);
}
View
2  server/index.js
@@ -25,7 +25,7 @@ server.io.configure(null, function(){
var fileServer = undefined;
if(configuration.enableFileServer) {
fileServer = new FileServer(
- ["jquery-1.6.2.min.js", "skeleton.js", "base.js", "wars.css",
+ ["jquery-1.6.2.min.js", "require.js", "skeleton.js", "base.js", "wars.css",
"login.html", "login.js", "register.html", "register.js",
"home.html", "home.js", "myMaps.html", "myMaps.js",
"mapEditor.html", "mapEditor.js", "map.js", "image_map.js",
Please sign in to comment.
Something went wrong with that request. Please try again.