-
Notifications
You must be signed in to change notification settings - Fork 4
/
Demo10-01.cpp
74 lines (52 loc) · 1.3 KB
/
Demo10-01.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// MUD Programming
// Ron Penton
// (C)2003
// Demo10-01.cpp - SimpleMUD - Enemies, Enemy Databases, and the Game Loop
//
//
#include <sstream>
#include "SocketLib/SocketLib.h"
#include "SimpleMUD/ItemDatabase.h"
#include "SimpleMUD/PlayerDatabase.h"
#include "SimpleMUD/RoomDatabase.h"
#include "SimpleMUD/EnemyDatabase.h"
#include "SimpleMUD/Logon.h"
#include "SimpleMUD/Game.h"
#include "SimpleMUD/GameLoop.h"
#include "SimpleMUD/SimpleMUDLogs.h"
using namespace SocketLib;
using namespace SimpleMUD;
int main()
{
try
{
GameLoop gameloop;
ListeningManager<Telnet, Logon> lm;
ConnectionManager<Telnet, Logon> cm( 128, 60, 65536 );
lm.SetConnectionManager( &cm );
lm.AddPort( 5100 );
while( Game::Running() )
{
lm.Listen();
cm.Manage();
gameloop.Loop();
ThreadLib::YieldThread();
}
}
catch( SocketLib::Exception& e )
{
ERRORLOG.Log( "Fatal Socket Error: " + e.PrintError() );
}
catch( ThreadLib::Exception& )
{
ERRORLOG.Log( "Fatal Thread Error" );
}
catch( std::exception& e )
{
ERRORLOG.Log( "Standard Error: " + std::string( e.what() ) );
}
catch( ... )
{
ERRORLOG.Log( "Unspecified Error" );
}
}