Mercurial > hg > openttd
comparison src/openttd.cpp @ 11954:92364e306ac7 draft
(svn r16358) -Fix (r16343): strdup doesn't like NULL
author | glx <glx@openttd.org> |
---|---|
date | Tue, 19 May 2009 17:04:42 +0000 |
parents | 75b7687b5cc3 |
children | 6ec97548e188 |
comparison
equal
deleted
inserted
replaced
11953:a299a5b5a555 | 11954:92364e306ac7 |
---|---|
574 InitFreeType(); | 574 InitFreeType(); |
575 | 575 |
576 /* This must be done early, since functions use the InvalidateWindow* calls */ | 576 /* This must be done early, since functions use the InvalidateWindow* calls */ |
577 InitWindowSystem(); | 577 InitWindowSystem(); |
578 | 578 |
579 if (graphics_set == NULL) graphics_set = strdup(_ini_graphics_set); | 579 if (graphics_set == NULL && _ini_graphics_set != NULL) graphics_set = strdup(_ini_graphics_set); |
580 if (!SetGraphicsSet(graphics_set)) { | 580 if (!SetGraphicsSet(graphics_set)) { |
581 StrEmpty(graphics_set) ? | 581 StrEmpty(graphics_set) ? |
582 usererror("Failed to find a graphics set. Please acquire a graphics set for OpenTTD.") : | 582 usererror("Failed to find a graphics set. Please acquire a graphics set for OpenTTD.") : |
583 usererror("Failed to select requested graphics set '%s'", graphics_set); | 583 usererror("Failed to select requested graphics set '%s'", graphics_set); |
584 } | 584 } |
586 | 586 |
587 /* Initialize game palette */ | 587 /* Initialize game palette */ |
588 GfxInitPalettes(); | 588 GfxInitPalettes(); |
589 | 589 |
590 DEBUG(misc, 1, "Loading blitter..."); | 590 DEBUG(misc, 1, "Loading blitter..."); |
591 if (blitter == NULL) blitter = strdup(_ini_blitter); | 591 if (blitter == NULL && _ini_blitter != NULL) blitter = strdup(_ini_blitter); |
592 if (BlitterFactoryBase::SelectBlitter(blitter) == NULL) | 592 if (BlitterFactoryBase::SelectBlitter(blitter) == NULL) |
593 StrEmpty(blitter) ? | 593 StrEmpty(blitter) ? |
594 usererror("Failed to autoprobe blitter") : | 594 usererror("Failed to autoprobe blitter") : |
595 usererror("Failed to select requested blitter '%s'; does it exist?", blitter); | 595 usererror("Failed to select requested blitter '%s'; does it exist?", blitter); |
596 free(blitter); | 596 free(blitter); |
597 | 597 |
598 DEBUG(driver, 1, "Loading drivers..."); | 598 DEBUG(driver, 1, "Loading drivers..."); |
599 | 599 |
600 if (sounddriver == NULL) sounddriver = strdup(_ini_sounddriver); | 600 if (sounddriver == NULL && _ini_sounddriver != NULL) sounddriver = strdup(_ini_sounddriver); |
601 _sound_driver = (SoundDriver*)SoundDriverFactoryBase::SelectDriver(sounddriver, Driver::DT_SOUND); | 601 _sound_driver = (SoundDriver*)SoundDriverFactoryBase::SelectDriver(sounddriver, Driver::DT_SOUND); |
602 if (_sound_driver == NULL) { | 602 if (_sound_driver == NULL) { |
603 StrEmpty(sounddriver) ? | 603 StrEmpty(sounddriver) ? |
604 usererror("Failed to autoprobe sound driver") : | 604 usererror("Failed to autoprobe sound driver") : |
605 usererror("Failed to select requested sound driver '%s'", sounddriver); | 605 usererror("Failed to select requested sound driver '%s'", sounddriver); |
606 } | 606 } |
607 free(sounddriver); | 607 free(sounddriver); |
608 | 608 |
609 if (musicdriver == NULL) musicdriver = strdup(_ini_musicdriver); | 609 if (musicdriver == NULL && _ini_musicdriver != NULL) musicdriver = strdup(_ini_musicdriver); |
610 _music_driver = (MusicDriver*)MusicDriverFactoryBase::SelectDriver(musicdriver, Driver::DT_MUSIC); | 610 _music_driver = (MusicDriver*)MusicDriverFactoryBase::SelectDriver(musicdriver, Driver::DT_MUSIC); |
611 if (_music_driver == NULL) { | 611 if (_music_driver == NULL) { |
612 StrEmpty(musicdriver) ? | 612 StrEmpty(musicdriver) ? |
613 usererror("Failed to autoprobe music driver") : | 613 usererror("Failed to autoprobe music driver") : |
614 usererror("Failed to select requested music driver '%s'", musicdriver); | 614 usererror("Failed to select requested music driver '%s'", musicdriver); |
615 } | 615 } |
616 free(musicdriver); | 616 free(musicdriver); |
617 | 617 |
618 if (videodriver == NULL) videodriver = strdup(_ini_videodriver); | 618 if (videodriver == NULL && _ini_videodriver != NULL) videodriver = strdup(_ini_videodriver); |
619 _video_driver = (VideoDriver*)VideoDriverFactoryBase::SelectDriver(videodriver, Driver::DT_VIDEO); | 619 _video_driver = (VideoDriver*)VideoDriverFactoryBase::SelectDriver(videodriver, Driver::DT_VIDEO); |
620 if (_video_driver == NULL) { | 620 if (_video_driver == NULL) { |
621 StrEmpty(videodriver) ? | 621 StrEmpty(videodriver) ? |
622 usererror("Failed to autoprobe video driver") : | 622 usererror("Failed to autoprobe video driver") : |
623 usererror("Failed to select requested video driver '%s'", videodriver); | 623 usererror("Failed to select requested video driver '%s'", videodriver); |