• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisioneca68130b80eada0588fed5d810c0f539ffd396a (tree)
Time2019-06-09 22:46:51
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38844 player_uid を player_type 構造体に加える.

Change Summary

Incremental Difference

--- a/src/externs.h
+++ b/src/externs.h
@@ -54,7 +54,6 @@ extern bool repair_objects;
5454 * Software options (set via the '=' command). See "tables.c"
5555 */
5656
57-extern int player_uid;
5857 extern int player_euid;
5958 extern int player_egid;
6059 extern pos_list tmp_pos;
--- a/src/files.c
+++ b/src/files.c
@@ -5947,8 +5947,8 @@ void process_player_name(bool sf)
59475947 strcpy(savefile_base, p_ptr->base_name);
59485948
59495949 #ifdef SAVEFILE_USE_UID
5950- /* Rename the savefile, using the player_uid and p_ptr->base_name */
5951- (void)sprintf(temp, "%d.%s", player_uid, p_ptr->base_name);
5950+ /* Rename the savefile, using the p_ptr->player_uid and p_ptr->base_name */
5951+ (void)sprintf(temp, "%d.%s", p_ptr->player_uid, p_ptr->base_name);
59525952 #else
59535953 /* Rename the savefile, using the p_ptr->base_name */
59545954 (void)sprintf(temp, "%s", p_ptr->base_name);
@@ -6799,7 +6799,7 @@ static errr counts_seek(int fd, u32b where, bool flag)
67996799 int i;
68006800
68016801 #ifdef SAVEFILE_USE_UID
6802- (void)sprintf(temp1, "%d.%s.%d%d%d", player_uid, savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
6802+ (void)sprintf(temp1, "%d.%s.%d%d%d", p_ptr->player_uid, savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
68036803 #else
68046804 (void)sprintf(temp1, "%s.%d%d%d", savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
68056805 #endif
--- a/src/main.c
+++ b/src/main.c
@@ -280,11 +280,11 @@ int main(int argc, char *argv[])
280280 #ifdef SET_UID
281281
282282 /* Get the user id (?) */
283- player_uid = getuid();
283+ p_ptr->player_uid = getuid();
284284
285285 #ifdef VMS
286286 /* Mega-Hack -- Factor group id */
287- player_uid += (getgid() * 1000);
287+ p_ptr->player_uid += (getgid() * 1000);
288288 #endif
289289
290290 # ifdef SAFE_SETUID
@@ -339,9 +339,9 @@ int main(int argc, char *argv[])
339339
340340 /* Acquire the "user name" as a default player name */
341341 #ifdef ANGBAND_2_8_1
342- user_name(p_ptr->name, player_uid);
342+ user_name(p_ptr->name, p_ptr->player_uid);
343343 #else /* ANGBAND_2_8_1 */
344- user_name(op_ptr->full_name, player_uid);
344+ user_name(op_ptr->full_name, p_ptr->player_uid);
345345 #endif /* ANGBAND_2_8_1 */
346346
347347 #ifdef PRIVATE_USER_PATH
--- a/src/player-status.h
+++ b/src/player-status.h
@@ -60,6 +60,8 @@ typedef struct player_type player_type;
6060
6161 struct player_type
6262 {
63+ int player_uid;
64+
6365 POSITION oldpy; /* Previous player location -KMW- */
6466 POSITION oldpx; /* Previous player location -KMW- */
6567
--- a/src/scores.c
+++ b/src/scores.c
@@ -521,7 +521,7 @@ errr top_twenty(void)
521521 sprintf(the_score.who, "%-.15s", p_ptr->name);
522522
523523 /* Save the player info */
524- sprintf(the_score.uid, "%7u", player_uid);
524+ sprintf(the_score.uid, "%7u", p_ptr->player_uid);
525525 sprintf(the_score.sex, "%c", (p_ptr->psex ? 'm' : 'f'));
526526 sprintf(the_score.p_r, "%2d", MIN(p_ptr->prace, MAX_RACES));
527527 sprintf(the_score.p_c, "%2d", MIN(p_ptr->pclass, MAX_CLASS));
@@ -634,7 +634,7 @@ errr predict_score(void)
634634 sprintf(the_score.who, "%-.15s", p_ptr->name);
635635
636636 /* Save the player info */
637- sprintf(the_score.uid, "%7u", player_uid);
637+ sprintf(the_score.uid, "%7u", p_ptr->player_uid);
638638 sprintf(the_score.sex, "%c", (p_ptr->psex ? 'm' : 'f'));
639639 sprintf(the_score.p_r, "%2d", MIN(p_ptr->prace, MAX_RACES));
640640 sprintf(the_score.p_c, "%2d", MIN(p_ptr->pclass, MAX_CLASS));
--- a/src/variable.c
+++ b/src/variable.c
@@ -20,7 +20,6 @@ bool repair_objects; /* Hack -- optimize detect objects */
2020 /*
2121 * User info
2222 */
23-int player_uid;
2423 int player_euid;
2524 int player_egid;
2625
--- a/src/z-config.h
+++ b/src/z-config.h
@@ -135,7 +135,7 @@
135135 * OPTION: for the AFS distributed file system, define this to ensure that
136136 * the program is secure with respect to the setuid code. This option has
137137 * not been tested (to the best of my knowledge). This option may require
138- * some weird tricks with "player_uid" and such involving "defines".
138+ * some weird tricks with "p_ptr->player_uid" and such involving "defines".
139139 * Note that this option used the AFS library routines Authenticate(),
140140 * bePlayer(), beGames() to enforce the proper priviledges.
141141 * You may need to current_world_ptr->game_turn "SAFE_SETUID" off to use this option.
Show on old repository browser