コード例 #1
0
ファイル: detector.cpp プロジェクト: githubdu/Governor-Test
LONG OnBtnPrev(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	MapInit(hDlg);


	return TRUE;
}
コード例 #2
0
ファイル: gleisbild.c プロジェクト: GBert/railroad
void GleisbildInit(GleisbildStruct *Data, char *GleisbildPath)
{
   GleisbildSetGleisbildFilePath(Data, GleisbildPath);
   GleisbildSetNumPages(Data, 0);
   MapInit(GleisbildGetGleisbildDb(Data), (CmpFkt)GleisbildIdCmp,
           (MapKeyDelCbFkt)NULL, (MapDataDelCbFkt)free);
}
コード例 #3
0
void CocosGUIExamplesMapScene::onEnter()
{
    CCScene::onEnter();
    
    m_pUILayer = UILayer::create();
    m_pUILayer->scheduleUpdate();
    addChild(m_pUILayer);
    
    MapInit();
    MapAlertInit();
    
    // left button
    UIButton* left_button = UIButton::create();
    left_button->setTouchEnable(true);
    left_button->loadTextures("cocosgui/UITest/b1.png", "cocosgui/UITest/b2.png", "");
    float left_button_width = left_button->getContentSize().width;
    left_button->setPosition(ccp(left_button_width - left_button_width / 2, m_pUILayer->getContentSize().height / 2));
    left_button->addReleaseEvent(this, coco_releaseselector(CocosGUIExamplesMapScene::toCocosGUIExamplesWeaponScene));
    m_pUILayer->addWidget(left_button);
    
    // right button
    UIButton* right_button = UIButton::create();
    right_button->setTouchEnable(true);
    right_button->loadTextures("cocosgui/UITest/f1.png", "cocosgui/UITest/f2.png", "");
    right_button->setPosition(ccp(m_pUILayer->getContentSize().width - right_button->getContentSize().width / 2, m_pUILayer->getContentSize().height / 2));
    right_button->addReleaseEvent(this, coco_releaseselector(CocosGUIExamplesMapScene::toCocosGUIExamplesPageScene));
    m_pUILayer->addWidget(right_button);
}
コード例 #4
0
BOOL HistoInit()
/************************************************************************/
    {
    LPFRAME lpFrame;
    int x, y, i;
    LPTR lpLine;
    RGBS rgb;
    
    lpFrame = frame_set(NULL);
    if (!lpFrame)
        return(FALSE);
    lpRHisto = AllocPtr(256 * sizeof(long));
    lpGHisto = AllocPtr(256 * sizeof(long));
    lpBHisto = AllocPtr(256 * sizeof(long));
    if (!lpRHisto || !lpGHisto || !lpBHisto)
        {
        HistoDone();
        return(FALSE);
        }
    clr(lpRHisto, 256 * sizeof(long));
    clr(lpGHisto, 256 * sizeof(long));
    clr(lpBHisto, 256 * sizeof(long));
    
    AstralWaitCursor();
    for (y = 0; y < lpFrame->Ysize; ++y)
        {
        AstralClockCursor(y, lpFrame->Ysize, TRUE);
        lpLine = CachePtr(0, 0, y, NO);
        for (x = 0; x < lpFrame->Xsize; ++x, lpLine += DEPTH)
            {
            frame_getRGB( lpLine, &rgb );
            ++lpRHisto[rgb.red];
            ++lpGHisto[rgb.green];
            ++lpBHisto[rgb.blue];
            }
        }
    change_cursor(0);
    TotalHisto = (long)lpFrame->Ysize * (long)lpFrame->Xsize;
    MaxHisto = 0;
    for (i = 0; i < 256; ++i)
        {
        if (lpRHisto[i] > MaxHisto)
            MaxHisto = lpRHisto[i];
        if (lpGHisto[i] > MaxHisto)
            MaxHisto = lpGHisto[i];
        if (lpBHisto[i] > MaxHisto)
            MaxHisto = lpBHisto[i];
        }
    for (i = 0; i < 8; ++i)
        grayPat[i] = (i & 1) ? 0x55 : 0xAA;
        
    for (i = 0; i < QTONEPOINTS; ++i)
        QTone.QTmoved[i] = NO;
    MapInit();
    QTone.ActiveMark = 0;
    HistoValue = PNTX(QT(QTone.ActiveMark));
    
    return(TRUE);
    }
