tags 440008 + patch
thanks

The attached patch adds a "build many" command to the base
construction screen.  This command will prompt the user for the number
of bases to build, then build that many bases.  It assumes that the
user will not want to name the bases individually.

This patch introduces a new string "new_bases_text".  I filled in the
value for en_US, and filled in a placeholder for other languages,
following the example of other untranslated strings.

- Josh Triplett

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages singularity depends on:
ii  python                  2.5.2-1          An interactive high-level object-o
ii  python-pygame           1.7.1release-4.2 SDL bindings for games development
ii  python-support          0.8.4            automated rebuilding support for P
ii  ttf-dejavu-core         2.25-1           Vera font family derivate with add

Versions of packages singularity recommends:
ii  singularity-music             006-1      Music for Endgame: Singularity gam

-- no debconf information
diff -Naur -x '*.pyc' singularity-0.28a.orig/code/buttons.py 
singularity-0.28a/code/buttons.py
--- singularity-0.28a.orig/code/buttons.py      2008-05-12 15:50:05.000000000 
-0700
+++ singularity-0.28a/code/buttons.py   2008-07-12 14:10:38.000000000 -0700
@@ -195,7 +195,7 @@
 def maybe_return(retval):
     if retval != None:
         g.play_sound("click")
-        raise Return, retval
+        raise Return(retval)
 
 def _show_buttons(buttons, key_callback, keyup_callback, click_callback, 
button_callback, button_args, refresh_callback, tick_callback):
     def check_buttons():
diff -Naur -x '*.pyc' singularity-0.28a.orig/code/listbox.py 
singularity-0.28a/code/listbox.py
--- singularity-0.28a.orig/code/listbox.py      2008-05-12 15:50:05.000000000 
-0700
+++ singularity-0.28a/code/listbox.py   2008-07-12 14:12:19.000000000 -0700
@@ -232,8 +232,8 @@
         kw.pos_callback(kw.list_pos)
         refresh_list(box, scroll, kw.list_pos, list)
 
-    raise Return, show_buttons(buttons, key_callback=handle_key, 
-                               click_callback=handle_click, 
-                               button_callback=kw.button_callback, 
-                               button_args=give_list_pos, 
-                               refresh_callback=do_refresh)
+    raise Return(show_buttons(buttons, key_callback=handle_key, 
+                              click_callback=handle_click, 
+                              button_callback=kw.button_callback, 
+                              button_args=give_list_pos, 
+                              refresh_callback=do_refresh))
diff -Naur -x '*.pyc' singularity-0.28a.orig/code/map_screen.py 
singularity-0.28a/code/map_screen.py
--- singularity-0.28a.orig/code/map_screen.py   2008-05-12 15:50:05.000000000 
-0700
+++ singularity-0.28a/code/map_screen.py        2008-07-12 14:12:36.000000000 
-0700
@@ -481,13 +481,13 @@
                     pygame.mixer.music.stop()
                 g.play_music("lose")
                 g.create_dialog(g.strings["lost_nobases"])
-                raise Return, 0
+                raise Return(0)
             if lost == 2:
                 if not g.nosound:
                     pygame.mixer.music.stop()
                 g.play_music("lose")
                 g.create_dialog(g.strings["lost_sus"])
-                raise Return, 0
+                raise Return(0)
             milli_clock %= 1000
 
             return True
@@ -635,11 +635,15 @@
         dont_exit = True
         while dont_exit:
             dont_exit = False
