void NameGenerator::GenerateName(csString &namebuffer,int length_low,int length_high) { unsigned int length; PhonicEntry *lastphonic=NULL; namebuffer.Clear(); length=randomgen->Get((length_high-length_low))+length_low; // Pick a beginning lastphonic=GetRandomBeginner(); namebuffer.Append(lastphonic->phonic); // Add phonics to the middle while within length while (namebuffer.Length() < length) { if (lastphonic->flags & PHONIC_POSTJOINER) lastphonic=GetRandomNonPreJoiner(); else lastphonic=GetRandomPreJoiner(); namebuffer.Append(lastphonic->phonic); } // Pick an ending lastphonic=GetRandomEnder(!(lastphonic->flags & PHONIC_POSTJOINER)); namebuffer.Append(lastphonic->phonic); namebuffer.Downcase(); }
void psWorld::GetAllRegionNames(csString &str) { str.Clear(); for(unsigned i=0; i < regions->GetSize(); i++) { str.Append(regions->Get(i)); str.Append("|"); } }
void Client::GetTargetTypeName(int32_t targetType, csString& targetDesc) const { targetDesc.Clear(); TestTarget(targetDesc, targetType, TARGET_NONE, "the surrounding area"); TestTarget(targetDesc, targetType, TARGET_ITEM, "items"); TestTarget(targetDesc, targetType, TARGET_SELF, "yourself"); TestTarget(targetDesc, targetType, TARGET_FRIEND, "living friends"); TestTarget(targetDesc, targetType, TARGET_FOE, "living enemies"); TestTarget(targetDesc, targetType, TARGET_DEAD, "the dead"); }
bool mcMapParser::ReadNextToken (csString& str) { char c, next_c; str.Clear(); m_empty_token = false; /* Skip commented and empty lines */ for(;;) { if( !SkipWhitespace() ) { return false; } if( !GetChar(c) ) { return false; } if(c == '\n') { /* An empty line */ ++m_current_line; continue; } if( PeekChar(next_c) ) { if( c == '/' && next_c == '/') { if( !SkipToNextLine() ) { return false; } } else { break; } } else { break; } } /* Quoted strings are returned directly */ if (c == '\"') { for(;;) { if ( !GetChar(c) ) { /* If we fail now, the token is not complete! */ return false; } if (c == '\"') { /* The end of the string has been reached */ m_empty_token = str.IsEmpty(); return true; } str << c; } } /* Check for special single character tokens */ if ( c == '{' || c == '}' || c == '(' || c == ')' || c == '\'' || c ==':' ) { str << c; return true; } /* Parse a regular word */ for(;;) { str << c; if (!PeekChar(next_c)) { break; } if ( next_c == '{' || next_c == '}' || next_c == '(' || next_c == ')' || next_c == '\'' || next_c ==':' || next_c == ' ' || next_c == '\t' || next_c == '\r' || next_c == '\n' ) { break; } if(!GetChar(c)) { break; } } return true; }