what i did was put int PROJ_STONE and so on at the top of the function. and now all i have is
if( bow->value[5] != arrow->value[4] )
{
char *msg = "You have nothing to fire...\n\r";
switch( bow->value[5] )
{
case PROJ_BOLT: msg = "You have no bolts...\n\r"; break;
case PROJ_ARROW: msg = "You have no arrows...\n\r"; break;
case PROJ_DART: msg = "You have no darts...\n\r"; break;
case PROJ_STONE: msg = "You have no slingstones...\n\r"; break;
}
send_to_char( msg, ch );
return;
}
here is the error message:
archery.c(1191) : error C2051: case expression not constant
archery.c(1192) : error C2051: case expression not constant
archery.c(1193) : error C2051: case expression not constant
archery.c(1194) : error C2051: case expression not constant
ok, i'm lookin and i think i need a default but i don't know what to put default or if i even need one. here's the whole function.
[code]
void do_fire( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim = NULL;
OBJ_DATA *arrow;
OBJ_DATA *bow;
sh_int max_dist;
int PROJ_STONE;
int PROJ_BOLT;
int PROJ_ARROW;
int PROJ_DART;
if( ( bow = get_eq_char( ch, WEAR_MISSILE_WIELD ) ) == NULL )
{
send_to_char( "But you are not wielding a missile weapon!!\n\r", ch );
return;
}
one_argument( argument, arg );
if ( arg[0] == '\0' && ch->fighting == NULL )
{
send_to_char( "Fire at whom or what?\n\r", ch );
return;
}
if( !str_cmp( arg, "none" ) || !str_cmp( arg, "self" ) || victim == ch )
{
send_to_char( "How exactly did you plan on firing at yourself?\n\r", ch );
return;
}
if( ( arrow = get_eq_char( ch, WEAR_HOLD ) ) == NULL )
{
send_to_char( "You are not holding a projectile!\n\r", ch );
return;
}
if( arrow->item_type != ITEM_PROJECTILE )
{
send_to_char( "You are not holding a projectile!\n\r", ch );
return;
}
/* modify maximum distance based on bow-type and ch's class/str/etc */
max_dist = URANGE( 1, bow->value[4], 10 );
if( bow->value[5] != arrow->value[4] )
{
char *msg = "You have nothing to fire...\n\r";
switch( bow->value[5] )
{
case PROJ_BOLT: msg = "You have no bolts...\n\r"; break;
case PROJ_ARROW: msg = "You have no arrows...\n\r"; break;
case PROJ_DART: msg = "You have no darts...\n\r"; break;
case PROJ_STONE: msg = "You have no slingstones...\n\r"; break;
}
send_to_char( msg, ch );
return;
}
/* Add wait state to fire for pkill, etc... */
WAIT_STATE( ch, 6 );
No, those shouldn't be ints, those should be constants of the form:
#define PROJ_STONE ???
where the ??? is the right number. I'd be a little surprised if those aren't in the snippet package somewhere... and they'd usually go into mud.h.
I'd try getting in touch with Samson to ask him about the defines... you probably don't want to put in random numbers there.
For the gsns, there should be a whole pile of:
extern int gsn_something_or_other;
in mud.h, and then in db.c those gsns are assigned the skill numbers from skill name lookups. Didn't the snippet ask you to do that too? Hmm... sounds like an incomplete snippet... :P
As was mentioned on our forums, the archery code requires the weapon profficiency patch to work. If that's not installed, then you'll get errors and the like, much like these.
Hmmm. I put in the weapon proficiency code, compiled, and checked it out. Worked great too.
But when I put in the archery code I get the same errors as above. I have since gone back through and checked both the weapon proficiency instructions and files, and now the archery ones, and I have followed them to a t.
Maybe I am misreading an instruction somehow? The archery system sounds very cool. I'm going back to see if maybe the copy of either archery snippet or weapon prof snippet was updated/changed. Maybe I have an older version of one or the other. Anybody have a clue? How did you make out with it, Ithildin?
Gadush
Forget it, it was me. I somehow put the old files back into src before making clean and compiling. Doh! Apologies all. I went through each file and fixed it up, and it is working now.
Thanks,
Gadush