Esempio n. 1
0
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();
}
Esempio n. 2
0
void psWorld::GetAllRegionNames(csString &str)
{
    str.Clear();
    for(unsigned i=0; i < regions->GetSize(); i++)
    {
        str.Append(regions->Get(i));
        str.Append("|");
    }
}
Esempio n. 3
0
static inline void TestTarget(csString& targetDesc, int32_t targetType,
                              enum TARGET_TYPES type, const char* desc)
{
    if (targetType & type)
    {
        if (targetDesc.Length() > 0)
        {
            targetDesc.Append((targetType > (type * 2)) ? ", " : ", or ");
        }
        targetDesc.Append(desc);
    }
}
void ProximityList::DebugDumpContents(csString& out)
{
    size_t x;
    csString temp;

    temp.AppendFmt("I represent client %d\n",clientnum);
    temp.AppendFmt("I am publishing updates to:\n");
    
    for (x = 0; x < objectsThatWatchMe.GetSize(); x++ )
    {
        temp.AppendFmt( "\tClient %d (%s), range %1.2f min_range %.2f\n",
                objectsThatWatchMe[x].client,
                ((gemObject*)(objectsThatWatchMe[x].object))->GetName(),
                        objectsThatWatchMe[x].dist,
                        objectsThatWatchMe[x].min_dist);
    }

    if (clientnum)
    {
        temp.Append( "I am listening to:\n");
        for (x = 0; x < objectsThatIWatch.GetSize(); x++ )
        {
            gemObject * obj = objectsThatIWatch[x];
            
            temp.AppendFmt("\t%-3d %s\n", obj->GetEID().Unbox(), obj->GetName());
        }
    }
    else
    {
        temp.Append("I am not a human player, so I don't subscribe to other entities.\n");
    }
    out.Append(temp);
}
Esempio n. 5
0
void psServerStatusRunEvent::ReportNPC(psCharacter* chardata, csString & reportString)
{
    csString escpxml_name = EscpXML(chardata->GetCharFullName());
    csString player;
               
    player.Format("<npc name=\"%s\" characterID=\"%u\" kills=\"%u\" deaths=\"%u\" suicides=\"%u\" pos_x=\"%.2f\" pos_y=\"%.2f\" pos_z=\"%.2f\" sector=\"%s\" />\n", 
                  escpxml_name.GetData(), chardata->GetPID().Unbox(),
                  chardata->GetKills(), chardata->GetDeaths(), chardata->GetSuicides(), chardata->location.loc.x, chardata->location.loc.y, chardata->location.loc.z, (const char*) EscpXML(chardata->location.loc_sector->name));
    
    reportString.Append( player ); 
}
Esempio n. 6
0
void csWrappedDocumentNode::AppendNodeText (WrapperWalker& walker, 
					    csString& text)
{
  while (walker.HasNext ())
  {
    iDocumentNode* node = walker.Peek ();
    if (node->GetType () != CS_NODE_TEXT)
      break;

    text.Append (node->GetValue ());

    walker.Next ();
  }
}