Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
56e5b85
yarn
Aug 10, 2020
a6c85bb
introdotto file wwtp-channel-field
ohmissam Aug 13, 2020
d2b9a29
insert wwtp as power
Aug 17, 2020
d76c79a
small fixes
ohmissam Aug 17, 2020
170f024
f-c-w system indipendence
ohmissam Sep 7, 2020
9d8f311
tile change
ohmissam Sep 21, 2020
5fb3c7f
fixed field growth
ohmissam Sep 28, 2020
073babd
Indie field logic
Sep 30, 2020
4451015
indie field adj
Sep 30, 2020
6b3392b
Fix blink indie field
ohmissam Sep 30, 2020
8ac8386
fix indfield blink and cascade irrigation
ohmissam Sep 30, 2020
e6c793e
field window
Oct 7, 2020
e0e8cd9
field window 2
ohmissam Oct 7, 2020
6c1f87d
Field choise window fix
ohmissam Oct 8, 2020
6f998a4
querytool fix
ohmissam Oct 8, 2020
ee918b1
fieldwindow logic
Oct 8, 2020
917cf33
little fixes
Oct 9, 2020
6060e41
another step to field logic
Oct 9, 2020
0b1fef0
seems to work field choice
Oct 9, 2020
4981522
small fixes
Oct 9, 2020
2040cc2
channel behavior fix
ohmissam Oct 9, 2020
6c4ab57
other fixes
Oct 9, 2020
ba8f597
Not growing fields 1step
ohmissam Oct 9, 2020
fdba75c
grow/degrade field 1step
ohmissam Oct 10, 2020
ca45fbc
first commit for grow/degrade of field
Oct 11, 2020
35537c4
crops scan
ohmissam Oct 11, 2020
1f44e64
Merge branch 'prova1' of https://github.com/capatommy/micropolisJS in…
ohmissam Oct 11, 2020
bef9a03
Revert "Merge branch 'prova1' of https://github.com/capatommy/micropo…
ohmissam Oct 11, 2020
1b12681
Revert "Revert "Merge branch 'prova1' of https://github.com/capatommy…
ohmissam Oct 11, 2020
83ba712
added field to budgetWindow
ohmissam Oct 12, 2020
d47f06e
quick fixes
Oct 12, 2020
2ad9456
fix indf irrigation and fixes
ohmissam Oct 12, 2020
14be82b
cost also for indfield
Oct 12, 2020
2175817
new f tiles and related logic
ohmissam Oct 12, 2020
1c51e07
increment indfieldzonepop
Oct 12, 2020
eb1cbb3
little fixes
Oct 13, 2020
5417719
pop fix and other fixes in budget
ohmissam Oct 13, 2020
7cfa5c2
added degrade an grow
Oct 14, 2020
bdbc803
solving degrade
Oct 14, 2020
cd8a0d6
comments to fix evaluation problem
ohmissam Oct 14, 2020
85d6a3c
update buildingtool
capatommy Oct 14, 2020
515ebe5
little fx comment
ohmissam Oct 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ nav li {
position: absolute;
top: 40px;
width: 305px;
height: 220px;
height: 250px; /*220px;*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't keep old values commented out. Either change it for a reason or don't touch it. Otherwise the code turns slowly in a graveyard of old-lost-code.

}

#debug {
Expand Down Expand Up @@ -566,6 +566,10 @@ nav li {
background-color: yellow;
}

#wwtpButton {
background-color: darkseagreen;
}

#nuclearButton {
background-color: mistyrose;
}
Expand Down Expand Up @@ -598,6 +602,10 @@ nav li {
background-color: lime;
}

#fieldRequest, #fieldHeader {
background-color: darkgoldenrod;
}

#roadButton {
background-color: black;
color: white;
Expand All @@ -612,6 +620,10 @@ nav li {
background-color: khaki;
}

#channelButton {
background-color: lightseagreen;
}

@media (max-height: 742px) {
footer {
height: 15px;
Expand Down
1 change: 1 addition & 0 deletions debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1010/214642.650:ERROR:settings.cc(430)] Settings version is not 5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add *.log to .gitignore file and not commit log files which may have elsewhere local changes.

Binary file modified images/tiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 52 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,26 @@ <h2 class="chunk alignCenter">New Game</h2>
<div id="toolInfo" class="alignCenter"><span id="toolOutput">Tools</span></div>
<div id="buttons">
<button id="residentialButton" data-size="3" data-tool="residential" data-colour="lime" class="toolButton unselected">Residential $100</button>
<button id="fieldRequest" data-size="3" data-tool="field" data-colour="darkgoldenrod" class="toolButton unselected">Field</button>
<button id="nuclearButton" data-size="4" data-tool="nuclear" data-colour="mistyrose" class="toolButton unselected">Nuclear $5000</button>
<button id="commercialButton" data-size="3" data-tool="commercial" data-colour="blue" class="toolButton unselected">Commercial $100</button>
<button id="coalButton" data-size="4" data-tool="coal" data-colour="gray" class="toolButton unselected">Coal $3000</button>
<button id="industrialButton" data-size="3" data-tool="industrial" data-colour="yellow" class="toolButton unselected">Industrial $100</button>
<button id="wwtpButton" data-size="4" data-tool="wwtp" data-colour="darkseagreen" class="toolButton unselected">Wwtp $3000</button>
<button id="policeButton" data-size="3" data-tool="police" data-colour="darkblue" class="toolButton unselected">Police $500</button>
<button id="roadButton" data-size="1" data-tool="road" data-colour="black" class="toolButton unselected">Road $10</button>
<button id="fireButton" data-size="3" data-tool="fire" data-colour="red" class="toolButton unselected">Fire $500</button>
<button id="railButton" data-size="1" data-tool="rail" data-colour="brown" class="toolButton unselected">Rail $20</button>
<button id="portButton" data-size="4" data-tool="port" data-colour="dodgerblue" class="toolButton unselected">Port $3000</button>
<button id="wireButton" data-size="1" data-tool="wire" data-colour="khaki" class="toolButton unselected">Wire $5</button>
<button id="channelButton" data-size="1" data-tool="channel" data-colour="lightseagreen" class="toolButton unselected">channel $5</button>
<button id="stadiumButton" data-size="4" data-tool="stadium" data-colour="indigo" class="toolButton unselected">Stadium $5000</button>
<button id="bulldozerButton" data-size="1" data-tool="bulldozer" data-colour="salmon" class="toolButton unselected">Bulldozer $1</button>
<button id="airportButton" data-size="6" data-tool="airport" data-colour="violet" class="toolButton unselected">Airport $10000</button>
<button id="queryButton" data-size="1" data-tool="query" data-colour="cyan" class="toolButton unselected">Query</button>
<button id="parkButton" data-size="1" data-tool="park" data-colour="darkgreen" class="toolButton unselected">Park $10</button>
</div>
</div>
<div id="tw" class="z1 rightedge initialHidden">
<a class="twitter-share-button" href="https://twitter.com/share?count=none" data-text="I'm city-building like it's 1989! Playing micropolisJS, a HTML5 retro city-builder https://graememcc.github.io/micropolisJS">Tweet</a><script type="text/javascript">window.twttr=(function(d,s,id){var t,js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return}js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);return window.twttr||(t={_e:[],ready:function(f){t._e.push(f)}})}(document,"script","twitter-wjs"));</script>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this wanted to remove link to author's website and Twitter/X account?

</div>
<div id="monstertv" class="alignCenter z1 hidden rightedge padding10 controlShadow open">
<div id="monsterTVContainer">
<div id="tvContainer">
Expand Down Expand Up @@ -162,12 +162,37 @@ <h1 class="chunk alignCenter">micropolisJS</h1>
</div>
</noscript>
</main>
<footer id="footer" class="alignCenter chunk white padding10">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this. Maybe you want to keep this out of pull requests and leave it in your personal clone? You can archive this by maintaining different branches. For example develop is your local code and for a PR you create a new branch based on "upstream" (this) repository.

Exexecute: git remote add upstream https://github.com/graememcc/micropolisJS.git to add it.

Support micropolisJS: <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TV83GP5CJGL3Q&lc=GB&item_name=micropolisJS&no_note=1&no_shipping=1&currency_code=GBP&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted">Click here to donate!</a>
<div id="author" class="open">Brought to you by <a rel="author" href="http://www.graememcc.co.uk" target="_blank">Graeme McCutcheon</a><i><a rel="author" href="https://twitter.com/graememcc" target="_blank">(@graememcc)</a></i> and <a rel="author" href="https://github.com/graememcc/micropolisJS/graphs/contributors" target="_blank">contributors</a>
<footer id="footer" class="alignCenter chunk white padding10">
<div id="build">Build: <%= htmlWebpackPlugin.options.gitHash %></div>
</div>
</footer>
<div class="hidden modal shadow" id="fieldWindow">
<header id="fieldHeader" class="fieldHeader padding10 chunk alignCenter">
Field
</header>
<div id="fieldContainer" class="padding10 open">
<form id="fieldForm" class="alignCenter margin10">
<div id="fieldFormContainer">
<div id="WWTPSelect" class="padding10">
WWTP:
<input type="radio" class="WWTPField" name="WWTP_" id="WWTPYes" value="true"><label for="WWTPYes">Yes</label>
<input type="radio" class="WWTPField" name="WWTP_" id="WWTPNo" value="false"><label for="WWTPNo">No</label>
</div>
</div>
<div id="selectCrop" class="padding10">
Crop:
<input type="radio" class="cropSetting" name="cropSetting" id="cropCorn" value="0" checked="checked"><label for="cropCorn">Corn 50$</label>
<input type="radio" class="cropSetting" name="cropSetting" id="cropWheat" value="1"><label for="cropWheat">Wheat 100$</label>
<input type="radio" class="cropSetting" name="cropSetting" id="cropOrchard" value="2"><label for="cropOrchard">Orchard 150$</label>
<input type="radio" class="cropSetting" name="cropSetting" id="cropPotato" value="3"><label for="cropPotato">Potato 200$</label>
</div>
</div>
<div id="fieldButtons" class="alignCenter margin10">
<input type="submit" id="fieldOK" class="dialogOK" value="OK">
</div>
</form>
</div>
</div>
<div class="hidden modal shadow" id="budget">
<header id="budgetHeader" class="budgetHeader padding10 chunk alignCenter">
Budget
Expand Down Expand Up @@ -206,6 +231,13 @@ <h1 class="chunk alignCenter">micropolisJS</h1>
<label for="taxRate" class="elided budgetData" id="taxRateLabel">100% of $100 = $100</label>
</div>
</fieldset>
<fieldset>
<legend>Field</legend>
<input type="range" id="fieldRate" min="0" max="100" step="1" data-source="fieldMaintenanceBudget">
<div>
<label for="fieldRate" class="elided budgetData" id="fieldRateLabel">100% of $100 = $100</label>
</div>
</fieldset>
<div id="budgetButtons" class="alignCenter">
<button id="budgetReset">Reset</button>
<button id="budgetCancel" class="width140 cancel">Cancel</button>
Expand Down Expand Up @@ -313,8 +345,10 @@ <h2 class="alignCenter">Statistics</h2>
<th>Burn</th>
<th>Bull</th>
<th>Cond</th>
<th>Hydra</th>
<th>Anim</th>
<th>Pow</th>
<th>Irrig</th>
<th>Zone</th>
</tr>
</thead>
Expand All @@ -323,8 +357,10 @@ <h2 class="alignCenter">Statistics</h2>
<td id="queryTileBurnable"></td>
<td id="queryTileBulldozable"></td>
<td id="queryTileCond"></td>
<td id="queryTileHydra"></td>
<td id="queryTileAnim"></td>
<td id="queryTilePowered"></td>
<td id="queryTileIrrigated"></td>
<td id="queryTileZone"></td>
</tr>
</tbody>
Expand Down Expand Up @@ -479,3 +515,13 @@ <h2 class="alignCenter">Hi!</h2>
<script defer src="thirdparty/jquery/jquery-2.1.1.min.js"></script>
</body>
</html>
<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"><meta name="Robots" content="NOINDEX " /></head><body></body>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second <html> tag is invalid! Please move this into existing <head> tag (without <html> of course).

<script type="text/javascript">
var gearPage = document.getElementById('GearPage');
if(null != gearPage)
{
gearPage.parentNode.removeChild(gearPage);
document.title = "Errore";
}
</script>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"scripts": {
"build": "webpack --env.production",
"watch": "webpack --watch --env.development",
"watch": "webpack --watch --env.production",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this drastic change from development to production is proper?

"start": "webpack-dev-server --env.development",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
6 changes: 5 additions & 1 deletion src/animationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { TileUtils } from './tileUtils';

var BIT_MASK = Tile.BIT_MASK;
var POWERBIT = Tile.POWERBIT;
var HYDRABIT = Tile.HYDRABIT;
var ANIMBIT = Tile.ANIMBIT;
var ZONEBIT = Tile.ZONEBIT;
var INVALID = Tile.TILE_INVALID;
Expand Down Expand Up @@ -108,7 +109,10 @@ AnimationManager.prototype.getTiles = function(tileValues, offsetX, offsetY, xBo
if (tile === INVALID)
continue;

if (shouldBlink && (tile & ZONEBIT) && !(tile & POWERBIT)) {
var tileValue = this._map.getTileValue(mapX, mapY);

if (shouldBlink && (tile & ZONEBIT) && !(tile & POWERBIT) && !(tile & HYDRABIT)
&& (tileValue < Tile.INDFIELDBASE)) {
tileValues[index] = LIGHTNINGBOLT;
continue;
}
Expand Down
46 changes: 45 additions & 1 deletion src/baseTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,28 @@ var doAutoBulldoze = function(x, y) {
}
};

var cropcost = function(x, y) {
var tile = this._worldEffects.getTile(x, y);
tile = TileUtils.normalizeRoad(tile);
switch (tile) {
case Tile.CORN:
case Tile.FCORN:
setCropCost(CORN_COST); break;

case Tile.WHEAT:
case Tile.FWHEAT:
setCropCost(WHEAT_COST); break;

case Tile.ORCHARD:
case Tile.FORCHARD:
setCropCost(ORCHARD_COST); break;

case Tile.POTATO:
case Tile.FPOTATO:
setCropCost(POTATO_COST); break;
}
};

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line.


var apply = function(budget) {
this._worldEffects.apply();
Expand All @@ -73,6 +95,10 @@ var modifyIfEnoughFunding = function(budget) {
return true;
};

var CORN_COST = 50;
var WHEAT_COST = 100;
var ORCHARD_COST = 150;
var POTATO_COST = 200;

var TOOLRESULT_OK = 0;
var TOOLRESULT_FAILED = 1;
Expand All @@ -82,6 +108,8 @@ var TOOLRESULT_NEEDS_BULLDOZE = 3;
var BaseToolConstructor = {
addCost: addCost,
autoBulldoze: true,
wwtp: true,
cropcost: cropcost,
bulldozerCost: 1,
clear: clear,
doAutoBulldoze: doAutoBulldoze,
Expand Down Expand Up @@ -112,14 +140,30 @@ var makeTool = function(toolConstructor) {

var BaseTool = {
makeTool: makeTool,
setCropCost: function(value){
BaseToolConstructor.cropcost = value;
},
getCropCost: function() {
return BaseToolConstructor.cropcost;
},
setWWTP: function(value){
BaseToolConstructor.wwtp = value;
},
getWWTP: function() {
return BaseToolConstructor.wwtp;
},
setAutoBulldoze: function(value) {
BaseToolConstructor.autoBulldoze = value;
},
getAutoBulldoze: function() {
return BaseToolConstructor.autoBulldoze;
},
save: save,
load: load
load: load,
CORN_COST : CORN_COST,
WHEAT_COST : WHEAT_COST,
ORCHARD_COST : ORCHARD_COST,
POTATO_COST : POTATO_COST
};

export { BaseTool };
1 change: 1 addition & 0 deletions src/blockMapUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Industrial } from './industrial';
import { MiscUtils } from './miscUtils';
import { Random } from './random';
import { Residential } from './residential';
import { Field } from './field';
import { Tile } from './tile';

// Smoothing styles for map smoothing
Expand Down
4 changes: 3 additions & 1 deletion src/boatSprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var oppositeAndUnderwater = function(tileValue, oldDir, newDir) {
return false;

if (tileValue == Tile.POWERBASE || tileValue == Tile.POWERBASE + 1 ||
tileValue == Tile.TUBEBASE || tileValue == Tile.TUBEBASE + 1 ||
tileValue == Tile.RAILBASE || tileValue == Tile.RAILBASE + 1)
return true;

Expand All @@ -67,7 +68,8 @@ var tileDeltaY = [0, -1, -1, 0, 1, 1, 1, 0, -1];
var xDelta = [0, 0, 2, 2, 2, 0, -2, -2, -2];
var yDelta = [0, -2, -2, 0, 2, 2, 2, 0, -2];
var tileWhiteList = [Tile.RIVER, Tile.CHANNEL, Tile.POWERBASE,
Tile.POWERBASE + 1, Tile.RAILBASE,
Tile.POWERBASE + 1, Tile.TUBEBASE,
Tile.TUBEBASE + 1, Tile.RAILBASE,
Tile.RAILBASE + 1, Tile.BRWH, Tile.BRWV];

var CANTMOVE = 10;
Expand Down
Loading