Ok I installed the weapon types snippet from samsons site.
Heres the error I get now.
build.c: In function `do_oset':
build.c:4196: case label not within a switch statement
build.c:4200: case label not within a switch statement
build.c:4209: case label not within a switch statement
build.c:4210: case label not within a switch statement
build.c:4211: case label not within a switch statement
build.c:4218: case label not within a switch statement
build.c:4219: case label not within a switch statement
build.c:4229: case label not within a switch statement
build.c:4234: case label not within a switch statement
build.c:4235: case label not within a switch statement
build.c:4236: case label not within a switch statement
build.c:4237: case label not within a switch statement
build.c:4195: break statement not within loop or switch
build.c:4199: break statement not within loop or switch
build.c:4208: break statement not within loop or switch
build.c:4217: break statement not within loop or switch
build.c:4228: break statement not within loop or switch
build.c:4233: break statement not within loop or switch
build.c:4243: break statement not within loop or switch
make[1]: *** [build.o] Error 1
make[1]: Leaving directory `/cygdrive/c/smaug/src'
make: *** [all] Error 2
The loops, cases and breaks strike me as odd.
Heres the code (somewhat modified by me...made only one break per case)
/*
* Make it easier to set special object values by name than number
* -Thoric
*/
tmp = -1;
switch( obj->item_type )
{
case ITEM_PROJECTILE:
if ( !str_cmp( arg2, "missiletype" ) )
{
int x;
value = -1;
for ( x = 0; x < sizeof( projectiles ) / sizeof( projectiles[0] ); x++ )
if ( !str_cmp( arg3, projectiles[x] ) )
value = x;
if ( value < 0 )
{
send_to_char( "Unknown projectile type.\n\r", ch );
return;
}
tmp = 4;
}
if ( !str_cmp( arg2, "damtype" ) )
{
int x;
value = -1;
for ( x = 0; x < sizeof( attack_table ) / sizeof( attack_table[0] ); x++ )
if ( !str_cmp( arg3, attack_table[x] ) )
value = x;
if ( value < 0 )
{
send_to_char( "Unknown damage type.\n\r", ch );
return;
}
tmp = 3;
break;
}
case ITEM_WEAPON:
if ( !str_cmp( arg2, "weapontype" ) )
{
int x;
value = -1;
for ( x = 0; x < sizeof( weapon_skills ) / sizeof( weapon_skills[0] ); x++ )
if ( !str_cmp( arg3, weapon_skills[x] ) )
value = x;
if ( value < 0 )
{
send_to_char( "Unknown weapon type.\n\r", ch );
return;
}
tmp = 4;
}
if ( !str_cmp( arg2, "damtype" ) )
{
int x;
value = -1;
for ( x = 0; x < sizeof( attack_table ) / sizeof( attack_table[0] ); x++ )
if ( !str_cmp( arg3, attack_table[x] ) )
value = x;
if ( value < 0 )
{
send_to_char( "Unknown damage type.\n\r", ch );
return;
}
tmp = 3;
}
if ( !str_cmp( arg2, "condition" ) ) tmp = 0;
}
if ( !str_cmp( arg2, "condition" ) ) tmp = 0;
break;
case ITEM_ARMOR:
if ( !str_cmp( arg2, "condition" ) ) tmp = 3;
if ( !str_cmp( arg2, "ac" ) ) tmp = 1;
break;
case ITEM_SALVE:
if ( !str_cmp( arg2, "slevel" ) ) tmp = 0;
if ( !str_cmp( arg2, "maxdoses" ) ) tmp = 1;
if ( !str_cmp( arg2, "doses" ) ) tmp = 2;
if ( !str_cmp( arg2, "delay" ) ) tmp = 3;
if ( !str_cmp( arg2, "spell1" ) ) tmp = 4;
if ( !str_cmp( arg2, "spell2" ) ) tmp = 5;
if ( tmp >=4 && tmp <= 5 ) value = skill_lookup(arg3);
break;
case ITEM_SCROLL:
case ITEM_POTION:
case ITEM_PILL:
if ( !str_cmp( arg2, "slevel" ) ) tmp = 0;
if ( !str_cmp( arg2, "spell1" ) ) tmp = 1;
if ( !str_cmp( arg2, "spell2" ) ) tmp = 2;
if ( !str_cmp( arg2, "spell3" ) ) tmp = 3;
if ( tmp >=1 && tmp <= 3 ) value = skill_lookup(arg3);
break;
case ITEM_STAFF:
case ITEM_WAND:
if ( !str_cmp( arg2, "slevel" ) ) tmp = 0;
if ( !str_cmp( arg2, "spell" ) )
{
tmp = 3;
value = skill_lookup(arg3);
}
if ( !str_cmp( arg2, "maxcharges" ) ) tmp = 1;
if ( !str_cmp( arg2, "charges" ) ) tmp = 2;
break;
case ITEM_CONTAINER:
if ( !str_cmp( arg2, "capacity" ) ) tmp = 0;
if ( !str_cmp( arg2, "cflags" ) ) tmp = 1;
if ( !str_cmp( arg2, "key" ) ) tmp = 2;
break;
case ITEM_SWITCH:
case ITEM_LEVER:
case ITEM_PULLCHAIN:
case ITEM_BUTTON:
if ( !str_cmp( arg2, "tflags" ) )
{
tmp = 0;
value = get_trigflag(arg3);
}
break;
if ( tmp >= 0 && tmp <= 3 )
{
if ( !can_omodify( ch, obj ) )
return;
obj->value[tmp] = value;
if ( IS_OBJ_STAT(obj, ITEM_PROTOTYPE) )
obj->pIndexData->value[tmp] = value;
return;
}
So what do you all think?
|