Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] (PR#3376) print exact number of points in science dialog
Home

[Freeciv-Dev] (PR#3376) print exact number of points in science dialog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#3376) print exact number of points in science dialog
From: "Genevieve Gracian via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 10 Feb 2003 09:58:15 -0800
Reply-to: rt.freeciv.org@xxxxxxxxxxxxxx

Hello.

That adds how many science points the player exactly gets
(near "number of turns for a tech" in science dialog) on the
gtk client.

G. Gracian

diff -u -r freeciv/client/gui-gtk/repodlgs.c 
sci_points/client/gui-gtk/repodlgs.c
--- freeciv/client/gui-gtk/repodlgs.c   2003-01-14 00:27:03.000000000 +0100
+++ sci_points/client/gui-gtk/repodlgs.c        2003-02-10 18:39:27.000000000 
+0100
@@ -363,18 +363,20 @@
   GList *sorting_list = NULL;
   gfloat pct;
   int turns_to_advance;
+  int points_per_turn;
   int steps;
 
   if(is_report_dialogs_frozen()) return;
 
   turns_to_advance = tech_turns_to_advance(game.player_ptr);
+       points_per_turn = tech_points_per_turn(game.player_ptr);
   if (turns_to_advance == FC_INFINITY) {
     my_snprintf(text, sizeof(text), _("Research speed: no research"));
   } else {
     my_snprintf(text, sizeof(text),
-               PL_("Research speed: %d turn/advance",
-                   "Research speed: %d turns/advance", turns_to_advance),
-               turns_to_advance);
+               PL_("Research speed: %d turn/advance (%d points/turn)",
+                   "Research speed: %d turns/advance (%d points/turn)", 
turns_to_advance),
+               turns_to_advance, points_per_turn);
   }
 
   gtk_set_label(science_label, text);
diff -u -r freeciv/common/tech.c sci_points/common/tech.c
--- freeciv/common/tech.c       2003-01-22 20:55:08.000000000 +0100
+++ sci_points/common/tech.c    2003-02-10 18:39:06.000000000 +0100
@@ -321,6 +321,26 @@
 }
 
 /**************************************************************************
+ Returns number of bulbs per turn (assuming current state of
+ civilization).
+**************************************************************************/
+int tech_points_per_turn(struct player *pplayer)
+{
+  /* The number of bulbs the civilization produces every turn. */
+  int current_output = 0;
+
+  city_list_iterate(pplayer->cities, pcity) {
+    current_output += pcity->science_total;
+  } city_list_iterate_end;
+
+  if (current_output <= 0) {
+    return FC_INFINITY;
+  }
+
+  return (current_output);
+}
+
+/**************************************************************************
   Returns the number of bulbs which are required to finished the
   currently researched tech denoted by
   pplayer->research.researching. This is _NOT_ the number of bulbs
diff -u -r freeciv/common/tech.h sci_points/common/tech.h
--- freeciv/common/tech.h       2003-01-14 00:27:12.000000000 +0100
+++ sci_points/common/tech.h    2003-02-10 18:39:06.000000000 +0100
@@ -115,6 +115,7 @@
 Tech_Type_id find_tech_by_flag(int index, enum tech_flag_id flag);
 
 int tech_turns_to_advance(struct player *pplayer);
+int tech_points_per_turn(struct player *pplayer);
 
 int total_bulbs_required(struct player *pplayer);
 int base_total_bulbs_required(struct player *pplayer,Tech_Type_id tech);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#3376) print exact number of points in science dialog, Genevieve Gracian via RT <=