From 141d50f0c175be1b6a337f8f60968b3972c2a243 Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <seth@kipro-pcb.com>
Date: Mon, 24 Feb 2025 15:11:05 -0800
Subject: [PATCH] Initialize m_orginal

---
 include/template_fieldnames.h | 3 ++-
 pcbnew/pcb_field.cpp          | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/template_fieldnames.h b/include/template_fieldnames.h
index 57c7b6d9d9..8686df5722 100644
--- a/include/template_fieldnames.h
+++ b/include/template_fieldnames.h
@@ -40,7 +40,8 @@ class TEMPLATE_FIELDNAMES_LEXER;
  * NOTE: this must stay a enum class to prevent developers from trying to use it as an array
  * index.
  */
-enum class FIELD_T {
+enum class FIELD_T : int
+{
     USER,                   ///< The field ID hasn't been set yet; field is invalid
     REFERENCE,              ///< Field Reference of part, i.e. "IC21"
     VALUE,                  ///< Field Value of part, i.e. "3.3K"
diff --git a/pcbnew/pcb_field.cpp b/pcbnew/pcb_field.cpp
index 7ccffc8f93..17599e9424 100644
--- a/pcbnew/pcb_field.cpp
+++ b/pcbnew/pcb_field.cpp
@@ -34,6 +34,7 @@
 PCB_FIELD::PCB_FIELD( FOOTPRINT* aParent, FIELD_T aFieldId, const wxString& aName ) :
         PCB_TEXT( aParent, PCB_FIELD_T ),
         m_id( aFieldId ),
+        m_ordinal( static_cast<int>( aFieldId ) ),
         m_name( aName )
 {
     if( m_id == FIELD_T::USER )
@@ -46,6 +47,7 @@ PCB_FIELD::PCB_FIELD( FOOTPRINT* aParent, FIELD_T aFieldId, const wxString& aNam
 PCB_FIELD::PCB_FIELD( const PCB_TEXT& aText, FIELD_T aFieldId, const wxString& aName ) :
         PCB_TEXT( aText ),
         m_id( aFieldId ),
+        m_ordinal( static_cast<int>( aFieldId ) ),
         m_name( aName )
 {
 }