commit d356b8a1ac8729945be0467ca3f4bd56696b4cac
Author: elexis <elexis1@users.noreply.github.com>
Date: Wed Oct 26 14:28:53 2016 +0200
Fix a serious map placement bug that for example caused latium to have nearly no metal and corinthian isthmus to have very few fish.
Reason being the place functions of SimpleGroup and RandomGroup not returning an array with the results but only a boolean.
For the createObjectGroup function that wasn't needed (because the objects were placed in the place group, contrary to other placer prototypes),
but createObjectGroups and createObjectGroupsByAreas would parse the returned false by these two affected placer prototypes as a success (!== undefined), thus abort placing early.
diff --git a/binaries/data/mods/public/maps/random/guadalquivir_river.js b/binaries/data/mods/public/maps/random/guadalquivir_river.js
index 005e70c..88ce089 100644
a
|
b
|
createDecoration
|
364 | 364 | [new SimpleObject(aLillies, 1,2, 0,1)] |
365 | 365 | ], |
366 | 366 | [ |
367 | | scaleByMapSize(800, 12800), |
368 | | scaleByMapSize(800, 12800) |
| 367 | scaleByMapSize(750, 1500), |
| 368 | scaleByMapSize(750, 1500) |
369 | 369 | ], |
370 | 370 | stayClasses(clShallow, 0) |
371 | 371 | ); |
… |
… |
createFood
|
405 | 405 | [new SimpleObject(oFish, 2,3, 0,2)] |
406 | 406 | ], |
407 | 407 | [ |
408 | | 25 * numPlayers |
| 408 | scaleByMapSize(10, 50) |
409 | 409 | ], |
410 | | avoidClasses(clLand, 2, clRiver, 1) |
| 410 | avoidClasses(clLand, 2, clRiver, 1, clFood, 12) |
411 | 411 | ); |
412 | 412 | |
413 | 413 | RMS.SetProgress(85); |
diff --git a/binaries/data/mods/public/maps/random/rmgen/placer.js b/binaries/data/mods/public/maps/random/rmgen/placer.js
index 41e8a83..4a87d8f 100644
a
|
b
|
SimpleGroup.prototype.place = function(player, constraint)
|
527 | 527 | var objs = element.place(this.x, this.z, player, this.avoidSelf, constraint); |
528 | 528 | |
529 | 529 | if (objs === undefined) |
530 | | return false; |
| 530 | return undefined; |
531 | 531 | |
532 | 532 | resultObjs = resultObjs.concat(objs); |
533 | 533 | } |
… |
… |
SimpleGroup.prototype.place = function(player, constraint)
|
543 | 543 | this.tileClass.add(Math.floor(obj.position.x/CELL_SIZE), Math.floor(obj.position.z/CELL_SIZE)); |
544 | 544 | } |
545 | 545 | |
546 | | return true; |
| 546 | return resultObjs; |
547 | 547 | }; |
548 | 548 | |
549 | 549 | ///////////////////////////////////////////////////////////////////////////////////////// |
… |
… |
RandomGroup.prototype.place = function(player, constraint)
|
574 | 574 | |
575 | 575 | var resultObjs = placer.place(this.x, this.z, player, this.avoidSelf, constraint); |
576 | 576 | if (resultObjs === undefined) |
577 | | return false; |
| 577 | return undefined; |
578 | 578 | |
579 | 579 | // Add placed objects to map |
580 | 580 | for (let obj of resultObjs) |
… |
… |
RandomGroup.prototype.place = function(player, constraint)
|
586 | 586 | this.tileClass.add(Math.floor(obj.position.x/CELL_SIZE), Math.floor(obj.position.z/CELL_SIZE)); |
587 | 587 | } |
588 | 588 | |
589 | | return true; |
| 589 | return resultObjs; |
590 | 590 | }; |
diff --git a/binaries/data/mods/public/maps/random/rmgen/utilityfunctions.js b/binaries/data/mods/public/maps/random/rmgen/utilityfunctions.js
index 869add6..bd107ca 100644
a
|
b
|
function createForests(terrainset, constraint, tileclass, numMultiplier, biomeID
|
98 | 98 | { |
99 | 99 | var MIN_TREES = 1000 * numMultiplier; |
100 | 100 | var MAX_TREES = 6000 * numMultiplier; |
101 | | var P_FOREST = 0.52; |
| 101 | var P_FOREST = 0.75; |
102 | 102 | } |
103 | 103 | else |
104 | 104 | { |
105 | 105 | var MIN_TREES = 500 * numMultiplier; |
106 | 106 | var MAX_TREES = 3000 * numMultiplier; |
107 | | var P_FOREST = 0.7; |
| 107 | var P_FOREST = 0.85; |
108 | 108 | } |
109 | 109 | var totalTrees = scaleByMapSize(MIN_TREES, MAX_TREES); |
110 | 110 | var numForest = totalTrees * P_FOREST; |