00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "../paradialog.h"
00023 #include "../loaders.h"
00024 #include "../windowing.h"
00025
00026 class NextCampaignMap : public ConfigurableWindow
00027 {
00028 private:
00029 ASCString file;
00030 public:
00031 NextCampaignMap(PG_Widget* parent, const PG_Rect& r );
00032 GameMap* getMap();
00033 bool search( int id );
00034 };
00035
00036 const char* waiting = "-- searching, please wait -- ";
00037
00038 NextCampaignMap :: NextCampaignMap(PG_Widget* parent, const PG_Rect& r ) : ConfigurableWindow( parent, r, "continuecampaign" )
00039 {
00040 setup();
00041 setLabelText( "Title", waiting);
00042 setLabelText( "CodeWord", waiting);
00043 setLabelText( "Filename", waiting);
00044
00045 PG_Button* b = dynamic_cast<PG_Button*>( FindChild( "GO", true ) );
00046 if ( b )
00047 b->sigClick.connect( SigC::slot( *this, &NextCampaignMap::QuitModal ));
00048
00049 }
00050
00051 bool NextCampaignMap :: search( int id )
00052 {
00053 MapConinuationInfo mci = findNextCampaignMap( id );
00054 if ( mci.filename.length() ) {
00055 setLabelText( "Title", mci.title );
00056 setLabelText( "CodeWord", mci.codeword );
00057 setLabelText( "Filename", mci.filename );
00058 file = mci.filename;
00059 return true;
00060 } else {
00061 errorMessage("The next campaign map is not available");
00062 return false;
00063 }
00064 }
00065
00066 GameMap* NextCampaignMap :: getMap()
00067 {
00068 return mapLoadingExceptionChecker( file, MapLoadingFunction( tmaploaders::loadmap ));
00069 };
00070
00071
00072 GameMap* nextCampaignMap( int id )
00073 {
00074 NextCampaignMap ncm( NULL, PG_Rect(50,50,500,300) );
00075 ncm.Show();
00076 if ( ncm.search( id ) ) {
00077 ncm.RunModal();
00078 return ncm.getMap();
00079 } else
00080 return NULL;
00081 }
00082