From 284aca4d841e6a47e4da5d1c4fc8fc09c4c889d4 Mon Sep 17 00:00:00 2001
From: harryob <55142896+harryob@users.noreply.github.com>
Date: Fri, 28 Jul 2023 08:21:41 +0100
Subject: [PATCH] handle no round id
---
code/datums/entities/player_note.dm | 4 +++-
code/game/verbs/records.dm | 4 ++--
code/modules/admin/admin.dm | 4 ++--
code/modules/admin/tabs/admin_tab.dm | 4 ++--
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/code/datums/entities/player_note.dm b/code/datums/entities/player_note.dm
index 9ee7cf7a34ba..420bb5f0a470 100644
--- a/code/datums/entities/player_note.dm
+++ b/code/datums/entities/player_note.dm
@@ -1,9 +1,11 @@
+#define NOTE_ROUND_ID(note_entity) note_entity.round_id ? "(ID: [note_entity.round_id])" : ""
+
/datum/entity/player_note
var/player_id
var/admin_id
var/text
var/date
- var/round_id = "N/A"
+ var/round_id
var/is_ban = FALSE
var/ban_time
var/is_confidential = FALSE
diff --git a/code/game/verbs/records.dm b/code/game/verbs/records.dm
index d783039f4fb1..f09de72da2e6 100644
--- a/code/game/verbs/records.dm
+++ b/code/game/verbs/records.dm
@@ -53,7 +53,7 @@
if(NOTE_YAUTJA)
color = "#114e11"
- dat += "[N.text] by [admin_ckey] ([N.admin_rank]) on [N.date] (ID: [N.round_id]) "
+ dat += "[N.text] by [admin_ckey] ([N.admin_rank]) on [N.date] [NOTE_ROUND_ID(N)] "
dat += "
"
dat += "
"
@@ -168,7 +168,7 @@
continue
var/admin_ckey = N.admin_ckey
- dat += "[N.text] by [admin_ckey] ([N.admin_rank]) on [N.date] (ID: [N.round_id]) "
+ dat += "[N.text] by [admin_ckey] ([N.admin_rank]) on [N.date] [NOTE_ROUND_ID(N)] "
///Can remove notes from anyone other than yourself, unless you're the host. So long as you have deletion access anyway.
if((can_del && target != get_player_from_key(key)) || ishost(usr))
dat += "Remove"
diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm
index 32c2dffcd0f9..2c749df71bb7 100644
--- a/code/modules/admin/admin.dm
+++ b/code/modules/admin/admin.dm
@@ -89,7 +89,7 @@
if(N.is_ban)
var/time_d = N.ban_time ? "Banned for [N.ban_time] minutes | " : ""
color = "#880000" //Removed confidential check because we can't make confidential bans
- dat += "[time_d][N.text] by [admin_ckey] ([N.admin_rank])[confidential_text] on [N.date] (ID: [N.round_id]) "
+ dat += "[time_d][N.text] by [admin_ckey] ([N.admin_rank])[confidential_text] on [N.date] [NOTE_ROUND_ID(N)] "
else
if(N.is_confidential)
color = "#AA0055"
@@ -102,7 +102,7 @@
else if(N.note_category == NOTE_YAUTJA)
color = "#114e11"
- dat += "[N.text] by [admin_ckey] ([N.admin_rank])[confidential_text] on [N.date] (ID: [N.round_id]) "
+ dat += "[N.text] by [admin_ckey] ([N.admin_rank])[confidential_text] on [N.date] [NOTE_ROUND_ID(N)] "
if(admin_ckey == usr.ckey || admin_ckey == "Adminbot" || ishost(usr))
dat += "Remove"
diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm
index 904088d4ec78..a2f3bd42df5f 100644
--- a/code/modules/admin/tabs/admin_tab.dm
+++ b/code/modules/admin/tabs/admin_tab.dm
@@ -169,12 +169,12 @@
if(N.is_ban)
var/ban_text = N.ban_time ? "Banned for [N.ban_time] | " : ""
color = "#880000"
- dat += "[ban_text][N.text] by [admin_ckey] ([N.admin_rank])[confidential_text] on [N.date] (ID: [N.round_id]) "
+ dat += "[ban_text][N.text] by [admin_ckey] ([N.admin_rank])[confidential_text] on [N.date] [NOTE_ROUND_ID(N)] "
else
if(N.is_confidential)
color = "#AA0055"
- dat += "[N.text] by [admin_ckey] ([N.admin_rank])[confidential_text] on [N.date] (ID: [N.round_id]) "
+ dat += "[N.text] by [admin_ckey] ([N.admin_rank])[confidential_text] on [N.date] [NOTE_ROUND_ID(N)] "
dat += "
"
dat += "
"