Abs function
Moderator: Committer
Abs function
not sure if there are some other files that need changes, seems ok to me and compiled just fine... have a look and tell me if i missed something...
EDIT: any code provided here by me is released under GPL 2.0
EDIT: any code provided here by me is released under GPL 2.0
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
Last edited by georgido on Wed Jan 23, 2013 8:37 am, edited 1 time in total.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Abs function
Please edit your post to note that you release any changes under the GPL 2.0 or later.
Re: Abs function
doneGeoff the Medio wrote:Please edit your post to note that you release any changes under the GPL 2.0 or later.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Abs function
Have you tested using the new Abs function in a content script?
Re: Abs function
should have mentioned it before, not sure how to test it...Geoff the Medio wrote:Have you tested using the new Abs function in a content script?
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Abs function
Use it in a content script for an effect on a building, ship, tech, or similar. There are examples of using sin and cos in buildings.txt
Re: Abs function
ook tested it and worked fine... changed the buildcost of the evacuation building in buildings.txt from 10 to abs(50) and then to abs(-50) and both times the cost appeared as 50.0 in the building list... tried also for abs(0) and cost appeared as 0.0Geoff the Medio wrote:Use it in a content script for an effect on a building, ship, tech, or similar. There are examples of using sin and cos in buildings.txt
also tried for non-integer values (abs(0.5) and abs(-0.5)) and got the results expected (0.50)... if there's any other case you'd like me to test, tell me...
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Abs function
Couple things about the patch:
* Replace tabs with four spaces.
* You could probably use std::abs or similar to simplify the implementation of the actual absolute value calculation.
* Replace tabs with four spaces.
* You could probably use std::abs or similar to simplify the implementation of the actual absolute value calculation.
Re: Abs function
there you are... tested as well...Geoff the Medio wrote:Couple things about the patch:
* Replace tabs with four spaces.
* You could probably use std::abs or similar to simplify the implementation of the actual absolute value calculation.
again, any code provided is released under GPL 2.0
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]