00001 00008 /* 00009 This file is part of Advanced Strategic Command; http://www.asc-hq.de 00010 Copyright (C) 1994-1999 Martin Bickel and Marc Schellenberger 00011 00012 This program is free software; you can redistribute it and/or modify 00013 it under the terms of the GNU General Public License as published by 00014 the Free Software Foundation; either version 2 of the License, or 00015 (at your option) any later version. 00016 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with this program; see the file COPYING. If not, write to the 00024 Free Software Foundation, Inc., 59 Temple Place, Suite 330, 00025 Boston, MA 02111-1307 USA 00026 */ 00027 00028 #ifndef loadersH 00029 #define loadersH 00030 00031 #include <sigc++/sigc++.h> 00032 00033 #include "libs/loki/Functor.h" 00034 00035 #include "ascstring.h" 00036 #include "sgstream.h" 00037 #include "messages.h" 00038 00039 00040 00041 extern const int fileterminator; 00042 00043 extern const char* savegameextension; 00044 extern const char* mapextension; 00045 extern const char* tournamentextension; 00046 00047 00048 00050 extern void savemap( const char * name, GameMap* gamemap ); 00051 00053 extern void savegame( const ASCString& name ); 00054 00055 00056 typedef Loki::Functor<GameMap*, TYPELIST_1(const ASCString&) > MapLoadingFunction; 00057 extern GameMap* mapLoadingExceptionChecker( const ASCString& filename, MapLoadingFunction loader ); 00058 00059 00060 00061 extern GameMap* loadreplay( tmemorystreambuf* streambuf ); 00062 00064 extern void savereplay( GameMap* gamemap, int num ); 00065 00066 00067 class tspfldloaders { 00068 public: 00069 pnstream stream; 00070 GameMap* spfld; 00071 00072 static SigC::Signal1<void,GameMap*> mapLoaded; 00073 00074 void readoldevents ( void ); 00075 00076 00077 void writedissections ( void ); 00078 void readdissections ( void ); 00079 00080 void readLegacyNetwork ( void ); 00081 00082 virtual void initmap ( void ) = 0; 00083 00084 void writemap ( void ); 00085 void readmap ( void ); 00086 00087 void writefields ( void ); 00088 void readfields ( void ); 00089 00090 void writemessages ( void ); 00091 void writemessagelist( MessagePntrContainer& lst ); 00092 void readmessages ( void ); 00093 void readmessagelist( MessagePntrContainer& lst ); 00094 00095 void chainitems ( GameMap* actmap ); 00096 void setplayerexistencies ( void ); 00097 virtual ~tspfldloaders(); 00098 tspfldloaders ( void ); 00099 }; 00100 00101 00102 00103 class tmaploaders : public tspfldloaders { 00104 void initmap ( void ); 00105 GameMap* _loadmap ( const ASCString& name ); 00106 public: 00107 static GameMap* loadmap ( const ASCString& name ); 00108 00109 00110 int savemap ( const ASCString& name, GameMap* gamemap ); 00111 tmaploaders (void ) {}; 00112 }; 00113 00114 00115 00116 class tgameloaders : public tspfldloaders { 00117 protected: 00118 void initmap ( void ); 00119 void readAI( ); 00120 void writeAI( ); 00121 }; 00122 00123 class tnetworkloaders : public tgameloaders { 00124 public: 00125 GameMap* loadnwgame ( pnstream strm ); 00126 int savenwgame ( pnstream strm, const GameMap* gamemap ); 00127 }; 00128 00129 class tsavegameloaders : public tgameloaders { 00130 public: 00131 GameMap* loadgame ( pnstream strm ); 00132 static GameMap* loadGameFromFile ( const ASCString& name ); 00133 00134 void savegame ( pnstream strm, GameMap* gamemap, bool writeReplays = true ); 00135 00136 void savegame ( const ASCString& name ); 00137 }; 00138 00139 /* 00140 class treplayloaders : public tspfldloaders { 00141 void initmap ( void ); 00142 public: 00143 void loadreplay ( pmemorystreambuf streambuf ); 00144 void savereplay ( int num ); 00145 }; 00146 */ 00147 00149 extern bool validatemapfile ( const ASCString& filename ); 00150 00152 extern bool validatesavfile ( const ASCString& filename ); 00153 00155 extern bool validateemlfile ( const ASCString& filename ); 00156 00157 00158 struct MapConinuationInfo { 00159 ASCString title; 00160 ASCString codeword; 00161 ASCString filename; 00162 }; 00163 00164 extern MapConinuationInfo findNextCampaignMap( int id = -1 ); 00165 00166 00167 #endif
1.4.2