変愚蛮怒のメインリポジトリです
Revision | bbb1a2402335d7b11ea898d371933a3ef0c638d5 (tree) |
---|---|
Time | 2003-07-07 18:42:36 |
Author | mogami <mogami@0568...> |
Commiter | mogami |
gccのワーニング対策で書き換え。
ループ中で初めて代入される変数を、外で使うと未定義と区別が付かず、
ワーニングが出るので避ける。
@@ -148,7 +148,6 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power) | ||
148 | 148 | int attempts = 500; |
149 | 149 | int dis = 2; |
150 | 150 | bool look = TRUE; |
151 | - cave_type *c_ptr; | |
152 | 151 | monster_type *m_ptr = &m_list[m_idx]; |
153 | 152 | |
154 | 153 |
@@ -178,6 +177,8 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power) | ||
178 | 177 | /* Try several locations */ |
179 | 178 | for (i = 0; i < 500; i++) |
180 | 179 | { |
180 | + cave_type *c_ptr; | |
181 | + | |
181 | 182 | /* Pick a (possibly illegal) location */ |
182 | 183 | while (1) |
183 | 184 | { |
@@ -226,7 +227,7 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power) | ||
226 | 227 | sound(SOUND_TPOTHER); |
227 | 228 | |
228 | 229 | /* Update the new location */ |
229 | - c_ptr->m_idx = m_idx; | |
230 | + cave[ny][nx].m_idx = m_idx; | |
230 | 231 | |
231 | 232 | /* Update the old location */ |
232 | 233 | cave[oy][ox].m_idx = 0; |
@@ -520,7 +521,6 @@ msg_print(" | ||
520 | 521 | void teleport_level(int m_idx) |
521 | 522 | { |
522 | 523 | bool go_up; |
523 | - monster_type *m_ptr; | |
524 | 524 | char m_name[160]; |
525 | 525 | bool see_m = TRUE; |
526 | 526 |
@@ -534,7 +534,7 @@ void teleport_level(int m_idx) | ||
534 | 534 | } |
535 | 535 | else /* To monster */ |
536 | 536 | { |
537 | - m_ptr = &m_list[m_idx]; | |
537 | + monster_type *m_ptr = &m_list[m_idx]; | |
538 | 538 | |
539 | 539 | /* Get the monster name (or "it") */ |
540 | 540 | monster_desc(m_name, m_ptr, 0); |
@@ -683,6 +683,8 @@ void teleport_level(int m_idx) | ||
683 | 683 | /* Monster level teleportation is simple deleting now */ |
684 | 684 | if (m_idx > 0) |
685 | 685 | { |
686 | + monster_type *m_ptr = &m_list[m_idx]; | |
687 | + | |
686 | 688 | /* Check for quest completion */ |
687 | 689 | check_quest_completion(m_ptr); |
688 | 690 |