initial commit, lordsawar source, slightly modified
[lordsawar] / src / editor / cityset-main.cpp
1 //  Copyright (C) 2007, 2008, 2009 Ben Asselstine
2 //
3 //  This program is free software; you can redistribute it and/or modify
4 //  it under the terms of the GNU General Public License as published by
5 //  the Free Software Foundation; either version 3 of the License, or
6 //  (at your option) any later version.
7 //
8 //  This program is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //  GNU Library General Public License for more details.
12 //
13 //  You should have received a copy of the GNU General Public License
14 //  along with this program; if not, write to the Free Software
15 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
16 //  02110-1301, USA.
17
18 #ifdef HAVE_CONFIG_H
19 #include <config.h>
20 #endif
21
22 #include <iostream>
23 #include <stdlib.h>
24 #include <time.h>
25 #include <gtkmm.h>
26
27 #include "Configuration.h"
28 #include "File.h"
29 #include "GraphicsCache.h"
30 #include "timing.h"
31
32 #include "cityset-window.h"
33
34
35 int max_vector_width;
36 int main(int argc, char* argv[])
37 {
38     srand(time(NULL));         // set the random seed
39
40     initialize_configuration();
41     Vector<int>::setMaximumWidth(1000);
42
43     setlocale(LC_ALL, Configuration::s_lang.c_str());
44     textdomain ("lordsawar");
45
46     // Check if citysets are in the path (otherwise exit)
47     Cityset::scanSystemCollection();
48
49     // init GUI stuff
50     g_set_application_name(_("LordsAWar! Cityset Editor"));
51
52     CitySetWindow* cityset_window = NULL;
53     try
54     {
55         Gtk::Main kit(argc, argv);
56
57         if (argc > 1)
58           cityset_window = new CitySetWindow (argv[1]);
59         else
60           cityset_window = new CitySetWindow;
61
62         cityset_window->show();
63         
64         kit.run(cityset_window->get_window());
65         delete cityset_window;
66     }
67     catch (const Glib::Error &ex) {
68         std::cerr << ex.what() << std::endl;
69     }
70     
71     return EXIT_SUCCESS;
72 }