diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/client/gui-gtk/diplodlg.c freeciv/client/gui-gtk/diplodlg.c --- freeciv-orig/client/gui-gtk/diplodlg.c Sat Jun 5 08:35:02 1999 +++ freeciv/client/gui-gtk/diplodlg.c Fri Jun 4 20:15:24 1999 @@ -390,10 +390,10 @@ sprintf(buf, "This Eternal Treaty\nmarks the results of the diplomatic work between\nThe %s %s %s\nand\nThe %s %s %s", get_race_name(plr0->race), - get_ruler_title(plr0->government), + get_ruler_title(plr0->government, plr0->is_male, plr0->race), plr0->name, get_race_name(plr1->race), - get_ruler_title(plr1->government), + get_ruler_title(plr1->government, plr1->is_male, plr1->race), plr1->name); pdialog->dip_labelm=gtk_label_new(buf); diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/client/gui-gtk/inteldlg.c freeciv/client/gui-gtk/inteldlg.c --- freeciv-orig/client/gui-gtk/inteldlg.c Sat Jun 5 08:35:02 1999 +++ freeciv/client/gui-gtk/inteldlg.c Fri Jun 4 20:16:48 1999 @@ -89,7 +89,7 @@ gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 2); sprintf(buf, "Ruler: %s %s", - get_ruler_title(p->government), p->name); + get_ruler_title(p->government, p->is_male, p->race), p->name); label=gtk_label_new(buf); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, FALSE, 5); diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/client/gui-gtk/repodlgs.c freeciv/client/gui-gtk/repodlgs.c --- freeciv-orig/client/gui-gtk/repodlgs.c Sat Jun 5 08:35:02 1999 +++ freeciv/client/gui-gtk/repodlgs.c Fri Jun 4 20:17:42 1999 @@ -131,7 +131,7 @@ report_name, get_government_name(game.player_ptr->government), get_race_name_plural(game.player_ptr->race), - get_ruler_title(game.player_ptr->government), + get_ruler_title(game.player_ptr->government, game.player_ptr->is_male, game.player_ptr->race), game.player_ptr->name, textyear(game.year)); diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/common/Makefile.am freeciv/common/Makefile.am --- freeciv-orig/common/Makefile.am Sat Jun 5 08:35:12 1999 +++ freeciv/common/Makefile.am Wed Jun 2 23:51:14 1999 @@ -38,4 +38,6 @@ tech.c \ tech.h \ unit.c \ - unit.h + unit.h \ + government.c \ + governemnt.h diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/common/government.c freeciv/common/government.c --- freeciv-orig/common/government.c Thu Jan 1 01:00:00 1970 +++ freeciv/common/government.c Fri Jun 4 19:53:28 1999 @@ -0,0 +1,131 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ +#include +#include + +#include "player.h" +#include + +/* governemnts.ruleset, anyone? -- SKi */ +struct ruler_title ruler_titles_anarchy[] = { + { DEFAULT_TITLE, "Mr.", "Mrs." }, + NULL_RULER_TITLE +}; +struct ruler_title ruler_titles_despotism[] = { + { DEFAULT_TITLE, "Emperor", "Empress" }, + { R_ROMAN, "Dictator", "Dictator" }, + { R_EGYPTIAN, "Pharaoh", "Pharaoh" }, +/* { R_VIKINGS, "Warlord", "Warlord" }, */ +/* { R_SIOUX, "Chief", "Chief" }, */ + NULL_RULER_TITLE +}; +struct ruler_title ruler_titles_monarchy[] = { + { DEFAULT_TITLE, "King", "Queen" }, + { R_ROMAN, "Imperator", "Imperatrix" }, + { R_EGYPTIAN, "Great Pharaoh", "Great Pharaoh" }, + { R_INDIAN, "Maharaja", "Maharaja" }, + { R_RUSSIAN, "Czar", "Czarina" }, +/* { R_JAPANESE, "Shogun", "Shogun" }, */ +/* { R_PERSIAN, "Shah", "Shah" }, */ +/* { R_SIOUX, "Great Chief", "Great Chief" } */ +/* { R_ARAB, "Sultan", "Sultan" }, */ + NULL_RULER_TITLE +}; +struct ruler_title ruler_titles_communism[] = { + { DEFAULT_TITLE, "Comrade", "Comrade" }, + { R_CHINESE, "Chairman", "Chairperson" }, + NULL_RULER_TITLE +}; +/* +struct ruler_title ruler_titles_fundamentalism[] = { + { DEFAULT_TITLE, "High Priest", "High Priestess" }, + { R_GERMAN, "Archbishop", "Archbishop" }, + { R_AMERICAN, "Reverend", "Reverend" }, + { R_RUSSIAN, "Patriarch", "Matriarch" }, + { R_FRENCH, "Archbishop", "Archbishop" }, + { R_ENGLISH, "Lord Protector", "Lady Protector" }, + { R_CELT, "Druid", "Druid" }, + { R_SPANISH, "Archbishop", "Archbishop" }, + { R_PERSIAN, "Ayatollah", "Ayatollah" }, + { R_ARAB, "Ayatollah", "Ayatollah" }, + NULL_RULER_TITLE +}; +*/ +struct ruler_title ruler_titles_republic[] = { + { DEFAULT_TITLE, "Consul", "Consul" }, + { R_AMERICAN, "Speaker", "Speaker" }, + NULL_RULER_TITLE +}; +struct ruler_title ruler_titles_democracy[] = { + { DEFAULT_TITLE, "President", "President" }, + { R_GERMAN, "Chancellor", "Chancellor" }, + { R_GREEK, "Prime Minister", "Prime Minister" }, + { R_FRENCH, "Premier", "Premier" }, + { R_ENGLISH, "Prime Minister", "Prime Minister" }, +/* { R_JAPANESE, "Prime Minister", "Prime Minister" }, */ + NULL_RULER_TITLE +}; +struct government governments[] = { + { + "Anarchy", ruler_titles_anarchy, + 100, 90, + NO_UPKEEP, 0, 0, 0, + 0, CITY_SIZE_FREE, 0, 0, + ENTIRE_CITY, 0 + }, + { + "Despotism", ruler_titles_despotism, + 60, 80, + NO_UPKEEP, 0, 0, 0, + 0, CITY_SIZE_FREE, 0, 0, + ENTIRE_CITY, 0 + }, + { + "Monarchy", ruler_titles_monarchy, + 70, 70, + NO_UPKEEP, 0, 1, 0, + 0, 3, 0, 0, + 3, 0 + }, + { + "Communism", ruler_titles_communism, + 80, 50, + NO_UPKEEP, 0, 1, 0, + 0, 3, 0, 0, + 0, 0 + }, +/* + { + "Fundamentalism", ruler_titles_fundamentalism, + 60, 30, + NO_UPKEEP, 0, 0, 0, + 0, 10, 0, 0, + 0, 0 + }, +*/ + { + "Republic", ruler_titles_republic, + 80, 40, + 0, 0, 1, 0, + 1, 0, 0, 0, + 0, 0 + }, + { + "Democracy", ruler_titles_democracy, + 100, 30, + 1, 0, 1, 0, + 0, 0, 0, 0, + 0, UNBRIBABLE + } +}; + diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/common/government.h freeciv/common/government.h --- freeciv-orig/common/government.h Thu Jan 1 01:00:00 1970 +++ freeciv/common/government.h Fri Jun 4 19:52:55 1999 @@ -0,0 +1,91 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ +#ifndef __GOVERNMENT_H +#define __GOVERNMENT_H + +#include "genlist.h" +#include "shared.h" +#include "limits.h" + +/* governements.ruleset anyone? -- SKi */ +enum government_type { + G_ANARCHY, + G_DESPOTISM, + G_MONARCHY, + G_COMMUNISM, +/* G_FUNDAMENTALISM, */ + G_REPUBLIC, + G_DEMOCRACY, + G_LAST +}; + +/* speical values for extra_* fields -- SKi */ +#define NO_UPKEEP (INT_MAX) +/* special values for free_* fields -- SKi */ +#define CITY_SIZE_FREE (INT_MAX-1) +/* generic special values (for modifiers) -- SKi */ +#define ENTIRE_CITY (INT_MAX-1) +#define UNBRIBABLE (INT_MAX-1) + +/* each government has a NULL-record terminated list of ruler titles, + * at least one entry (the default) should be in it, the list is traversed + * when a players title is needed. + * -- SKi */ +#define DEFAULT_TITLE -1 +#define NULL_RULER_TITLE { 0, NULL, NULL } + +struct ruler_title +{ + int race; + char* male_title; + char* female_title; +}; + +struct government +{ + /* government name */ + char* name; + /* ruler titles */ + struct ruler_title *ruler_title; +/* char* male_ruler_title; + char* female_ruler_title; */ + + /* max rate that can go to one place -- SKi */ + int max_rate; + /* something to do with civil wars I suppose -- SKi */ + int civil_war; + + /* cost modifiers -- SKi*/ + int extra_happy_cost; + int extra_shield_cost; + int extra_food_cost; + int extra_gold_cost; + + /* number of units that a city does not have to "pay" for --SKi */ + int free_happy; + int free_shield; + int free_food; + int free_gold; + + /* how many unhappy citizens can military units suppress? + * (ENTRIE_CITY is possible here.) + * -- SKi */ + int military_contentment_mod; + /* additional cost in bribing units (how should it be measured?) + * (UNBRIBABLE is possible here.) + * -- SKi */ + int extra_bribe_cost; +}; +extern struct government governments[]; + +#endif diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/common/player.c freeciv/common/player.c --- freeciv-orig/common/player.c Sat Jun 5 08:35:13 1999 +++ freeciv/common/player.c Fri Jun 4 20:01:27 1999 @@ -20,6 +20,8 @@ #include #include #include +#include +#include extern int is_server; @@ -127,24 +129,6 @@ "Genghis" }; -int government_rates[G_LAST] = { - 100, 60, 70, 80, 80, 100 -}; - -int government_civil_war[G_LAST] = { - 90, 80, 70, 50, 40, 30 -}; - -char *government_names[G_LAST] = { - "Anarchy", "Despotism", "Monarchy", - "Communism", "Republic", "Democracy" -}; - -char *ruler_titles[G_LAST] = { - "Mr.", "Emperor", "King", /* even for Elizabeth */ - "Comrade", "President", "President" -}; - /*************************************************************** ... ***************************************************************/ @@ -188,9 +172,29 @@ /*************************************************************** ... ***************************************************************/ -char *get_ruler_title(enum government_type type) +char *get_ruler_title(enum government_type gov, int male, int race) { - return ruler_titles[type]; + struct ruler_title *best_match = NULL; + struct ruler_title *title; + + title = governments[gov].ruler_title; + do { + if (title->race == -1 && best_match == NULL) { + best_match = title; + } else if (title->race == race) { + best_match = title; + break; + } + ++title; + } while (title->male_title != NULL); + + if (best_match) { + freelog (LOG_NORMAL, "get_ruler_title: %s", male ? best_match->male_title : best_match->female_title); + return male ? best_match->male_title : best_match->female_title; + } else { + freelog (LOG_NORMAL, "get_ruler_title: found no title for government %d", gov); + return "Mr."; + } } /*************************************************************** @@ -198,7 +202,7 @@ ***************************************************************/ int get_government_max_rate(enum government_type type) { - return government_rates[type]; + return governments[type].max_rate; } /*************************************************************** @@ -207,7 +211,7 @@ int get_government_civil_war_prob(enum government_type type) { if(type >= G_ANARCHY && type < G_LAST) - return government_civil_war[type]; + return governments[type].civil_war; return 0; } @@ -216,7 +220,7 @@ ***************************************************************/ char *get_government_name(enum government_type type) { - return government_names[type]; + return governments[type].name; } /***************************************************************/ @@ -263,6 +267,7 @@ plr->player_no=plr-game.players; strcpy(plr->name, "YourName"); + plr->is_male = 1; plr->government=G_DESPOTISM; plr->race=R_LAST; plr->capital=0; diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/common/player.h freeciv/common/player.h --- freeciv-orig/common/player.h Sat Jun 5 08:35:13 1999 +++ freeciv/common/player.h Fri Jun 4 20:13:16 1999 @@ -17,6 +17,7 @@ #include "unit.h" #include "city.h" #include "spaceship.h" +#include "government.h" struct tile; @@ -24,10 +25,6 @@ #define PLAYER_DEFAULT_SCIENCE_RATE 50 #define PLAYER_DEFAULT_LUXURY_RATE 0 #define TECH_GOALS 10 -enum government_type { - G_ANARCHY, G_DESPOTISM, G_MONARCHY, G_COMMUNISM, G_REPUBLIC, G_DEMOCRACY, - G_LAST -}; enum race_type { R_ROMAN, R_BABYLONIAN, R_GERMAN, R_EGYPTIAN, R_AMERICAN, R_GREEK, R_INDIAN, @@ -122,6 +119,7 @@ struct player { int player_no; char name[MAX_LENGTH_NAME]; + int is_male; enum government_type government; enum race_type race; int turn_done; @@ -154,7 +152,7 @@ int get_government_max_rate(enum government_type type); int get_government_civil_war_prob(enum government_type type); char *get_government_name(enum government_type type); -char *get_ruler_title(enum government_type type); +char *get_ruler_title(enum government_type gov, int male, int race); char *get_race_name(enum race_type race); char *get_race_name_plural(enum race_type race); struct player_race *get_race(struct player *plr); diff --exclude-from=../.diff_ignore -u -r -N freeciv-orig/server/cityturn.c freeciv/server/cityturn.c --- freeciv-orig/server/cityturn.c Sat Jun 5 08:35:15 1999 +++ freeciv/server/cityturn.c Fri Jun 4 22:07:52 1999 @@ -38,6 +38,7 @@ #include #include #include +#include extern signed short int minimap[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]; @@ -1276,13 +1268,13 @@ if (!pcity->was_happy && city_happy(pcity) && pcity->size>4) { notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_LOVE, "Game: We Love The %s Day celebrated in %s", - get_ruler_title(pplayer->government), + get_ruler_title(pplayer->government, pplayer->is_male, pplayer->race), pcity->name); } if (!city_happy(pcity) && pcity->was_happy && pcity->size>4) { notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_NORMAL, "Game: We Love The %s Day canceled in %s", - get_ruler_title(pplayer->government), + get_ruler_title(pplayer->government, pplayer->is_male, pplayer->race), pcity->name); }