Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move short_descr from NPC_DATA to CHAR_DATA for future consolidation.…

… Remove empty NPC_DATA class. Update short_descr to string.
  • Loading branch information...
commit c2a7f20d99bbacddd81a3dd6e96a0477d860b9ea 1 parent 64e44c3
@Kline- authored
View
4 src/act_obj.c
@@ -2957,8 +2957,8 @@ DO_FUN(do_list)
stopcounter++;
rounded_cost = round_money_off( 10 * pet->level * pet->level, 1 );
snprintf( costbuf, MSL, "%s", money_string( rounded_cost ) );
- snprintf( buf, MSL, "[ @@W%3d@@g] @@c%-*s@@g @@W%-*s@@N \r\n", pet->level, ccode_len( pet->npcdata->short_descr, 30 ),
- capitalize( pet->npcdata->short_descr ), ccode_len( costbuf, 35 ), costbuf );
+ snprintf( buf, MSL, "[ @@W%3d@@g] @@c%-*s@@g @@W%-*s@@N \r\n", pet->level, ccode_len( pet->short_descr.c_str(), 30 ),
+ capitalize( pet->short_descr.c_str() ), ccode_len( costbuf, 35 ), costbuf );
delete rounded_cost;
strncat( buf1, buf, MSL - 1 );
if ( stopcounter > 45 )
View
11 src/act_wiz.c
@@ -1066,7 +1066,7 @@ DO_FUN(do_mstat)
strncat( buf1, buf, MSL - 1 );
snprintf( buf, MSL, "Short description: %s.\r\nLong description: %s\r\n",
- IS_NPC(victim) ? victim->npcdata->short_descr : "(none)", !victim->long_descr.empty() ? victim->long_descr.c_str() : "(none)." );
+ IS_NPC(victim) ? victim->short_descr.c_str() : "(none)", !victim->long_descr.empty() ? victim->long_descr.c_str() : "(none)." );
strncat( buf1, buf, MSL - 1 );
if ( IS_NPC( victim ) )
@@ -1301,7 +1301,7 @@ DO_FUN(do_mfind)
if ( fAll || is_name( arg, pMobIndex->player_name ) )
{
found = TRUE;
- snprintf( buf, MSL, "[%5d] [%3d] %s\r\n", pMobIndex->vnum, pMobIndex->level, capitalize( pMobIndex->short_descr ) );
+ snprintf( buf, MSL, "[%5d] [%3d] %s\r\n", pMobIndex->vnum, pMobIndex->level, capitalize( pMobIndex->short_descr.c_str() ) );
strncat( buf1, buf, MSL - 1 );
}
}
@@ -1378,7 +1378,7 @@ DO_FUN(do_mfindlev)
perkills = ( pMobIndex->killed * 100 ) / ( kill_table[moblev].killed );
snprintf( buf, MSL, "(%3d) [%3d] [%5d] %s\r\n",
- perkills, pMobIndex->level, pMobIndex->vnum, capitalize( pMobIndex->short_descr ) );
+ perkills, pMobIndex->level, pMobIndex->vnum, capitalize( pMobIndex->short_descr.c_str() ) );
strncat( buf1, buf, MSL - 1 );
}
}
@@ -3181,9 +3181,8 @@ DO_FUN(do_mset)
send_to_char("Not on PC's.\r\n", ch);
return;
}
- free_string( victim->npcdata->short_descr );
- snprintf( buf, MSL, "%s", arg3 );
- victim->npcdata->short_descr = str_dup( buf );
+
+ victim->short_descr = arg3;
return;
}
View
2  src/areachk.c
@@ -299,7 +299,7 @@ DO_FUN(do_check_areas)
}
else
{
- fprintf( out_file, "Mob: [%5i] -> [%5i] %s\n", old_vnum, new_vnum, pMobIndex->short_descr );
+ fprintf( out_file, "Mob: [%5i] -> [%5i] %s\n", old_vnum, new_vnum, pMobIndex->short_descr.c_str() );
/*
* Delete from mob hashing table, and put new vnum in.
*/
View
2  src/areasave.c
@@ -311,7 +311,7 @@ void build_save_mobs( )
fprintf( SaveFile, "RaceMods %d\n", pMobIndex->race_mods );
fprintf( SaveFile, "Resist %d\n", pMobIndex->resist );
fprintf( SaveFile, "Sex %d\n", pMobIndex->sex );
- fprintf( SaveFile, "ShortDesc %s~\n", pMobIndex->short_descr );
+ fprintf( SaveFile, "ShortDesc %s~\n", CSTR( pMobIndex->short_descr ) );
fprintf( SaveFile, "Skills %d\n", pMobIndex->skills );
fprintf( SaveFile, "SMagic %d\n", pMobIndex->strong_magic );
fprintf( SaveFile, "SpecFun %s\n", rev_spec_lookup(pMobIndex->spec_fun) );
View
12 src/build.c
@@ -458,7 +458,7 @@ DO_FUN(build_showmob)
strncat( buf1, buf, MSL - 1 );
snprintf( buf, MSL, "@@WShort description: @@y%s.\r\n@@WLong description: @@y%s\r\n",
- pMob->short_descr, pMob->long_descr[0] != '\0' ? pMob->long_descr : "(none)." );
+ CSTR( pMob->short_descr ), pMob->long_descr[0] != '\0' ? pMob->long_descr : "(none)." );
strncat( buf1, buf, MSL - 1 );
if ( pMob->spec_fun != 0 )
@@ -1018,7 +1018,7 @@ DO_FUN(build_findmob)
if ( fAll || is_name( arg, pMobIndex->player_name ) )
{
found = TRUE;
- snprintf( buf, MSL, "[%5d] %s\r\n", pMobIndex->vnum, capitalize( pMobIndex->short_descr ) );
+ snprintf( buf, MSL, "[%5d] %s\r\n", pMobIndex->vnum, capitalize( CSTR( pMobIndex->short_descr ) ) );
strncat( buf1, buf, MSL - 1 );
}
}
@@ -1673,7 +1673,7 @@ DO_FUN(build_setmob)
if ( !str_cmp( arg2, "short" ) )
{
- build_strdup( &pMob->short_descr, arg3, TRUE, FALSE, ch );
+ build_strdup( pMob->short_descr, arg3, FALSE, ch );
area_modified( pArea );
return;
}
@@ -4948,7 +4948,7 @@ DO_FUN(build_setvnum)
found = FALSE;
}
else
- snprintf( buf2, MSL, "Mobile exists: %s\r\n", mob->short_descr );
+ snprintf( buf2, MSL, "Mobile exists: %s\r\n", CSTR( mob->short_descr ) );
break;
@@ -6077,9 +6077,7 @@ DO_FUN(build_clone)
if ( this_mob->player_name != NULL )
free_string( this_mob->player_name );
this_mob->player_name = str_dup( mob->player_name );
- if ( this_mob->short_descr != NULL )
- free_string( this_mob->short_descr );
- this_mob->short_descr = str_dup( mob->short_descr );
+ this_mob->short_descr = mob->short_descr;
if ( this_mob->long_descr != NULL )
free_string( this_mob->long_descr );
this_mob->long_descr = str_dup( mob->long_descr );
View
2  src/comm.c
@@ -1102,7 +1102,7 @@ void bust_a_prompt( DESCRIPTOR_DATA * d )
{
mob = get_mob_index( ch->pcdata->build_vnum );
if ( mob != NULL )
- snprintf( msg2, MSL, "[%5d]: %s", ch->pcdata->build_vnum, mob->short_descr );
+ snprintf( msg2, MSL, "[%5d]: %s", ch->pcdata->build_vnum, CSTR( mob->short_descr ) );
}
}
snprintf( msg3, MSL, "< %s %s >", msg, msg2 );
View
7 src/ctor.c
@@ -197,7 +197,6 @@ char_data::char_data()
next_in_room = NULL;
ngroup = NULL;
npc = false;
- npcdata = NULL;
num_followers = 0;
old_body = NULL;
old_prompt = &str_empty[0];
@@ -219,6 +218,7 @@ char_data::char_data()
saving_throw = 0;
searching = &str_empty[0];
sex = SEX_NEUTRAL;
+ short_descr = &str_empty[0];
sitting = NULL;
skills = 0;
spec_fun = NULL;
@@ -415,11 +415,6 @@ note_data::note_data()
note_list.push_back(this);
}
-npc_data::npc_data()
-{
- short_descr = &str_empty[0];
-}
-
npc_group_data::npc_group_data()
{
enemies = &str_empty[0];
View
9 src/db.c
@@ -1081,7 +1081,7 @@ void load_mobile( FILE * fp )
case 'S':
KEY("Sex", pMobIndex->sex, fread_number(fp));
- SKEY("ShortDesc", pMobIndex->short_descr, fread_string(fp));
+ KEY("ShortDesc", pMobIndex->short_descr, fread_string(fp));
KEY("Skills", pMobIndex->skills, fread_number(fp));
KEY("SMagic", pMobIndex->strong_magic, fread_number(fp));
if ( !str_cmp(word, "SpecFun") )
@@ -1134,7 +1134,7 @@ void load_mobile( FILE * fp )
if ( !fMatch )
{
- snprintf( log_buf, (2 * MIL), "Loading in mob :%s (%s), no match for ( %s ).", area_load->name, pMobIndex->short_descr, word );
+ snprintf( log_buf, (2 * MIL), "Loading in mob :%s (%s), no match for ( %s ).", area_load->name, CSTR( pMobIndex->short_descr ), word );
monitor_chan( log_buf, MONITOR_BAD );
fread_to_eol( fp );
}
@@ -1845,7 +1845,7 @@ void load_shop( FILE * fp )
if ( !fMatch )
{
- snprintf( log_buf, (2 * MIL), "Loading in shop :%s (%s), no match for ( %s ).", area_load->name, get_mob_index(pShop->keeper)->short_descr, word );
+ snprintf( log_buf, (2 * MIL), "Loading in shop :%s (%s), no match for ( %s ).", area_load->name, CSTR( get_mob_index(pShop->keeper)->short_descr ), word );
monitor_chan( log_buf, MONITOR_BAD );
fread_to_eol( fp );
}
@@ -2664,7 +2664,6 @@ CHAR_DATA *create_mobile( MOB_INDEX_DATA * pMobIndex )
}
mob = new CHAR_DATA;
- mob->npcdata = new NPC_DATA;
mob->npc = true;
mob->pIndexData = pMobIndex;
@@ -2677,7 +2676,7 @@ CHAR_DATA *create_mobile( MOB_INDEX_DATA * pMobIndex )
else
mob->name = str_dup( pMobIndex->player_name );
- mob->npcdata->short_descr = str_dup( pMobIndex->short_descr );
+ mob->short_descr = pMobIndex->short_descr;
mob->long_descr = str_dup( pMobIndex->long_descr );
mob->description = pMobIndex->description;
mob->spec_fun = pMobIndex->spec_fun;
View
8 src/dtor.c
@@ -106,8 +106,6 @@ char_data::~char_data()
imc_freechardata(this);
- if ( npcdata )
- delete npcdata;
if ( pcdata )
delete pcdata;
delete money;
@@ -188,7 +186,6 @@ mob_index_data::~mob_index_data()
is_free = true;
free_string(long_descr);
free_string(player_name);
- free_string(short_descr);
}
money_type::~money_type()
@@ -204,11 +201,6 @@ note_data::~note_data()
free_string(to_list);
}
-npc_data::~npc_data()
-{
- free_string(short_descr);
-}
-
npc_group_data::~npc_group_data()
{
free_string(enemies);
View
7 src/fight.c
@@ -1119,8 +1119,7 @@ void damage( CHAR_DATA * ch, CHAR_DATA * victim, float dam, int dt )
elemental->level = 140;
elemental->name = ".hidden";
- free_string( elemental->npcdata->short_descr );
- elemental->npcdata->short_descr = str_dup( "@@NThe @@rConflict@@N of @@eFire @@Nand @@aIce@@N" );
+ elemental->short_descr = "@@NThe @@rConflict@@N of @@eFire @@Nand @@aIce@@N";
elemental->long_descr = "@@NA @@rPillar@@N of @@eFire @@Nand @@aIce@@N immolates itself!";
char_to_room( elemental, ch->in_room );
@@ -1341,8 +1340,8 @@ void damage( CHAR_DATA * ch, CHAR_DATA * victim, float dam, int dt )
else
{
snprintf( buf, MSL, "%s turns %s into a corpse. Whooops.",
- ( IS_NPC(ch) ? ch->npcdata->short_descr : ch->name.c_str() ),
- ( IS_NPC(victim) ? victim->npcdata->short_descr : victim->name.c_str()) );
+ ( IS_NPC(ch) ? CSTR( ch->short_descr ) : ch->name.c_str() ),
+ ( IS_NPC(victim) ? CSTR( victim->short_descr ) : victim->name.c_str()) );
info( buf, 1 );
}
View
15 src/h/ack.h
@@ -517,7 +517,7 @@ class mob_index_data
int race_mods;
int resist;
short sex;
- char *short_descr;
+ string short_descr;
int skills;
SPEC_FUN *spec_fun;
float speed[MAX_SPEED];
@@ -606,7 +606,6 @@ class char_data
CHAR_DATA *next_in_room;
NPC_GROUP_DATA *ngroup;
bool npc; /* For NPC's, no more flag */
- NPC_DATA *npcdata;
short num_followers;
CHAR_DATA *old_body; /* = descriptor->original */
string old_prompt; /* used to hold prompt when writing */
@@ -628,6 +627,7 @@ class char_data
short saving_throw;
string searching; /* For NPCs hunting continuously */
short sex;
+ string short_descr;
OBJ_DATA *sitting; /* What they're resting or sleeping on */
int skills;
SPEC_FUN *spec_fun;
@@ -653,17 +653,6 @@ class char_data
};
/*
- * Data which only NPC's have.
- */
-class npc_data
-{
- public:
- npc_data();
- ~npc_data();
- char *short_descr;
-};
-
-/*
* Data which only PC's have.
*/
class pc_data
View
1  src/h/build.h
@@ -48,6 +48,7 @@ DECLARE_DO_FUN(build_help);
DECLARE_DO_FUN(build_forcereset);
char *build_simpstrdup P_((char *buf));
void build_strdup P_((char **dest, char *src, bool freesrc, bool newline, CHAR_DATA *ch));
+void build_strdup P_((string dest, char *src, bool newline, CHAR_DATA *ch));
void build_editstr P_((char **dest, char *src, CHAR_DATA *ch));
void build_finishedstr P_((char *orig, char **dest, CHAR_DATA *ch, bool saved));
DECLARE_DO_FUN(build_set_oedit);
View
1  src/h/typedefs.h
@@ -87,7 +87,6 @@ typedef struct mob_index_data MOB_INDEX_DATA;
typedef struct note_data NOTE_DATA;
typedef struct obj_data OBJ_DATA;
typedef struct obj_index_data OBJ_INDEX_DATA;
-typedef struct npc_data NPC_DATA;
typedef struct pc_data PC_DATA;
typedef struct reset_data RESET_DATA;
typedef struct room_affect_data ROOM_AFFECT_DATA;
View
4 src/mbr_fun.c
@@ -164,7 +164,7 @@ const char *char_data::get_name( CHAR_DATA *looker )
if ( can_see(looker, this) )
{
if ( IS_NPC(this) )
- return npcdata->short_descr;
+ return CSTR( short_descr );
else
{
if ( IS_WOLF(this) && (IS_SHIFTED(this) || IS_RAGED(this)) )
@@ -184,7 +184,7 @@ const char *char_data::get_name( CHAR_DATA *looker )
else
{
if ( IS_NPC(this) )
- return npcdata->short_descr;
+ return CSTR( short_descr );
else
return name.c_str();
}
View
14 src/mquest.c
@@ -224,7 +224,7 @@ DO_FUN(do_mquest)
if ( ch->pcdata->quest_info->quest_type == QUEST_MULTI_KILL || ch->pcdata->quest_info->quest_type == QUEST_KILLING )
{
MOB_INDEX_DATA *imob = get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[hint-1]);
- snprintf(buf, MSL, "%s can be found somewhere in %s.\r\n", imob->short_descr, imob->area->name);
+ snprintf(buf, MSL, "%s can be found somewhere in %s.\r\n", CSTR( imob->short_descr ), imob->area->name);
send_to_char(buf, ch);
}
else if ( ch->pcdata->quest_info->quest_type == QUEST_MULTI_KILL_R || ch->pcdata->quest_info->quest_type == QUEST_KILLING_R )
@@ -408,7 +408,7 @@ DO_FUN(do_qstat)
case QUEST_KILLING:
if ( victim->pcdata->quest_info->quest_mob_vnum[0] > -1 )
{
- snprintf(buf, MSL, "%s is seeking mob %d-%s...\r\n", victim->get_name(ch), victim->pcdata->quest_info->quest_mob_vnum[0], get_mob_index(victim->pcdata->quest_info->quest_mob_vnum[0])->short_descr);
+ snprintf(buf, MSL, "%s is seeking mob %d-%s...\r\n", victim->get_name(ch), victim->pcdata->quest_info->quest_mob_vnum[0], CSTR(get_mob_index(victim->pcdata->quest_info->quest_mob_vnum[0])->short_descr));
send_to_char(buf, ch);
if ( victim->pcdata->quest_info->amount[0] > 0 )
@@ -426,7 +426,7 @@ DO_FUN(do_qstat)
{
if ( victim->pcdata->quest_info->quest_mob_vnum[i] > -1 )
{
- snprintf(buf, MSL, "Target #%d: %5d-%s (%d)\r\n", i + 1, victim->pcdata->quest_info->quest_mob_vnum[i], get_mob_index(victim->pcdata->quest_info->quest_mob_vnum[i])->short_descr, victim->pcdata->quest_info->amount[i]);
+ snprintf(buf, MSL, "Target #%d: %5d-%s (%d)\r\n", i + 1, victim->pcdata->quest_info->quest_mob_vnum[i], CSTR(get_mob_index(victim->pcdata->quest_info->quest_mob_vnum[i])->short_descr), victim->pcdata->quest_info->amount[i]);
send_to_char(buf, ch);
}
}
@@ -506,7 +506,7 @@ void mquest_info( CHAR_DATA *ch )
case QUEST_KILLING:
if ( ch->pcdata->quest_info->quest_mob_vnum[0] > -1 )
{
- snprintf(buf, MSL, "You are seeking out the creature known as %s@@N.\r\n", get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[0])->short_descr);
+ snprintf(buf, MSL, "You are seeking out the creature known as %s@@N.\r\n", CSTR(get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[0])->short_descr));
send_to_char(buf, ch);
if ( ch->pcdata->quest_info->amount[0] > 0 )
@@ -529,7 +529,7 @@ void mquest_info( CHAR_DATA *ch )
{
if ( ch->pcdata->quest_info->quest_mob_vnum[i] > -1 )
{
- snprintf(buf, MSL, "Target #%d: %s (%d)", i + 1, get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->short_descr, ch->pcdata->quest_info->amount[i]);
+ snprintf(buf, MSL, "Target #%d: %s (%d)", i + 1, CSTR(get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->short_descr), ch->pcdata->quest_info->amount[i]);
send_to_char(buf, ch);
if ( ch->pcdata->quest_info->quest_hint[i] )
snprintf(buf, MSL, " [%s]\r\n", get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->area->name);
@@ -1132,7 +1132,7 @@ char *display_mob_target( CHAR_DATA *ch, CHAR_DATA *victim )
if ( ch->pcdata->quest_info->quest_mob_vnum[i] > -1
&& ch->pcdata->quest_info->amount[i] > 0
&& (ch->pcdata->quest_info->quest_mob_vnum[i] == victim->pIndexData->vnum
- || (!str_cmp(get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->short_descr, victim->npcdata->short_descr)
+ || (!str_cmp(CSTR(get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->short_descr), CSTR(victim->short_descr))
&& get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->area == victim->in_room->area)) )
return "@@e[@@yTARGET@@e] @@N";
}
@@ -1194,7 +1194,7 @@ void update_mquest_kill( CHAR_DATA *ch, CHAR_DATA *victim )
continue;
if ( ch->pcdata->quest_info->amount[i] > 0
&& (ch->pcdata->quest_info->quest_mob_vnum[i] == victim->pIndexData->vnum
- || (!str_cmp(get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->short_descr, victim->npcdata->short_descr)
+ || (!str_cmp(CSTR(get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->short_descr), CSTR(victim->short_descr))
&& get_mob_index(ch->pcdata->quest_info->quest_mob_vnum[i])->area == victim->in_room->area)) )
{
ch->pcdata->quest_info->amount[i]--;
View
4 src/save.c
@@ -236,7 +236,7 @@ void fwrite_char( CHAR_DATA * ch, FILE * fp )
fprintf( fp, "%sEOL\n", outstr.c_str() );
if ( IS_NPC(ch) )
- fprintf( fp, "ShortDescr %s~\n", ch->npcdata->short_descr );
+ fprintf( fp, "ShortDescr %s~\n", CSTR( ch->short_descr ) );
fprintf( fp, "LongDescr %s~\n", ch->long_descr_orig.c_str() );
fprintf( fp, "Description %s~\n", ch->description.c_str() );
fprintf( fp, "Prompt %s~\n", ch->prompt.c_str() );
@@ -1282,7 +1282,7 @@ void fread_char( CHAR_DATA * ch, FILE * fp )
KEY( "Sentence", ch->pcdata->sentence, fread_number( fp ) );
KEY( "Sex", ch->sex, fread_number( fp ) );
if ( IS_NPC( ch ) )
- SKEY( "ShortDescr", ch->npcdata->short_descr, fread_string( fp ) );
+ KEY( "ShortDescr", ch->short_descr, fread_string( fp ) );
if ( !str_cmp( word, "Skill" ) && !IS_NPC( ch ) )
{
View
10 src/scheck.c
@@ -139,7 +139,6 @@ static void walk_mob_index_data( MOB_INDEX_DATA * m )
return;
touch( m->player_name );
- touch( m->short_descr );
touch( m->long_descr );
touch( m->description );
@@ -178,14 +177,6 @@ static void walk_note_data( NOTE_DATA * note )
touch( note->text );
}
-static void walk_npcdata( NPC_DATA * n )
-{
- if ( !n )
- return;
-
- touch( n->short_descr );
-}
-
static void walk_pcdata( PC_DATA * p )
{
int i;
@@ -270,7 +261,6 @@ static void walk_char_data( CHAR_DATA * ch )
if ( !ch )
return;
- walk_npcdata( ch->npcdata );
walk_pcdata( ch->pcdata );
walk_shieldlist( ch->first_shield );
}
Please sign in to comment.
Something went wrong with that request. Please try again.