| 342 | static QVector<NetHackQtWindow*> id_to_window; |
| 343 | |
| 344 | winid NetHackQtBind::qt_create_nhwindow(int type) |
| 345 | { |
| 346 | winid id; |
| 347 | for (id = 0; id < (winid) id_to_window.size(); id++) { |
| 348 | if ( !id_to_window[(int)id] ) |
| 349 | break; |
| 350 | } |
| 351 | if ( id == (winid) id_to_window.size() ) |
| 352 | id_to_window.resize(id+1); |
| 353 | |
| 354 | NetHackQtWindow* window=0; |
| 355 | |
| 356 | switch (type) { |
| 357 | case NHW_MAP: { |
| 358 | NetHackQtMapWindow2* w=new NetHackQtMapWindow2(clickbuffer); |
| 359 | main->AddMapWindow(w); |
| 360 | window=w; |
| 361 | break; |
| 362 | } |
| 363 | case NHW_MESSAGE: { |
| 364 | NetHackQtMessageWindow* w=new NetHackQtMessageWindow; |
| 365 | main->AddMessageWindow(w); |
| 366 | window=w; |
| 367 | break; |
| 368 | } |
| 369 | case NHW_STATUS: { |
| 370 | NetHackQtStatusWindow* w=new NetHackQtStatusWindow; |
| 371 | main->AddStatusWindow(w); |
| 372 | window=w; |
| 373 | break; |
| 374 | } |
| 375 | case NHW_MENU: |
| 376 | window=new NetHackQtMenuOrTextWindow(mainWidget()); |
| 377 | break; |
| 378 | case NHW_TEXT: |
| 379 | window=new NetHackQtTextWindow(mainWidget()); |
| 380 | break; |
| 381 | } |
| 382 | |
| 383 | window->nhid = id; |
| 384 | |
| 385 | // Note: use of isHidden does not work with Qt 2.1 |
| 386 | if ( splash |
| 387 | #if QT_VERSION >= 300 |
| 388 | && !main->isHidden() |
| 389 | #else |
| 390 | && main->isVisible() |
| 391 | #endif |
| 392 | ) { |
| 393 | delete splash; |
| 394 | splash = 0; |
| 395 | } |
| 396 | |
| 397 | id_to_window[(int)id] = window; |
| 398 | return id; |
nothing calls this directly
no test coverage detected