Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1311 closed defect (fixed)

[PATCH] Update wall_builder and add wall_demo random map

Reported by: FeXoR Owned by: leper
Priority: Must Have Milestone: Alpha 10
Component: UI & Simulation Keywords: rmgen, fix, update
Cc: Patch:

Description

Updated rmgen lib wall_builder.js:

  • Updated to new object placement in random maps
  • Updated to new walls and towers of celt, hele and iber
  • Tidied and documented code
  • Added linear and circular wall placement functions

Fix random map fortress:

  • Updated to the new method that fixes the poor placement since object placement changed

Added wall_demo random map as an code example

I still don't know what component to choose...

Attachments (7)

deep_forest.js (10.4 KB ) - added by FeXoR 12 years ago.
fortress.js (12.9 KB ) - added by FeXoR 12 years ago.
wall_builder.js (36.8 KB ) - added by FeXoR 12 years ago.
wall_demo.js (10.0 KB ) - added by FeXoR 12 years ago.
wall_demo.json (371 bytes ) - added by FeXoR 12 years ago.
wall_builder_update.diff (90.9 KB ) - added by leper 12 years ago.
Patch for wall_builder.js, fortress.js, wall_demo.js, wall_demo.json, deep_forest.js and deep_forest.json
wall_builder_update2.diff (93.6 KB ) - added by FeXoR 12 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 by FeXoR, 12 years ago

Further changes:

  • Fixed random map deep_forest that contained unused fortress placement (removed it)
  • Added placeCustomFortress that doesn't depend on fortressTypes associative array
  • Changed fortress placement in random map fortress.js to the new placement method
  • Added 'undefined' entity support for linear/circular walls (needed for entries)
  • Added documentation and brought it up to date
  • Added some checks and warnings

You'r to slow ;)

Last edited 12 years ago by FeXoR (previous) (diff)

comment:2 by FeXoR, 12 years ago

Updated patch to 11430

  • Added wall style 'romanSiege'
  • Added 'others' to wall styles including fences, columns, benches, tables, flags, ...
  • Fixed a minor bug that raises warnings when the last wall elements entity was 'undefined'
  • Added and clarify documentation

I'm to impatient x)

comment:3 by FeXoR, 12 years ago

Fixed the house placement for random map 'fortress'. Playtested and all get 50 population cap at start but Celts. Celts get 54 but I think it's better then 49 with one house less. Celtic fortresses only add 12 instead of 15 population cap anyway. And it was like that before. The 4 additional population cap comes from the barracks. THX much, Leper, for finding this!

Last edited 12 years ago by FeXoR (previous) (diff)

by FeXoR, 12 years ago

Attachment: deep_forest.js added

by FeXoR, 12 years ago

Attachment: fortress.js added

by FeXoR, 12 years ago

Attachment: wall_builder.js added

by FeXoR, 12 years ago

Attachment: wall_demo.js added

by FeXoR, 12 years ago

Attachment: wall_demo.json added

comment:4 by FeXoR, 12 years ago

The game was updated many times but AFAIK none of the files I edited. But just to make sure everything works fine with the update I added any single file changed as it should look after the patch. This ticked replaces Ticket #1288. Sorry for the 'double ticket'.

Last edited 12 years ago by FeXoR (previous) (diff)

by leper, 12 years ago

Attachment: wall_builder_update.diff added

Patch for wall_builder.js, fortress.js, wall_demo.js, wall_demo.json, deep_forest.js and deep_forest.json

comment:5 by leper, 12 years ago

Component: Core engineUI & Simulation

Some comments:

Move the comments after the function definition and before the opening brace in front of the function. Remove (or start to) the unneeded semi-colons.

wall_builder.js
You have some strange symbols (in the comments with the degree sign).
I'd replace the definitions in WallElement and other functions with ternary operators as in this.angle = (angle !== undefined) ? angle : 0*PI;.
line 293 typo 'exsists'
You should use === to check if something is undefined (as noted in our coding conventions).

That are just some things I noticed while reading some of the code.

comment:6 by FeXoR, 12 years ago

  • Removed all semicolons after closing brackets of function, for, while, if and else
  • Moved the comments from between function definition and opening brackets befor the function definition
  • Separated different parts of documentation more clearly
  • Removed the angles in degree from documentation
  • Removed the typo 'exsists' -> 'exists'
  • Changed ' == undefined' -> ' === undefined'
  • Changed to ternary operators

NOTE: A patch was added concerning most random maps while I edited including fortress.js. So I choose another filename for the patch: wall_builder_update2.diff. For me the patch applied cleanly after: revert -> deleting added files -> update -> patch

If I don't delete added files (wall_demo.js/.json) applying patch strangely states:

Rejected patch hunks for 'wall_builder.js'

--- binaries/data/mods/public/maps/random/rmgen/wall_builder.js

+++ binaries/data/mods/public/maps/random/rmgen/wall_builder.js

Last edited 12 years ago by FeXoR (previous) (diff)

by FeXoR, 12 years ago

Attachment: wall_builder_update2.diff added

comment:7 by leper, 12 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 11515:

Update wall_builder and add wall_demo map. Patch by FeXoR. Closes #1311.

comment:8 by leper, 12 years ago

Keywords: review removed
Milestone: BacklogAlpha 10

Thanks for the patch.

Note: See TracTickets for help on using tickets.