Ticket #1311 (closed defect: fixed)

Opened 14 months ago

Last modified 14 months ago

[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:

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

deep_forest.js (10.4 KB) - added by FeXoR 14 months ago.
fortress.js (12.9 KB) - added by FeXoR 14 months ago.
wall_builder.js (36.8 KB) - added by FeXoR 14 months ago.
wall_demo.js (10.0 KB) - added by FeXoR 14 months ago.
wall_demo.json (371 bytes) - added by FeXoR 14 months ago.
wall_builder_update.diff (90.9 KB) - added by leper 14 months 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 14 months ago.

Change History

comment:1 Changed 14 months ago by FeXoR

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 14 months ago by FeXoR (previous) (diff)

comment:2 Changed 14 months ago by FeXoR

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 Changed 14 months ago by FeXoR

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 14 months ago by FeXoR (previous) (diff)

Changed 14 months ago by FeXoR

Changed 14 months ago by FeXoR

Changed 14 months ago by FeXoR

Changed 14 months ago by FeXoR

Changed 14 months ago by FeXoR

comment:4 Changed 14 months ago by FeXoR

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 14 months ago by FeXoR (previous) (diff)

Changed 14 months ago by leper

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

comment:5 Changed 14 months ago by leper

  • Component changed from Core engine to UI & 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 Changed 14 months ago by FeXoR

  • 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 14 months ago by FeXoR (previous) (diff)

Changed 14 months ago by FeXoR

comment:7 Changed 14 months ago by leper

  • Owner set to leper
  • Status changed from new to closed
  • Resolution set to fixed

In 11515:

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

comment:8 Changed 14 months ago by leper

  • Keywords review, removed
  • Milestone changed from Backlog to Alpha 10

Thanks for the patch.

Note: See TracTickets for help on using tickets.