Vampires x_x

Posted by Mopop on Tue 31 Jan 2006 04:45 AM — 12 posts, 40,704 views.

#0
I been adding all my new races (all 21 of them) and I needed to remove vampire. I spent almost all day doing this and I was down to one thing where it was checking for VAMP_AC in mstat which i removed.


#define GET_AC(ch)		((ch)->armor				    \
				    + ( IS_AWAKE(ch)			    \
				    ? dex_app[get_curr_dex(ch)].defensive   \
				    : 0 )				    \
				    + VAMP_AC(ch))


I removed the + VAMP_AC

after that I compiled and got a strange error instead of thinking I took care of it.

act_wiz.c: In function `do_mstat':
act_wiz.c:1917: error: parse error before ';' token


pager_printf_color( ch, "&cHitroll : &C%-5d           &cAlign  : &w%-5d           &cArmorclass: &w%d\r\n",
                       GET_HITROLL( victim ), victim->alignment, GET_AC( victim ) );


Yeah It was fine, till now? What went wrong??? I would like to get these vampires out of mind I been doing this all day and I am pretty sure I screwed up nanny removing them. (Which I will probably have to post soon, depending if it worked or not :P) As always thanks in advance!

USA #1
Your GET_AC probably looks like this:

#define GET_AC(ch)		((ch)->armor				    \
				    + ( IS_AWAKE(ch)			    \
				    ? dex_app[get_curr_dex(ch)].defensive   \
				    : 0 )				    \

Note that you have a trailing backslash at the end of the last line.

The backslash means to extend the macro to the next line. So you don't want it if the macro does not, in fact, extend.

Furthermore, if your GET_AC looks like the above, it is missing a closing parenthesis. You want it to look like:

#define GET_AC(ch)		((ch)->armor				    \
				    + ( IS_AWAKE(ch)			    \
				    ? dex_app[get_curr_dex(ch)].defensive   \
				    : 0 )				    \
				    )
#2
Wow dur lol, simple simple. I really suck at () and brackets. Why did it mention it in act wiz tho? and not in mud.h? Thats what threw me off. ^_^ anywho glad to see a clan compile now to see how much damage i did lol!
USA #3
It's because the macro is expanded in act_wiz.cpp. What you see in mud.h isn't a function; it's what's called a macro. A macro is expanded to its text whenever you use it. So, strictly speaking, the error really was in act_wiz.cpp because that's where the macro was expanded.
USA #4
Working in C++ lately, Ksilyan? =P

Just so you don't get confused Mopop, I'm sure he meant act_wiz.c
USA #5
Err, uhh... *looks around innocently*

Sorry :P Yes I did mean act_wiz.c.
USA #6
Just curious. If you're removing the vampire race, why are you taking out vamp_ac exactly? Do you not want the vampire _class_ to have that functionality anymore (ac adjustment based on time of day)? I always thought that was kind of cool, but maybe that's just me. ;)

USA #7
He's actually trying to remove the whole vampire race/class coding from all the code, he's just going about via brute force method without fully understanding what he's yanking... I tried to advise him that the easy solution was to not remove it at all but just make vampire a non-player class. *shrug*
USA #8
Oh. Well in that case, nevermind. ;)


#9
I like doing things the hard way as a crash course to learn more about the code I guess =P I duuno call me stubborn haha.
USA #10
The only problem is that you might be breaking things in a very subtle manner, that will be hard if not impossible to detect later on. The errors could lead to crashes, or perhaps even worse, lead to changes in game play that you didn't intend and aren't aware about.

Still, it can be a good way to learn, as long as you're careful. And if you document every change you make, you should be ok.

I'm guessing that I should have mentioned earlier that you should comment at every place you removed something. :-)
#11
I hope not, Its only Vampires. Everything seems to be running great right now. I had a little problem a bit ago but it was because of a ~ I forgot in tongues.dat

If a problem arises I will try to find it and remove it, all part of my crash course :) I thank you for the advice and help tho ^_^ now If only I could figure something out in do_speak *mumbles*