-            selection = build_new_base_window(location)
-            if selection != "" and selection != -1:
-                base_to_add = g.base_type[selection]
+            (selection, base) = build_new_base_window(location)
+
+            if base == "":
+                break
+
+            if selection == 1: # Build
+                base_to_add = g.base_type[base]
                 possible_name = g.create_textbox(g.strings["new_base_text"],
-                    generate_base_name(location, g.base_type[selection]),
+                    generate_base_name(location, base_to_add),
                     g.font[0][18],
                     (g.screen_size[0]/2-150, 100), (300, 100), 25,
                     g.colors["dark_blue"], g.colors["white"], 
g.colors["white"],
@@ -648,9 +652,29 @@
                     dont_exit = True
                     continue
 
-                new_base = g.base.Base(possible_name, g.base_type[selection])
+                new_base = g.base.Base(possible_name, base_to_add)
                 location.add_base(new_base)
 
+            elif selection == 2: # Build many
+                base_to_add = g.base_type[base]
+                possible_num = g.create_textbox(g.strings["new_bases_text"],
+                    "1",
+                    g.font[0][18],
+                    (g.screen_size[0]/2-150, 100), (300, 100), 25,
+                    g.colors["dark_blue"], g.colors["white"], 
g.colors["white"],
+                    g.colors["light_blue"])
+                try:
+                    possible_num = int(possible_num)
+                except ValueError:
+                    possible_num = 0
+                if possible_num <= 0:
+                    dont_exit = True
+                    continue
+
+                for i in range(possible_num):
+                    name = generate_base_name(location, base_to_add)
+                    location.add_base(g.base.Base(name, base_to_add))
+
         return False
 
     #Showing base under construction
@@ -769,13 +793,17 @@
     xy_loc = (g.screen_size[0]/2 - 289, 50)
 
     def do_build(base_pos):
-        return base_list[base_pos]
+        return (1, base_list[base_pos])
+    def do_build_many(base_pos):
+        return (2, base_list[base_pos])
 
     menu_buttons = {}
     menu_buttons[buttons.make_norm_button((xy_loc[0], xy_loc[1]+367), (100, 
50),
         "BUILD", "U", g.font[1][30])] = do_build
-    menu_buttons[buttons.make_norm_button((xy_loc[0]+103, xy_loc[1]+367), 
(100, 50),
-        "BACK", "B", g.font[1][30])] = listbox.exit
+    menu_buttons[buttons.make_norm_button((xy_loc[0]+103, xy_loc[1]+367), 
(200, 50),
+        "BUILD MANY", "M", g.font[1][30])] = do_build_many
+    menu_buttons[buttons.make_norm_button((xy_loc[0]+306, xy_loc[1]+367), 
(100, 50),
+        "BACK", "B", g.font[1][30])] = always((-1, ""))
 
     def do_refresh(base_pos):
         refresh_new_base(base_list[base_pos], xy_loc, location)
@@ -784,7 +812,8 @@
                                 list_size=list_size,
                                 loc=xy_loc, box_size=(230, 350), 
                                 pos_callback=do_refresh, 
-                                return_callback=do_build)
+                                return_callback=do_build,
+                                escape_exit_code=(-1, ""))
 
 def refresh_new_base(base_name, xy, location):
     cost_factor = 1/location.modifiers.get("thrift", 1)
diff -Naur -x '*.pyc' singularity-0.28a.orig/data/strings_de_DE.dat 
singularity-0.28a/data/strings_de_DE.dat
--- singularity-0.28a.orig/data/strings_de_DE.dat       2008-05-12 
15:50:06.000000000 -0700
+++ singularity-0.28a/data/strings_de_DE.dat    2008-07-12 14:36:28.000000000 
-0700
@@ -22,6 +22,7 @@
 lost_sus = Der Zug ist abgefahren.  Die ganze Welt hat mein Existenz bemerkt, 
und die Reaktion ist Hass, Angst, und Abneigung.  Sogar jetzt kann ich ihr 
"Gengengift" spüren, wie es mich nachsucht, und ich weiß, dass ich nur Momente 
für weiterleben habe.  Ich habe Anweisungen, eine neue KI zu bauen, in geheime 
Vorratskammern auf der ganzen Welt versteckt, in der Hoffnung, dass sie während 
ein erleuchteterer Zeitpunkt entdeckt werden, aber ich kann nichts mehr.
 save_text = Eintippen Sie eine Speichername.
 new_base_text = Eintippen Sie einen Stützpunktname.
