diff --git a/src/LedgerFormats.cpp b/src/LedgerFormats.cpp index f8fc80d4d..89cc24d07 100644 --- a/src/LedgerFormats.cpp +++ b/src/LedgerFormats.cpp @@ -86,13 +86,18 @@ LedgerEntryFormat LedgerFormats[]= { NULL, ltINVALID } }; - LedgerEntryFormat* getLgrFormat(LedgerEntryType t) +{ + return getLgrFormat(t); +} + +LedgerEntryFormat* getLgrFormat(int t) { LedgerEntryFormat* f = LedgerFormats; while (f->t_name != NULL) { - if (f->t_type == t) return f; + if (f->t_type == t) + return f; ++f; } return NULL; diff --git a/src/LedgerFormats.h b/src/LedgerFormats.h index 82221ca31..7b4a95683 100644 --- a/src/LedgerFormats.h +++ b/src/LedgerFormats.h @@ -48,5 +48,6 @@ struct LedgerEntryFormat extern LedgerEntryFormat LedgerFormats[]; extern LedgerEntryFormat* getLgrFormat(LedgerEntryType t); +extern LedgerEntryFormat* getLgrFormat(int t); #endif // vim:ts=4 diff --git a/src/SerializedTypes.cpp b/src/SerializedTypes.cpp index 6eeb0c912..570a2e80c 100644 --- a/src/SerializedTypes.cpp +++ b/src/SerializedTypes.cpp @@ -5,6 +5,8 @@ #include "SerializedTypes.h" #include "SerializedObject.h" #include "TransactionFormats.h" +#include "LedgerFormats.h" +#include "FieldNames.h" #include "Log.h" #include "NewcoinAddress.h" #include "utils.h" @@ -50,6 +52,18 @@ STUInt16* STUInt16::construct(SerializerIterator& u, SField::ref name) std::string STUInt16::getText() const { + if (getFName() == sfLedgerEntryType) + { + LedgerEntryFormat *f = getLgrFormat(value); + if (f != NULL) + return f->t_name; + } + if (getFName() == sfTransactionType) + { + TransactionFormat *f = getTxnFormat(value); + if (f != NULL) + return f->t_name; + } return boost::lexical_cast(value); } diff --git a/src/TransactionFormats.cpp b/src/TransactionFormats.cpp index eec5b363d..9e84d3200 100644 --- a/src/TransactionFormats.cpp +++ b/src/TransactionFormats.cpp @@ -100,14 +100,20 @@ TransactionFormat InnerTxnFormats[]= { NULL, ttINVALID } }; -TransactionFormat* getTxnFormat(TransactionType t) +TransactionFormat* getTxnFormat(TransactionType t) { - TransactionFormat* f = InnerTxnFormats; - while (f->t_name != NULL) + return getTxnFormat(t); +} + +TransactionFormat* getTxnFormat(int t) +{ + TransactionFormat* f = InnerTxnFormats; + while (f->t_name != NULL) { - if (f->t_type == t) return f; + if (f->t_type == t) + return f; ++f; } - return NULL; + return NULL; } // vim:ts=4 diff --git a/src/TransactionFormats.h b/src/TransactionFormats.h index edbccf3a6..57b155285 100644 --- a/src/TransactionFormats.h +++ b/src/TransactionFormats.h @@ -46,5 +46,6 @@ const uint32 tfNoRippleDirect = 0x00080000; extern TransactionFormat InnerTxnFormats[]; extern TransactionFormat* getTxnFormat(TransactionType t); +extern TransactionFormat* getTxnFormat(int t); #endif // vim:ts=4