home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Online / Twiny / Windows / Source / Config.cpp next >
C/C++ Source or Header  |  2000-08-14  |  924b  |  29 lines

  1. #include <windows.h>
  2.  
  3. #include "config.h"
  4.  
  5. struct ConfigData    Config;
  6. static char            IniFileName[] = "Twiny.ini";
  7.  
  8. void LoadConfig( struct ConfigData *cfg )
  9. {
  10.     char    IniFile[ MAX_PATH ];
  11.  
  12.     memset( cfg, 0, sizeof( *cfg ));
  13.  
  14.     GetModuleFileName( NULL, IniFile, sizeof( IniFile ));
  15.  
  16.     // I hereby state I don't code this way. Usually. :)
  17.     strrchr( IniFile, '\\' )[1] = '\0';
  18.     strcat( IniFile, IniFileName );
  19.  
  20.     cfg->Port      = GetPrivateProfileInt( "Server", "Port", 1414, IniFile );
  21.     cfg->WinX      = GetPrivateProfileInt( "Window", "X", 650, IniFile );
  22.     cfg->WinY      = GetPrivateProfileInt( "Window", "Y", 2, IniFile );
  23.     cfg->WinWidth  = GetPrivateProfileInt( "Window", "Width", 100, IniFile );
  24.     cfg->WinHeight = GetPrivateProfileInt( "Window", "Height", 100, IniFile );
  25.  
  26.     GetPrivateProfileString( "Server", "Host", "Amiga", 
  27.                              cfg->Host, sizeof( cfg->Host ), IniFile );
  28.  
  29. }