1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include <string.h>
#include <stdio.h>
#include "../simdebug.h"
#include "pakselector.h"
#include "../dataobj/umgebung.h"
/**
* what to do after loading
*/
void pakselector_t::action(const char *filename)
{
umgebung_t::objfilename = (cstring_t)filename + "/";
}
void pakselector_t::del_action(const char *filename)
{
// cannot delete set => use this for selection
umgebung_t::objfilename = (cstring_t)filename + "/";
}
const char *pakselector_t::get_info(const char *fname)
{
return "";
}
void pakselector_t::zeichnen(koord p, koord gr)
{
gui_frame_t::zeichnen( p, gr );
display_multiline_text( p.x+10, p.y+10,
"You have multiple pak sets to choose from.\n", COL_BLACK );
display_multiline_text( p.x+10, p.y+gr.y-4-(LINESPACE*3),
"To avoid seeing this dialogue define a path by:\n"
" - adding 'pak_file_path = pak/' to your simuconf.tab\n"
" - using '-objects pakxyz/' on the command line", COL_BLACK );
}
bool pakselector_t::check_file( const char *filename, const char * )
{
char buf[1024];
sprintf( buf, "%s/ground.Outside.pak", filename );
FILE *f=fopen( buf, "r" );
if(f) {
fclose(f);
}
// found only one?
if(f!=NULL) {
if(entries.count()==0) {
umgebung_t::objfilename = (cstring_t)filename + "/";
}
else if( !umgebung_t::objfilename.empty() ) {
umgebung_t::objfilename = "";
}
}
return f!=NULL;
}
pakselector_t::pakselector_t() : savegame_frame_t( NULL, umgebung_t::program_dir )
{
remove_komponente( &input );
remove_komponente( &savebutton );
remove_komponente( &cancelbutton );
remove_komponente( ÷r1 );
fnlabel.setze_text( "Choose one graphics set for playing:" );
}
|