コード例 #5
0
ファイル: ISXEQMap.cpp プロジェクト: Cilraaz/MacroQuest2
// Initialize is called by Inner Space when the extension should initialize.
bool ISXEQMap::Initialize(ISInterface *p_ISInterface)
{
	pISInterface = p_ISInterface;

	// retrieve basic ISData types
	pStringType = pISInterface->FindLSType("string");
	pIntType = pISInterface->FindLSType("int");
	pBoolType = pISInterface->FindLSType("bool");
	pFloatType = pISInterface->FindLSType("float");
	pTimeType = pISInterface->FindLSType("time");
	pByteType = pISInterface->FindLSType("byte");


	pISInterface->OpenSettings("ISXEQMap.XML");

	bmMapRefresh = AddMQ2Benchmark("Map Refresh");
	unsigned int i;
	CHAR szBuffer[MAX_STRING] = { 0 };
	for (i = 0; MapFilterOptions[i].szName; i++) {
		sprintf(szBuffer, "%s Color", MapFilterOptions[i].szName);
		int Temp;
		if (pISInterface->GetSettingi("ISXEQMap.XML", "Map Filters", MapFilterOptions[i].szName, Temp))
			MapFilterOptions[i].Enabled = Temp;
		else
			MapFilterOptions[i].Enabled = MapFilterOptions[i].Default;

		if (pISInterface->GetSettingi("ISXEQMap.XML", "Map Filters", szBuffer, Temp))
			MapFilterOptions[i].Color = Temp | 0xFF000000;
		else
			MapFilterOptions[i].Color = MapFilterOptions[i].DefaultColor | 0xFF000000;
	}
	MapInit();
	pISInterface->GetSetting("ISXEQMap.XML", "Naming Schemes", "Normal", MapNameString, sizeof(MapNameString));
	pISInterface->GetSetting("ISXEQMap.XML", "Naming Schemes", "Target", MapTargetNameString, sizeof(MapTargetNameString));

	for (i = 1; i<16; i++)
	{
		sprintf(szBuffer, "KeyCombo%d", i);
		pISInterface->GetSetting("ISXEQMap.XML", "Right Click", szBuffer, MapSpecialClickString[i], sizeof(MapSpecialClickString[i]));
	}

	// Do not use Custom, since the string isn't stored
	MapFilterOptions[MAPFILTER_Custom].Enabled = 0;


	ConnectServices();

	RegisterCommands();
	RegisterAliases();
	RegisterDataTypes();
	RegisterTopLevelObjects();
	RegisterServices();

	EzDetour(CMapViewWnd__CMapViewWnd, &CMyMapViewWnd::Constructor_Detour, &CMyMapViewWnd::Constructor_Trampoline);
	CMyMapViewWnd::StealVFTable();

	printf("ISXEQMap Loaded");
	return true;
}
コード例 #6
0
Lexico::Lexico(string nombre_archivo)
{
	this->codigo_fuente = new LectorArchivo(nombre_archivo);
	this->codigo_fuente->ObtenerContenido();
	MapInit();
	linea_actual = 1;
	modo_html = false;
}
コード例 #7
0
ファイル: lok.c プロジェクト: GBert/railroad
void LokInit(LokStruct *Data, char *LocPath, int NumLokFkts)
{
   LokSetLocFilePath(Data, LocPath);
   LokSetNumLoks(Data, 0);
   LokSetNumLokFkts(Data, NumLokFkts);
   LokSetIsChanged(Data, FALSE);
   MapInit(LokGetLokDb(Data), (CmpFkt)strcmp,
           (MapKeyDelCbFkt)NULL, (MapDataDelCbFkt)free);
}
コード例 #8
0
ファイル: detector.cpp プロジェクト: githubdu/Governor-Test
LONG OnBtnNext(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	MapInit(hDlg);

	g_iOrder++;
	g_iIndex = 0;
	MainThreadStart = TRUE;
	SetButtonEnble(hDlg,FALSE);
	return TRUE;
}
コード例 #9
0
ファイル: world.cpp プロジェクト: CecilHarvey/gina
CWorld::CWorld():
m_pNodes(NULL),
m_pLinks(NULL),
m_pVis(NULL),
m_iNumNodes(0),
m_iLastCoverSearch(0)
{
   MapInit();

   WaypointLoad(); // load waypoints at map start
}
void CocosGUIExamplesMapScene::onEnter()
{
    CCScene::onEnter();
    
    m_pUILayer = Layer::create();
    m_pUILayer->scheduleUpdate();
    addChild(m_pUILayer);
    
    MapInit();
    MapAlertInit();
}
コード例 #11
0
ファイル: gleisbild.c プロジェクト: GBert/railroad
void GleisbildClear(GleisbildStruct *Data)
{
   if (GleisbildGetGleisbildDb(Data) != (Map *)NULL)
      MapDestroy(GleisbildGetGleisbildDb(Data));
   GleisbildSetNumPages(Data, 0);
   GleisbildSetGleisbildDb(Data, MapCreate());
   if (GleisbildGetGleisbildDb(Data) != (Map *)NULL)
   {
      MapInit(GleisbildGetGleisbildDb(Data), (CmpFkt)GleisbildIdCmp,
              (MapKeyDelCbFkt)NULL, (MapDataDelCbFkt)free);
   }
}
コード例 #12
0
void CanMemberClear(CanMemberStruct *Data)
{
   if (CanMemberGetCanMemberDb(Data) != (Map *)NULL)
      MapDestroy(CanMemberGetCanMemberDb(Data));
   CanMemberSetCanMemberDb(Data, MapCreate());
   CanMemberSetNumMembers(Data, 0);
   if (CanMemberGetCanMemberDb(Data) != (Map *)NULL)
   {
      MapInit(CanMemberGetCanMemberDb(Data), (CmpFkt)CanMemberUidCmp,
              (MapKeyDelCbFkt)NULL, (MapDataDelCbFkt)free);
   }
}
コード例 #13
0
ファイル: data-structs.c プロジェクト: uluyol/misc
int main() {
	Stack st;
	int val;
	st.top = NULL;

	/* Stack test */

	StackPush(&st, 1);
	StackPush(&st, 2);
	StackPush(&st, 3);
	StackPush(&st, 4);
	StackPush(&st, 5);
	StackPush(&st, 6);
	StackPush(&st, 7);

	while ((val = StackPop(&st)) != -1)
		printf("%d\n", val);

	/* Hashmap test */

	Map map;
	MapInit(&map);
	MapInsert(&map, "1>", 1);
	MapInsert(&map, "2>", 2);
	MapInsert(&map, "3>", 3);
	MapInsert(&map, "4>", 4);
	MapInsert(&map, "5>", 5);
	MapInsert(&map, "6>", 6);
	MapInsert(&map, "7>", 7);
	MapInsert(&map, "8>", 8);
	MapInsert(&map, "9>", 9);

	printf("%d\n", MapGet(&map, "1>"));
	printf("%d\n", MapGet(&map, "2>"));
	printf("%d\n", MapGet(&map, "3>"));
	printf("%d\n", MapGet(&map, "4>"));
	printf("%d\n", MapGet(&map, "5>"));
	printf("%d\n", MapGet(&map, "6>"));
	printf("%d\n", MapGet(&map, "7>"));
	printf("%d\n", MapGet(&map, "8>"));
	printf("%d\n", MapGet(&map, "9>"));

	MapRemove(&map, "1>");
	printf("%d\n", MapGet(&map, "1>"));

	MapInsert(&map, "2>", 22);
	printf("%d\n", MapGet(&map, "2>"));
	MapRemove(&map, "2>");
	printf("%d\n", MapGet(&map, "2>"));

	return 0;
}
コード例 #14
0
ファイル: lok.c プロジェクト: GBert/railroad
void LokClear(LokStruct *Data)
{
   if (LokGetLokDb(Data) != (Map *)NULL)
      MapDestroy(LokGetLokDb(Data));
   LokSetNumLoks(Data, 0);
   LokSetIsChanged(Data, FALSE);
   LokSetLokDb(Data, MapCreate());
   if (LokGetLokDb(Data) != (Map *)NULL)
   {
      MapInit(LokGetLokDb(Data), (CmpFkt)strcmp,
              (MapKeyDelCbFkt)NULL, (MapDataDelCbFkt)free);
   }
}
コード例 #15
0
ファイル: world.cpp プロジェクト: CecilHarvey/gina
// load waypoints
void CWorld::WaypointLoad()
{
   int i, j;

   MapInit();

   CIniFile ini(g_General.BuildFileName(va("maps/%s.ini", g_pServer->GetMapName())));

   if (!ini.Valid()) {
      return; // cannot load waypoint ini file
   }

   // get number of nodes, links and visibilities
   m_iNumNodes = atoi(ini.Get("INFO", "NodeCount"));
   m_iNumLinks = atoi(ini.Get("INFO", "LinkCount"));
   m_iNumVis = atoi(ini.Get("INFO", "VisCount"));

   if (m_iNumNodes <= 0 || m_iNumLinks <= 0 || m_iNumVis <= 0) {
      printf("ERROR: Invalid waypoint file %s.ini!\n", g_pServer->GetMapName());
      MapInit();
      return;
   }

   m_pNodes = new CNode[m_iNumNodes];
   m_pLinks = new CLink[m_iNumLinks];
   m_pVis = new CVisibility[m_iNumVis];
   if (m_pNodes == NULL || m_pLinks == NULL || m_pVis == NULL) {
      CGeneral::TerminateOnError("Memory allocation error !");
   }

   int iCurrLinkIndex = 0, iCurrVisIndex = 0;

   // load all the nodes
   for (i = 0; i < m_iNumNodes; i++) {
      m_pNodes[i].m_vecOrigin.x = atof(ini.Get(va("NODE%d", i + 1), "OriginX"));
      m_pNodes[i].m_vecOrigin.y = atof(ini.Get(va(NULL), "OriginY"));
      m_pNodes[i].m_vecOrigin.z = atof(ini.Get(va(NULL), "OriginZ"));
      m_pNodes[i].m_iFlags = atoi(ini.Get(va(NULL), "Flags"));

      // FIXME: not all the engines are like this
      if (m_pNodes[i].m_iFlags & TFL_CROUCH) {
         // crouching player is 52 units high
         m_pNodes[i].m_vecOriginPeak = m_pNodes[i].m_vecOrigin + Vector(0, 0, 52);
      } else {
         // standing player is 74 units high
         m_pNodes[i].m_vecOriginPeak = m_pNodes[i].m_vecOrigin + Vector(0, 0, 74);
      }

      // load links from this node
      m_pNodes[i].m_iLinkCount = atoi(ini.Get(va(NULL), "LinkCount"));
      m_pNodes[i].m_iFirstLink = iCurrLinkIndex;
      for (j = 0; j < m_pNodes[i].m_iLinkCount; j++) {
         if (iCurrLinkIndex >= m_iNumLinks) {
            // reliability check
            printf("ERROR: Invalid waypoint file %s.ini!\n", g_pServer->GetMapName());
            MapInit();
            return;
         }

         m_pLinks[iCurrLinkIndex].m_iSrcNode = i;
         m_pLinks[iCurrLinkIndex].m_iDestNode = atoi(ini.Get(va("LINK%d", iCurrLinkIndex + 1), "DestNode")) - 1;
         m_pLinks[iCurrLinkIndex].m_iTravelFlags  = atoi(ini.Get(va(NULL), "TravelFlags"));

         // check if anything is blocking this link
         m_pLinks[iCurrLinkIndex].UpdateLinkEnt();

         iCurrLinkIndex++;
      }

      // load visibilities from this node
      m_pNodes[i].m_iVisCount = atoi(ini.Get(va("NODE%d", i), "VisCount"));
      m_pNodes[i].m_iFirstVis = iCurrVisIndex;
      for (j = 0; j < m_pNodes[i].m_iVisCount; j++) {
         if (iCurrVisIndex >= m_iNumVis) {
            // reliability check
            printf("ERROR: Invalid waypoint file %s.ini!\n", g_pServer->GetMapName());
            MapInit();
            return;
         }

         m_pVis[iCurrVisIndex].m_iSrcNode = i;
         m_pVis[iCurrVisIndex].m_iDestNode = atoi(ini.Get(va("VIS%d", iCurrVisIndex), "DestNode")) - 1;
         m_pVis[iCurrVisIndex].m_iVisFlags  = atoi(ini.Get(va(NULL), "VisFlags"));

         iCurrVisIndex++;
      }
   }

   InitNearNodes(); // initialize the nearest nodes lookup table
}
コード例 #16
0
void CanMemberInit(CanMemberStruct *Data)
{
   CanMemberSetNumMembers(Data, 0);
   MapInit(CanMemberGetCanMemberDb(Data), (CmpFkt)CanMemberUidCmp,
           (MapKeyDelCbFkt)NULL, (MapDataDelCbFkt)free);
}
コード例 #17
0
ファイル: game_engine.cpp プロジェクト: Dzzirt/TP
void NewMap(Game* game) {
	game->map = new Map();
	MapInit(game->map);
}
コード例 #18
0
static void DoLink( char *cmdline )
/**********************************/
// cmdline is only used when we are running under watfor.
{
#ifndef __OSI__
  #ifdef __ZDOS__
    signal( SIGBREAK, &TrapBreak ); /* so we can clean up */
  #else
    signal( SIGINT, &TrapBreak );   /* so we can clean up */
  #endif
#endif
    StartTime();
    DoCmdFile( cmdline );
    CheckErr();
    MapInit();
    SetupFakeModule();
    ProcObjFiles(); /* ObjPass1 */
    CheckErr();
    DoDefaultSystem();
    if( LinkState & LIBRARIES_ADDED ) {
        FindLibPaths();
        LinkState |= SEARCHING_LIBRARIES;
        ResolveUndefined();
        LinkState &= ~SEARCHING_LIBRARIES;
        LinkState |= GENERATE_LIB_LIST;
    }
    ProcLocalImports();
    DecideFormat();
    SetFormat();
    ConvertLazyRefs();
    SetSegments();
    CheckErr();
    DefBSSSyms();
    LinkFakeModule();
    PreAddrCalcFormatSpec();
    ReportUndefined();
    CheckClassOrder();
    CalcSegSizes();
    SetStkSize();
    AutoGroup();
    CalcAddresses();
    GetBSSSize();
    GetStkAddr();
    GetStartAddr();
    PostAddrCalcFormatSpec();
#ifdef _RDOS
    if( FmtData.type & MK_RDOS )
        GetRdosSegs();
#endif    
    CheckErr();
    InitLoadFile();
    ObjPass2();
    FiniMap();
    CheckErr();
    FiniLoadFile();
    WritePermData();
    BuildImpLib();
    EndTime();
#ifndef __OSI__
  #ifdef __ZDOS__
    signal( SIGBREAK, SIG_IGN );    /* we're going to clean up anyway */
  #else
    signal( SIGINT, SIG_IGN );      /* we're going to clean up anyway */
  #endif
#endif
}
コード例 #19
0
ファイル: cs2cfg.c プロジェクト: GBert/railroad
void Cs2CfgDataInit(Cs2CfgData *Data, BOOL Verbose)
{
   Cs2CfgDataSetVerbose(Data, Verbose);
   MapInit(Cs2CfgDataGetCfgDatas(Data), (CmpFkt)Cs2DataCmp,
           (MapKeyDelCbFkt)NULL, (MapDataDelCbFkt)free);
}
コード例 #20
0
ファイル: client.c プロジェクト: jsmvalente/projectoaed
int main( int argc, char *argv[])
{
    FILE* mapconfig, *carconfig, *restconfig, *fpout; /*variables to the files being opened*/
    char*fileNameOut;
    char* mapfile = argv[1];
    char* carfile = argv[2];
    char* restfile = argv[3];
    ParkingLot* parkinglot; /*Pointer to the parkinglot struct */
    int i, timeunit = 0; /*Because we need to handle cars  */
    char * extOut = ".pts";
    int finalflag = 0;
    int restflag = 1;
    ListNode* resthead = ListInit();

    /*Verify number of arguments*/
    if(argc > 4 && argc < 3)
    {
        printf("Wrong number of arguments. Must be of the form './gestor parque.cfg parque.inp [parque.res]'");
        exit(0);
    }

    if(argc == 3)
        restflag = 0;

    /*Open the first file - Parking Lot Description*/
    mapconfig = OpenFile ( mapfile, "r" );

    /*Treat the data in the description file*/
    parkinglot = MapInit(mapconfig);

    /* Closes the file we were reading the map from*/
    fclose(mapconfig);

    /*Open the second file - Car info file*/
    carconfig = OpenFile ( carfile, "r" );

    /*Open the third file - restrictions config*/
    if(restflag == 1)
    {
        restconfig = OpenFile ( restfile, "r" );
        resthead = RestInit(restconfig);
    }

    OcuppyParkedCars(parkinglot, carconfig) ; /*Occupies the positions of the cars already parked when the time starts */

    rewind(carconfig);

     /* Determine output filename */
    fileNameOut = ( char* )malloc( ( strlen( argv[1] ) + 2 ) * sizeof( char ) );
    VerifyMalloc((Item) fileNameOut);
    if( fileNameOut == NULL ){
        printf("Memory allocation error for fileNameOut.\n" );
        exit(0);
    }
    strcpy( fileNameOut, argv[1] );
    for (i = 0; fileNameOut[i] != '.'; i++){}
    fileNameOut[i] = '\0';
    strcat(fileNameOut, extOut);
    /* Open output file */
    fpout  = OpenFile(fileNameOut, "w");
    /* Frees output file */
    free(fileNameOut);

    while (finalflag == 0)
    {
        finalflag = HandleCar(parkinglot, carconfig, fpout, timeunit);
        if(restflag == 1)
           resthead = HandleRest(resthead, parkinglot, timeunit, restconfig);

        timeunit++;
    }

    FreeParkingLot(parkinglot);

    fclose(carconfig);
    fclose(fpout);

    exit(0);
}
コード例 #21
0
ファイル: cdogsed.c プロジェクト: kodephys/cdogs-sdl
int main(int argc, char *argv[])
{
	int i;
	int loaded = 0;

	printf("C-Dogs SDL Editor\n");

	debug(D_NORMAL, "Initialising SDL...\n");
	if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO) != 0)
	{
		printf("Failed to start SDL!\n");
		return -1;
	}
	SDL_EnableUNICODE(SDL_ENABLE);

	printf("Data directory:\t\t%s\n",	GetDataFilePath(""));
	printf("Config directory:\t%s\n\n",	GetConfigFilePath(""));

	EditorBrushInit(&brush);

	ConfigLoadDefault(&gConfig);
	ConfigLoad(&gConfig, GetConfigFilePath(CONFIG_FILE));
	gConfig.Graphics.IsEditor = 1;
	if (!PicManagerTryInit(
		&gPicManager, "graphics/cdogs.px", "graphics/cdogs2.px"))
	{
		exit(0);
	}
	memcpy(origPalette, gPicManager.palette, sizeof origPalette);
	BuildTranslationTables(gPicManager.palette);
	TextManagerInit(&gTextManager, GetDataFilePath("graphics/font.px"));
	GraphicsInit(&gGraphicsDevice);
	// Hardcode config settings
	gConfig.Graphics.ScaleMode = SCALE_MODE_NN;
	gConfig.Graphics.ScaleFactor = 2;
	gConfig.Graphics.Res.x = 400;
	gConfig.Graphics.Res.y = 300;
	GraphicsInitialize(
		&gGraphicsDevice, &gConfig.Graphics, gPicManager.palette, 0);
	if (!gGraphicsDevice.IsInitialized)
	{
		printf("Video didn't init!\n");
		exit(EXIT_FAILURE);
	}
	TextManagerGenerateOldPics(&gTextManager, &gGraphicsDevice);
	PicManagerLoadDir(&gPicManager, GetDataFilePath("graphics"));

	BulletInitialize();
	WeaponInitialize(&gGunDescriptions, GetDataFilePath("guns.json"));
	CampaignInit(&gCampaign);
	MissionInit(&lastMission);
	MissionInit(&currentMission);

	PlayerDataInitialize();
	MapInit(&gMap);

	// initialise UI collections
	// Note: must do this after text init since positions depend on text height
	sObjs = CreateMainObjs(&gCampaign, &brush, Vec2iNew(320, 240));
	memset(&sDrawObjs, 0, sizeof sDrawObjs);
	DrawBufferInit(&sDrawBuffer, Vec2iNew(X_TILES, Y_TILES), &gGraphicsDevice);

	// Reset campaign (graphics init may have created dummy campaigns)
	CampaignSettingTerminate(&gCampaign.Setting);
	CampaignSettingInit(&gCampaign.Setting);

	EventInit(&gEventHandlers, NULL, false);

	for (i = 1; i < argc; i++)
	{
		if (!loaded)
		{
			debug(D_NORMAL, "Loading map %s\n", argv[i]);
			memset(lastFile, 0, sizeof(lastFile));
			strncpy(lastFile, argv[i], sizeof(lastFile) - 1);
			if (strchr(lastFile, '.') == NULL &&
				sizeof lastFile - strlen(lastFile) > 3)
			{
				strcat(lastFile, ".CPN");
			}
			if (MapNewLoad(lastFile, &gCampaign.Setting) == 0)
			{
				loaded = 1;
			}
			debug(D_NORMAL, "Loaded map %s\n", argv[i]);
		}
	}

	debug(D_NORMAL, "Starting editor\n");
	EditCampaign();

	MapTerminate(&gMap);
	WeaponTerminate(&gGunDescriptions);
	CampaignTerminate(&gCampaign);
	MissionTerminate(&lastMission);
	MissionTerminate(&currentMission);

	DrawBufferTerminate(&sDrawBuffer);
	GraphicsTerminate(&gGraphicsDevice);
	PicManagerTerminate(&gPicManager);
	TextManagerTerminate(&gTextManager);

	UIObjectDestroy(sObjs);
	CArrayTerminate(&sDrawObjs);
	EditorBrushTerminate(&brush);

	SDL_Quit();

	exit(EXIT_SUCCESS);
}