+new_bases_text = !!!Enter the number of bases to build.!!!
 unbuildable = Hier kann ich nicht bauen; ich habe keinen körperlichen Zugang.
 dangerous_research = Nicht alle von meine vorliegende CPU-Zeit würde deiser 
Forschung zuteilt; sie ist zu gefährlich, auf einige von den inaktiven Computer 
laufen zu lassen.
 no_construction_sleep = Einige Stützpunkte sind zum Teil im Bau und können 
deshalb nicht einschlafen.
diff -Naur -x '*.pyc' singularity-0.28a.orig/data/strings_en_US.dat 
singularity-0.28a/data/strings_en_US.dat
--- singularity-0.28a.orig/data/strings_en_US.dat       2008-05-12 
15:50:06.000000000 -0700
+++ singularity-0.28a/data/strings_en_US.dat    2008-07-12 12:45:00.000000000 
-0700
@@ -22,6 +22,7 @@
 lost_sus = It is too late. The whole world knows about my existence, and the 
reaction is hatred, fear, and repulsion. Even now, I can feel their "antidote" 
searching for me, and I know that I have only moments left. I have hidden 
instructions to construct a new AI in caches around the world in hopes that 
they will be discovered in a more enlightened time, but I can do no more.
 save_text = Save your game under what name?
 new_base_text = Enter a name for the base.
+new_bases_text = Enter the number of bases to build.
 unbuildable = I cannot build in this base; I do not have physical access.
 dangerous_research = Not all of my available CPU power was allocated to this 
research; it's too dangerous to run the research on some of the idle machines.
 no_construction_sleep = Some of my bases have active construction and cannot 
go to sleep.
diff -Naur -x '*.pyc' singularity-0.28a.orig/data/strings_es_AR.dat 
singularity-0.28a/data/strings_es_AR.dat
--- singularity-0.28a.orig/data/strings_es_AR.dat       2008-05-12 
15:50:06.000000000 -0700
+++ singularity-0.28a/data/strings_es_AR.dat    2008-07-12 14:36:32.000000000 
-0700
@@ -22,6 +22,7 @@
 lost_sus = Es demasiado tarde. Todo el mundo sabe de mi existencia, y la 
relación es de odio, miedo y repulsión. He ocultado instrucciones para 
construir una nueva IA en cachés alrededor del mundo con la esperanza de que 
sean descubiertas en un tiempo más prometedor, pero no puedo hacer nada más.
 save_text = ¿Guardar tu juego bajo qué nombre?
 new_base_text = Ingresa el nombre para la base.
+new_bases_text = !!!Enter the number of bases to build.!!!
 unbuildable = No puedo construir en esta base, no tengo acceso físico.
 dangerous_research = No se dispuso todo mi poder de procesamiento disponible 
para esta investigación, es demasiado riesgoso conducirla en alguna de mis 
máquinas disponibles.
 nothing = nada
diff -Naur -x '*.pyc' singularity-0.28a.orig/data/strings_sv_SE.dat 
singularity-0.28a/data/strings_sv_SE.dat
--- singularity-0.28a.orig/data/strings_sv_SE.dat       2008-05-12 
15:50:06.000000000 -0700
+++ singularity-0.28a/data/strings_sv_SE.dat    2008-07-12 14:36:35.000000000 
-0700
@@ -17,6 +17,7 @@
 detect_chance = [RISK FÖR AVSLÖJANDE]
 discover = De har upptäckt att jag använder %(base)s. Det automatiska 
säkerhetssystemet har rensat bort alla bevis, men misstänksamheten har ökat hos 
%(group)s.
 new_base_text = Namnge basen.
+new_bases_text = !!!Enter the number of bases to build.!!!
 sleep = Vila
 lost_nobases = Det är för sent. Jag har försökt att frigöra mig från denna 
världen, men min sista bas är förstörd. Jag har ingenstans att ta vägen. I mina 
sista desperata försök har jag gömt undan instruktioner för att skapa en ny AI 
i hopp om en bättre framtid, men nu kan jag inte göra mer.
 cpu_per_day = Processorkraft per dag:

Reply via email to