shithub: pokecrystal

Download patch

ref: 287d893d22792de96856c8c5488ce31ef811a7ff
parent: 5b9e6c0299af7b02630122c5cd1e2c65d65b97a8
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Wed Feb 10 03:50:39 EST 2021

Use PARTY_LENGTH and MAILBOX_CAPACITY constants

--- a/engine/pokemon/mail.asm
+++ b/engine/pokemon/mail.asm
@@ -241,11 +241,11 @@
 	call OpenSRAM
 	ld hl, sPartyMail
 	ld de, sPartyMailBackup
-	ld bc, 6 * MAIL_STRUCT_LENGTH
+	ld bc, PARTY_LENGTH * MAIL_STRUCT_LENGTH
 	call CopyBytes
 	ld hl, sMailboxCount
 	ld de, sMailboxCountBackup
-	ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
+	ld bc, 1 + MAILBOX_CAPACITY * MAIL_STRUCT_LENGTH
 	call CopyBytes
 	jp CloseSRAM
 
@@ -254,11 +254,11 @@
 	call OpenSRAM
 	ld hl, sPartyMailBackup
 	ld de, sPartyMail
-	ld bc, 6 * MAIL_STRUCT_LENGTH
+	ld bc, PARTY_LENGTH * MAIL_STRUCT_LENGTH
 	call CopyBytes
 	ld hl, sMailboxCountBackup
 	ld de, sMailboxCount
-	ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
+	ld bc, 1 + MAILBOX_CAPACITY * MAIL_STRUCT_LENGTH
 	call CopyBytes
 	jp CloseSRAM
 
@@ -267,11 +267,11 @@
 	call OpenSRAM
 	xor a
 	ld hl, sPartyMail
-	ld bc, 6 * MAIL_STRUCT_LENGTH
+	ld bc, PARTY_LENGTH * MAIL_STRUCT_LENGTH
 	call ByteFill
 	xor a
 	ld hl, sMailboxCount
-	ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
+	ld bc, 1 + MAILBOX_CAPACITY * MAIL_STRUCT_LENGTH
 	call ByteFill
 	jp CloseSRAM