
Pages:<< prev 1 next >>


Fledgling

GroupMembers
Posts33
JoinedDec 20, 2010
I recent was trying to add new affect and i noticed a bug in the code.
if( !str_cmp( arg2, "affect" ) ) { affect_data *paf; bitset < MAX_RIS_FLAG > risabit; short loc; bool found = false; risabit.reset( ); //argument = one_argument( argument, arg2 ); argument = one_argument( argument, arg3 ); arg4 = argument; //if( arg2.empty( ) || argument.empty( ) ) if( arg3.empty( ) || argument.empty( ) ) { ch->print( "Usage: oset <object> affect <field> <value>\r\n" ); return; } //loc = get_atype( arg2 ); loc = get_atype( arg3 ); if( loc < 1 ) { //ch->printf( "Unknown field: %s\r\n", arg2.c_str( ) ); ch->printf( "Unknown field: %s\r\n", arg3.c_str( ) ); return; } if( loc == APPLY_AFFECT ) { argument = one_argument( argument, arg3 ); if( loc == APPLY_AFFECT ) { value = get_aflag( arg3 ); if( value < 0 || value >= MAX_AFFECTED_BY ) ch->printf( "Unknown affect: %s\r\n", arg3.c_str( ) ); else found = true; } } else if( loc == APPLY_RESISTANT || loc == APPLY_IMMUNE || loc == APPLY_SUSCEPTIBLE || loc == APPLY_ABSORB ) { string flag; //while( !arg3.empty( ) ) while( !arg4.empty( ) ) { //arg3 = one_argument( arg3, flag ); arg4 = one_argument( arg4, flag ); value = get_risflag( flag ); if( value < 0 || value >= MAX_RIS_FLAG ) ch->printf( "Unknown flag: %s\r\n", flag.c_str( ) ); else { risabit.set( value ); found = true; } } } else if( loc == APPLY_WEAPONSPELL || loc == APPLY_WEARSPELL || loc == APPLY_REMOVESPELL || loc == APPLY_STRIPSN || loc == APPLY_RECURRINGSPELL || loc == APPLY_EAT_SPELL ) { //ch->printf( "Value of Arg3 check: %s\r\n", value ); argument = one_argument ( argument, arg3); //ch->printf( "Value of Arg3 check: %s\r\n", value ); value = skill_lookup( arg3 ); //ch->printf( "Value of Arg3 after lookup check: %d\r\n", value ); if( !IS_VALID_SN( value ) ) { ch->printf( "Invalid spell: %s\r\n", arg3.c_str( ) ); //ch->printf( "Invalid spell: %s\r\n", arg3.c_str( ) ); //ch->printf( "Value of Value: %d\r\n", value ); } else found = true; } else { //value = atoi( arg3.c_str( ) ); value = atoi( arg4.c_str( ) ); found = true; } if( !found ) return; paf = new affect_data; paf->type = -1; paf->duration = -1; paf->location = loc; paf->modifier = value; paf->rismod = risabit; paf->bit = 0; if( obj->extra_flags.test( ITEM_PROTOTYPE ) ) { if( loc != APPLY_WEARSPELL && loc != APPLY_REMOVESPELL && loc != APPLY_STRIPSN && loc != APPLY_WEAPONSPELL ) { list < char_data * >::iterator ich; list < obj_data * >::iterator iobj; for( ich = charlist.begin( ); ich != charlist.end( ); ++ich ) { char_data *vch = *ich; for( iobj = vch->carrying.begin( ); iobj != vch->carrying.end( ); ++iobj ) { obj_data *eq = *iobj; if( eq->pIndexData == obj->pIndexData && eq->wear_loc != WEAR_NONE ) vch->affect_modify( paf, true ); } } } obj->pIndexData->affects.push_back( paf ); } else obj->affects.push_back( paf ); ++top_affect; ch->print( "Object affect added.\r\n" ); return; }



Magician

GroupMembers
Posts189
JoinedSep 5, 2010
You might want to point out what the bug is and why it's a bug. And whether or not you fixed the bug and/or looking for help.



Fledgling

GroupMembers
Posts33
JoinedDec 20, 2010
Sorry about that I did not think I posted this yet. I started last night then ended up working on another issue.
This bug never passes all the arguments through. They needed to be incremented by 1.
This bug never passes all the arguments through. They needed to be incremented by 1.
Pages:<< prev 1 next >>