ID:170076
 
Is there any way to have a #define'd filename copied into the resource file at compile time?

The following code won't compile.
#define ICON_FILE "something.dmi"

var/icon/I = '[ICON_FILE]'


[edit]
I just realized that I could put the ''s in the #define statement instead and it would work. Are there any other ways of doing this?
[/edit]
I think this may work

#define ICON_FILE 'temp.dmi'

mob
icon = ICON_FILE


You just can't have any #defines directly in a string literal.
Why not just do..
mob/icon = 'Whatever.dmi'
Then everything thats a mob will have that icon.
In response to Flame Sage
mob/icon = 'Whatever.dmi'
Then everything thats a mob will have that icon.

Then general reason for using a #define is that you are planning on using it in several places. That way if you need to change it you only need to change it once. The object oriented route only works if all the items share a common parent. Plus with a #define you can throw it in some easily accessable place with other constants so you don't have to dig through code to change it.
Jon88 wrote:
var/icon/I = '[ICON_FILE]'

Mind you, you've just assigned an icon file to I, but it's not an actual /icon unless you use new(file(ICON_FILE)).

Lummox JR