Add Formosan nation by resodan, SVG flag by J.M. Maalderink (mixcoatl@gna).
[freeciv.git] / data / civ2civ3 / script.lua
blob5c24b3b8ae4855207b358b9037e4762dd08ba6de
1 -- Freeciv - Copyright (C) 2007 - The Freeciv Project
2 -- This program is free software; you can redistribute it and/or modify
3 -- it under the terms of the GNU General Public License as published by
4 -- the Free Software Foundation; either version 2, or (at your option)
5 -- any later version.
6 --
7 -- This program is distributed in the hope that it will be useful,
8 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
9 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 -- GNU General Public License for more details.
12 function city_destroyed_callback(city, loser, destroyer)
13 city.tile:create_base("Ruins", NIL)
14 -- continue processing
15 return false
16 end
18 signal.connect("city_destroyed", "city_destroyed_callback")
20 function place_map_labels()
21 local mountains = 0
22 local deep_oceans = 0
23 local deserts = 0
24 local glaciers = 0
25 local selected_mountain = 0
26 local selected_ocean = 0
27 local selected_desert = 0
28 local selected_glacier = 0
30 for place in whole_map_iterate() do
31 local terr = place.terrain
32 local tname = terr:rule_name()
33 if tname == "Mountains" then
34 mountains = mountains + 1
35 elseif tname == "Deep Ocean" then
36 deep_oceans = deep_oceans + 1
37 elseif tname == "Desert" then
38 deserts = deserts + 1
39 elseif tname == "Glacier" then
40 glaciers = glaciers + 1
41 end
42 end
44 if random(1, 100) <= 75 then
45 selected_mountains = random(1, mountains)
46 end
47 if random(1, 100) <= 75 then
48 selected_ocean = random(1, deep_oceans)
49 end
50 if random(1, 100) <= 75 then
51 selected_desert = random(1, deserts)
52 end
53 if random(1, 100) <= 75 then
54 selected_glacier = random(1, glaciers)
55 end
57 for place in whole_map_iterate() do
58 local terr = place.terrain
59 local tname = terr:rule_name()
61 if tname == "Mountains" then
62 selected_mountain = selected_mountain - 1
63 if selected_mountain == 0 then
64 place:set_label(_("Highest Peak"))
65 end
66 elseif tname == "Deep Ocean" then
67 selected_ocean = selected_ocean - 1
68 if selected_ocean == 0 then
69 place:set_label(_("Deep Trench"))
70 end
71 elseif tname == "Desert" then
72 selected_desert = selected_desert - 1
73 if selected_desert == 0 then
74 place:set_label(_("Scorched Spot"))
75 end
76 elseif tname == "Glacier" then
77 selected_glacier = selected_glacier - 1
78 if selected_glacier == 0 then
79 place:set_label(_("Frozen Lake"))
80 end
81 end
82 end
84 return false
85 end
87 signal.connect("map_generated", "place_map_labels")