Menu

#69 Code Issue and bug

open
nobody
None
5
2003-01-08
2003-01-08
Miyu Yang
No

1. In location.cpp:
int Location::short_dir_to_num(char *the_dir)
{
int i;

// i never be used

return i;
}

I think var 'i' can be remove. it never used and if/else
if/else cover all.

2. in area_dbase.cpp
if I enabled DEBUG_LOAD:

int Area_Dbase::coord_area1(ErrLog *error_log,
Object_List *obj_dbase)
{
..
MudObject *cur_obj;
..
while (cur_entity != NULL)
{
#ifdef DEBUG_LOAD
printf("coordinating: %s\n", cur_obj->get_name());
#endif
...
}
The 'cur_obj' not yet be init in first execute!

I think you should change code like that:
int Area_Dbase::coord_area1(ErrLog *error_log,
Object_List *obj_dbase)
{
..
MudObject *cur_obj;
..
while (cur_entity != NULL)
{
if (cur_entity->is_a_mudobject())
{
cur_obj = (MudObject *) cur_entity;
// let cur_obj have init value at first run
#ifdef DEBUG_LOAD
printf("coordinating: %s\n", cur_obj->get_name());
#endif
...
}

Discussion


Log in to post a comment.