mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-13 00:24:29 +00:00
Merge pull request #47 from mrwonko/MapLoading
Ability to open .map files with Radiant
This commit is contained in:
commit
fd89b34bbb
3 changed files with 15 additions and 3 deletions
|
@ -894,7 +894,11 @@ int main( int argc, char* argv[] ) {
|
||||||
|
|
||||||
g_pParentWnd = new MainFrame();
|
g_pParentWnd = new MainFrame();
|
||||||
|
|
||||||
if ( g_PrefsDlg.m_bLoadLastMap && g_PrefsDlg.m_strLastMap.GetLength() > 0 ) {
|
// If the first parameter is a .map, load that.
|
||||||
|
if( g_argc > 1 && IsMap( g_argv[1] ) ){
|
||||||
|
Map_LoadFile( g_argv[1] );
|
||||||
|
}
|
||||||
|
else if ( g_PrefsDlg.m_bLoadLastMap && g_PrefsDlg.m_strLastMap.GetLength() > 0 ) {
|
||||||
Map_LoadFile( g_PrefsDlg.m_strLastMap.GetBuffer() );
|
Map_LoadFile( g_PrefsDlg.m_strLastMap.GetBuffer() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -3621,9 +3621,14 @@ void MainFrame::ShowMenuItemKeyBindings( GtkWidget* window ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks whether a given filename ends in .map
|
||||||
|
const bool IsMap(const char* filename){
|
||||||
|
return strlen(filename) >= 4 && strcmp(filename + strlen(filename) - 4, ".map") == 0;
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::CreateQEChildren(){
|
void MainFrame::CreateQEChildren(){
|
||||||
// load the project file
|
// load the project file, if it is a project file. (Or at least no .map)
|
||||||
if ( g_argc > 1 ) {
|
if ( g_argc > 1 && !IsMap( g_argv[1] ) ) {
|
||||||
Sys_Printf( "loading project file from the command line: %s\n", g_argv[1] );
|
Sys_Printf( "loading project file from the command line: %s\n", g_argv[1] );
|
||||||
if ( !QE_LoadProject( g_argv[1] ) ) {
|
if ( !QE_LoadProject( g_argv[1] ) ) {
|
||||||
Error( "Unable to load project file %s\n", g_argv[1] );
|
Error( "Unable to load project file %s\n", g_argv[1] );
|
||||||
|
|
|
@ -908,4 +908,7 @@ int gdk_offset_y;
|
||||||
// some C API to the mainframe functions
|
// some C API to the mainframe functions
|
||||||
void WINAPI QERApp_Sleep();
|
void WINAPI QERApp_Sleep();
|
||||||
|
|
||||||
|
// Checks whether a given filename ends in .map
|
||||||
|
const bool IsMap(const char* filename);
|
||||||
|
|
||||||
#endif // _MAINFRAME_H_
|
#endif // _MAINFRAME_H_
|
||||||
|
|
Loading…
Reference in a new issue