help.cc
mud++/src/help.cc · 1.9 KB
From the archive mud++0.1.tar.gz
Download the archive « Back to the archive contents
/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project. All
................................................ contributions are welcome.
....Copyright(C).1995.Melvin.Smith.............. Enjoy.
------------------------------------------------------------------------------
Melvin Smith (aka Fusion) msmith@falcon.mercer.peachnet.edu
MUD++ development mailing list mudpp-list@spice.com
------------------------------------------------------------------------------
help.cc
*/
#include "file.h"
#include "string.h"
#include "llist.h"
#include "help.h"
// This needs to be changed to a LList
Help *help_list[MAX_HELP];
void loadHelps()
{
char filename[BUF];
char buf[BUF];
sprintf( filename, "%s/%s", HELP_DIR, HELP_FILE );
InFile in( filename );
if( !in )
{
Cout<<"loadHelps : can't open help file "<<filename<<endl;
return;
}
int i = 0;
while( in && ( in.get( *buf ) != '#' ) )
{
in.putback();
help_list[i] = new Help;
help_list[i]->readFrom(in);
i++;
}
Cout<<"Help index loaded with "<<i<<" keywords.\n";
}
int Help::readFrom( InFile &in )
{
if( !in )
return -1;
char buf[ BUF ];
setName( in.getstring( buf ) );
level = in.getnum();
filename = in.getword( buf );
return 0;
}
int Help::writeTo( OutFile &out ) const
{
if( !out )
return -1;
out << name << "; " << level << filename << endl;
return 0;
}
void Help::setLevel( int l )
{
if( l > 0 )
level = l;
}
const String & Help::fileName()
{
return filename;
}
void Help::setFileName( const String & str )
{
filename = str;
}
int Help::getLevel()
{
return level;
}
bool Help::isName( const String & str )
{
return name.subStr( str );
}