Bug: Spec_fun names are assigned improperly when binding pets
Danger: Unknown - There was no compiler warning or error, and nothing has triggered it in runtime so far.
Discovered in: AFKMud 2.02
Found by: Samson
Fixed by: Samson
---
character.cpp, char_data::set_specfun
Locate:
case CLASS_PALADIN:
spec_fun = m_spec_lookup( "spec_paladin" );
spec_funname = STRALLOC( "spec_paladin" );
break;
case CLASS_DRUID:
spec_fun = m_spec_lookup( "spec_druid" );
spec_funname = STRALLOC( "spec_druid" );
break;
case CLASS_ANTIPALADIN:
spec_fun = m_spec_lookup( "spec_antipaladin" );
spec_funname = STRALLOC( "spec_antipaladin" );
break;
case CLASS_BARD:
spec_fun = m_spec_lookup( "spec_bard" );
spec_funname = STRALLOC( "spec_bard" );
break;
Change to:
case CLASS_PALADIN:
this->spec_fun = m_spec_lookup( "spec_paladin" );
this->spec_funname = "spec_paladin";
break;
case CLASS_DRUID:
this->spec_fun = m_spec_lookup( "spec_druid" );
this->spec_funname = "spec_druid";
break;
case CLASS_ANTIPALADIN:
this->spec_fun = m_spec_lookup( "spec_antipaladin" );
this->spec_funname = "spec_antipaladin";
break;
case CLASS_BARD:
this->spec_fun = m_spec_lookup( "spec_bard" );
this->spec_funname = "spec_bard";
break;
The spec_funname member of char_data is a std::string and should not have been passed through the hash table for char* strings. However for some reason the compiler is not reporting a problem with this and it slipped by unnoticed. Since the effects of this are unknown at runtime, it's advisable to fix this.