Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

nextcampaignmap.cpp

Go to the documentation of this file.
00001 /*
00002      This file is part of Advanced Strategic Command; http://www.asc-hq.de
00003      Copyright (C) 1994-1999  Martin Bickel  and  Marc Schellenberger
00004  
00005      This program is free software; you can redistribute it and/or modify
00006      it under the terms of the GNU General Public License as published by
00007      the Free Software Foundation; either version 2 of the License, or
00008      (at your option) any later version.
00009  
00010      This program is distributed in the hope that it will be useful,
00011      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013      GNU General Public License for more details.
00014  
00015      You should have received a copy of the GNU General Public License
00016      along with this program; see the file COPYING. If not, write to the 
00017      Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
00018      Boston, MA  02111-1307  USA
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 

Generated on Tue Jun 24 01:27:46 2008 for Advanced Strategic Command by  doxygen 1.4.2