Jump to content

@CNCNET Devs


Humble

Recommended Posts

In regards to the Free Radar Toggler.. I made a quick solution. It's not built in but it is an external program you have to run. It simply toggles the current setting off the map to on or off.

 

Hopefully this can get implemented but in the mean time this works for me.

 

#include <iostream>
#include <windows.h>

#define SECTION "Basic"
#define KEY "FreeRadar"

using namespace std;

int FreeRadar( char* szFileName) {
    char szBuffer[MAX_PATH];
    if( GetPrivateProfileString( SECTION, KEY, NULL, szBuffer, sizeof( szBuffer ), szFileName ) != 0 ) {
        if( strcmpi( szBuffer, "yes") == 0 ) {
            WritePrivateProfileString( SECTION, KEY, "no", szFileName);
            return 1;
        } else if( strcmpi( szBuffer, "no") == 0 ) {
            WritePrivateProfileString( SECTION, KEY, "yes", szFileName);
            return 2;
        }
    } 
    return 0; 
}

int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nCmdShow )
{
    int ret;

    OPENFILENAME ofn;

    char szFileName[MAX_PATH];

    ZeroMemory(&ofn, sizeof(ofn));

    ofn.lStructSize = sizeof(ofn);
    ofn.lpstrFilter = "Map Files (*.mpr;*.map)\0*.mpr;*.map";
    ofn.lpstrFile = szFileName;
    ofn.nMaxFile = MAX_PATH;
    ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;

    if(GetOpenFileName(&ofn))
    {
        if( ofn.lpstrFile != NULL ) {
            ret = FreeRadar( ofn.lpstrFile );
            if( ret == 1 ) {
                MessageBox ( NULL, "It appears to be free, setting to paid.", "Success" , MB_OK);
            } else if( ret == 2 ) {
                MessageBox ( NULL, "It appears to be paid, setting to free.", "Success" , MB_OK);
            } else {
                MessageBox ( NULL, "Something went totally wrong..", "Error" , MB_OK);
            }
        } else {
            MessageBox ( NULL, "You didn't select a file..", "Error" , MB_OK);
        }
    }
    return 0;
}

 

Theres an executable download below.

 

MD5: 6ffb0fc408ad3201452db7384007fde6

 

Enjoy.

FreeRadarToggler.rar

Link to comment
Share on other sites

@hamster:

 

This actually edits the map file itself, so we will have to run this while CNCNET is not running, or restart CNCNET for the change to take effect, correct?

 

Right, you will have to restart it to reload the maps.

 

You'll be creating edited duplicates of maps on cncnet though... might be nice if that program changed the map name to reflect that.

 

Good idea.

 

#include <iostream>
#include <windows.h>

#define SECTION "Basic"
#define NAME "Name"
#define RADAR "FreeRadar"

using namespace std;

int FreeRadar( char* szFileName) {
    char szName[MAX_PATH], 
szRadar[MAX_PATH], szBuffer[MAX_PATH];
    if( GetPrivateProfileString( SECTION, RADAR, NULL, szRadar, sizeof( szRadar ), szFileName ) != 0 ) {
if( GetPrivateProfileString( SECTION, NAME, NULL, szName, sizeof( szName ), szFileName ) != 0 ) {
    sprintf( szBuffer, "%s {free-radar}, szName );
            WritePrivateProfileString( SECTION, NAME, szBuffer, szFileName);
            if( strcmpi( szBuffer, "yes") == 0 ) {
                WritePrivateProfileString( SECTION, RADAR, "no", szFileName);
                return 1;
            } else if( strcmpi( szBuffer, "no") == 0 ) {
                WritePrivateProfileString( SECTION, RADAR, "yes", szFileName);
                return 2;
            }
        }
    }
    return 0;
}

int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nCmdShow )
{
    int ret;

    OPENFILENAME ofn;

    char szFileName[MAX_PATH];

    ZeroMemory(&ofn, sizeof(ofn));

    ofn.lStructSize = sizeof(ofn);
    ofn.lpstrFilter = "Map Files (*.mpr;*.map)\0*.mpr;*.map";
    ofn.lpstrFile = szFileName;
    ofn.nMaxFile = MAX_PATH;
    ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;

    if(GetOpenFileName(&ofn))
    {
        if( ofn.lpstrFile != NULL ) {
            ret = FreeRadar( ofn.lpstrFile );
            if( ret == 1 ) {
                MessageBox ( NULL, "It appears to be free, setting to paid.", "Success" , MB_OK);
            } else if( ret == 2 ) {
                MessageBox ( NULL, "It appears to be paid, setting to free.", "Success" , MB_OK);
            } else {
                MessageBox ( NULL, "Something went totally wrong..", "Error" , MB_OK);
            }
        } else {
            MessageBox ( NULL, "You didn't select a file..", "Error" , MB_OK);
        }
    }
    return 0;
}

Link to comment
Share on other sites

Also: When helipads are full and building new aircraft, the aircraft spawns off the map, and about 10% of the time or more gets stuck off map.

 

You can also attack units by edge of map and aircraft sometimes gets stuck off map.  If the aircraft are numbered you can select the team number and hit 'S' key, then click units back to map.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...