X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Frace.qc;h=6ec8a68e4935cbd9ce7f6ee35e68b90f1f8eb401;hb=58b8eafbf5e2ff9147477e115292246458c4c5eb;hp=2b61afd7e9636c0288177bfbec7ed4f50ec698ba;hpb=e46955aa359b3a9b0399b572ebd34e3770c283b7;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 2b61afd7e..6ec8a68e4 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -149,17 +149,17 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e) } float oldrec; - string recorddifference, oldrec_holder; + string oldrec_holder; if (player_prevpos && (player_prevpos < newpos || !newpos)) { oldrec = race_readTime(GetMapname(), player_prevpos); race_SendStatus(0, e); // "fail" - Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_RACE_FAIL_RANKED, mynetname, player_prevpos, t, oldrec); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_FAIL_RANKED, mynetname, player_prevpos, t, oldrec); return; } else if (!newpos) { // no ranking, time worse than the worst ranked oldrec = race_readTime(GetMapname(), RANKINGS_CNT); race_SendStatus(0, e); // "fail" - Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_RACE_FAIL_UNRANKED, mynetname, RANKINGS_CNT, t, oldrec); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_FAIL_UNRANKED, mynetname, RANKINGS_CNT, t, oldrec); return; } @@ -168,7 +168,7 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e) // if the player does not have a UID we can unfortunately not store the record, as the rankings system relies on UIDs if(myuid == "") { - bprint(mynetname, "^1 scored a new record with ^7", TIME_ENCODED_TOSTRING(t), "^1, but lacks a UID, so the record will unfortunately be lost.\n"); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_NEW_MISSING_UID, mynetname, t); return; } @@ -187,34 +187,24 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e) if(rankings_reply) strunzone(rankings_reply); rankings_reply = strzone(getrankings()); - if(newpos == 1) { - if(newpos == player_prevpos) { - recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]"); - bprint(mynetname, "^1 improved their 1st place record with ", TIME_ENCODED_TOSTRING(t), recorddifference, "\n"); - } else if (oldrec == 0) { - bprint(mynetname, "^1 set the 1st place record with ", TIME_ENCODED_TOSTRING(t), "\n"); - } else { - recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]"); - bprint(mynetname, "^1 broke ", oldrec_holder, "^1's 1st place record with ", strcat(TIME_ENCODED_TOSTRING(t), recorddifference, "\n")); - } - race_SendStatus(3, e); // "new server record" - Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_RACE_NEW_RECORD, e.netname, TIME_ENCODED_TOSTRING(t)); - } else { - if(newpos == player_prevpos) { - recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]"); - bprint(mynetname, "^5 improved their ", race_placeName(newpos), " ^5place record with ", TIME_ENCODED_TOSTRING(t), recorddifference, "\n"); - race_SendStatus(1, e); // "new time" - Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_RACE_NEW_TIME, e.netname, TIME_ENCODED_TOSTRING(t)); - } else if (oldrec == 0) { - bprint(mynetname, "^2 set the ", race_placeName(newpos), " ^2place record with ", TIME_ENCODED_TOSTRING(t), "\n"); - race_SendStatus(2, e); // "new rank" - Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_RACE_NEW_RANK, e.netname, TIME_ENCODED_TOSTRING(t)); - } else { - recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]"); - bprint(mynetname, "^2 broke ", oldrec_holder, "^2's ", race_placeName(newpos), " ^2place record with ", strcat(TIME_ENCODED_TOSTRING(t), recorddifference, "\n")); - race_SendStatus(2, e); // "new rank" - Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_RACE_NEW_RANK, e.netname, TIME_ENCODED_TOSTRING(t)); - } + + if(newpos == player_prevpos) + { + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_NEW_IMPROVED, mynetname, newpos, t, oldrec); + if(newpos == 1) { race_SendStatus(3, e); } // "new server record" + else { race_SendStatus(1, e); } // "new time" + } + else if(oldrec == 0) + { + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_NEW_SET, mynetname, newpos, t); + if(newpos == 1) { race_SendStatus(3, e); } // "new server record" + else { race_SendStatus(2, e); } // "new rank" + } + else + { + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_NEW_BROKEN, mynetname, oldrec_holder, newpos, t, oldrec); + if(newpos == 1) { race_SendStatus(3, e); } // "new server record" + else { race_SendStatus(2, e); } // "new rank" } } @@ -287,7 +277,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) { e.race_completed = 1; MAKE_INDEPENDENT_PLAYER(e); - bprint(e.netname, "^7 has finished the race.\n"); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_FINISHED, e.netname); ClientData_Touch(e); } } @@ -904,7 +894,7 @@ void race_AbandonRaceCheck(entity p) { p.race_completed = 1; MAKE_INDEPENDENT_PLAYER(p); - bprint(p.netname, "^7 has abandoned the race.\n"); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_RACE_ABANDONED, p.netname); ClientData_Touch(p); } }