414 } |
414 } |
415 } |
415 } |
416 |
416 |
417 void HWForm::NetStartServer() |
417 void HWForm::NetStartServer() |
418 { |
418 { |
419 config->SaveOptions(); |
419 config->SaveOptions(); |
420 pnetserver = new HWNetServer; |
420 |
421 pnetserver->StartServer(ui.pageNetServer->sbPort->value()); |
421 pnetserver = new HWNetServer; |
422 _NetConnect("localhost", pnetserver->getRunningPort(), ui.pageOptions->editNetNick->text()); |
422 if(!pnetserver->StartServer(ui.pageNetServer->sbPort->value())) |
423 |
423 { |
424 if (ui.pageNet->rbLocalGame->isChecked()) |
424 QMessageBox::critical(0, tr("Error"), |
425 pRegisterServer = new HWNetUdpServer(0, ui.pageNetServer->leServerDescr->text(), ui.pageNetServer->sbPort->value()); |
425 tr("Unable to start the server")); |
426 else |
426 delete pnetserver; |
427 pRegisterServer = new HWNetWwwServer(0, ui.pageNetServer->leServerDescr->text(), ui.pageNetServer->sbPort->value()); |
427 pnetserver = 0; |
|
428 return; |
|
429 } |
|
430 |
|
431 _NetConnect("localhost", pnetserver->getRunningPort(), ui.pageOptions->editNetNick->text()); |
|
432 |
|
433 if (ui.pageNet->rbLocalGame->isChecked()) |
|
434 pRegisterServer = new HWNetUdpServer(0, ui.pageNetServer->leServerDescr->text(), ui.pageNetServer->sbPort->value()); |
|
435 else |
|
436 pRegisterServer = new HWNetWwwServer(0, ui.pageNetServer->leServerDescr->text(), ui.pageNetServer->sbPort->value()); |
428 } |
437 } |
429 |
438 |
430 void HWForm::NetDisconnect() |
439 void HWForm::NetDisconnect() |
431 { |
440 { |
432 if(hwnet) { |
441 if(hwnet) { |