Added new Random maps. Updated the existing ones with the new starting unit formation.
Description
Description
Details
Details
- Auditors
elexis - Committed
Spahbod Feb 24 2012, 11:34 AM - Parents
- rP11136: Automated build.
- Branches
- Unknown
- Tags
Event Timeline
Comment Actions
Problem: Map needs to work with 8 different mapsizes
Solution: Copy the entire code of map 8 times
Comment Actions
The meme posted about snowflake searocks also works for guadalquivir_river.js. The memes from D252 also apply.
/ps/trunk/binaries/data/mods/public/maps/random/aegean_sea.js | ||
---|---|---|
417 | Really explaining the argument of the painter constructors in hundreds of calls with a bunch of tabs? | |
485 | What would we have done without these comments... | |
/ps/trunk/binaries/data/mods/public/maps/random/anatolian_plateau.js | ||
1 | Can't add an inline comment here for any reason. That loop was useless (if we already add a path from X to Y, then we don't need another from Y to X): for (m = 0; m < numIslands; m++){ for (n = 0; n < numIslands; n++){ if(isConnected[m][n] == 1){ isConnected[n][m] = 1; } } } | |
/ps/trunk/binaries/data/mods/public/maps/random/guadalquivir_river.js | ||
308 | unused var | |
310 | That value is never read from as it is overwritten in each if-statement below | |
314 | After a too long time, I figured cu = curve | |
318 | The wrong indentation mislead me to remove a wrong brace and commit a JS syntax error. | |
322 | Took me only a day of solving equations to come to the conclusion that this is an exact copy of the other dozens of river functions and give those magic numbers human readable names. That -3 had been some other constant some day, but all the constants were squelched so that noone could recognize them (and thus change them feasibly) anymore. -> rP20185 | |
339 | Not to speak of 9 pairs of unneeded braces in each of the copies of this line. | |
/ps/trunk/binaries/data/mods/public/maps/random/the_nile.js | ||
295 | copies every mistake from guadalquivir river |
/ps/trunk/binaries/data/mods/public/maps/random/rivers.js | ||
---|---|---|
641 | No need to compute the angle with that formula, as its just halfway between the two player angles. | |
641 | isRiver[c][numPlayers] doesn't have to be a two-dimensional array, nor a one-dimensional array. In this commit there is a river between each neighbor, later it was changed to only add rivers between players. Can just query that, no need to save it in a two dimensional array where one dimension is never used. | |
657 | No need for an array in thetha, seed, shallowstuff if it can be just determined in the loop below | |
666 | Only one player loop needed as we only need to compare neighbors, not every player with everyone else. The playerloop should be the outermost, as everything inside it is about that one river for that one player. | |
693 | ^ mess |
Comment Actions
All of the issues yelled about above were fixed.
The rndRiver copies were removed by iirc spahbod in a later commit.
Most of the other copied code is equally copied in all the other maps.
So all of the issues that can be complained about in particularly this commit are finished.
Hence marking this as audited.
/ps/trunk/binaries/data/mods/public/maps/random/rivers.js | ||
---|---|---|
671 |
Readable code doesn't fear modification | |
673 | image point = foot of the perpendicular | |
677 | c = determinant, cross product | |
691 | sit is between 0 and 1 if the foot of the perpendicular is within the line segment given by the river start and end coordinates | |
692 | scaleByMapSize(5,15) = half river width | |
740 | duplication above |