summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-12-13 17:10:05 +0100
committerBardur Arantsson <bardur@scientician.net>2015-12-28 16:04:45 +0100
commitaf1b22bc057519500c58e4e87b60fefdec6f8d35 (patch)
tree348a0470843cab1f684d07dcda0738fdb172e17d
parentd10adaf65d299c3b4c2f4fa25c48b2dfabb7a0c8 (diff)
Remove get_month_name()
Use simple numbered days instead and remove START_{DAY,YEAR} since they are no longer used.
-rw-r--r--src/cmd4.cc14
-rw-r--r--src/defines.h2
-rw-r--r--src/dungeon.cc17
-rw-r--r--src/files.cc18
-rw-r--r--src/notes.cc16
-rw-r--r--src/tables.cc37
-rw-r--r--src/util.cc43
-rw-r--r--src/util.hpp1
8 files changed, 16 insertions, 132 deletions
diff --git a/src/cmd4.cc b/src/cmd4.cc
index b260174..f2d2b75 100644
--- a/src/cmd4.cc
+++ b/src/cmd4.cc
@@ -4273,16 +4273,12 @@ void do_cmd_change_movement(int i)
*/
void do_cmd_time()
{
- int day = bst(DAY, turn);
-
int hour = bst(HOUR, turn);
int min = bst(MINUTE, turn);
int full = hour * 100 + min;
- char buf2[20];
-
int start = 9999;
int end = -9999;
@@ -4299,12 +4295,10 @@ void do_cmd_time()
/* Note */
strcpy(desc, "It is a strange time.");
- /* Format time of the day */
- strnfmt(buf2, 20, get_day(bst(YEAR, turn) + START_YEAR));
-
- /* Display current date in the Elvish calendar */
- msg_format("This is %s of the %s year of the third age.",
- get_month_name(day, wizard, FALSE), buf2);
+ /* Display day */
+ u32b days = bst(DAY, turn) + 1;
+ msg_format("This is the %s day of your adventure.",
+ get_day(days));
/* Message */
msg_format("The time is %d:%02d %s.",
diff --git a/src/defines.h b/src/defines.h
index ee875b6..fc1f61f 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -258,8 +258,6 @@
#define HOUR (DAY / 24) /* Number of turns per hour */
#define MINUTE (HOUR / 60) /* Number of turns per minute */
#define DAY_START (HOUR * 6) /* Sunrise */
-#define START_YEAR 2890 /* Bilbo birthday year */
-#define START_DAY (DAY * (42 + 127)) /* Bilbo birthday */
#define BREAK_GLYPH 550 /* Rune of protection resistance */
#define BREAK_MINOR_GLYPH 99 /* For explosive runes */
diff --git a/src/dungeon.cc b/src/dungeon.cc
index c4282a2..3ec7906 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -1395,17 +1395,6 @@ static void process_world(void)
}
}
- /* Tell a day passed */
- if (((turn + (DAY_START * 10L)) % (10L * DAY)) == 0)
- {
- char buf[20];
-
- sprintf(buf, "%s", get_day(bst(YEAR, turn) + START_YEAR));
- cmsg_format(TERM_L_GREEN,
- "Today it is %s of the %s year of the third age.",
- get_month_name(bst(DAY, turn), wizard, FALSE), buf);
- }
-
/*** Process the monsters ***/
/* Check for creature generation. */
@@ -5249,14 +5238,14 @@ void play_game(bool_ new_game)
p_ptr->inside_quest = 0;
/* Hack -- enter the world */
- /* Mega-hack Vampires and Spectres start in the dungeon */
+ /* Mega-hack Vampires and Spectres start at midnight */
if (race_flags1_p(PR1_UNDEAD))
{
- turn = (10L * DAY / 2) + (START_DAY * 10) + 1;
+ turn = (10L * DAY / 2) + 1;
}
else
{
- turn = (START_DAY * 10) + 1;
+ turn = 1;
}
}
diff --git a/src/files.cc b/src/files.cc
index 765ea65..f91b51a 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -2215,7 +2215,7 @@ void display_player(int mode)
c_put_str(TERM_L_BLUE, deity_info[p_ptr->pgod].name, 7, 9);
/* Age, Height, Weight, Social */
- prt_num("Age ", (int)p_ptr->age + bst(YEAR, turn - (START_DAY * 10)), 2, 32, TERM_L_BLUE, " ");
+ prt_num("Age ", (int)p_ptr->age + bst(YEAR, turn), 2, 32, TERM_L_BLUE, " ");
prt_num("Height ", (int)p_ptr->ht, 3, 32, TERM_L_BLUE, " ");
prt_num("Weight ", (int)p_ptr->wt, 4, 32, TERM_L_BLUE, " ");
prt_num("Social Class ", (int)p_ptr->sc, 5, 32, TERM_L_BLUE, " ");
@@ -2750,17 +2750,7 @@ errr file_character(cptr name, bool_ full)
/* Date */
{
- char buf2[20];
- u32b days = bst(DAY, turn - (START_DAY * 10));
-
- strnfmt(buf2, 20, get_day(bst(YEAR, START_DAY * 10) + START_YEAR));
- fprintf(fff, "\n\n You started your adventure the %s of the %s year of the third age.",
- get_month_name(bst(DAY, START_DAY * 10), wizard, FALSE), buf2);
-
- strnfmt(buf2, 20, get_day(bst(YEAR, turn) + START_YEAR));
- fprintf(fff, "\n %s the %s of the %s year of the third age.",
- (death ? "You ended your adventure" : "It is currently"),
- get_month_name(bst(DAY, turn), wizard, FALSE), buf2);
+ u32b days = bst(DAY, turn);
fprintf(fff,
(death ? "\n Your adventure lasted %ld day%s." : "\n You have been adventuring for %ld day%s."),
(long int) days, (days == 1) ? "" : "s");
@@ -5182,7 +5172,7 @@ static errr top_twenty(void)
the_score.gold[9] = '\0';
/* Save the current turn */
- sprintf(the_score.turns, "%9lu", (long)turn - (START_DAY * 10L));
+ sprintf(the_score.turns, "%9lu", (long)turn);
the_score.turns[9] = '\0';
/* Save the date in standard form (8 chars) */
@@ -5283,7 +5273,7 @@ static errr predict_score(void)
the_score.gold[9] = '\0';
/* Save the current turn */
- sprintf(the_score.turns, "%9lu", (long)turn - (START_DAY * 10L));
+ sprintf(the_score.turns, "%9lu", (long)turn);
the_score.turns[9] = '\0';
/* Hack -- no time needed */
diff --git a/src/notes.cc b/src/notes.cc
index de9b755..d8b6a77 100644
--- a/src/notes.cc
+++ b/src/notes.cc
@@ -89,7 +89,7 @@ void add_note(char *note, char code)
{
char buf[100];
char final_note[100];
- char long_day[50];
+ char turn_s[50];
char depths[32];
/* Get the first 60 chars - so do not have an overflow */
@@ -97,16 +97,14 @@ void add_note(char *note, char code)
strncpy(buf, note, 60);
/* Get date and time */
- sprintf(long_day, "%ld:%02ld %s, %s", (long int) ((bst(HOUR, turn) % 12 == 0) ? 12 : (bst(HOUR, turn) % 12)),
- (long int) bst(MINUTE, turn), (bst(HOUR, turn) < 12) ? "AM" : "PM", get_month_name(bst(DAY, turn), FALSE,
- FALSE));
+ sprintf(turn_s, "Turn % 12ld", static_cast<long int>(turn));
/* Get depth */
if (!dun_level) strcpy(depths, " Town");
else sprintf(depths, "Lev%3d", dun_level);
/* Make note */
- sprintf(final_note, "%-20s %s %c: %s", long_day, depths, code, buf);
+ sprintf(final_note, "%-20s %s %c: %s", turn_s, depths, code, buf);
/* Output to the notes file */
output_note(final_note);
@@ -118,17 +116,13 @@ void add_note(char *note, char code)
*/
void add_note_type(int note_number)
{
- char long_day[50], true_long_day[50];
+ char true_long_day[50];
char buf[1024];
time_t ct = time((time_t*)0);
/* Get the date */
strftime(true_long_day, 30, "%Y-%m-%d at %H:%M:%S", localtime(&ct));
- /* Get the date */
- sprintf(buf, "%ld", (long int) (bst(YEAR, turn) + START_YEAR));
- sprintf(long_day, "%ld:%02ld %s the %s of III %s", (long int) ((bst(HOUR, turn) % 12 == 0) ? 12 : (bst(HOUR, turn) % 12)), (long int) bst(MINUTE, turn), (bst(HOUR, turn) < 12) ? "AM" : "PM", get_month_name(bst(DAY, turn), FALSE, FALSE), buf);
-
/* Work out what to do */
switch (note_number)
{
@@ -161,7 +155,7 @@ void add_note_type(int note_number)
"%s slew Morgoth on %s\n"
"Long live %s!\n"
"================================================",
- player_name, long_day, player_name);
+ player_name, true_long_day, player_name);
break;
}
diff --git a/src/tables.cc b/src/tables.cc
index ea14865..09e6c18 100644
--- a/src/tables.cc
+++ b/src/tables.cc
@@ -4341,43 +4341,6 @@ between_exit between_exits[MAX_BETWEEN_EXITS] =
};
/*
- * Months
- */
-int month_day[9] =
-{
- 0, /* 1 day */
-
- 1, /* 54 days */
- 55, /* 72 days */
- 127, /* 54 days */
-
- 181, /* 3 days */
-
- 184, /* 54 days */
- 238, /* 72 days */
- 310, /* 54 days */
-
- 364, /* 1 day */
-};
-
-cptr month_name[9] =
-{
- "Yestare",
-
- "Tuile",
- "Laire",
- "Yavie",
-
- "Enderi",
-
- "Quelle",
- "Hrive",
- "Coire",
-
- "Mettare",
-};
-
-/*
* max body parts
*/
int max_body_part[BODY_MAX] =
diff --git a/src/util.cc b/src/util.cc
index f2ed1f6..8971b97 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -3413,49 +3413,6 @@ s32b bst(s32b what, s32b t)
}
}
-cptr get_month_name(int day, bool_ full, bool_ compact)
-{
- int i = 8;
- static char buf[40];
-
- /* Find the period name */
- while ((i > 0) && (day < month_day[i]))
- {
- i--;
- }
-
- switch (i)
- {
- /* Yestare/Mettare */
- case 0:
- case 8:
- {
- char buf2[20];
-
- sprintf(buf2, "%s", get_day(day + 1));
- if (full) sprintf(buf, "%s (%s day)", month_name[i], buf2);
- else sprintf(buf, "%s", month_name[i]);
- break;
- }
- /* 'Normal' months + Enderi */
- default:
- {
- char buf2[20];
- char buf3[20];
-
- sprintf(buf2, "%s", get_day(day + 1 - month_day[i]));
- sprintf(buf3, "%s", get_day(day + 1));
-
- if (full) sprintf(buf, "%s day of %s (%s day)", buf2, month_name[i], buf3);
- else if (compact) sprintf(buf, "%s day of %s", buf2, month_name[i]);
- else sprintf(buf, "%s %s", buf2, month_name[i]);
- break;
- }
- }
-
- return (buf);
-}
-
cptr get_day(int day)
{
static char buf[20];
diff --git a/src/util.hpp b/src/util.hpp
index 9c6685c..bb8a64f 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -10,7 +10,6 @@ extern bool_ input_box(cptr text, int y, int x, char *buf, int max);
extern void draw_box(int y, int x, int h, int w);
extern void display_list(int y, int x, int h, int w, cptr title, cptr *list, int max, int begin, int sel, byte sel_color);
extern cptr get_player_race_name(int pr, int ps);
-extern cptr get_month_name(int month, bool_ full, bool_ compact);
extern cptr get_day(int day);
extern s32b bst(s32b what, s32b t);
extern errr path_temp(char *buf, int max);