From: <Kha...@us...> - 2009-03-22 12:37:50
|
Revision: 3280 http://planeshift.svn.sourceforge.net/planeshift/?rev=3280&view=rev Author: KhakiLord Date: 2009-03-22 12:37:47 +0000 (Sun, 22 Mar 2009) Log Message: ----------- Improved error messages when npcclient can't connect to server. Modified Paths: -------------- trunk/src/npcclient/networkmgr.cpp trunk/src/npcclient/npc.cpp trunk/src/npcclient/npc.h trunk/src/npcclient/npcclient.cpp Modified: trunk/src/npcclient/networkmgr.cpp =================================================================== --- trunk/src/npcclient/networkmgr.cpp 2009-03-22 11:22:50 UTC (rev 3279) +++ trunk/src/npcclient/networkmgr.cpp 2009-03-22 12:37:47 UTC (rev 3280) @@ -1229,7 +1229,7 @@ { if (!connection->Connect(host,port)) { - CPrintf(CON_ERROR, "Couldn't connect to %s on port %d.\n",(const char *)host,port); + CPrintf(CON_ERROR, "Couldn't resolve hostname %s on port %d.\n",(const char *)host,port); return; } // 2 seconds to allow linkdead messages to be processed Modified: trunk/src/npcclient/npc.cpp =================================================================== --- trunk/src/npcclient/npc.cpp 2009-03-22 11:22:50 UTC (rev 3279) +++ trunk/src/npcclient/npc.cpp 2009-03-22 12:37:47 UTC (rev 3280) @@ -100,7 +100,7 @@ { // Ensure NPC only has one tick at a time. CS_ASSERT(tick == NULL); - tick = new psNPCTick(NPC_BRAIN_TICK); + tick = new psNPCTick(NPC_BRAIN_TICK, this); tick->QueueEvent(); if(npcclient->IsReady()) @@ -115,7 +115,7 @@ timeTaken, GetName(), ShowID(GetEID())); Dump(); } - npcclient->GetNetworkMgr()->SendAllCommands(true); + networkmanager->SendAllCommands(true); } } Modified: trunk/src/npcclient/npc.h =================================================================== --- trunk/src/npcclient/npc.h 2009-03-22 11:22:50 UTC (rev 3279) +++ trunk/src/npcclient/npc.h 2009-03-22 12:37:47 UTC (rev 3280) @@ -271,7 +271,7 @@ NPC *npc; public: - psNPCTick(int offsetticks): psGameEvent(0,offsetticks,"psNPCTick") {}; + psNPCTick(int offsetticks, NPC *npc): psGameEvent(0,offsetticks,"psNPCTick"), npc(npc) {}; virtual void Trigger() { npc->tick = NULL; Modified: trunk/src/npcclient/npcclient.cpp =================================================================== --- trunk/src/npcclient/npcclient.cpp 2009-03-22 11:22:50 UTC (rev 3279) +++ trunk/src/npcclient/npcclient.cpp 2009-03-22 12:37:47 UTC (rev 3280) @@ -158,9 +158,6 @@ pass = _pass ? _pass : configmanager->GetStr("PlaneShift.NPCClient.password", "planeshift"); port = _port ? _port : configmanager->GetInt("PlaneShift.NPCClient.port", 13331); - CPrintf(CON_DEBUG, "Connecting to Host: '%s' User: '%s' Password: '%s' Port %d...\n", - (const char*) host, (const char*) user, (const char*) pass, port); - CPrintf (CON_DEBUG, "Initialize Network Thread...\n"); connection = new psNetConnection(500); // 500 elements in queue if (!connection->Initialize(object_reg)) @@ -171,7 +168,7 @@ } if (!connection->Connect(host,port)) { - CPrintf(CON_ERROR, "Couldn't connect to %s on port %d.\n",(const char *)host,port); + CPrintf(CON_ERROR, "Couldn't resolve hostname %s on port %d.\n",(const char *)host,port); exit(1); } @@ -237,7 +234,9 @@ cdsys = csQueryRegistry<iCollideSystem> (objreg); PFMaps = new psPFMaps(objreg); - + + CPrintf(CON_DEBUG, "Connecting to Host: '%s' User: '%s' Password: '%s' Port %d...\n", + (const char*) host, (const char*) user, (const char*) pass, port); // Starts the logon process network->Authenticate(host,port,user,pass); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |