Feature Request #2790

Renum: Escape RPN expressions.

Added by Lakie over 9 years ago. Updated about 8 years ago.

Status:ClosedStart date:2011-06-23
Priority:NormalDue date:
Assignee:Lakie% Done:


Target version:5.1.2


I'd like to suggest the allowing of RPN expressions escape sequences so that RPN expressions can be used inside of Actions as well as sprite definitions. There is already a hook point within Renum for this, but the hook was left commented out.

This would allow for the following format, \<size>(<rpn>), an example could be \w(0x8000 VEH_ID +).

There are to methods of implementation that I could see:
  1. Altering both GrfCodec and Renum to support it.
  2. Alter only Renum, and have it rewrite the escape.

The former would require a fair amount of rewriting and duplication of code, due to GrfCodec not supporting the various commands linked to RPN expressions, and DoCalc being specifically designed for use only in Renum.

The latter is a less clean solution, but would require minimalist changes to achieve, it would require altering the original string, removing the RPN expression and replacing it with the RPN result instead.

I've attached two diffs, the first merely enables the existence (and value checking) of escape based RPN sequences, the second built upon the first, replaces the RPN with the result. (The third is the same as the second, but just writes the hexadecimal version for results over or equal to 0x8000).

escape-rpn.diff Magnifier (929 Bytes) Lakie, 2011-06-23 11:13

replace-rpn.diff Magnifier (963 Bytes) Lakie, 2011-06-23 11:13

replace-rpn-hex.diff Magnifier (1 KB) Lakie, 2011-06-23 11:13

Associated revisions

Revision 941:0e28011614e5
Added by Rubidium about 8 years ago

-Change: enable the existence (and value checking) of escape based RPN sequences (Lakie #2790)

Revision 942:5723db0c33ae
Added by Rubidium about 8 years ago

-Feature: replace RPN value of calculation during nforenum run (Lakie) (closes #2790)


#1 Updated by Rubidium almost 9 years ago

I'd personally go with nforenum rewriting the number, and keeping grfcodec simple. Especially since you should run nforenum anyhow for validations and what not.

#2 Updated by Rubidium about 8 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset 5723db0c33ae.

Also available in: Atom PDF