Re: custom damage nouns
[email protected] Tue, 14 Mar 2006 14:33:34 -0500
| Newsgroups | gmane.games.devel.mud.rom |
|---|---|
| Message-ID | <[email protected]> |
Quoting Chad Simmons <[email protected]>: > --- [email protected] wrote: > >> 1. Even though the ROM is technically written in C, and C (as specified >> AFAIK) does not support default values for function arguments, if I am using > a >> recent version of gcc, can I use default values for function >> arguments? Sort > >> of the same way I can use // for comments? > > > No, C doesn't have any ability to default function arguments. You can however > compile it as C++ with only a few changes, and then you'd have no trouble > defaulting the arguments to your function. > > >> I want to be able to send a string to the damage() (and subsequently to >> dam_message()) function to use as an arbitrary attack noun and I do not want >> to have to find every call to damage() and tack a ', NULL' on the >> end for all >> the places I'm still using the attack table/skill table damage noun. > > > You could do this with either a preprocessor macro, or a wrapper function. I > prefer the wrapper method as it is less likely to mess with gdb. Just > take the > meat from your damage() function and move it to a new function called > custom_damage which takes all the normal arguments you'd pass to damage as > well as this new custom attack noun. Then just have your damage function call > custom_damage and pass it's args and NULL for the last one. > Thanks for the help. I went with the wrapper method and things seem to be working out great! Now I just need my builders to start adding these things to weapons! I didn't do it exactly like how you describe, I more or less just duplicated the whole damage function and dam_message function and added my custom bits; it occurred to me that there had to be a way to consolidate them but it hadn't occurred to me until I read this. I'll be changing that soon since my fight.c file seems bloated now (~130k) > >> Does fread_string start reading from the place the file pointer left off or >> does it read in an entire line? > > > All the fread functions start reading at the current position in the file > AFAIK. > Good good, with items having 10 values, in area files I'm reading in the last value in as a string then depending on the item type I either store it in a non-type specific char pointer or pass it through atoi and store the value in 'value[9]'. I think it would probably be 'better' to just leave the 10 values as numbers and simply add another text field to area files... but, with OLC no one really has a need to look at the area file (except me when I forgot to save the ~ at the end of the line when I was first testing things, area file have version numbers now so I don't have to deal with that) so I should not have to concern myself with their format right? Would it make any difference if the string was on its own line as opposed to the end of another line? Anyways, thanks a bunch and keep up the good work. Jaagari AnimeMUD II (pending name change) anime2.ipupdater.net 7000 -- ROM mailing list [email protected] Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom