Commit 2746539f authored by Jyrki's avatar Jyrki 🐾

beware of untested code!

parent 5b6ec8b7
......@@ -45,6 +45,7 @@ window.gameVars = {
lstimEnabled = false
cgtimEnabled = false
currPos = 0
# update all the counters and stop everything if the game was lost
updateCounters = ->
......@@ -154,8 +155,14 @@ warTimer = ->
message: message
}
# progress bar thingy
progressTimer = ->
currPos++
NProgress.set currPos / 30
# random event
eventTimer = ->
currPos = 0
NProgress.done()
ev = Math.floor((Math.random() * 10000000) % 7)
......@@ -390,10 +397,12 @@ fitim = window.setInterval fieldTimer, 100
whtim = window.setInterval wheatTimer, 100
lstim = window.setInterval livestockTimer, 1000
cgtim = window.setInterval cattleGridTimer, 1000
prtim = window.setInterval progressTimer, 1000
$(document).ready ->
NProgress.configure
trickle: false
minimum: 0
NProgress.start()
updateCounters()
unless window.localStorage.gv
......
// Generated by CoffeeScript 1.7.1
(function() {
var cattleGridTimer, cgtim, cgtimEnabled, eventTimer, evtim, fieldTimer, fitim, getPrice, initItem, livestockTimer, loadGame, lstim, lstimEnabled, marketBuyItem, marketSellItem, marketSliderChange, saveGame, setPriceLabels, updateCounters, warTimer, wheatTimer, whtim;
var cattleGridTimer, cgtim, cgtimEnabled, currPos, eventTimer, evtim, fieldTimer, fitim, getPrice, initItem, livestockTimer, loadGame, lstim, lstimEnabled, marketBuyItem, marketSellItem, marketSliderChange, progressTimer, prtim, saveGame, setPriceLabels, updateCounters, warTimer, wheatTimer, whtim;
initItem = function(defaultCount, consumable) {
var retobj;
......@@ -47,6 +47,8 @@
cgtimEnabled = false;
currPos = 0;
updateCounters = function() {
var x, _i, _len, _ref;
$('span#valuables-gold').html(window.gameVars.gold);
......@@ -163,8 +165,14 @@
});
};
progressTimer = function() {
currPos++;
return NProgress.set(currPos / 30);
};
eventTimer = function() {
var ev, f, g, i, message, title, w;
currPos = 0;
NProgress.done();
ev = Math.floor((Math.random() * 10000000) % 7);
console.log("Event " + ev);
......@@ -437,9 +445,12 @@
cgtim = window.setInterval(cattleGridTimer, 1000);
prtim = window.setInterval(progressTimer, 1000);
$(document).ready(function() {
NProgress.configure({
trickle: false
trickle: false,
minimum: 0
});
NProgress.start();
updateCounters();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment