From 7fd95d1fe65376e5c935d21632cc324f19920836 Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Mon, 26 Aug 2024 20:45:23 +0000 Subject: [PATCH 01/10] queue updates --- .vscode/settings.json | 3 +- code/act_comm.c | 3 +- code/queue.h | 113 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 48b7fc4..dbe877c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -69,7 +69,8 @@ "codecvt": "cpp", "charconv": "cpp", "source_location": "cpp", - "cerrno": "cpp" + "cerrno": "cpp", + "any": "cpp" }, "testMate.cpp.test.executables": "tests/*{_tests}*", "testMate.cpp.debug.configTemplate": { diff --git a/code/act_comm.c b/code/act_comm.c index e62e551..7c9ac1f 100644 --- a/code/act_comm.c +++ b/code/act_comm.c @@ -2592,7 +2592,8 @@ void speech_handler(CHAR_DATA *ch, CHAR_DATA *mob, SPEECH_DATA *speech) return; } - RS.Queue.AddToQueue(speech->current_line->delay, 3, speech_handler, ch, mob, speech); + //RS.Queue.AddToNewQueue(speech->current_line->delay, 3, speech_handler, ch, mob, speech); + RS.Queue.AddToNewQueue(speech->current_line->delay, speech_handler, ch, mob, speech); } /* diff --git a/code/queue.h b/code/queue.h index 03f3659..00e7220 100644 --- a/code/queue.h +++ b/code/queue.h @@ -11,6 +11,9 @@ */ #define MAX_QUEUE_ARGS 8 typedef void (*QUEUE_FUNCTION)(...); + +class char_data; +typedef struct char_data CHAR_DATA; class CQueue { public: @@ -21,6 +24,90 @@ class CQueue static void AddToQueue(int nTimer, int nArgs, ...); static bool HasQueuePending(void *qChar); static void DeleteQueuedEventsInvolving(void *qChar); + + /// Adds a function pointer to the queue with related arguments. The function will be executed at the specified time (in ticks). + /// @tparam Func: Template type of the function to call. + /// @tparam ...Args: Template parameter pack used to specify the variadic arguments. + /// @param nTimer: The time (in ticks) which the function executes. + /// @param func: The function to execute at the specified time. + /// @param ...args: Variadic arguments used to call the function. + template + void AddToNewQueue(int nTimer, Func func, Args &&...args) + { + if(nTimer < 0) + Logger.Warn("Negative Queue Timer - NumArgs: {}", sizeof...(Args)); + + // capture parameter pack + auto tuple = std::tuple(args...); + auto chs = GetCharacterData(tuple); + + // place on queue + auto qtip = std::make_tuple(nTimer, chs, [&]() { std::apply(func, tuple); }); + newQueue.push_back(qtip); + } + + /// Processes all items on the queue. Any entry that has a timer of zero gets executed. + /// Once all items are processed, those functions that have executed are removed from the queue. + void ProcessNewQueue() + { + newQueue.erase( + std::remove_if(newQueue.begin(), newQueue.end(), [](const auto& item) + { + auto delay = std::get<0>(item); + if (delay < 0) + return true; + + if (--delay == 0) + { + auto func = std::get<2>(item); + func(); + return true; + } + + return false; + }), newQueue.end()); + } + + /// Determines if a specific character has any remaining entries in the queue. + /// This function applies to both directions (eg. either character being affected or is affecting another pc or environment). + /// @param qChar: The character to lookup in the queue. + /// @return true if there are entries related to the character in the queue; otherwise false. + bool HasNewQueuePending(CHAR_DATA *qChar) + { + for (auto& q : newQueue) + { + auto delay = std::get<0>(q); + auto v = std::get<1>(q); + auto contains = std::find(v.begin(), v.end(), qChar) != v.end(); + if (contains && delay > 0) + return true; + } + + return false; + } + + /// Deletes all entries in the queue pertaining to the specified character. + /// @param qChar: The character to lookup in the queue. + void DeleteNewQueuedEventsInvolving(CHAR_DATA *qChar) + { + int deleted = 0; + newQueue.erase( + std::remove_if(newQueue.begin(), newQueue.end(), [&](const auto& item) + { + auto delay = std::get<0>(item); + auto v = std::get<1>(item); + auto contains = std::find(v.begin(), v.end(), qChar) != v.end(); + if (contains && delay > 0) + { + deleted++; + return true; + } + + return false; + }), newQueue.end()); + + Logger.Warn("{} events deleted.", deleted); + } private: void FreeQueue(); @@ -31,6 +118,32 @@ class CQueue int queue_delay; /* seconds _remaining_ */ void * queue_args[MAX_QUEUE_ARGS]; /* Queue function args */ int queue_numargs; + std::vector, std::function>> newQueue; + + /// Helper function used to extract character data from the specfied tuple. + /// @note Main use is for extracting character data sent to the AddToQueue method. + /// @tparam ...Tp: Template parameter pack used to specify the variadic arguments. + /// @param t: Variadic arguments containing the values of the tuple. + /// @return A list containing character data from the tuple. + template + std::vector GetCharacterData(std::tuple& t) + { + std::vector accumulator; + + std::apply([&] (const auto&... tupleArgs) + { + size_t index = 0; + auto processTuple = [&](const auto& x) + { + if constexpr (std::is_same::value) + accumulator.push_back(x); + index++; + }; + (processTuple(tupleArgs), ...); + }, t); + + return accumulator; + } }; #endif /* QUEUE_H */ From d16c5f6f07403ba13d011dd7856cdb49e164396b Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Wed, 28 Aug 2024 17:39:30 +0000 Subject: [PATCH 02/10] Fixed error in GetCharacterData where characters weren't being added to the vector --- code/queue.h | 4 +--- tests/queue_tests.c | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/code/queue.h b/code/queue.h index 00e7220..7e6a52a 100644 --- a/code/queue.h +++ b/code/queue.h @@ -132,12 +132,10 @@ class CQueue std::apply([&] (const auto&... tupleArgs) { - size_t index = 0; auto processTuple = [&](const auto& x) { - if constexpr (std::is_same::value) + if constexpr (std::is_same::type,CHAR_DATA*>::value) accumulator.push_back(x); - index++; }; (processTuple(tupleArgs), ...); }, t); diff --git a/tests/queue_tests.c b/tests/queue_tests.c index 5f97093..9bbf004 100644 --- a/tests/queue_tests.c +++ b/tests/queue_tests.c @@ -8,7 +8,6 @@ void testQueueFunction(char_data *qChar) { SCENARIO("Testing queueing functions", "[AddToQueue]") { - GIVEN("a function with no parameters") { int timer = 3; // 3 tics @@ -16,19 +15,42 @@ SCENARIO("Testing queueing functions", "[AddToQueue]") WHEN("AddToQueue is called with a positive timer") { CQueue sut; - int numberOfArguments = 1; - char_data *mockPlayer; + char_data *mockPlayer = new char_data(); - sut.AddToQueue(timer, numberOfArguments, testQueueFunction, mockPlayer); + sut.AddToNewQueue(timer, testQueueFunction, mockPlayer); THEN("The queue should show a pending call") { - REQUIRE(CQueue::HasQueuePending(mockPlayer)); + REQUIRE(sut.HasNewQueuePending(mockPlayer)); } } } } +SCENARIO("Testing deleting queue entries with that involve character", "[DeleteQueuedEventsInvolving]") +{ + GIVEN("a function with no parameters") + { + CQueue sut; + char_data *mockPlayer = new char_data(); + int timer = 3; // 3 tics + + sut.AddToNewQueue(timer, testQueueFunction, mockPlayer); + + WHEN("DeleteQueuedEventsInvolving is called with a specified character in the queue") + { + sut.DeleteNewQueuedEventsInvolving(mockPlayer); + + THEN("The queue should show a no pending calls") + { + auto hasQueueEntries = sut.HasNewQueuePending(mockPlayer); + REQUIRE(hasQueueEntries == false); + } + } + } +} + + void updateValueFunction(char_data *qChar, long value) { qChar->id = value; @@ -40,12 +62,11 @@ SCENARIO("Testing queue processing", "[ProcessQueue]") { CQueue sut; int timer = 1; - int argCount = 2; char_data* tmpChar = new char_data(); tmpChar->id = 10107; long expected = 1337L; - sut.AddToQueue(timer, argCount, updateValueFunction, tmpChar, expected); - sut.ProcessQueue(); + sut.AddToNewQueue(timer, updateValueFunction, tmpChar, expected); + sut.ProcessNewQueue(); THEN("The function should update the value") { REQUIRE(tmpChar->id == expected); From f78b690379347e3da7a047e27266a1d64209a9a1 Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Sun, 1 Sep 2024 19:21:58 +0000 Subject: [PATCH 03/10] Fixed typing issues when placing items on the queue. --- code/act_comm.c | 7 +- code/act_comm.h | 1 + code/act_info.c | 5 + code/act_info.h | 1 + code/act_move.c | 8 +- code/act_obj.c | 6 +- code/act_wiz.c | 2 +- code/aprog.c | 8 +- code/characterClasses/ap.c | 160 ++++++++++----------- code/characterClasses/chrono.c | 7 +- code/characterClasses/chrono.h | 1 + code/characterClasses/druid.c | 16 +-- code/characterClasses/necro.c | 34 ++--- code/characterClasses/sorcerer.c | 12 +- code/characterClasses/warrior.c | 6 +- code/comm.c | 9 +- code/comm.h | 1 + code/fight.c | 6 + code/fight.h | 1 + code/handler.c | 4 +- code/interp.c | 5 + code/interp.h | 1 + code/iprog.c | 112 +++++++-------- code/magic.c | 5 +- code/mprog.c | 210 +++++++++++++-------------- code/mspec.c | 49 ++++--- code/newmem.c | 6 +- code/prof.c | 14 +- code/quest.c | 169 +++++++++++----------- code/queue.c | 236 +++++++++++++++---------------- code/queue.h | 24 +--- code/update.c | 2 +- 32 files changed, 572 insertions(+), 556 deletions(-) diff --git a/code/act_comm.c b/code/act_comm.c index 7c9ac1f..5541554 100644 --- a/code/act_comm.c +++ b/code/act_comm.c @@ -779,6 +779,11 @@ void do_say(CHAR_DATA *ch, char *argument) } } +void do_say_queue(CHAR_DATA *ch, std::string argument) +{ + do_say(ch, argument.data()); +} + void say_to(CHAR_DATA *ch, CHAR_DATA *victim, char *argument, char *extra) { if (argument[0] == '\0') @@ -1772,7 +1777,7 @@ void do_quit_new(CHAR_DATA *ch, char *argument, bool autoq) } } - if (CQueue::HasQueuePending(ch)) + if (RS.Queue.HasNewQueuePending(ch)) { if (autoq) RS.Logger.Warn("Trying to autoquit char {} with pending queue.", ch->name); diff --git a/code/act_comm.h b/code/act_comm.h index e1e2072..1bdc79f 100644 --- a/code/act_comm.h +++ b/code/act_comm.h @@ -36,6 +36,7 @@ void obj_say_heavenly_sceptre (CHAR_DATA *ch, OBJ_DATA *obj,char *argument); const char *upstring(const char *i); const char *lowstring(const char *i); void do_say (CHAR_DATA *ch, char *argument); +void do_say_queue (CHAR_DATA *ch, std::string argument); void say_to (CHAR_DATA *ch, CHAR_DATA *victim, char *argument, char *extra); void do_whisper (CHAR_DATA *ch, char *argument); void do_sing (CHAR_DATA *ch, char *argument); diff --git a/code/act_info.c b/code/act_info.c index b35928b..4c2348e 100644 --- a/code/act_info.c +++ b/code/act_info.c @@ -2311,6 +2311,11 @@ void do_look(CHAR_DATA *ch, char *argument) } } +void do_look_queue (CHAR_DATA *ch, std::string argument) +{ + do_look(ch, argument.data()); +} + /* RT added back for the hell of it */ void do_read(CHAR_DATA *ch, char *argument) { diff --git a/code/act_info.h b/code/act_info.h index 1dee067..316439a 100644 --- a/code/act_info.h +++ b/code/act_info.h @@ -61,6 +61,7 @@ bool show_altdesc (ROOM_INDEX_DATA *room); char *get_room_description(ROOM_INDEX_DATA *room); char *get_room_name(ROOM_INDEX_DATA *room); void do_look (CHAR_DATA *ch, char *argument); +void do_look_queue (CHAR_DATA *ch, std::string argument); /* RT added back for the hell of it */ void do_read (CHAR_DATA *ch, char *argument); /* diff --git a/code/act_move.c b/code/act_move.c index a09c3e7..1906c04 100644 --- a/code/act_move.c +++ b/code/act_move.c @@ -1002,7 +1002,7 @@ void move_char(CHAR_DATA *ch, int door, bool automatic, bool fcharm) if (td != nullptr && td->trap && td->trap->armed && ch->Profs()->ProfEffect("trap detecting") >= td->trap->quality) { - RS.Queue.AddToQueue(1, 2, send_to_char, "Something about your surroundings suddenly makes you feel wary.\n\r", ch); + RS.Queue.AddToNewQueue(1, send_to_char, "Something about your surroundings suddenly makes you feel wary.\n\r", ch); break; } } @@ -1048,7 +1048,7 @@ void move_char(CHAR_DATA *ch, int door, bool automatic, bool fcharm) } else if (is_npc(fch) && fch->last_fought == ch) { - RS.Queue.AddToQueue((number_percent() > 25) ? 1 : 2, 2, track_attack, fch, ch); + RS.Queue.AddToNewQueue((number_percent() > 25) ? 1 : 2, track_attack, fch, ch); } /* Greet trigger for mobs */ @@ -1215,7 +1215,7 @@ void trip_trap(CHAR_DATA *ch, ROOM_INDEX_DATA *room, TRAP_DATA *trap) if (ch->Profs()->GetProf("trap detecting") / 2 >= trap->quality) { ch->Profs()->CheckImprove("trap detecting", 400); - RS.Queue.AddToQueue(1, 2, send_to_char, "As you carefully advance, you spot a trap and quickly sidestep it!\n\r", ch); + RS.Queue.AddToNewQueue(1, send_to_char, "As you carefully advance, you spot a trap and quickly sidestep it!\n\r", ch); return; } else @@ -1229,7 +1229,7 @@ void trip_trap(CHAR_DATA *ch, ROOM_INDEX_DATA *room, TRAP_DATA *trap) if (trap->timer) { act(trap->trig_echo, ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(trap->timer, 3, trap_execute, nullptr, room, trap); + RS.Queue.AddToNewQueue(trap->timer, trap_execute, nullptr, room, trap); } else { diff --git a/code/act_obj.c b/code/act_obj.c index 9088b80..42da4e4 100644 --- a/code/act_obj.c +++ b/code/act_obj.c @@ -2905,8 +2905,7 @@ void do_quaff(CHAR_DATA *ch, char *argument) if (!check_deny_magic(ch)) { - RS.Queue.AddToQueue(nDelay, - 5, + RS.Queue.AddToNewQueue(nDelay, quaff_potion, ch, obj->value[0], @@ -2949,8 +2948,7 @@ void do_quaff(CHAR_DATA *ch, char *argument) if (!check_deny_magic(ch)) { - RS.Queue.AddToQueue(nDelay, - 5, + RS.Queue.AddToNewQueue(nDelay, quaff_potion, ch, obj->value[0], diff --git a/code/act_wiz.c b/code/act_wiz.c index e91d844..dbc325e 100644 --- a/code/act_wiz.c +++ b/code/act_wiz.c @@ -3454,7 +3454,7 @@ void start_reboot(CHAR_DATA *ch) do_echo(ch, buf); reboot_num--; - RS.Queue.AddToQueue(60, 1, (void *)start_reboot, ch); + RS.Queue.AddToNewQueue(60, start_reboot, ch); } } } diff --git a/code/aprog.c b/code/aprog.c index 2500556..d765dc5 100644 --- a/code/aprog.c +++ b/code/aprog.c @@ -282,8 +282,8 @@ void tick_prog_ilopheth(AREA_DATA *area) END_COLOR(pedroom->people)); act(buf, pedroom->people, 0, 0, TO_ALL); - RS.Queue.AddToQueue(4, 5, act, "The opacity of the crystal sphere appears to fade, and it begins to glow a brilliant white!", pedroom->people, 0, 0, TO_ALL); - RS.Queue.AddToQueue(7, 5, act, "To the northwest, an immense pillar of light ascends from the forest into the heavens!", pedroom->people, 0, 0, TO_ALL); + RS.Queue.AddToNewQueue(4, act_queue, "The opacity of the crystal sphere appears to fade, and it begins to glow a brilliant white!", pedroom->people, nullptr, nullptr, TO_ALL); + RS.Queue.AddToNewQueue(7, act_queue, "To the northwest, an immense pillar of light ascends from the forest into the heavens!", pedroom->people, nullptr, nullptr, TO_ALL); } for (obj = portroom->contents; obj; obj = obj->next_content) @@ -416,10 +416,10 @@ void sun_prog_ilopheth(AREA_DATA *area) switch (sun) { case SolarPosition::Sunrise: - RS.Queue.AddToQueue(15, 2, (void *)zone_echo, area, (char *)"With the beginning of the day sounds of life fill the valley, as the forest comes alive."); + RS.Queue.AddToNewQueue(15, zone_echo, area, (char *)"With the beginning of the day sounds of life fill the valley, as the forest comes alive."); break; case SolarPosition::Sunset: - RS.Queue.AddToQueue(15, 2, (void *)zone_echo, area, (char *)"The forest grows still, as the night sky settles over the valley."); + RS.Queue.AddToNewQueue(15, zone_echo, area, (char *)"The forest grows still, as the night sky settles over the valley."); break; } } diff --git a/code/characterClasses/ap.c b/code/characterClasses/ap.c index 286da84..1f83d4e 100644 --- a/code/characterClasses/ap.c +++ b/code/characterClasses/ap.c @@ -713,7 +713,7 @@ void command_execute(CHAR_DATA *ch) sprintf(buf, "An irresistible urge forces you to '%s'.\n\r", ch->pcdata->command[1]); send_to_char(buf, ch); - RS.Queue.AddToQueue(1, 2, command_execute_delay, ch, ch->pcdata->command[1]); + RS.Queue.AddToNewQueue(1, command_execute_delay, ch, ch->pcdata->command[1]); WAIT_STATE(ch, PULSE_PER_SECOND + 1); @@ -1283,7 +1283,7 @@ void check_unholy_communion(CHAR_DATA *ch, char *argument) act("As the name of the $t demon escapes your lips, the shadows writhe violently.", ch, (type == LESSER_DEMON) ? "lesser" : "greater", 0, TO_CHAR); - RS.Queue.AddToQueue(2, 5, act, "A sonorous throbbing fills your surroundings, and then all is deathly silent.", ch, nullptr, nullptr, TO_ALL); + RS.Queue.AddToNewQueue(2, act_queue, "A sonorous throbbing fills your surroundings, and then all is deathly silent.", ch, nullptr, nullptr, TO_ALL); affect_remove(ch, af); @@ -1293,7 +1293,7 @@ void check_unholy_communion(CHAR_DATA *ch, char *argument) *typeptr = type; *demonptr = demon; - RS.Queue.AddToQueue(3, 3, demon_appear, ch, demonptr, typeptr); + RS.Queue.AddToNewQueue(3, demon_appear, ch, demonptr, typeptr); } void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) @@ -1383,58 +1383,58 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) switch (demon) { case LESSER_BARBAS: - RS.Queue.AddToQueue(2, 2, do_emote, mob, (char *)"roars with anger and beats his meaty fists against his chest!"); - RS.Queue.AddToQueue(4, 5, act, "Still growling, $N peers toward you with a sneering rictus of despite.", ch, 0, mob, TO_CHAR); - RS.Queue.AddToQueue(6, 2, do_say, mob, (char *)"Summon me, you fool? Summon ME!?"); - RS.Queue.AddToQueue(8, 2, do_say, mob, (char *)"I'll bet me reputation an' a slice o' me power that I'm about ta beat you senseless!"); - RS.Queue.AddToQueue(10, 2, do_murder, mob, ch->name); - RS.Queue.AddToQueue(10, 5, act, "With a feral leap and a scream, $N is suddenly upon you!", ch, 0, mob, TO_CHAR); + RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"roars with anger and beats his meaty fists against his chest!"); + RS.Queue.AddToNewQueue(4, act_queue, "Still growling, $N peers toward you with a sneering rictus of despite.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToNewQueue(6, do_say_queue, mob, "Summon me, you fool? Summon ME!?"); + RS.Queue.AddToNewQueue(8, do_say_queue, mob, "I'll bet me reputation an' a slice o' me power that I'm about ta beat you senseless!"); + RS.Queue.AddToNewQueue(10, do_murder, mob, ch->name); + RS.Queue.AddToNewQueue(10, act_queue, "With a feral leap and a scream, $N is suddenly upon you!", ch, nullptr, mob, TO_CHAR); af.duration = -1; affect_to_char(mob, &af); break; case LESSER_AAMON: WAIT_STATE(ch, 5 * PULSE_VIOLENCE); - RS.Queue.AddToQueue(2, 2, do_emote, mob, (char *)"twitches violently as he stares around, bewildered."); - RS.Queue.AddToQueue(4, 2, do_whisper, mob, (char *)"And where am I now, precisely?"); - RS.Queue.AddToQueue(6, 5, act, "Jerking suddenly as if to watch in all directions at once, the demon spins.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(8, 2, do_say, mob, (char *)"You've summoned me! And now you will answer my riddle, yes!"); - RS.Queue.AddToQueue(10, 2, do_emote, mob, (char *)"clears his throat and glances around pensively."); - RS.Queue.AddToQueue(12, 2, do_say, mob, (char *)"Most often by hoes and by gardeners I'm chased, "); - RS.Queue.AddToQueue(13, 2, do_say, mob, (char *)"They cut off my head and then smash it to paste;"); - RS.Queue.AddToQueue(14, 2, do_say, mob, (char *)"Against them, however, my body is braced, "); - RS.Queue.AddToQueue(15, 2, do_say, mob, (char *)"For always I'm growing due south of the waist."); - RS.Queue.AddToQueue(16, 2, do_say, mob, (char *)"Now then... what am I?"); + RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"twitches violently as he stares around, bewildered."); + RS.Queue.AddToNewQueue(4, do_whisper, mob, (char *)"And where am I now, precisely?"); + RS.Queue.AddToNewQueue(6, act_queue, "Jerking suddenly as if to watch in all directions at once, the demon spins.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(8, do_say_queue, mob, "You've summoned me! And now you will answer my riddle, yes!"); + RS.Queue.AddToNewQueue(10, do_emote, mob, (char *)"clears his throat and glances around pensively."); + RS.Queue.AddToNewQueue(12, do_say_queue, mob, "Most often by hoes and by gardeners I'm chased, "); + RS.Queue.AddToNewQueue(13, do_say_queue, mob, "They cut off my head and then smash it to paste;"); + RS.Queue.AddToNewQueue(14, do_say_queue, mob, "Against them, however, my body is braced, "); + RS.Queue.AddToNewQueue(15, do_say_queue, mob, "For always I'm growing due south of the waist."); + RS.Queue.AddToNewQueue(16, do_say_queue, mob, "Now then... what am I?"); af.duration = 8; af.modifier = 0; affect_to_char(mob, &af); break; case LESSER_MALAPHAR: - RS.Queue.AddToQueue(2, 2, do_emote, mob, (char *)"'s eyes light up as he realizes where he is."); - RS.Queue.AddToQueue(4, 2, do_say, mob, (char *)"My friend! My friend, my patron, my emptor!"); - RS.Queue.AddToQueue(6, 5, act, "Malaphar sidles up to you, and with a conspiratorial wink, waves his hand.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(8, 2, do_whisper, mob, (char *)"I have something... something in which you would most undoubtedly be interested."); - RS.Queue.AddToQueue(10, 2, do_say, mob, (char *)"Sale or trade only, I'm afraid, no credit. And don't waste my time offering me paltry trifles."); + RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"'s eyes light up as he realizes where he is."); + RS.Queue.AddToNewQueue(4, do_say_queue, mob, "My friend! My friend, my patron, my emptor!"); + RS.Queue.AddToNewQueue(6, act_queue, "Malaphar sidles up to you, and with a conspiratorial wink, waves his hand.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToNewQueue(8, do_whisper, mob, (char *)"I have something... something in which you would most undoubtedly be interested."); + RS.Queue.AddToNewQueue(10, do_say_queue, mob, "Sale or trade only, I'm afraid, no credit. And don't waste my time offering me paltry trifles."); af.duration = 7; affect_to_char(mob, &af); break; case LESSER_FURCAS: - RS.Queue.AddToQueue(2, 2, do_emote, mob, (char *)"appears shocked, and he winces away from you automatically."); - RS.Queue.AddToQueue(4, 5, act, "Pawing his way around you, viewing you from all angles, Furcas blinks.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(6, 2, do_whisper, mob, (char *)"...can it find us? We think it cannot. We hope it tries its hardest."); - RS.Queue.AddToQueue(8, 5, act, "Suddenly, you blink and Furcas has vanished, leaving a cold sniff in the air!", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(9, 2, furcas_vanish, ch, mob); + RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"appears shocked, and he winces away from you automatically."); + RS.Queue.AddToNewQueue(4, act_queue, "Pawing his way around you, viewing you from all angles, Furcas blinks.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToNewQueue(6, do_whisper, mob, (char *)"...can it find us? We think it cannot. We hope it tries its hardest."); + RS.Queue.AddToNewQueue(8, act_queue, "Suddenly, you blink and Furcas has vanished, leaving a cold sniff in the air!", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(9, furcas_vanish, ch, mob); af.duration = 24; affect_to_char(mob, &af); break; case LESSER_IPOS: - RS.Queue.AddToQueue(2, 5, act, "$n, still steaming, looks around him with a small smile on his face.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(4, 5, act, "His gaze settles upon you, and his smile broadens to a genuine grin.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(6, 2, do_say, mob, (char *)"Greetings my rageful, irascible friend! The time for your fury has come to an end."); - RS.Queue.AddToQueue(7, 2, do_say, mob, (char *)"For a moment at least, for you see, I am weary of warriors bleak and dark paladins dreary."); - RS.Queue.AddToQueue(8, 2, do_say, mob, (char *)"Instead, it's my wish as I put pen to paper, that you'll indulge me with a frolicsome caper."); - RS.Queue.AddToQueue(9, 2, do_say, mob, (char *)"Be mindful, my ears are accustomed to rhymes; I hope you are willing to speak me four lines...."); - RS.Queue.AddToQueue(10, 2, do_emote, mob, (char *)"thrusts forward, anticipating your poem with an evil gleam in his eye."); + RS.Queue.AddToNewQueue(2, act_queue, "$n, still steaming, looks around him with a small smile on his face.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(4, act_queue, "His gaze settles upon you, and his smile broadens to a genuine grin.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToNewQueue(6, do_say_queue, mob, "Greetings my rageful, irascible friend! The time for your fury has come to an end."); + RS.Queue.AddToNewQueue(7, do_say_queue, mob, "For a moment at least, for you see, I am weary of warriors bleak and dark paladins dreary."); + RS.Queue.AddToNewQueue(8, do_say_queue, mob, "Instead, it's my wish as I put pen to paper, that you'll indulge me with a frolicsome caper."); + RS.Queue.AddToNewQueue(9, do_say_queue, mob, "Be mindful, my ears are accustomed to rhymes; I hope you are willing to speak me four lines...."); + RS.Queue.AddToNewQueue(10, do_emote, mob, (char *)"thrusts forward, anticipating your poem with an evil gleam in his eye."); af.modifier = 0; af.duration = 8; affect_to_char(mob, &af); @@ -1457,63 +1457,63 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) switch (demon) { case GREATER_OZE: - RS.Queue.AddToQueue(2, 2, do_emote, mob, (char *)"nearly collapses as he doubles over in sudden agony, howling pitifully."); - RS.Queue.AddToQueue(3, 2, do_say, mob, (char *)"What have you done...? What have you DONE?"); - RS.Queue.AddToQueue(4, 5, act, "Blubbering like a child, $n slowly composes $mself and rises to $s \"feet.\"", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(6, 5, act, "$e points a hideously deformed arm toward you, dripping blood and bits of sinew.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(8, 2, do_say, mob, (char *)"I charge you, mortal, with returning me to the abyss. I have been plucked from a place... a place from whence I should not have been plucked."); - RS.Queue.AddToQueue(10, 2, do_emote, mob, (char *)"shudders slightly before continuing."); - RS.Queue.AddToQueue(11, 2, do_say, mob, (char *)"I require your blood, meddler, in order that I might survive long enough to return.... Speak the words, whelp. Yes or no?"); + RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"nearly collapses as he doubles over in sudden agony, howling pitifully."); + RS.Queue.AddToNewQueue(3, do_say_queue, mob, "What have you done...? What have you DONE?"); + RS.Queue.AddToNewQueue(4, act_queue, "Blubbering like a child, $n slowly composes $mself and rises to $s \"feet.\"", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(6, act_queue, "$e points a hideously deformed arm toward you, dripping blood and bits of sinew.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(8, do_say_queue, mob, "I charge you, mortal, with returning me to the abyss. I have been plucked from a place... a place from whence I should not have been plucked."); + RS.Queue.AddToNewQueue(10, do_emote, mob, (char *)"shudders slightly before continuing."); + RS.Queue.AddToNewQueue(11, do_say_queue, mob, "I require your blood, meddler, in order that I might survive long enough to return.... Speak the words, whelp. Yes or no?"); af.duration = 6; affect_to_char(mob, &af); break; case GREATER_GAMYGYN: - RS.Queue.AddToQueue(2, 5, act, "The undulating, shimmering form before you rings with unearthly sound.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(4, 5, act, "Swooping toward your face, $n seems to peer directly into your eyes.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(6, 2, do_tell, mob, buf); - RS.Queue.AddToQueue(6, 3, sprintf, buf, (char *)"%s I see you, mortal.", ch->name); - RS.Queue.AddToQueue(6, 5, act, "A sudden voice echoes unsettlingly in your mind:", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(7, 5, act, "You wince involuntarily, pictures of transactions gone wrong in your mind's eye.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(9, 2, do_tell, mob, buf); - RS.Queue.AddToQueue(9, 3, sprintf, buf, (char *)"%s I will not devour you; you may yet entertain me. Rewards shall be yours if you provide me with the dead flesh of one of your aberrant lightwalking kin. Do you submit yourself to my desire?", ch->name); + RS.Queue.AddToNewQueue(2, act_queue, "The undulating, shimmering form before you rings with unearthly sound.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(4, act_queue, "Swooping toward your face, $n seems to peer directly into your eyes.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(6, do_tell, mob, buf); + RS.Queue.AddToNewQueue(6, sprintf, buf, (char *)"%s I see you, mortal.", ch->name); + RS.Queue.AddToNewQueue(6, act_queue, "A sudden voice echoes unsettlingly in your mind:", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(7, act_queue, "You wince involuntarily, pictures of transactions gone wrong in your mind's eye.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(9, do_tell, mob, buf); + RS.Queue.AddToNewQueue(9, sprintf, buf, (char *)"%s I will not devour you; you may yet entertain me. Rewards shall be yours if you provide me with the dead flesh of one of your aberrant lightwalking kin. Do you submit yourself to my desire?", ch->name); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_OROBAS: - RS.Queue.AddToQueue(2, 5, act, "Orobas' many faces stare around the area, nonplussed by your summoning.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(4, 2, do_say, mob, (char *)"I see."); - RS.Queue.AddToQueue(6, 5, act, "A great howling sound boils into existence as Orobas' limbs flail wildly!", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(8, 2, do_say, mob, (char *)"I am displeased to be here."); - RS.Queue.AddToQueue(9, 2, do_say, mob, (char *)"You will do my bidding, mortal, or I shall inform the abyss of your grievous error at once."); - RS.Queue.AddToQueue(10, 5, act, "The choir of blurred and screaming heads reaches a new pitch of fervor.", mob, 0, 0, TO_ALL); - RS.Queue.AddToQueue(12, 2, do_whisper, mob, (char *)"Speak now, or forever mourn your decision. Do you submit?"); + RS.Queue.AddToNewQueue(2, act_queue, "Orobas' many faces stare around the area, nonplussed by your summoning.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(4, do_say_queue, mob, "I see."); + RS.Queue.AddToNewQueue(6, act_queue, "A great howling sound boils into existence as Orobas' limbs flail wildly!", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(8, do_say_queue, mob, "I am displeased to be here."); + RS.Queue.AddToNewQueue(9, do_say_queue, mob, "You will do my bidding, mortal, or I shall inform the abyss of your grievous error at once."); + RS.Queue.AddToNewQueue(10, act_queue, "The choir of blurred and screaming heads reaches a new pitch of fervor.", mob, nullptr, nullptr, TO_ALL); + RS.Queue.AddToNewQueue(12, do_whisper, mob, (char *)"Speak now, or forever mourn your decision. Do you submit?"); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_GERYON: - RS.Queue.AddToQueue(2, 2, do_emote, mob, (char *)"smiles pleasantly, extending a cool, dry hand to shake your own."); - RS.Queue.AddToQueue(4, 2, do_say, mob, (char *)"It's wonderful to be back here, I must say. It's been far too long. Who was the last fellow? Ah, yes...."); - RS.Queue.AddToQueue(5, 2, do_emote, mob, (char *)"seems to finger something in his pocket, his eyes alight with pleasure."); - RS.Queue.AddToQueue(6, 5, act, "An uncomfortable sensation crawls over you as you eye this well-dressed demon.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(8, 2, do_say, mob, (char *)"But enough of my reminiscing! I imagine you have something you wanted to discuss, yes? Power, no doubt!"); - RS.Queue.AddToQueue(10, 2, do_emote, mob, (char *)"'s smile expands to a wider grin, and his eyes flicker red for a moment."); - RS.Queue.AddToQueue(11, 5, act, "...though it may have been a trick of the light.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(12, 2, do_say, mob, (char *)"So, to business. What shall it be, then? An eye or a finger?"); + RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"smiles pleasantly, extending a cool, dry hand to shake your own."); + RS.Queue.AddToNewQueue(4, do_say_queue, mob, "It's wonderful to be back here, I must say. It's been far too long. Who was the last fellow? Ah, yes...."); + RS.Queue.AddToNewQueue(5, do_emote, mob, (char *)"seems to finger something in his pocket, his eyes alight with pleasure."); + RS.Queue.AddToNewQueue(6, act_queue, "An uncomfortable sensation crawls over you as you eye this well-dressed demon.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(8, do_say_queue, mob, "But enough of my reminiscing! I imagine you have something you wanted to discuss, yes? Power, no doubt!"); + RS.Queue.AddToNewQueue(10, do_emote, mob, (char *)"'s smile expands to a wider grin, and his eyes flicker red for a moment."); + RS.Queue.AddToNewQueue(11, act_queue, "...though it may have been a trick of the light.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(12, do_say_queue, mob, "So, to business. What shall it be, then? An eye or a finger?"); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_CIMERIES: WAIT_STATE(ch, 5 * PULSE_VIOLENCE); - RS.Queue.AddToQueue(2, 2, do_emote, mob, (char *)"rises to his feet, and in a sudden panic attempts to flee by air."); - RS.Queue.AddToQueue(3, 5, act, "The greater demon's pathetic wings, completely impotent, flap helplessly.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(4, 5, act, "You stave off a pang of guilt at having summoned this massive beast to flounder.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(6, 5, act, "Your misplaced guilt quickly turns to fear as Cimeries rounds on you savagely!", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(7, 5, act, "Before you can react, Cimeries has clamped your head between two massive claws!", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(9, 5, act, "You gasp in pain, blood running down your face, as his talons pierce your nose and ear!", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(10, 5, act, "$n speaks in a low grunting language, and you cannot understand a word.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(11, 5, act, "$n tugs harshly on your ear and nose in turn, eliciting another gasp of pain.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(13, 5, act, "Suddenly, his cruel choice for you becomes clear: ear or nose?", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(15, 5, act, "A shiver runs down your spine while you contemplate your fate.", mob, 0, ch, TO_VICT); + RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"rises to his feet, and in a sudden panic attempts to flee by air."); + RS.Queue.AddToNewQueue(3, act_queue, "The greater demon's pathetic wings, completely impotent, flap helplessly.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(4, act_queue, "You stave off a pang of guilt at having summoned this massive beast to flounder.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(6, act_queue, "Your misplaced guilt quickly turns to fear as Cimeries rounds on you savagely!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(7, act_queue, "Before you can react, Cimeries has clamped your head between two massive claws!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(9, act_queue, "You gasp in pain, blood running down your face, as his talons pierce your nose and ear!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(10, act_queue, "$n speaks in a low grunting language, and you cannot understand a word.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(11, act_queue, "$n tugs harshly on your ear and nose in turn, eliciting another gasp of pain.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(13, act_queue, "Suddenly, his cruel choice for you becomes clear: ear or nose?", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(15, act_queue, "A shiver runs down your spine while you contemplate your fate.", mob, nullptr, ch, TO_VICT); af.duration = 4; affect_to_char(mob, &af); break; @@ -1565,9 +1565,9 @@ void lesser_demon_tick(CHAR_DATA *mob, AFFECT_DATA *af) if (af->duration == 1) { do_emote(mob, "laughs giddily and whirls to leave."); - RS.Queue.AddToQueue(1, 2, do_say, mob, (char *)"I'll be leaving now, and leaving you to your thoughts. You'll never know the answer to my riddle."); - RS.Queue.AddToQueue(2, 5, act, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(3, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(1, do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts. You'll never know the answer to my riddle."); + RS.Queue.AddToNewQueue(2, act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(3, delay_extract, mob); break; } case MOB_VNUM_MALAPHAR: @@ -2150,7 +2150,7 @@ void do_breath_mephisto(CHAR_DATA *ch, char *argument) act("You begin building up the intense cold within you.", ch, 0, 0, TO_CHAR); act("$n's skin shifts to a shade of blue.", ch, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(3, 3, mephisto_two, ch, victim, argument); + RS.Queue.AddToNewQueue(3, mephisto_two, ch, victim, argument); } void mephisto_two(CHAR_DATA *ch, CHAR_DATA *victim, char *argument) diff --git a/code/characterClasses/chrono.c b/code/characterClasses/chrono.c index 3ce0c48..4ea9a8b 100644 --- a/code/characterClasses/chrono.c +++ b/code/characterClasses/chrono.c @@ -88,7 +88,7 @@ void spell_stasis_wall(int sn, int level, CHAR_DATA *ch, void *vo, int target) usually make sure the lag on the rune is at least as long as the lag on the draw_rune queue */ - RS.Queue.AddToQueue(9, 1, draw_rune, rune); + RS.Queue.AddToNewQueue(9, draw_rune_queue, rune, rune->owner); } bool trigger_stasis_wall(void *vo, void *vo2, void *vo3, void *vo4) @@ -161,6 +161,11 @@ void draw_rune(void *vo, void *vo2) apply_rune(rune); } +void draw_rune_queue(RUNE_DATA *rune, CHAR_DATA *ch) +{ + draw_rune(rune, nullptr); +} + void do_rune(CHAR_DATA *ch, char *argument) { char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], ttype[MSL]; diff --git a/code/characterClasses/chrono.h b/code/characterClasses/chrono.h index 7c9aee4..226a436 100644 --- a/code/characterClasses/chrono.h +++ b/code/characterClasses/chrono.h @@ -11,6 +11,7 @@ void spell_stasis_wall (int sn, int level, CHAR_DATA *ch, void *vo,int target ); bool trigger_stasis_wall (void *vo,void *vo2,void *vo3,void *vo4); bool activate_stasis_wall (void *vo,void *vo2,void *vo3,void *vo4); //list your rune trigs here for good reference void draw_rune (void *vo, void *vo2); //attempt to add a rune that's just been initiated +void draw_rune_queue(RUNE_DATA *rune, CHAR_DATA *ch); void do_rune (CHAR_DATA *ch, char *argument ); RUNE_DATA *find_rune (void *vo, int target_type, int trigger_type, RUNE_DATA *rune_prev); void extract_rune (RUNE_DATA *rune); diff --git a/code/characterClasses/druid.c b/code/characterClasses/druid.c index 22a5483..711e8bc 100644 --- a/code/characterClasses/druid.c +++ b/code/characterClasses/druid.c @@ -100,15 +100,15 @@ void spell_tangleroot(int sn, int level, CHAR_DATA *ch, void *vo, int target) if (number_percent() > 10) { - RS.Queue.AddToQueue(2, 2, LAG_CHAR, victim, (2 * PULSE_VIOLENCE)); - RS.Queue.AddToQueue(2, 8, damage_queue, ch, victim, dam, DAM_BASH, HIT_UNBLOCKABLE, HIT_NOADD, HIT_NOMULT, (char *)"entangling roots*"); - RS.Queue.AddToQueue(2, 5, act, "A tangleroot bursts out of the ground and entangles $N!", ch, 0, victim, TO_NOTVICT); - RS.Queue.AddToQueue(2, 5, act, "A tangleroot bursts out of the ground and entangles you!", ch, 0, victim, TO_VICT); - RS.Queue.AddToQueue(2, 5, act, "A tangleroot bursts out of the ground and entangles $N!", ch, 0, victim, TO_CHAR); + RS.Queue.AddToNewQueue(2, LAG_CHAR, victim, (2 * PULSE_VIOLENCE)); + RS.Queue.AddToNewQueue(2, damage_queue, ch, victim, dam, DAM_BASH, HIT_UNBLOCKABLE, HIT_NOADD, HIT_NOMULT, (char *)"entangling roots*"); + RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_NOTVICT); + RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles you!", ch, nullptr, victim, TO_VICT); + RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_CHAR); return; } - RS.Queue.AddToQueue(2, 5, act, "A tangleroot bursts out of the ground, but $N avoids it!", ch, 0, victim, TO_NOTVICT); - RS.Queue.AddToQueue(2, 5, act, "A tangleroot bursts out of the ground, but you manage to avoid it!", ch, 0, victim, TO_VICT); - RS.Queue.AddToQueue(2, 5, act, "A tangleroot bursts out of the ground, but $N avoids it!", ch, 0, victim, TO_CHAR); + RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_NOTVICT); + RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground, but you manage to avoid it!", ch, nullptr, victim, TO_VICT); + RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_CHAR); } diff --git a/code/characterClasses/necro.c b/code/characterClasses/necro.c index 79e7e20..b6dbcbc 100644 --- a/code/characterClasses/necro.c +++ b/code/characterClasses/necro.c @@ -82,16 +82,16 @@ void spell_dark_vessel(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n plunges a hand into $p's chest cavity, and removes the heart.", ch, corpse, 0, TO_ROOM); - RS.Queue.AddToQueue(2, 5, act, "$n holds the heart aloft as it visibly begins to harden.", ch, 0, 0, TO_ROOM); + RS.Queue.AddToNewQueue(2, act_queue, "$n holds the heart aloft as it visibly begins to harden.", ch, nullptr, nullptr, TO_ROOM); send_to_char("You remove the corpse's heart and squeeze the blood out of it, hardening it into a solid object.\n\r", ch); - RS.Queue.AddToQueue(4, 2, make_urn, ch, corpse); + RS.Queue.AddToNewQueue(4, make_urn, ch, corpse); if(isNewUrn == false) { - RS.Queue.AddToQueue(6, 2, send_to_char, "You drink the remaining blood from your old vessel, expelling each drop into the new one as your body convulses!\n\r The old vessel drops from your hand as it turns to ash.\n\r", ch); - RS.Queue.AddToQueue(7, 5, act, "$n drinks a thick fluid from a sanguine object and begins convulsing as they expel the fluid into the newly made vessel!", ch, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(8, 5, act, "$n shudders, releasing the sanguine object as it turns to ash.", ch, 0, 0, TO_ROOM); + RS.Queue.AddToNewQueue(6, send_to_char, "You drink the remaining blood from your old vessel, expelling each drop into the new one as your body convulses!\n\r The old vessel drops from your hand as it turns to ash.\n\r", ch); + RS.Queue.AddToNewQueue(7, act_queue, "$n drinks a thick fluid from a sanguine object and begins convulsing as they expel the fluid into the newly made vessel!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(8, act_queue, "$n shudders, releasing the sanguine object as it turns to ash.", ch, nullptr, nullptr, TO_ROOM); } } @@ -400,7 +400,7 @@ void spell_animate_dead(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("You kneel before $p, chanting softly in an arcane language.", ch, corpse, 0, TO_CHAR); act("$n kneels before $p, chanting softly in an unintelligible language.", ch, corpse, 0, TO_ROOM); - RS.Queue.AddToQueue(2, 2, animate_two, ch, corpse); + RS.Queue.AddToNewQueue(2, animate_two, ch, corpse); } void animate_two(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -430,7 +430,7 @@ void animate_two(CHAR_DATA *ch, OBJ_DATA *corpse) act("You carve elaborate runes onto the torso of $p.", ch, corpse, nullptr, TO_CHAR); act("$n carves elaborate runes onto the torso of $p.", ch, corpse, nullptr, TO_ROOM); - RS.Queue.AddToQueue(2, 2, animate_three, ch, corpse); + RS.Queue.AddToNewQueue(2, animate_three, ch, corpse); } void animate_three(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -459,7 +459,7 @@ void animate_three(CHAR_DATA *ch, OBJ_DATA *corpse) act("The flesh of the corpse begins to decay rapidly, its skin left bloated and sagging.", ch, nullptr, nullptr, TO_ALL); - RS.Queue.AddToQueue(2, 2, animate_four, ch, corpse); + RS.Queue.AddToNewQueue(2, animate_four, ch, corpse); } void animate_four(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -681,7 +681,7 @@ void spell_visceral(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n slices open three corpses, spreading their entrails upon the ground.", ch, 0, 0, TO_ROOM); act("You slice open three corpses, spreading their entrails upon the ground.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(6, 1, visceral_two, ch); + RS.Queue.AddToNewQueue(6, visceral_two, ch); } void visceral_two(CHAR_DATA *ch) @@ -696,7 +696,7 @@ void visceral_two(CHAR_DATA *ch) act("Upon this gore, $n pours a generous amount of blood, saturating it.", ch, 0, 0, TO_ROOM); act("Upon this gore, you pour a generous amount of blood, saturating it.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(6, 1, visceral_three, ch); + RS.Queue.AddToNewQueue(6, visceral_three, ch); } void visceral_three(CHAR_DATA *ch) @@ -719,7 +719,7 @@ void visceral_three(CHAR_DATA *ch) act("$n and $s minions blissfully writhe in the carnage, praising the Dark Gods.", ch, 0, 0, TO_ROOM); act("You blissfully writhe in the carnage, praising the Dark Gods.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(6, 1, visceral_four, ch); + RS.Queue.AddToNewQueue(6, visceral_four, ch); } void visceral_four(CHAR_DATA *ch) @@ -802,7 +802,7 @@ void spell_ritual_soul(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n begins to spread out some infernal relics and charms.", ch, 0, 0, TO_ROOM); act("You begin to spread out some infernal relics and charms.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, 2, ritual_two, ch, victim); + RS.Queue.AddToNewQueue(3, ritual_two, ch, victim); } void ritual_two(CHAR_DATA *ch, CHAR_DATA *victim) @@ -821,7 +821,7 @@ void ritual_two(CHAR_DATA *ch, CHAR_DATA *victim) act("$n pours some blood onto the floor from $s urn, and chants quietly.", ch, 0, 0, TO_ROOM); act("You spill out blood from your urn, chanting softly in an arcane tongue.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, 2, ritual_three, ch, victim); + RS.Queue.AddToNewQueue(3, ritual_three, ch, victim); } void ritual_three(CHAR_DATA *ch, CHAR_DATA *victim) @@ -843,7 +843,7 @@ void ritual_three(CHAR_DATA *ch, CHAR_DATA *victim) ch->mana = (short)(ch->mana * .8); ch->move = (short)(ch->move * .5); - RS.Queue.AddToQueue(3, 2, ritual_four, ch, victim); + RS.Queue.AddToNewQueue(3, ritual_four, ch, victim); } void ritual_four(CHAR_DATA *ch, CHAR_DATA *victim) @@ -929,7 +929,7 @@ void spell_ritual_flesh(int sn, int level, CHAR_DATA *ch, void *vo, int target) ch->disrupted= false; - RS.Queue.AddToQueue(3, 2, flesh_two, ch, victim); + RS.Queue.AddToNewQueue(3, flesh_two, ch, victim); act("You prepare to make an unholy sacrifice to the Dark Gods!", ch, 0, 0, TO_CHAR); } @@ -945,7 +945,7 @@ void flesh_two(CHAR_DATA *ch, CHAR_DATA *victim) act("$n pours blood onto the floor, chanting softly in an undecipherable tongue.", ch, 0, 0, TO_ROOM); act("You pour blood onto the floor, chanting softly in an arcane tongue.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, 2, flesh_three, ch, victim); + RS.Queue.AddToNewQueue(3, flesh_three, ch, victim); } void flesh_three(CHAR_DATA *ch, CHAR_DATA *victim) @@ -964,7 +964,7 @@ void flesh_three(CHAR_DATA *ch, CHAR_DATA *victim) ch->hit = (short)(ch->hit * 0.8); - RS.Queue.AddToQueue(3, 2, flesh_four, ch, victim); + RS.Queue.AddToNewQueue(3, flesh_four, ch, victim); } void flesh_four(CHAR_DATA *ch, CHAR_DATA *victim) diff --git a/code/characterClasses/sorcerer.c b/code/characterClasses/sorcerer.c index fed1908..a248bb2 100644 --- a/code/characterClasses/sorcerer.c +++ b/code/characterClasses/sorcerer.c @@ -5054,7 +5054,7 @@ void spell_concave_shell(int sn, int level, CHAR_DATA *ch, void *vo, int target) dirptr = (int *)talloc_struct(sizeof(int)); *dirptr = dir; - RS.Queue.AddToQueue(6, 3, concave_shell_move, ch, dirptr, ch->in_room); + RS.Queue.AddToNewQueue(6, concave_shell_move, ch, dirptr, ch->in_room); act("Air begins to swirl rapidly around you.", ch, 0, 0, TO_CHAR); act("Swirling winds begin to mass near $n.", ch, 0, 0, TO_ROOM); @@ -7999,13 +7999,13 @@ void spell_mana_infusion(int sn, int level, CHAR_DATA *ch, void *vo, int target) af1.owner = ch; new_affect_to_char(victim, &af1); - RS.Queue.AddToQueue(2, 8, damage_queue, ch, victim, level, DAM_OTHER, HIT_UNBLOCKABLE, HIT_NOADD, dammod, (char *)"the escaping mana*"); - RS.Queue.AddToQueue(2, 2, affect_strip, victim, gsn_mana_infusion); - RS.Queue.AddToQueue(2, 5, act, "You scream in pain as the mana rushes from your body!", victim, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(2, 5, act, "As the mana rushes out of $n's body, $e cries out in pain!", victim, 0, 0, TO_ROOM); + RS.Queue.AddToNewQueue(2, damage_queue, ch, victim, level, DAM_OTHER, HIT_UNBLOCKABLE, HIT_NOADD, dammod, (char *)"the escaping mana*"); + RS.Queue.AddToNewQueue(2, affect_strip, victim, gsn_mana_infusion); + RS.Queue.AddToNewQueue(2, act_queue, "You scream in pain as the mana rushes from your body!", victim, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToNewQueue(2, act_queue, "As the mana rushes out of $n's body, $e cries out in pain!", victim, nullptr, nullptr, TO_ROOM); if (ch->level > 40 && number_percent() > 50 && !is_affected(victim, gsn_mana_sickness) && victim->hit > level + 30) - RS.Queue.AddToQueue(3, 2, mana_infusion_helper, ch, victim); + RS.Queue.AddToNewQueue(3, mana_infusion_helper, ch, victim); } void infusion_tick(CHAR_DATA *ch, AFFECT_DATA *af) diff --git a/code/characterClasses/warrior.c b/code/characterClasses/warrior.c index 57d5615..5ea2681 100644 --- a/code/characterClasses/warrior.c +++ b/code/characterClasses/warrior.c @@ -2710,8 +2710,8 @@ void do_brace(CHAR_DATA *ch, char *arg) braceptr = (float *)talloc_struct(sizeof(float)); *braceptr = bracemod; - RS.Queue.AddToQueue(8, 2, brace_helper_undo, ch, braceptr); - RS.Queue.AddToQueue(8, 5, act, "You are no longer bracing yourself against incoming blows.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToNewQueue(8, brace_helper_undo, ch, braceptr); + RS.Queue.AddToNewQueue(8, act_queue, "You are no longer bracing yourself against incoming blows.", ch, nullptr, nullptr, TO_CHAR); check_improve(ch, gsn_brace, true, 3); } } @@ -4712,7 +4712,7 @@ void do_retreat(CHAR_DATA *ch, char *arg) dirptr = (int *)talloc_struct(sizeof(int)); *dirptr = direction; - RS.Queue.AddToQueue(3, 2, execute_retreat, ch, dirptr); + RS.Queue.AddToNewQueue(3, execute_retreat, ch, dirptr); WAIT_STATE(ch, PULSE_VIOLENCE); } diff --git a/code/comm.c b/code/comm.c index bcedf22..9631a33 100644 --- a/code/comm.c +++ b/code/comm.c @@ -2724,7 +2724,7 @@ void nanny(DESCRIPTOR_DATA *d, char *argument) } ch->gold = 500; - RS.Queue.AddToQueue(3, 1, create_academy_pet, ch); + RS.Queue.AddToNewQueue(3, create_academy_pet, ch); // academy pet here, on queue } else if (ch->in_room != nullptr) @@ -3125,6 +3125,11 @@ void act(const char *format, CHAR_DATA *ch, const void *arg1, const void *arg2, act_new(format, ch, arg1, arg2, type, POS_RESTING); } +void act_queue(std::string format, CHAR_DATA *ch, OBJ_DATA *arg1, CHAR_DATA *arg2, int type) +{ + act_new(format.c_str(), ch, (void*)arg1, (void*)arg2, type, POS_RESTING); +} + void act_area(const char *format, CHAR_DATA *ch, CHAR_DATA *victim) { static char *const he_she[] = {"it", "he", "she"}; @@ -3379,7 +3384,7 @@ void act_new(const char *format, CHAR_DATA *ch, const void *arg1, const void *ar i = his_her[URANGE(0, vch->sex, 2)]; break; case 'p': - if (!obj1) + if (obj1 == nullptr) { i = "something"; break; diff --git a/code/comm.h b/code/comm.h index 355ef1b..82b42f3 100644 --- a/code/comm.h +++ b/code/comm.h @@ -172,6 +172,7 @@ void show_string (struct descriptor_data *d, char *input); /* quick sex fixer */ void fix_sex (CHAR_DATA *ch); void act (const char *format, CHAR_DATA *ch, const void *arg1, const void *arg2, int type); +void act_queue (std::string format, CHAR_DATA *ch, OBJ_DATA *arg1, CHAR_DATA *arg2, int type); void act_area (const char *format, CHAR_DATA *ch, CHAR_DATA *victim); void act_new (const char *format, CHAR_DATA *ch, const void *arg1, const void *arg2, int type, int min_pos); void announce_login (CHAR_DATA *ch); diff --git a/code/fight.c b/code/fight.c index 99ef32c..0aa2588 100644 --- a/code/fight.c +++ b/code/fight.c @@ -5341,6 +5341,12 @@ void do_bash(CHAR_DATA *ch, char *argument) } } +void do_bash_queue (CHAR_DATA *ch, std::string argument) +{ + do_bash(ch, argument.data()); +} + + void do_dirt(CHAR_DATA *ch, char *argument) { char arg[MAX_INPUT_LENGTH]; diff --git a/code/fight.h b/code/fight.h index 4f70f85..62e44d0 100644 --- a/code/fight.h +++ b/code/fight.h @@ -114,6 +114,7 @@ bool can_bash (CHAR_DATA *ch, CHAR_DATA *victim); void disarm (CHAR_DATA *ch, CHAR_DATA *victim); void do_berserk (CHAR_DATA *ch, char *argument); void do_bash (CHAR_DATA *ch, char *argument); +void do_bash_queue (CHAR_DATA *ch, std::string argument); void do_dirt (CHAR_DATA *ch, char *argument); void do_trip (CHAR_DATA *ch, char *argument); void do_hit (CHAR_DATA *ch, char *argument); diff --git a/code/handler.c b/code/handler.c index 7254e4a..e7a60f7 100644 --- a/code/handler.c +++ b/code/handler.c @@ -2317,10 +2317,10 @@ void extract_char(CHAR_DATA *ch, bool fPull) char_from_room(ch); - if (is_npc(ch) && CQueue::HasQueuePending(ch)) + if (is_npc(ch) && RS.Queue.HasNewQueuePending(ch)) { RS.Logger.Warn("Attempt at extracting mob {} while it has queue events pending. Deleting events.", ch->pIndexData->vnum); - CQueue::DeleteQueuedEventsInvolving(ch); + RS.Queue.DeleteNewQueuedEventsInvolving(ch); } /* Death room is set in the cabal table now */ diff --git a/code/interp.c b/code/interp.c index b1f4e92..919e9d4 100644 --- a/code/interp.c +++ b/code/interp.c @@ -1120,6 +1120,11 @@ void interpret(CHAR_DATA *ch, char *argument) tail_chain(); } +void interpret_queue(CHAR_DATA *ch, std::string argument) +{ + interpret(ch, argument.data()); +} + bool knows_command(CHAR_DATA *ch, int cmd) { if (!cmd_table[cmd].skill_name || cmd_table[cmd].skill_name == "none") diff --git a/code/interp.h b/code/interp.h index 4ec0162..010a513 100644 --- a/code/interp.h +++ b/code/interp.h @@ -124,6 +124,7 @@ extern void do_proficiencies(CHAR_DATA *ch, char *argument); // prof.c void list_cmd_queue(CHAR_DATA *ch); void clear_cmd_queue(CHAR_DATA *ch); void interpret(CHAR_DATA *ch, char *argument); +void interpret_queue(CHAR_DATA *ch, std::string argument); bool knows_command(CHAR_DATA *ch, int cmd); bool check_social(CHAR_DATA *ch, char *command, char *argument); bool is_number(char *arg); diff --git a/code/iprog.c b/code/iprog.c index 10468ce..677fa2f 100644 --- a/code/iprog.c +++ b/code/iprog.c @@ -1630,14 +1630,14 @@ void verb_prog_antava_touch_hand(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) if (ch->in_room->vnum != 462) return; - RS.Queue.AddToQueue(14, 5, act, "Darkness closes back in upon the antechamber as the stone above you shuts abruptly!", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(9, 2, do_look, ch, "auto"); - RS.Queue.AddToQueue(9, 5, act, "$n suddenly slides down from above!", ch, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(9, 2, char_to_room, ch, tomb); - RS.Queue.AddToQueue(9, 1, char_from_room, ch); - RS.Queue.AddToQueue(9, 5, act, "You suddenly feel the ground drop out from under you!", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(9, 5, act, "The sound of grinding granite fills the air as $n suddenly drops out of sight!", ch, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(2, 2, WAIT_STATE, ch, PULSE_VIOLENCE * 5); + RS.Queue.AddToNewQueue(14, act_queue, "Darkness closes back in upon the antechamber as the stone above you shuts abruptly!", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToNewQueue(9, do_look_queue, ch, "auto"); + RS.Queue.AddToNewQueue(9, act_queue, "$n suddenly slides down from above!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(9, char_to_room, ch, tomb); + RS.Queue.AddToNewQueue(9, char_from_room, ch); + RS.Queue.AddToNewQueue(9, act_queue, "You suddenly feel the ground drop out from under you!", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToNewQueue(9, act_queue, "The sound of grinding granite fills the air as $n suddenly drops out of sight!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(2, WAIT_STATE, ch, PULSE_VIOLENCE * 5); } void verb_prog_sidhe_climb_vine(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) @@ -1737,8 +1737,8 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) { row = RS.SQL.GetRow(); temp = palloc_string(row[0]); - RS.Queue.AddToQueue(inc * 5, 1, (void *)free, temp); - RS.Queue.AddToQueue(inc * 5, 4, (void *)say_to, fat, ch, (char *)"Just do yourself a favor, and watch out for $t.", temp); + RS.Queue.AddToNewQueue(inc * 5, free, temp); + RS.Queue.AddToNewQueue(inc * 5, say_to, fat, ch, (char *)"Just do yourself a favor, and watch out for $t.", temp); } } else if (rand == 2) @@ -1764,8 +1764,8 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) mysql_free_result(res2); } } - RS.Queue.AddToQueue(inc*4, 1, (void*)free,temp); - RS.Queue.AddToQueue(inc*4, 4, (void*)say_to, fat, ch, (char*)"Haha, $t got him again! By Rygath's teeth, that's a fine thief...", temp); + RS.Queue.AddToNewQueue(inc*4, free,temp); + RS.Queue.AddToNewQueue(inc*4, say_to, fat, ch, (char*)"Haha, $t got him again! By Rygath's teeth, that's a fine thief...", temp); */ } /* @@ -1834,7 +1834,7 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) tc = i; } - RS.Queue.AddToQueue(inc*6, 4, (void*)say_to, violet, ch, + RS.Queue.AddToNewQueue(inc*6, say_to, violet, ch, (char*)"Well then, I suppose it's only a matter of time before we're all members of $t", cabal_table[tc].name); mprog_say(inc*7,"They're really cleaning house out there.", violet, ch); */ @@ -2670,7 +2670,7 @@ void verb_prog_touch_obelisk(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) ch->pcdata->condition[COND_HUNGER] = 1; ch->pcdata->condition[COND_THIRST] = 1; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); } void communion_handler(CHAR_DATA *ch) @@ -2700,7 +2700,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 2: sprintf(buf, "%sThe sonorous tone of a ramshorn booms through the void surrounding you.%s\n\r", @@ -2709,7 +2709,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 3: sprintf(buf, "%sA pearly luminescence begins to coalesce before your eyes, suspended in the darkness that rushes past as you plummet.%s\n\r", @@ -2718,7 +2718,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 4: sprintf(buf, "%sWithin the light, humanoid outlines begin to take shape.%s\n\r", @@ -2727,7 +2727,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 5: sprintf(buf, "%sYou see a behemoth of a man, gird in naught but animal hides and a belt adorned with human scalps.%s\n\r", @@ -2736,7 +2736,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 6: sprintf(buf, "%sThe stillness is shattered by a deafening battlecry, as the figures blur into motion.%s\n\r", @@ -2745,7 +2745,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 7: sprintf(buf, "%sA spray of blood follows his axe's arcing path through the air, light glinting off the silver blade.%s\n\r", @@ -2754,7 +2754,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 8: sprintf(buf, "%sYou have the sensation of being lifted higher, as your field of vision broadens.%s\n\r", @@ -2763,7 +2763,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 9: sprintf(buf, "%sA battlefield is spread out beneath you, the combat just witnessed but a part of the larger picture.%s\n\r", @@ -2772,7 +2772,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 10: sprintf(buf, "%sA small band of barbarians appear to have been trapped by a well-armored force of vastly superior numbers, a sheer cliffside at their backs.%s\n\r", @@ -2781,7 +2781,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 11: sprintf(buf, "%sFierce men and women, of all the races of Shalar, the barbarian horde raise their voices in a single outcry.%s\n\r", @@ -2790,7 +2790,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 12: sprintf(buf, "%sTheir bellowed warcry rippling out over the plains, they launch themselves into the heart of the enemy formation.%s\n\r", @@ -2799,7 +2799,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 13: sprintf(buf, "%sThe clash of steel upon steel and the horrible cries of dying men rise from the melee below...%s\n\r", @@ -2808,7 +2808,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 14: sprintf(buf, "%s...and the pungent odor of blood and death fills the air as the earth is stained a deep crimson.%s\n\r", @@ -2817,7 +2817,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 15: sprintf(buf, "%sThe barbarian horde cleaves a swath of terrible carnage through the heart of the fray, destruction trailing in their wake.%s\n\r", @@ -2826,7 +2826,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 16: sprintf(buf, "%sThe once-superior force, now decimated, turns to flee, a cacophony of shouts from the barbarians at their backs.%s\n\r", @@ -2835,7 +2835,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 17: sprintf(buf, "%sAs suddenly as the scene appeared, it is gone, the figures sinking into the earth and fading from sight entirely.%s\n\r", @@ -2844,7 +2844,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 18: SET_BIT(ch->comm, COMM_PROMPT); @@ -2858,7 +2858,7 @@ void communion_handler(CHAR_DATA *ch) ch->pcdata->tribe = tribe; af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 19: af->modifier++; @@ -2881,7 +2881,7 @@ void communion_handler(CHAR_DATA *ch) do_look(ch, "auto"); } - RS.Queue.AddToQueue(2, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(2, communion_handler, ch); break; case 20: sprintf(buf, "%sYou see a blur of motion streaking towards you from the edge of the forest.%s\n\r", @@ -2890,7 +2890,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(2, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(2, communion_handler, ch); break; case 21: af->modifier++; @@ -2997,7 +2997,7 @@ void communion_handler(CHAR_DATA *ch) } af->modifier++; - RS.Queue.AddToQueue(8, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(8, communion_handler, ch); break; case 23: sprintf(buf, "%sRays of light pierce your eyelids as they flutter open, and you groggily stagger to your feet.%s\n\r", @@ -3010,7 +3010,7 @@ void communion_handler(CHAR_DATA *ch) ch->position = POS_STANDING; af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 24: sprintf(buf, "%sA trophy belt is fastened securely about your waist, and you sense the weight of a massive pelt upon your back.%s\n\r", @@ -3093,7 +3093,7 @@ void communion_handler(CHAR_DATA *ch) equip_char(ch, obj, WEAR_ABOUT, false); - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 25: sprintf(buf, "%sEven as your mind reels, trying to make sense of all you have seen, you feel infused with newfound vigor.%s\n\r", @@ -3105,7 +3105,7 @@ void communion_handler(CHAR_DATA *ch) ch->mana = ch->max_mana; af->modifier++; - RS.Queue.AddToQueue(5, 1, communion_handler, ch); + RS.Queue.AddToNewQueue(5, communion_handler, ch); break; case 26: sprintf(buf, @@ -3170,7 +3170,7 @@ void verb_prog_feed_baby(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) act("$n's baby greedily begins to feed.", ch, 0, 0, TO_ROOM); milk->value[1] = 0; - RS.Queue.AddToQueue(12, 5, act, "$p drifts off to sleep.", ch, obj, 0, TO_CHAR); + RS.Queue.AddToNewQueue(12, act_queue, "$p drifts off to sleep.", ch, obj, nullptr, TO_CHAR); init_affect_obj(&af); af.where = TO_OBJ_APPLY; @@ -3711,13 +3711,13 @@ void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument if (!lRoom->exit[eDir]->u1.to_room) { // call elevator SIR! - RS.Queue.AddToQueue(2, 2, act_to_room, mmsg, lRoom); - RS.Queue.AddToQueue(2, 2, act_to_room, mmsg, tRoom); - RS.Queue.AddToQueue(2, 2, act_to_room, mmsg, eleRoom); - RS.Queue.AddToQueue(3, 1, close_elevator, eleRoom); - RS.Queue.AddToQueue(5, 2, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); - RS.Queue.AddToQueue(9, 2, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); - RS.Queue.AddToQueue(10, 2, open_elevator, eleRoom, lRoom); + RS.Queue.AddToNewQueue(2, act_to_room, mmsg, lRoom); + RS.Queue.AddToNewQueue(2, act_to_room, mmsg, tRoom); + RS.Queue.AddToNewQueue(2, act_to_room, mmsg, eleRoom); + RS.Queue.AddToNewQueue(3, close_elevator, eleRoom); + RS.Queue.AddToNewQueue(5, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); + RS.Queue.AddToNewQueue(9, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); + RS.Queue.AddToNewQueue(10, open_elevator, eleRoom, lRoom); act("You pull the lever into the down position.", ch, 0, 0, TO_CHAR); act("$n pulls the lever into the down position.", ch, 0, 0, TO_ROOM); @@ -3725,13 +3725,13 @@ void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument else if (lRoom->exit[eDir]->u1.to_room) { // elevator is here, we can send it back up tRoom = get_room_index(obj->value[1]); - RS.Queue.AddToQueue(2, 2, act_to_room, mmsg, lRoom); - RS.Queue.AddToQueue(2, 2, act_to_room, mmsg, tRoom); - RS.Queue.AddToQueue(2, 2, act_to_room, mmsg, eleRoom); - RS.Queue.AddToQueue(3, 1, close_elevator, eleRoom); - RS.Queue.AddToQueue(5, 2, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); - RS.Queue.AddToQueue(9, 2, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); - RS.Queue.AddToQueue(10, 2, open_elevator, eleRoom, tRoom); + RS.Queue.AddToNewQueue(2, act_to_room, mmsg, lRoom); + RS.Queue.AddToNewQueue(2, act_to_room, mmsg, tRoom); + RS.Queue.AddToNewQueue(2, act_to_room, mmsg, eleRoom); + RS.Queue.AddToNewQueue(3, close_elevator, eleRoom); + RS.Queue.AddToNewQueue(5, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); + RS.Queue.AddToNewQueue(9, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); + RS.Queue.AddToNewQueue(10, open_elevator, eleRoom, tRoom); act("You pull the lever into the up position.", ch, 0, 0, TO_CHAR); act("$n pulls the lever into the up position.", ch, 0, 0, TO_ROOM); @@ -3945,9 +3945,9 @@ void verb_prog_turn_wyntran(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) act("The temperature in the room drops rapidly as a darkened portal opens overhead.", ch, 0, 0, TO_ROOM); act("The temperature in the room drops rapidly as a darkened portal opens overhead.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, 5, act, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, 5, act, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(4, 2, char_to_room, victim, ch->in_room); + RS.Queue.AddToNewQueue(3, act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToNewQueue(3, act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(4, char_to_room, victim, ch->in_room); WAIT_STATE(ch, PULSE_VIOLENCE * 2); } diff --git a/code/magic.c b/code/magic.c index 9cca697..7115878 100644 --- a/code/magic.c +++ b/code/magic.c @@ -36,6 +36,7 @@ char *target_name; + /// /// Returns the number for a skill, searched by name. /// @param name: The name of the skill. @@ -4350,7 +4351,7 @@ void spell_summon(int sn, int level, CHAR_DATA *ch, void *vo, int target) return; } - RS.Queue.AddToQueue(3, 2, summon_char, ch, victim); + RS.Queue.AddToNewQueue(3, summon_char, ch, victim); act("You begin the summoning of $N.", ch, 0, victim, TO_CHAR); @@ -4671,7 +4672,7 @@ void spell_word_of_recall(int sn, int level, CHAR_DATA *ch, void *vo, int target if (ch != victim) act("You prepare to send $N home.", ch, 0, victim, TO_CHAR); - RS.Queue.AddToQueue(6, 2, recall_execute, victim, location); + RS.Queue.AddToNewQueue(6, recall_execute, victim, location); send_to_char("A tingling feeling runs down your spine for a moment.\n\r", victim); diff --git a/code/mprog.c b/code/mprog.c index f8dfba0..76afdd6 100644 --- a/code/mprog.c +++ b/code/mprog.c @@ -57,6 +57,7 @@ #include "utility.h" #include "newmem.h" #include "room.h" +#include "./include/spdlog/fmt/bundled/format.h" const struct improg_type mprog_table[] = { @@ -155,26 +156,20 @@ const struct improg_type mprog_table[] = void mprog_tell(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { - char buf[MSL]; - - RS.Queue.AddToQueue(inc, 5, act, buf, ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(inc, 6, sprintf, buf, (char *)"%s tells you '%s%s%s'", mob->short_descr, get_char_color(ch, "tells"), arg, END_COLOR(ch)); + auto buffer = fmt::format("{} tells you '{}{}{}'", mob->short_descr, get_char_color(ch, "tells"), arg, END_COLOR(ch)); + RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } void mprog_say(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { - char buf[MSL]; - - RS.Queue.AddToQueue(inc, 5, act, buf, ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(inc, 6, sprintf, buf, (char *)"%s says '%s%s%s'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); + auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); + RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } void mprog_emote(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { - char buf[MSL]; - - RS.Queue.AddToQueue(inc, 5, act, buf, ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(inc, 4, sprintf, buf, (char *)"%s %s", mob->short_descr, arg); + auto buffer = fmt::format("{} {}", mob->short_descr, arg); + RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } int mprog_drop(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) @@ -183,13 +178,13 @@ int mprog_drop(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) if (arg) { - RS.Queue.AddToQueue(inc, 5, act, buf, ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(inc, 6, sprintf, buf, (char *)"%s says '%s%s%s'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); + auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); + RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } - RS.Queue.AddToQueue(inc, 2, obj_to_room, obj, mob->in_room); - RS.Queue.AddToQueue(inc, 1, obj_from_char, obj); - RS.Queue.AddToQueue(inc, 5, act, "$n drops $p.", mob, obj, 0, TO_ROOM); + RS.Queue.AddToNewQueue(inc, obj_to_room, obj, mob->in_room); + RS.Queue.AddToNewQueue(inc, obj_from_char, obj); + RS.Queue.AddToNewQueue(inc, act_queue, "$n drops $p.", mob, obj, nullptr, TO_ROOM); return 0; } @@ -199,13 +194,13 @@ int mprog_give(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) if (arg) { - RS.Queue.AddToQueue(inc, 5, act, buf, ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(inc, 6, sprintf, buf, (char *)"%s says '%s%s%s'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); + auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); + RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } - RS.Queue.AddToQueue(inc, 2, obj_to_char, obj, ch); - RS.Queue.AddToQueue(inc, 1, obj_from_char, obj); - RS.Queue.AddToQueue(inc, 5, act, "$n gives you $p.", mob, obj, ch, TO_VICT); + RS.Queue.AddToNewQueue(inc, obj_to_char, obj, ch); + RS.Queue.AddToNewQueue(inc, obj_from_char, obj); + RS.Queue.AddToNewQueue(inc, act_queue, "$n gives you $p.", mob, obj, ch, TO_VICT); return 0; } @@ -623,9 +618,9 @@ void pulse_prog_arangird_patrol(CHAR_DATA *mob) void greet_prog_profteacher(CHAR_DATA *mob, CHAR_DATA *ch) { if (number_percent() > 50) - RS.Queue.AddToQueue(2, 5, act, "$N beckons you to approach $M.", ch, 0, mob, TO_CHAR); + RS.Queue.AddToNewQueue(2, act_queue, "$N beckons you to approach $M.", ch, nullptr, mob, TO_CHAR); else - RS.Queue.AddToQueue(2, 5, act, "$N meets your eyes thoughtfully, nodding slightly.", ch, 0, mob, TO_CHAR); + RS.Queue.AddToNewQueue(2, act_queue, "$N meets your eyes thoughtfully, nodding slightly.", ch, nullptr, mob, TO_CHAR); } void greet_prog_ruins_spirit(CHAR_DATA *mob, CHAR_DATA *ch) @@ -1567,7 +1562,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToQueue(1, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(1, delay_extract, mob); af->owner->pcdata->lesserdata[LESSER_BARBAS] = FAVOR_NONE; return; } @@ -1607,7 +1602,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToQueue(1, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(1, delay_extract, mob); return; } @@ -1647,7 +1642,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToQueue(1, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(1, delay_extract, mob); return; } @@ -1778,9 +1773,9 @@ void speech_prog_aamon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) break; default: do_emote(mob, "laughs giddily and whirls to leave."); - RS.Queue.AddToQueue(1, 2, do_say, mob, (char *)"I'll be leaving now, and leaving you to your thoughts! You'll never know the answer to my riddle."); - RS.Queue.AddToQueue(2, 5, act, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(3, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(1, do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts! You'll never know the answer to my riddle."); + RS.Queue.AddToNewQueue(2, act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(3, delay_extract, mob); ch->pcdata->lesserdata[LESSER_AAMON] = FAVOR_FAILED; break; } @@ -1894,7 +1889,7 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act(" $t", mob, mob->speechbuf[2], 0, TO_ROOM); act(" $t", mob, mob->speechbuf[3], 0, TO_ROOM); - RS.Queue.AddToQueue(2, 2, do_say, mob, (char *)"Quite the worst bit of garbage I've ever had the joyless task of committing to memory. Good day, my rhythmless friend."); + RS.Queue.AddToNewQueue(2, do_say_queue, mob, "Quite the worst bit of garbage I've ever had the joyless task of committing to memory. Good day, my rhythmless friend."); do_note(mob, "to anti-paladin"); do_note(mob, "subject Verse, the Worst"); @@ -1919,7 +1914,7 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_note(mob, "+ [at the bottom of the scroll, in florid script, is a single 'I']"); do_note(mob, "send"); - RS.Queue.AddToQueue(4, 2, send_to_char, (char *)"You feel suddenly overcome with a desire to lash out at someone verbally.\n\r", ch); + RS.Queue.AddToNewQueue(4, send_to_char, (char *)"You feel suddenly overcome with a desire to lash out at someone verbally.\n\r", ch); ch->pcdata->lesserdata[LESSER_IPOS] = FAVOR_GRANTED; ch->pcdata->learned[skill_lookup("taunt")] = 1; @@ -1929,8 +1924,8 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) free_pstring(mob->speechbuf[i]); } - RS.Queue.AddToQueue(5, 5, act, "With a derisive snort, $n steps through a gate and vanishes without a trace.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(6, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(5, act_queue, "With a derisive snort, $n steps through a gate and vanishes without a trace.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(6, delay_extract, mob); } } @@ -1956,11 +1951,11 @@ void speech_prog_oze(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) stop_fighting(mob, true); - RS.Queue.AddToQueue(3, 5, act, "Suddenly rejuvenated, Oze begins to growl deep in his torso of exposed organs.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(5, 2, do_say, mob, (char *)"I would say that your deed would be remembered... but as you were the one who put me here in the first place, I doubt very much that you would wish it so. I take my leave."); - RS.Queue.AddToQueue(7, 5, act, "With a squelching sound, Oze thins into a gout of blood and shoots into the sky.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(8, 1, delay_extract, mob); - RS.Queue.AddToQueue(8, 1, save_char_obj, ch); + RS.Queue.AddToNewQueue(3, act_queue, "Suddenly rejuvenated, Oze begins to growl deep in his torso of exposed organs.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(5, do_say_queue, mob, "I would say that your deed would be remembered... but as you were the one who put me here in the first place, I doubt very much that you would wish it so. I take my leave."); + RS.Queue.AddToNewQueue(7, act_queue, "With a squelching sound, Oze thins into a gout of blood and shoots into the sky.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(8, delay_extract, mob); + RS.Queue.AddToNewQueue(8, save_char_obj, ch); ch->pcdata->greaterdata[GREATER_OZE] = FAVOR_GRANTED; ch->pcdata->learned[skill_lookup("leech")] = 1; ch->pcdata->perm_hit -= 70; @@ -1974,8 +1969,8 @@ void speech_prog_oze(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) sprintf(buf, "The abyss will not forget this treachery, %s.", ch->name); do_whisper(mob, buf); - RS.Queue.AddToQueue(1, 5, act, "The puddle of gore before you that was once a greater demon dissolves into the earth.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(2, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(1, act_queue, "The puddle of gore before you that was once a greater demon dissolves into the earth.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(2, delay_extract, mob); ch->pcdata->greaterdata[GREATER_OZE] = FAVOR_FAILED; return; } @@ -2000,11 +1995,11 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("Roaring suddenly with a thunder not unlike a thousand horses, $n rises.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(2, 5, act, "Plunging suddenly headlong, the demon dissolves into your midsection as you scream involuntarily.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(2, 5, act, "Plunging suddenly headlong, the demon dissolves into $N's midsection as $E screams.", mob, 0, ch, TO_NOTVICT); - RS.Queue.AddToQueue(3, 1, delay_extract, mob); - RS.Queue.AddToQueue(3, 2, send_to_char, buf, ch); - RS.Queue.AddToQueue(3, 4, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "blue"), END_COLOR(ch)); + RS.Queue.AddToNewQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into your midsection as you scream involuntarily.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into $N's midsection as $E screams.", mob, nullptr, ch, TO_NOTVICT); + RS.Queue.AddToNewQueue(3, delay_extract, mob); + RS.Queue.AddToNewQueue(3, send_to_char, buf, ch); + RS.Queue.AddToNewQueue(3, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "blue"), END_COLOR(ch)); init_affect(&af); af.where = TO_AFFECTS; @@ -2026,10 +2021,10 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("With a flourishing fanfare which seems nonetheless foreboding, $n rises.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(1, 2, do_tell, mob, buf); - RS.Queue.AddToQueue(1, 3, sprintf, buf, (char *)"%s You may yet live to regret your rash decision. Doubtless the seeds of realization sprout within you now.", ch->name); - RS.Queue.AddToQueue(2, 5, act, "Flashing a great dark light, $n vanishes from sight.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(3, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(1, do_tell, mob, buf); + RS.Queue.AddToNewQueue(1, sprintf, buf, (char *)"%s You may yet live to regret your rash decision. Doubtless the seeds of realization sprout within you now.", ch->name); + RS.Queue.AddToNewQueue(2, act_queue, "Flashing a great dark light, $n vanishes from sight.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(3, delay_extract, mob); ch->pcdata->greaterdata[GREATER_GAMYGYN] = FAVOR_FAILED; } @@ -2052,17 +2047,17 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_emote(mob, "smiles deviously, and you grow confused attempting to locate his lips."); - RS.Queue.AddToQueue(1, 2, do_say, mob, buf); - RS.Queue.AddToQueue(1, 3, sprintf, buf, (char *)"Very well. I shall watch over you. I require the corpse of another anti-paladin to warm my feet, %s... I trust you shall not disappoint.", ch->name); - RS.Queue.AddToQueue(2, 5, act, "Before you realize what's happening, $n has planted a firm grip on your arm.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(3, 5, act, "The terrible demon's many hands begin grappling with your frame.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(5, 5, act, "A multitude of taloned fingers dig deeply into your flesh.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(6, 5, act, "$n draws $mself toward you and you scream involuntarily!", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(8, 5, act, "You writhe in agony and pure horror as $n reaches down your throat...", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(10, 5, act, "In a few moments, $n has vanished entirely into your body.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(11, 1, delay_extract, mob); - RS.Queue.AddToQueue(12, 2, send_to_char, buf, ch); - RS.Queue.AddToQueue(12, 4, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "red"), END_COLOR(ch)); + RS.Queue.AddToNewQueue(1, do_say, mob, buf); + RS.Queue.AddToNewQueue(1, sprintf, buf, (char *)"Very well. I shall watch over you. I require the corpse of another anti-paladin to warm my feet, %s... I trust you shall not disappoint.", ch->name); + RS.Queue.AddToNewQueue(2, act_queue, "Before you realize what's happening, $n has planted a firm grip on your arm.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(3, act_queue, "The terrible demon's many hands begin grappling with your frame.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(5, act_queue, "A multitude of taloned fingers dig deeply into your flesh.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(6, act_queue, "$n draws $mself toward you and you scream involuntarily!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(8, act_queue, "You writhe in agony and pure horror as $n reaches down your throat...", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(10, act_queue, "In a few moments, $n has vanished entirely into your body.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(11, delay_extract, mob); + RS.Queue.AddToNewQueue(12, send_to_char, buf, ch); + RS.Queue.AddToNewQueue(12, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "red"), END_COLOR(ch)); init_affect(&af); af.where = TO_AFFECTS; @@ -2085,9 +2080,9 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("Shrieks of outrage rise up from $n, arms and legs kicking out toward you.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(1, 2, do_say, mob, (char *)"I expected nothing else."); - RS.Queue.AddToQueue(2, 5, act, "With a fierce snarl and many assorted whispers, $n streaks into the darkness.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(3, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(1, do_say_queue, mob, "I expected nothing else."); + RS.Queue.AddToNewQueue(2, act_queue, "With a fierce snarl and many assorted whispers, $n streaks into the darkness.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(3, delay_extract, mob); ch->pcdata->greaterdata[GREATER_OROBAS] = FAVOR_FAILED; } @@ -2112,15 +2107,15 @@ void speech_prog_geryon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_say(mob, buf); do_emote(mob, "smiles pleasantly once more, reaching to his belt for a small metal tool."); - RS.Queue.AddToQueue(2, 5, act, "Cupping one hand around the back of your head, Geryon plunges with the tool....", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(4, 5, act, "The greater demon's even, pearly teeth are the last thing your left eye sees.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(5, 5, act, "The next thing your right eye sees is a hand moving away, holding a bloody orb.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(6, 5, act, "You stifle a scream as the suddenness of the operation becomes realization.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(8, 5, act, "Geryon drops your left eye into a bag at his belt, still smiling.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(10, 2, do_say, mob, (char *)"That's a good lad! Do try not to cry just yet, there's nothing quite like the sting of tears in an open eye socket. Now, then...."); - RS.Queue.AddToQueue(11, 2, send_to_char, (char *)"The warmth of suffused power tingles through your fingers.\n\r", ch); - RS.Queue.AddToQueue(12, 2, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); - RS.Queue.AddToQueue(13, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(2, act_queue, "Cupping one hand around the back of your head, Geryon plunges with the tool....", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(4, act_queue, "The greater demon's even, pearly teeth are the last thing your left eye sees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(5, act_queue, "The next thing your right eye sees is a hand moving away, holding a bloody orb.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(6, act_queue, "You stifle a scream as the suddenness of the operation becomes realization.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(8, act_queue, "Geryon drops your left eye into a bag at his belt, still smiling.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(10, do_say_queue, mob, "That's a good lad! Do try not to cry just yet, there's nothing quite like the sting of tears in an open eye socket. Now, then...."); + RS.Queue.AddToNewQueue(11, send_to_char, (char *)"The warmth of suffused power tingles through your fingers.\n\r", ch); + RS.Queue.AddToNewQueue(12, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); + RS.Queue.AddToNewQueue(13, delay_extract, mob); ch->pcdata->greaterdata[GREATER_GERYON] = GERYON_EYE; return; @@ -2134,16 +2129,16 @@ void speech_prog_geryon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_say(mob, buf); do_emote(mob, "smiles pleasantly once more, reaching to his belt for a very sharp knife."); - RS.Queue.AddToQueue(2, 5, act, "Seizing your hand abruptly, Geryon places the blade of his knife against it.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(4, 5, act, "With a quick sawing motion, the greater demon looses your left index finger!", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(5, 5, act, "Blood pounding in your ears, you're unsure whether the scream you hear is yours.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(6, 5, act, "Catching the flying finger in his hand, Geryon places it into a bag at his belt.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(7, 5, act, "Geryon releases your wrist, and gouts of blood begin to pour from the wound.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(8, 5, act, "Geryon flashes his handsome smile and pushes stray hair back from his face.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(10, 2, do_say, mob, (char *)"Well done, my boy. Just stop up that stump you've got, or you'll bleed to death before I've gone! Now, then..."); - RS.Queue.AddToQueue(11, 2, send_to_char, (char *)"The warmth of suffused power tingles through your eyes.\n\r", ch); - RS.Queue.AddToQueue(12, 2, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); - RS.Queue.AddToQueue(13, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(2, act_queue, "Seizing your hand abruptly, Geryon places the blade of his knife against it.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(4, act_queue, "With a quick sawing motion, the greater demon looses your left index finger!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(5, act_queue, "Blood pounding in your ears, you're unsure whether the scream you hear is yours.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(6, act_queue, "Catching the flying finger in his hand, Geryon places it into a bag at his belt.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(7, act_queue, "Geryon releases your wrist, and gouts of blood begin to pour from the wound.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(8, act_queue, "Geryon flashes his handsome smile and pushes stray hair back from his face.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(10, do_say_queue, mob, "Well done, my boy. Just stop up that stump you've got, or you'll bleed to death before I've gone! Now, then..."); + RS.Queue.AddToNewQueue(11, send_to_char, (char *)"The warmth of suffused power tingles through your eyes.\n\r", ch); + RS.Queue.AddToNewQueue(12, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); + RS.Queue.AddToNewQueue(13, delay_extract, mob); ch->pcdata->greaterdata[GREATER_GERYON] = GERYON_FINGER; return; @@ -2166,12 +2161,12 @@ void speech_prog_cimeries(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) send_to_char("The sound of Cimeries' claw grinding against your skull fills your soul...", ch); - RS.Queue.AddToQueue(2, 5, act, "Slowly, with a disgusting grin, Cimeries scrapes your ear away from your head.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(3, 5, act, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(5, 5, act, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(6, 5, act, "You seem to absorb the blow more readily than you'd have thought possible.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(8, 5, act, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(9, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(2, act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your ear away from your head.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(3, act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(5, act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(6, act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(8, act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(9, delay_extract, mob); ch->pcdata->greaterdata[GREATER_CIMERIES] = CIMERIES_EAR; ch->pcdata->beauty = std::max(1, ch->pcdata->beauty - 4); @@ -2184,13 +2179,12 @@ void speech_prog_cimeries(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) send_to_char("You feel Cimeries' claw dig into the bridge of your nose and pull...", ch); - RS.Queue.AddToQueue(2, 5, act, "Slowly, with a disgusting grin, Cimeries scrapes your nose away from your head.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(3, 5, act, - "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(5, 5, act, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(6, 5, act, "You seem to absorb the blow more readily than you'd have thought possible.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(8, 5, act, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(9, 1, delay_extract, mob); + RS.Queue.AddToNewQueue(2, act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your nose away from your head.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(3, act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(5, act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(6, act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToNewQueue(8, act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(9, delay_extract, mob); ch->pcdata->greaterdata[GREATER_CIMERIES] = CIMERIES_NOSE; ch->pcdata->beauty = std::max(1, ch->pcdata->beauty - 4); @@ -2467,8 +2461,8 @@ void greet_prog_tower_shopkeeper(CHAR_DATA *mob, CHAR_DATA *ch) act("$N glances over his shoulder at $n and grumbles.", ch, 0, mob, TO_ROOM); act("$n glances over his shoulder at you and grumbles.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(4, 2, do_say, mob, (char *)"Well, are ye goin' to buy somethin' or are ye just going t'stand there and stare at me!?"); - RS.Queue.AddToQueue(24, 2, do_astrip, mob, (char *)""); + RS.Queue.AddToNewQueue(4, do_say_queue, mob, "Well, are ye goin' to buy somethin' or are ye just going t'stand there and stare at me!?"); + RS.Queue.AddToNewQueue(24, do_astrip, mob, (char *)""); } void pulse_prog_wizard_summon(CHAR_DATA *mob) @@ -2521,7 +2515,7 @@ void pulse_prog_wizard_summon(CHAR_DATA *mob) do_look(vch, "auto"); - RS.Queue.AddToQueue(1, 2, do_say, mob, (char *)"Please be more careful, and examine your surroundings. You'll live longer."); + RS.Queue.AddToNewQueue(1, do_say_queue, mob, "Please be more careful, and examine your surroundings. You'll live longer."); affect_remove(mob, paf); } @@ -3173,15 +3167,15 @@ void fight_prog_law_subdue(CHAR_DATA *mob, CHAR_DATA *ch) char_from_room(ch); char_to_room(ch, get_room_index(5)); - RS.Queue.AddToQueue(10, 2, (void *)send_to_char, (char *)"You are dimly aware of being dragged along the ground...\n\r", ch); - RS.Queue.AddToQueue(19, 1, (void *)wake_up, ch); - RS.Queue.AddToQueue(19, 2, (void *)affect_strip, ch, &gsn_subdue); - RS.Queue.AddToQueue(19, 2, (void *)char_to_room, ch, pRoom); - RS.Queue.AddToQueue(19, 1, (void *)char_from_room, ch); - RS.Queue.AddToQueue(20, 2, (void *)send_to_char, (char *)"You are shaken awake by a fuzzy man, as seen through your own personal haze.\n\r", ch); - RS.Queue.AddToQueue(20, 5, act, (char *)"$N comes to $S knees holding the back of $S head.", 0, 0, ch, TO_NOTVICT); - RS.Queue.AddToQueue(21, 2, (void *)send_to_char, buf, ch); - RS.Queue.AddToQueue(21, 5, (void *)sprintf, buf, (char *)"A Hydra trooper tells you '%sAnd stay out of Cimar, ye %s!%s'\n\r", get_char_color(ch, "tells"), get_insult(ch), END_COLOR(ch)); + RS.Queue.AddToNewQueue(10, send_to_char, (char *)"You are dimly aware of being dragged along the ground...\n\r", ch); + RS.Queue.AddToNewQueue(19, wake_up, ch); + RS.Queue.AddToNewQueue(19, affect_strip, ch, gsn_subdue); + RS.Queue.AddToNewQueue(19, char_to_room, ch, pRoom); + RS.Queue.AddToNewQueue(19, char_from_room, ch); + RS.Queue.AddToNewQueue(20, send_to_char, (char *)"You are shaken awake by a fuzzy man, as seen through your own personal haze.\n\r", ch); + RS.Queue.AddToNewQueue(20, act_queue, "$N comes to $S knees holding the back of $S head.", nullptr, nullptr, ch, TO_NOTVICT); + RS.Queue.AddToNewQueue(21, send_to_char, buf, ch); + RS.Queue.AddToNewQueue(21, sprintf, buf, (char *)"A Hydra trooper tells you '%sAnd stay out of Cimar, ye %s!%s'\n\r", get_char_color(ch, "tells"), get_insult(ch), END_COLOR(ch)); } else { diff --git a/code/mspec.c b/code/mspec.c index 3186d74..a2443c8 100644 --- a/code/mspec.c +++ b/code/mspec.c @@ -127,8 +127,8 @@ BEGIN_SPEC(mspec_horde_tanner) mprog_say(1, "Ya jus give me a sec and I'll hack this up for ya.", mob, ch); mprog_emote(3, "slams the corpse on his work table and begins cutting it up.", mob, ch); - RS.Queue.AddToQueue(5, 5, act, "$N hands $n a stack of sliced raw meat.", ch, 0, mob, TO_ROOM); - RS.Queue.AddToQueue(5, 5, act, "$N hands you a stack of sliced raw meat.", ch, 0, mob, TO_CHAR); + RS.Queue.AddToNewQueue(5, act_queue, "$N hands $n a stack of sliced raw meat.", ch, nullptr, mob, TO_ROOM); + RS.Queue.AddToNewQueue(5, act_queue, "$N hands you a stack of sliced raw meat.", ch, nullptr, mob, TO_CHAR); extract_obj(obj); } @@ -264,19 +264,19 @@ void create_academy_pet(CHAR_DATA *ch) mob->leader = ch; ch->pet = mob; - RS.Queue.AddToQueue(3, 2, do_say, mob, + RS.Queue.AddToNewQueue(3, do_say_queue, mob, "I can aid you in finding food, water, a boat, and a place to practice. If you need to find "\ "somewhere to fight for learning, I can help with that, as well as a few other things."); char tbuf[MSL], *tref; - RS.Queue.AddToQueue(5, 2, do_say, mob, "To ask for my aid, direct your question to me."); + RS.Queue.AddToNewQueue(5, do_say_queue, mob, "To ask for my aid, direct your question to me."); sprintf(tbuf, "%s, I need to find food.", mob->short_descr); tref = talloc_string(tbuf); - RS.Queue.AddToQueue(8, 4, do_say, ch, tref); + RS.Queue.AddToNewQueue(8, do_say, ch, tref); } void apet_force(CHAR_DATA *ch, const char *cmd, int delay) @@ -287,8 +287,8 @@ void apet_force(CHAR_DATA *ch, const char *cmd, int delay) tal = talloc_string(buf); - RS.Queue.AddToQueue(delay, 2, interpret, ch, cmd); - RS.Queue.AddToQueue(delay, 2, send_to_char, tal, ch); + RS.Queue.AddToNewQueue(delay, interpret_queue, ch, std::string(cmd)); + RS.Queue.AddToNewQueue(delay, send_to_char, tal, ch); ch->wait = std::min((int)ch->wait, 20); } @@ -364,7 +364,7 @@ void apet_walk_to_room(CHAR_DATA *ch, int vnum) WAIT_STATE(ch->leader, PULSE_VIOLENCE); - RS.Queue.AddToQueue(2, 2, apet_walk_to_room, ch, vnum); + RS.Queue.AddToNewQueue(2, apet_walk_to_room, ch, vnum); } BEGIN_SPEC(mspec_academy_pet) @@ -541,13 +541,13 @@ BEGIN_SPEC(mspec_academy_pet) if (ch->alignment > -1) { - RS.Queue.AddToQueue(2, 2, do_say, mob, + RS.Queue.AddToNewQueue(2, do_say_queue, mob, "A good place to fight for us might be the Dying Forest. I understand the trolls there "\ "are good opponents."); - RS.Queue.AddToQueue(4, 2, do_say, mob, + RS.Queue.AddToNewQueue(4, do_say_queue, mob, "You can reach it by going out the eastern gate of Cimar along the Cimarrite Causeway, "\ "then south through the Stunted Forest to the Dying Forest."); - RS.Queue.AddToQueue(6, 2, do_say, mob, + RS.Queue.AddToNewQueue(6, do_say_queue, mob, "On the other hand, I've heard rumors of a crypt accessible through the Cimar Library "\ "north of the water fountain, where you can fight the undead. I'm not sure how you get "\ "in, but I bet you could find it if you looked there."); @@ -555,27 +555,26 @@ BEGIN_SPEC(mspec_academy_pet) if (ch->alignment == -1000) { - RS.Queue.AddToQueue(2, 2, do_say, mob, "We can slay the fool dryads in the Emerald Forest!"); - RS.Queue.AddToQueue(4, 2, do_say, mob, - "To reach it, first you should go to the major city of Melcene, out the eastern gate of " + RS.Queue.AddToNewQueue(2, do_say_queue, mob, "We can slay the fool dryads in the Emerald Forest!"); + RS.Queue.AddToNewQueue(4, do_say_queue, mob, + "To reach it, first you should go to the major city of Melcene, out the eastern gate of "\ "Cimar along the Cimarrite Causeway, along the Great Shalaran Road."); - RS.Queue.AddToQueue(6, 2, do_say, mob, - "Then, when you're before the Gates of Melcene, head north all the way, east as far as you " + RS.Queue.AddToNewQueue(6, do_say_queue, mob, + "Then, when you're before the Gates of Melcene, head north all the way, east as far as you "\ "can, north, and east all the way into the village square of the Emerald Forest."); } if (get_skill(ch, gsn_enhanced_damage) < 1) { - RS.Queue.AddToQueue(7, 2, do_say, mob, - "Although... I've heard of caves around Iseldheim. Caves where there are zombies nearly " - "impervious to physical attacks: they can rematerialize at the touch of metal.. but if you " + RS.Queue.AddToNewQueue(7, do_say_queue, mob, + "Although... I've heard of caves around Iseldheim. Caves where there are zombies nearly "\ + "impervious to physical attacks: they can rematerialize at the touch of metal.. but if you "\ "can think of a way around that - magic, maybe - you'd be good to go."); - RS.Queue.AddToQueue( - 8, 2, do_say, mob, - "To get there, first head to the great Northern City of Iseldheim. Leave Cimar by the Northern Gate, then " - "head all north and east through the village along the North Cimar Road."); - RS.Queue.AddToQueue(9, 2, do_say, mob, - "Once you're in Iseldheim, go up to the top level, out the eastern gate, and go northeast " + RS.Queue.AddToNewQueue(8, do_say_queue, mob, + "To get there, first head to the great Northern City of Iseldheim. Leave Cimar by the Northern Gate, then "\ + "head all north and east through the village along the North Cimar Road."); + RS.Queue.AddToNewQueue(9, do_say_queue, mob, + "Once you're in Iseldheim, go up to the top level, out the eastern gate, and go northeast "\ "till you reach a woodland trail. Caves should be around there... but be careful."); } diff --git a/code/newmem.c b/code/newmem.c index 4e79dfe..a599b60 100644 --- a/code/newmem.c +++ b/code/newmem.c @@ -197,9 +197,11 @@ void do_memtest(CHAR_DATA *ch, char *argument) char buf[MSL]; CHAR_DATA *qch; argument = one_argument(argument, buf); - CQueue j; - RS.Queue.AddToQueue(6,2,(void*)do_bash,ch,"Calenduil"); + RS.Queue.AddToNewQueue(6, do_bash_queue, ch, "Calenduil"); return; + + //TODO: what the what??? + if(buf[0]=='\0' || !argument || !is_number(argument)) return; if(number_percent()> (.2 * get_skill(ch,gsn_rage))) diff --git a/code/prof.c b/code/prof.c index c4728c0..879f6f9 100644 --- a/code/prof.c +++ b/code/prof.c @@ -404,10 +404,10 @@ void CProficiencies::TrainProficiency(char_data* ch, char_data* trainer, char* a END_COLOR(ch)); char *tptr = talloc_string(buffer.c_str()); - RS.Queue.AddToQueue((i + 1) * 2, 2, send_to_char, tptr, ch); + RS.Queue.AddToNewQueue((i + 1) * 2, send_to_char, tptr, ch); } - RS.Queue.AddToQueue((i + 1) * 2, 5, act, prof_msg_table[prof].learning_msgs[i], ch, 0, trainer, TO_CHAR); + RS.Queue.AddToNewQueue((i + 1) * 2, act_queue, prof_msg_table[prof].learning_msgs[i], ch, nullptr, trainer, TO_CHAR); } ch->Profs()->DeductPoints(proficiency.cost); @@ -1024,11 +1024,11 @@ void prof_firestart(CHAR_DATA *ch, char *argument) act("$n begins to build a campfire, gathering sticks and twigs from $s surroundings.", ch, 0, 0, TO_ROOM); ch->move -= ch->level; - RS.Queue.AddToQueue(1, 2, send_to_char, "You rub two sticks together, trying to produce a flame.\n\r", ch); - RS.Queue.AddToQueue(1, 5, act, "$n rubs two sticks together, trying to produce a flame.", ch, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(3, 2, send_to_char, "The sticks begin to smoke, and soon you produce a spark.\n\r", ch); - RS.Queue.AddToQueue(3, 5, act, "The sticks begin to smoke, and soon $n produces a spark.", ch, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(5, 2, build_fire, ch, dur); + RS.Queue.AddToNewQueue(1, send_to_char, "You rub two sticks together, trying to produce a flame.\n\r", ch); + RS.Queue.AddToNewQueue(1, act_queue, "$n rubs two sticks together, trying to produce a flame.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(3, send_to_char, "The sticks begin to smoke, and soon you produce a spark.\n\r", ch); + RS.Queue.AddToNewQueue(3, act_queue, "The sticks begin to smoke, and soon $n produces a spark.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToNewQueue(5, build_fire, ch, dur); WAIT_STATE(ch, PULSE_VIOLENCE * 2); } diff --git a/code/quest.c b/code/quest.c index 32f0038..e9aeeec 100644 --- a/code/quest.c +++ b/code/quest.c @@ -466,15 +466,15 @@ void speech_prog_ilopheth_shack(ROOM_INDEX_DATA *room, CHAR_DATA *ch, char *spee do_look(ch, "auto"); do_say(mob, "So he told you my name, did he? You're here to learn, eh? They always are. Always coming, "\ "wanting what's mine. Wanting, taking, with their grubby minds and dull hands, yes."); - RS.Queue.AddToQueue(5, 2, do_say, mob, (char *)"Well you can't have it!"); - RS.Queue.AddToQueue(8, 2, do_emote, mob, (char *)"pauses for a moment and strokes his long, ragged beard."); - RS.Queue.AddToQueue(10, 2, do_say, mob, (char *)"Unless.... Yes, yes... you can help me! Ah, my turn to grub!"); - RS.Queue.AddToQueue(13, 2, do_say, mob, - (char *)"Can't go out there, or they'd tear me to pieces, yes! Crack my skull open "\ - "and snatch my brains and all their knowledge! But I need something...."); - RS.Queue.AddToQueue(15, 2, do_say, mob, (char *)"Moss! Not just any moss. Special moss. White moss. Glows, it does."); - RS.Queue.AddToQueue(17, 2, do_say, mob, (char *)"So, you'll get it for me, yes?"); - RS.Queue.AddToQueue(18, 2, do_emote, mob, (char *)"peers at you expectantly."); + RS.Queue.AddToNewQueue(5, do_say_queue, mob, "Well you can't have it!"); + RS.Queue.AddToNewQueue(8, do_emote, mob, (char *)"pauses for a moment and strokes his long, ragged beard."); + RS.Queue.AddToNewQueue(10, do_say_queue, mob, "Unless.... Yes, yes... you can help me! Ah, my turn to grub!"); + RS.Queue.AddToNewQueue(13, do_say_queue, mob, + "Can't go out there, or they'd tear me to pieces, yes! Crack my skull open "\ + "and snatch my brains and all their knowledge! But I need something...."); + RS.Queue.AddToNewQueue(15, do_say_queue, mob, "Moss! Not just any moss. Special moss. White moss. Glows, it does."); + RS.Queue.AddToNewQueue(17, do_say_queue, mob, "So, you'll get it for me, yes?"); + RS.Queue.AddToNewQueue(18, do_emote, mob, (char *)"peers at you expectantly."); } break; @@ -625,47 +625,47 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) extract_obj(obj); /* moss */ do_emote(mob, "'s eyes beam as he gingerly handles the white moss in his hands."); - RS.Queue.AddToQueue(3, 2, do_say, mob, - (char *)"This is it! You've found it! Oh yes, yes! A fine specimen indeed! Not bad for "\ - "some grubber, no, no, not bad at all!"); - RS.Queue.AddToQueue(7, 2, do_emote, mob, (char *)"pauses in his examination of the moss and peers at you."); - RS.Queue.AddToQueue(10, 2, do_say, mob, - (char *)"Oh yes! You want me to help you. With magic, yes? Knowledge... powerful "\ - "magic, perhaps you can handle it. Perhaps... perhaps not! Perhaps your head "\ - "will crack like a delicate little egg, hee hee!"); - RS.Queue.AddToQueue(15, 2, do_emote, mob, + RS.Queue.AddToNewQueue(3, do_say_queue, mob, + "This is it! You've found it! Oh yes, yes! A fine specimen indeed! Not bad for "\ + "some grubber, no, no, not bad at all!"); + RS.Queue.AddToNewQueue(7, do_emote, mob, (char *)"pauses in his examination of the moss and peers at you."); + RS.Queue.AddToNewQueue(10, do_say_queue, mob, + "Oh yes! You want me to help you. With magic, yes? Knowledge... powerful "\ + "magic, perhaps you can handle it. Perhaps... perhaps not! Perhaps your head "\ + "will crack like a delicate little egg, hee hee!"); + RS.Queue.AddToNewQueue(15, do_emote, mob, (char *)"goes over to a towering stack of books and scraps in a far corner of the shack, "\ "and begins to rummage."); - RS.Queue.AddToQueue(18, 2, do_say, mob, - (char *)"Mysteries... no... not this one. Arcane... no. Curses of Ba... hrm, hee hee, "\ - "no not that one either. Ah, here we go! Secrets of the Talismanic Powers."); - RS.Queue.AddToQueue(23, 2, do_emote, mob, (char *)"slowly straightens and totters toward you, cradling the tome in his hands."); - RS.Queue.AddToQueue(27, 2, do_say, mob, - (char *)"Here it is... right on page... what the... grubbers! The page.. it's stolen! "\ - "Gone! Vanished into thin air! You stole it! I'll kill you!"); - RS.Queue.AddToQueue(31, 2, do_say, mob, (char *)"Oh, wait. No, you didn't. Yes, yes, I know. Those grubbers must've got it!"); - RS.Queue.AddToQueue(34, 2, do_emote, mob, (char *)"waves his arms around wildly. VERY wildly. He must be seriously perturbed."); - RS.Queue.AddToQueue(37, 2, do_say, mob, - (char *)"Grubbers! Well, a secret I'll tell you. Yes, a secret! I didn't always used "\ - "to live here! No no!"); - RS.Queue.AddToQueue(42, 2, do_say, mob, - (char *)"I lived deep in a forest bit east of that big city. Silmur or something. That "\ - "city. Anyway... nice trees. Very nice. Very quiet, too."); - RS.Queue.AddToQueue(48, 2, do_say, mob, - (char *)"Well, except for the bandits. Bastardly grubbers, I tell you. Woke up one "\ - "morning, and they were in my shack, goin' right through my things! Trying to get "\ - "my secrets! Oh yes, the precious secrets, hee hee!"); - RS.Queue.AddToQueue(53, 2, do_say, mob, - (char *)"So I moved. Here. To this wretched place. But my secrets are safe here! Oh "\ - "yes, yes, hee hee! Safe until you came in here, you grubber! And stole 'em!"); - RS.Queue.AddToQueue(58, 2, do_say, mob, - (char *)"Oh, wait. No, you didn't. I said I'd give it to you. But yes yes, you need to find that page! "\ - "Bring it back here, and I'll give you what you want, you grubber!"); - RS.Queue.AddToQueue(70, 2, do_say, mob, (char *)"Are you still here? Go on, and find that page! Now out you go, hee hee!"); - RS.Queue.AddToQueue(71, 2, do_look, ch, (char *)"auto"); - RS.Queue.AddToQueue(71, 2, char_to_room, ch, outside); - RS.Queue.AddToQueue(71, 1, char_from_room, ch); - RS.Queue.AddToQueue(71, 2, do_emote, mob, (char *)"hustles you rapidly out of his shack."); + RS.Queue.AddToNewQueue(18, do_say_queue, mob, + "Mysteries... no... not this one. Arcane... no. Curses of Ba... hrm, hee hee, "\ + "no not that one either. Ah, here we go! Secrets of the Talismanic Powers."); + RS.Queue.AddToNewQueue(23, do_emote, mob, (char *)"slowly straightens and totters toward you, cradling the tome in his hands."); + RS.Queue.AddToNewQueue(27, do_say_queue, mob, + "Here it is... right on page... what the... grubbers! The page.. it's stolen! "\ + "Gone! Vanished into thin air! You stole it! I'll kill you!"); + RS.Queue.AddToNewQueue(31, do_say_queue, mob, "Oh, wait. No, you didn't. Yes, yes, I know. Those grubbers must've got it!"); + RS.Queue.AddToNewQueue(34, do_emote, mob, (char *)"waves his arms around wildly. VERY wildly. He must be seriously perturbed."); + RS.Queue.AddToNewQueue(37, do_say_queue, mob, + "Grubbers! Well, a secret I'll tell you. Yes, a secret! I didn't always used "\ + "to live here! No no!"); + RS.Queue.AddToNewQueue(42, do_say_queue, mob, + "I lived deep in a forest bit east of that big city. Silmur or something. That "\ + "city. Anyway... nice trees. Very nice. Very quiet, too."); + RS.Queue.AddToNewQueue(48, do_say_queue, mob, + "Well, except for the bandits. Bastardly grubbers, I tell you. Woke up one "\ + "morning, and they were in my shack, goin' right through my things! Trying to get "\ + "my secrets! Oh yes, the precious secrets, hee hee!"); + RS.Queue.AddToNewQueue(53, do_say_queue, mob, + "So I moved. Here. To this wretched place. But my secrets are safe here! Oh "\ + "yes, yes, hee hee! Safe until you came in here, you grubber! And stole 'em!"); + RS.Queue.AddToNewQueue(58, do_say_queue, mob, + "Oh, wait. No, you didn't. I said I'd give it to you. But yes yes, you need to find that page! "\ + "Bring it back here, and I'll give you what you want, you grubber!"); + RS.Queue.AddToNewQueue(70, do_say_queue, mob, "Are you still here? Go on, and find that page! Now out you go, hee hee!"); + RS.Queue.AddToNewQueue(71, do_look_queue, ch, "auto"); + RS.Queue.AddToNewQueue(71, char_to_room, ch, outside); + RS.Queue.AddToNewQueue(71, char_from_room, ch); + RS.Queue.AddToNewQueue(71, do_emote, mob, (char *)"hustles you rapidly out of his shack."); ch->pcdata->quests[TALISMANIC_QUEST] = 4; return; @@ -675,33 +675,33 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) { /* page */ do_emote(mob, "scrunches his haggard face up at he peers intently at the page."); - RS.Queue.AddToQueue(3, 2, do_say, mob, - (char *)"This is the missing page! So you're the one who stole it! You dirty grubber, "\ - "you'll pay for this!"); - RS.Queue.AddToQueue(8, 2, do_say, mob, - (char *)"Oh, wait. No you didn't. Now I can show you what I've been meaning to all this "\ - "time, hee hee. I think you'll like it, oh yes you will."); - RS.Queue.AddToQueue(13, 2, do_emote, mob, (char *)"inserts the page into the book, confirming the perfect fit with a glance."); - RS.Queue.AddToQueue(16, 2, do_emote, mob, (char *)"totters over to your side and begins to murmur softly."); - RS.Queue.AddToQueue(20, 2, do_emote, mob, + RS.Queue.AddToNewQueue(3, do_say_queue, mob, + "This is the missing page! So you're the one who stole it! You dirty grubber, "\ + "you'll pay for this!"); + RS.Queue.AddToNewQueue(8, do_say_queue, mob, + "Oh, wait. No you didn't. Now I can show you what I've been meaning to all this "\ + "time, hee hee. I think you'll like it, oh yes you will."); + RS.Queue.AddToNewQueue(13, do_emote, mob, (char *)"inserts the page into the book, confirming the perfect fit with a glance."); + RS.Queue.AddToNewQueue(16, do_emote, mob, (char *)"totters over to your side and begins to murmur softly."); + RS.Queue.AddToNewQueue(20, do_emote, mob, (char *)"speaks with remarkable lucidity for one so seemingly deranged, guiding you "\ "through an explanation of the arcane tome."); - RS.Queue.AddToQueue(25, 2, send_to_char, + RS.Queue.AddToNewQueue(25, send_to_char, (char *)"You suddenly have a flash of insight, and understand precisely what Pelamon is "\ "attempting to teach. Amazing... a protective spell of remarkable power!\n\r", ch); - RS.Queue.AddToQueue(36, 1, talismanic_reward, ch); - RS.Queue.AddToQueue(30, 2, do_say, mob, - (char *)"Ah, I see you've got it, yes yes! And no cracks in your head, hee hee! Maybe "\ - "you're not such a grubber after all."); - RS.Queue.AddToQueue(34, 2, do_say, mob, - (char *)"Well, you've taken enough of my time. You'll have to be on your way now... I'm "\ - "expecting company, hee hee!"); - RS.Queue.AddToQueue(37, 2, do_emote, mob, (char *)"winks mischievously."); - RS.Queue.AddToQueue(40, 2, do_look, ch, (char *)"auto"); - RS.Queue.AddToQueue(40, 2, char_to_room, ch, outside); - RS.Queue.AddToQueue(40, 1, char_from_room, ch); - RS.Queue.AddToQueue(40, 2, do_emote, mob, (char *)"hustles you rapidly out of his shack."); - RS.Queue.AddToQueue(41, 1, talismanic_reward, ch); + RS.Queue.AddToNewQueue(36, talismanic_reward, ch); + RS.Queue.AddToNewQueue(30, do_say_queue, mob, + "Ah, I see you've got it, yes yes! And no cracks in your head, hee hee! Maybe "\ + "you're not such a grubber after all."); + RS.Queue.AddToNewQueue(34, do_say_queue, mob, + "Well, you've taken enough of my time. You'll have to be on your way now... I'm "\ + "expecting company, hee hee!"); + RS.Queue.AddToNewQueue(37, do_emote, mob, (char *)"winks mischievously."); + RS.Queue.AddToNewQueue(40, do_look_queue, ch, "auto"); + RS.Queue.AddToNewQueue(40, char_to_room, ch, outside); + RS.Queue.AddToNewQueue(40, char_from_room, ch); + RS.Queue.AddToNewQueue(40, do_emote, mob, (char *)"hustles you rapidly out of his shack."); + RS.Queue.AddToNewQueue(41, talismanic_reward, ch); } if (found) @@ -917,13 +917,13 @@ void give_prog_drow_scribe(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) do_emote(mob, "returns to his work."); - RS.Queue.AddToQueue(2, 2, do_say, mob, (char *)"Well, while you're here..."); - RS.Queue.AddToQueue(4, 2, do_say, mob, - (char *)"I have a scroll made up for a master mage on the fourth floor... Deliver it to "\ - "him, and he'll surely tip you."); - RS.Queue.AddToQueue(6, 2, do_say, mob, - (char *)"I offer this to you only because you didn't seem very pleased with the tip that I gave you."); - RS.Queue.AddToQueue(8, 2, do_say, mob, (char *)"Do you accept?"); + RS.Queue.AddToNewQueue(2, do_say_queue, mob, "Well, while you're here..."); + RS.Queue.AddToNewQueue(4, do_say_queue, mob, + "I have a scroll made up for a master mage on the fourth floor... Deliver it to "\ + "him, and he'll surely tip you."); + RS.Queue.AddToNewQueue(6, do_say_queue, mob, + "I offer this to you only because you didn't seem very pleased with the tip that I gave you."); + RS.Queue.AddToNewQueue(8, do_say_queue, mob, "Do you accept?"); ch->pcdata->quests[SCRIBE_QUEST] = 4; } @@ -1121,7 +1121,7 @@ BEGIN_SPEC(mspec_academy_smith) mprog_say(2, "Good! I'm in short bloody supply of materials to work with these days.", mob, ch); mprog_say(4, "If yer can find me some, I'll keep half for myself and use the other half to strengthen yer weapon.", mob, ch); mprog_say(6, "I need four raw metals. Iandia said there might be some secreted in the Outlying Wilds and thereabouts.", mob, ch); - RS.Queue.AddToQueue(8, 5, act, "$N returns to his forge, turning his back to you.", ch, 0, mob, TO_CHAR); + RS.Queue.AddToNewQueue(8, act_queue, "$N returns to his forge, turning his back to you.", ch, nullptr, mob, TO_CHAR); SET_STAGE(ch, 2); END_EVENT @@ -1180,10 +1180,9 @@ BEGIN_SPEC(mspec_academy_smith) char buf[MSL], *tptr; sprintf(buf, "%s", obj->short_descr); tptr = talloc_string(buf); - RS.Queue.AddToQueue(1, 5, act, "Accepting $t, $N turns to the forge, preparing his tools.", ch, tptr, mob, TO_CHAR); - RS.Queue.AddToQueue(3, 5, act, "$N begins to reshape $t, the hammering ringing loud in your ears.", ch, tptr, mob, - TO_CHAR); - RS.Queue.AddToQueue(7, 5, act, "Hefting it with a flourish, $N turns to you.", ch, obj, mob, TO_CHAR); + RS.Queue.AddToNewQueue(1, act, "Accepting $t, $N turns to the forge, preparing his tools.", ch, tptr, mob, TO_CHAR); + RS.Queue.AddToNewQueue(3, act, "$N begins to reshape $t, the hammering ringing loud in your ears.", ch, tptr, mob, TO_CHAR); + RS.Queue.AddToNewQueue(7, act, "Hefting it with a flourish, $N turns to you.", ch, obj, mob, TO_CHAR); if (improved == 0) mprog_say(8, "Har! This piece o' duergar dung might actually be worth using now.", mob, ch); else @@ -1201,8 +1200,8 @@ BEGIN_SPEC(mspec_academy_smith) if (get_quest_val(ch, SMITH_QUEST_COMP_ACQUIRED) >= 15) // all done { SET_STAGE(ch, 4); - RS.Queue.AddToQueue(10, 2, gain_exp, ch, 3000); - RS.Queue.AddToQueue(10, 2, send_to_char, + RS.Queue.AddToNewQueue(10, gain_exp, ch, 3000); + RS.Queue.AddToNewQueue(10, send_to_char, "Handling your newly completed weapon, you feel ready to take on the world!\n\r", ch); mprog_say(10, "That's about all I can do with the thing. Good luck, ye flamin' elfhugger.", mob, ch); delete_quest_val(ch, SMITH_QUEST_COMP_ACQUIRED); diff --git a/code/queue.c b/code/queue.c index bf905ff..69f93d1 100644 --- a/code/queue.c +++ b/code/queue.c @@ -1,127 +1,127 @@ -#include "queue.h" -#define NOP asm volatile("nop"); +// #include "queue.h" +// #define NOP asm volatile("nop"); -CQueue *CQueue::queue_first = 0; /*null*/ +// CQueue *CQueue::queue_first = 0; /*null*/ -CQueue::CQueue() -{ -} +// CQueue::CQueue() +// { +// } -CQueue::~CQueue() -{ -} -void CQueue::ProcessQueue() -{ - int i; - void *j; - CQueue *qf, *qf_next; - for(qf = queue_first; qf; qf = qf_next) - { - qf_next = qf->queue_next; - if(qf->queue_delay < 0) /* weird bug i don't want to find, probably a fucked up addtoq somewhere in the code */ - { - qf->FreeQueue(); - continue; - } - if(--qf->queue_delay == 0) - { - switch(qf->queue_numargs) - { - case 0: - (*qf->queue_function)(); - break; - case 1: - (*qf->queue_function)(qf->queue_args[0]); - break; - case 2: - (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1]); - break; - case 3: - (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2]); - break; - case 4: - (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3]); - break; - case 5: - (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4]); - break; - case 6: - (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5]); - break; - case 7: - (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5],qf->queue_args[6]); - break; - case 8: - (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5],qf->queue_args[6],qf->queue_args[7]); - break; - } +// CQueue::~CQueue() +// { +// } +// void CQueue::ProcessQueue() +// { +// int i; +// void *j; +// CQueue *qf, *qf_next; +// for(qf = queue_first; qf; qf = qf_next) +// { +// qf_next = qf->queue_next; +// if(qf->queue_delay < 0) /* weird bug i don't want to find, probably a fucked up addtoq somewhere in the code */ +// { +// qf->FreeQueue(); +// continue; +// } +// if(--qf->queue_delay == 0) +// { +// switch(qf->queue_numargs) +// { +// case 0: +// (*qf->queue_function)(); +// break; +// case 1: +// (*qf->queue_function)(qf->queue_args[0]); +// break; +// case 2: +// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1]); +// break; +// case 3: +// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2]); +// break; +// case 4: +// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3]); +// break; +// case 5: +// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4]); +// break; +// case 6: +// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5]); +// break; +// case 7: +// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5],qf->queue_args[6]); +// break; +// case 8: +// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5],qf->queue_args[6],qf->queue_args[7]); +// break; +// } - qf->FreeQueue(); - } - } -} -void CQueue::AddToQueue(int nTimer, int nArgs, ...) -{ - va_list ap; - int i; - void *hax[MAX_QUEUE_ARGS]; +// qf->FreeQueue(); +// } +// } +// } +// void CQueue::AddToQueue(int nTimer, int nArgs, ...) +// { +// va_list ap; +// int i; +// void *hax[MAX_QUEUE_ARGS]; - if(nTimer < 0) - Logger.Warn("Negative Queue Timer - NumArgs: {}", nArgs); - CQueue *nq = new CQueue; - nq->queue_delay = nTimer; - nq->queue_numargs = nArgs; - nq->queue_next = queue_first; - queue_first = nq; - va_start(ap, nArgs); - nq->queue_function = (QUEUE_FUNCTION)va_arg(ap, void *); - for(i = 0; i < MAX_QUEUE_ARGS; i++) - nq->queue_args[i] = va_arg(ap, void *); - va_end(ap); -} +// if(nTimer < 0) +// Logger.Warn("Negative Queue Timer - NumArgs: {}", nArgs); +// CQueue *nq = new CQueue; +// nq->queue_delay = nTimer; +// nq->queue_numargs = nArgs; +// nq->queue_next = queue_first; +// queue_first = nq; +// va_start(ap, nArgs); +// nq->queue_function = (QUEUE_FUNCTION)va_arg(ap, void *); +// for(i = 0; i < MAX_QUEUE_ARGS; i++) +// nq->queue_args[i] = va_arg(ap, void *); +// va_end(ap); +// } -void CQueue::FreeQueue(void) -{ - if(this == queue_first) - { - queue_first = this->queue_next; - delete this; - return; - } - CQueue *r; - for(r = queue_first; r && r->queue_next != this; r = r->queue_next) - ; - if(!r) - throw("FreeQueue(): Invalid linked list"); - r->queue_next = this->queue_next; - delete this; -} +// void CQueue::FreeQueue(void) +// { +// if(this == queue_first) +// { +// queue_first = this->queue_next; +// delete this; +// return; +// } +// CQueue *r; +// for(r = queue_first; r && r->queue_next != this; r = r->queue_next) +// ; +// if(!r) +// throw("FreeQueue(): Invalid linked list"); +// r->queue_next = this->queue_next; +// delete this; +// } -bool CQueue::HasQueuePending(void *qChar) -{ - CQueue *r; - for(r = queue_first; r; r = r->queue_next) - for(int i = 0; i < r->queue_numargs; i++) - if(r->queue_args[i] == qChar && r->queue_delay > 0) - return true; - return false; -} +// bool CQueue::HasQueuePending(void *qChar) +// { +// CQueue *r; +// for(r = queue_first; r; r = r->queue_next) +// for(int i = 0; i < r->queue_numargs; i++) +// if(r->queue_args[i] == qChar && r->queue_delay > 0) +// return true; +// return false; +// } -void CQueue::DeleteQueuedEventsInvolving(void *qChar) -{ - CQueue *r, *r_next = 0;//null - int deleted = 0; - for(r = queue_first; r != 0 /*null*/; r = r_next) - { - r_next = r->queue_next; - for(int i = 0; i < r->queue_numargs; i++) - if(r->queue_args[i] == qChar && r->queue_delay > 0) - { - r->FreeQueue(); - deleted++; - break; - } - } +// void CQueue::DeleteQueuedEventsInvolving(void *qChar) +// { +// CQueue *r, *r_next = 0;//null +// int deleted = 0; +// for(r = queue_first; r != 0 /*null*/; r = r_next) +// { +// r_next = r->queue_next; +// for(int i = 0; i < r->queue_numargs; i++) +// if(r->queue_args[i] == qChar && r->queue_delay > 0) +// { +// r->FreeQueue(); +// deleted++; +// break; +// } +// } - Logger.Warn("{} events deleted.", deleted); -} +// Logger.Warn("{} events deleted.", deleted); +// } diff --git a/code/queue.h b/code/queue.h index 7e6a52a..b657577 100644 --- a/code/queue.h +++ b/code/queue.h @@ -9,22 +9,15 @@ * this is all in assembly and fucking around in queue.h or .c will break it * then I WILL BREAK YOU */ -#define MAX_QUEUE_ARGS 8 -typedef void (*QUEUE_FUNCTION)(...); +// forward declarations. Once char_data is separated to its own file, we can get rid of these and include the file. +// but since these are defined in merc.h, this will have to do. We can't include merc.h because that causes a circular +// dependency. class char_data; typedef struct char_data CHAR_DATA; class CQueue { public: - CQueue(); - ~CQueue(); - - static void ProcessQueue(void); - static void AddToQueue(int nTimer, int nArgs, ...); - static bool HasQueuePending(void *qChar); - static void DeleteQueuedEventsInvolving(void *qChar); - /// Adds a function pointer to the queue with related arguments. The function will be executed at the specified time (in ticks). /// @tparam Func: Template type of the function to call. /// @tparam ...Args: Template parameter pack used to specify the variadic arguments. @@ -109,15 +102,7 @@ class CQueue Logger.Warn("{} events deleted.", deleted); } private: - void FreeQueue(); - inline static CLogger Logger = CLogger(); - static CQueue * queue_first; - CQueue * queue_next; - QUEUE_FUNCTION queue_function; - int queue_delay; /* seconds _remaining_ */ - void * queue_args[MAX_QUEUE_ARGS]; /* Queue function args */ - int queue_numargs; std::vector, std::function>> newQueue; /// Helper function used to extract character data from the specfied tuple. @@ -134,10 +119,11 @@ class CQueue { auto processTuple = [&](const auto& x) { + // decay x to get the actual argument type to compare to our character data type if constexpr (std::is_same::type,CHAR_DATA*>::value) accumulator.push_back(x); }; - (processTuple(tupleArgs), ...); + (processTuple(tupleArgs), ...); // fold expression - calls processTuple for each argument in tupleArgs }, t); return accumulator; diff --git a/code/update.c b/code/update.c index 8acb3d2..3bdc741 100644 --- a/code/update.c +++ b/code/update.c @@ -2179,7 +2179,7 @@ void update_handler(void) else iprog_pulse_update(false); - RS.Queue.ProcessQueue(); + RS.Queue.ProcessNewQueue(); // execute_queue(); //execute queue every second. } From e7c2449c06ae3f7fc881905120ff5c69a015669e Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Sun, 8 Sep 2024 00:19:14 +0000 Subject: [PATCH 04/10] Renamed new methods back to the old names --- code/CMakeLists.txt | 1 - code/act_comm.c | 6 +- code/act_move.c | 8 +- code/act_obj.c | 4 +- code/act_wiz.c | 2 +- code/aprog.c | 8 +- code/characterClasses/ap.c | 160 +++++++++++++------------- code/characterClasses/chrono.c | 2 +- code/characterClasses/druid.c | 16 +-- code/characterClasses/necro.c | 34 +++--- code/characterClasses/sorcerer.c | 12 +- code/characterClasses/warrior.c | 6 +- code/comm.c | 2 +- code/handler.c | 4 +- code/iprog.c | 112 +++++++++--------- code/magic.c | 4 +- code/mprog.c | 192 +++++++++++++++---------------- code/mspec.c | 34 +++--- code/newmem.c | 2 +- code/prof.c | 14 +-- code/quest.c | 102 ++++++++-------- code/queue.c | 127 -------------------- code/queue.h | 8 +- code/update.c | 2 +- tests/queue_tests.c | 14 +-- 25 files changed, 374 insertions(+), 502 deletions(-) delete mode 100644 code/queue.c diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 50e5224..6736ed2 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -34,7 +34,6 @@ set(RIFT_SOURCE config.cpp skills.c tables.c update.c - queue.c tattoo.c dioextra.c cabal.c diff --git a/code/act_comm.c b/code/act_comm.c index 5541554..6ea4788 100644 --- a/code/act_comm.c +++ b/code/act_comm.c @@ -1777,7 +1777,7 @@ void do_quit_new(CHAR_DATA *ch, char *argument, bool autoq) } } - if (RS.Queue.HasNewQueuePending(ch)) + if (RS.Queue.HasQueuePending(ch)) { if (autoq) RS.Logger.Warn("Trying to autoquit char {} with pending queue.", ch->name); @@ -2597,8 +2597,8 @@ void speech_handler(CHAR_DATA *ch, CHAR_DATA *mob, SPEECH_DATA *speech) return; } - //RS.Queue.AddToNewQueue(speech->current_line->delay, 3, speech_handler, ch, mob, speech); - RS.Queue.AddToNewQueue(speech->current_line->delay, speech_handler, ch, mob, speech); + //RS.Queue.AddToQueue(speech->current_line->delay, 3, speech_handler, ch, mob, speech); + RS.Queue.AddToQueue(speech->current_line->delay, speech_handler, ch, mob, speech); } /* diff --git a/code/act_move.c b/code/act_move.c index 1906c04..d673775 100644 --- a/code/act_move.c +++ b/code/act_move.c @@ -1002,7 +1002,7 @@ void move_char(CHAR_DATA *ch, int door, bool automatic, bool fcharm) if (td != nullptr && td->trap && td->trap->armed && ch->Profs()->ProfEffect("trap detecting") >= td->trap->quality) { - RS.Queue.AddToNewQueue(1, send_to_char, "Something about your surroundings suddenly makes you feel wary.\n\r", ch); + RS.Queue.AddToQueue(1, send_to_char, "Something about your surroundings suddenly makes you feel wary.\n\r", ch); break; } } @@ -1048,7 +1048,7 @@ void move_char(CHAR_DATA *ch, int door, bool automatic, bool fcharm) } else if (is_npc(fch) && fch->last_fought == ch) { - RS.Queue.AddToNewQueue((number_percent() > 25) ? 1 : 2, track_attack, fch, ch); + RS.Queue.AddToQueue((number_percent() > 25) ? 1 : 2, track_attack, fch, ch); } /* Greet trigger for mobs */ @@ -1215,7 +1215,7 @@ void trip_trap(CHAR_DATA *ch, ROOM_INDEX_DATA *room, TRAP_DATA *trap) if (ch->Profs()->GetProf("trap detecting") / 2 >= trap->quality) { ch->Profs()->CheckImprove("trap detecting", 400); - RS.Queue.AddToNewQueue(1, send_to_char, "As you carefully advance, you spot a trap and quickly sidestep it!\n\r", ch); + RS.Queue.AddToQueue(1, send_to_char, "As you carefully advance, you spot a trap and quickly sidestep it!\n\r", ch); return; } else @@ -1229,7 +1229,7 @@ void trip_trap(CHAR_DATA *ch, ROOM_INDEX_DATA *room, TRAP_DATA *trap) if (trap->timer) { act(trap->trig_echo, ch, 0, 0, TO_CHAR); - RS.Queue.AddToNewQueue(trap->timer, trap_execute, nullptr, room, trap); + RS.Queue.AddToQueue(trap->timer, trap_execute, nullptr, room, trap); } else { diff --git a/code/act_obj.c b/code/act_obj.c index 42da4e4..1001125 100644 --- a/code/act_obj.c +++ b/code/act_obj.c @@ -2905,7 +2905,7 @@ void do_quaff(CHAR_DATA *ch, char *argument) if (!check_deny_magic(ch)) { - RS.Queue.AddToNewQueue(nDelay, + RS.Queue.AddToQueue(nDelay, quaff_potion, ch, obj->value[0], @@ -2948,7 +2948,7 @@ void do_quaff(CHAR_DATA *ch, char *argument) if (!check_deny_magic(ch)) { - RS.Queue.AddToNewQueue(nDelay, + RS.Queue.AddToQueue(nDelay, quaff_potion, ch, obj->value[0], diff --git a/code/act_wiz.c b/code/act_wiz.c index dbc325e..62d5073 100644 --- a/code/act_wiz.c +++ b/code/act_wiz.c @@ -3454,7 +3454,7 @@ void start_reboot(CHAR_DATA *ch) do_echo(ch, buf); reboot_num--; - RS.Queue.AddToNewQueue(60, start_reboot, ch); + RS.Queue.AddToQueue(60, start_reboot, ch); } } } diff --git a/code/aprog.c b/code/aprog.c index d765dc5..ba88f9f 100644 --- a/code/aprog.c +++ b/code/aprog.c @@ -282,8 +282,8 @@ void tick_prog_ilopheth(AREA_DATA *area) END_COLOR(pedroom->people)); act(buf, pedroom->people, 0, 0, TO_ALL); - RS.Queue.AddToNewQueue(4, act_queue, "The opacity of the crystal sphere appears to fade, and it begins to glow a brilliant white!", pedroom->people, nullptr, nullptr, TO_ALL); - RS.Queue.AddToNewQueue(7, act_queue, "To the northwest, an immense pillar of light ascends from the forest into the heavens!", pedroom->people, nullptr, nullptr, TO_ALL); + RS.Queue.AddToQueue(4, act_queue, "The opacity of the crystal sphere appears to fade, and it begins to glow a brilliant white!", pedroom->people, nullptr, nullptr, TO_ALL); + RS.Queue.AddToQueue(7, act_queue, "To the northwest, an immense pillar of light ascends from the forest into the heavens!", pedroom->people, nullptr, nullptr, TO_ALL); } for (obj = portroom->contents; obj; obj = obj->next_content) @@ -416,10 +416,10 @@ void sun_prog_ilopheth(AREA_DATA *area) switch (sun) { case SolarPosition::Sunrise: - RS.Queue.AddToNewQueue(15, zone_echo, area, (char *)"With the beginning of the day sounds of life fill the valley, as the forest comes alive."); + RS.Queue.AddToQueue(15, zone_echo, area, (char *)"With the beginning of the day sounds of life fill the valley, as the forest comes alive."); break; case SolarPosition::Sunset: - RS.Queue.AddToNewQueue(15, zone_echo, area, (char *)"The forest grows still, as the night sky settles over the valley."); + RS.Queue.AddToQueue(15, zone_echo, area, (char *)"The forest grows still, as the night sky settles over the valley."); break; } } diff --git a/code/characterClasses/ap.c b/code/characterClasses/ap.c index 1f83d4e..a50f382 100644 --- a/code/characterClasses/ap.c +++ b/code/characterClasses/ap.c @@ -713,7 +713,7 @@ void command_execute(CHAR_DATA *ch) sprintf(buf, "An irresistible urge forces you to '%s'.\n\r", ch->pcdata->command[1]); send_to_char(buf, ch); - RS.Queue.AddToNewQueue(1, command_execute_delay, ch, ch->pcdata->command[1]); + RS.Queue.AddToQueue(1, command_execute_delay, ch, ch->pcdata->command[1]); WAIT_STATE(ch, PULSE_PER_SECOND + 1); @@ -1283,7 +1283,7 @@ void check_unholy_communion(CHAR_DATA *ch, char *argument) act("As the name of the $t demon escapes your lips, the shadows writhe violently.", ch, (type == LESSER_DEMON) ? "lesser" : "greater", 0, TO_CHAR); - RS.Queue.AddToNewQueue(2, act_queue, "A sonorous throbbing fills your surroundings, and then all is deathly silent.", ch, nullptr, nullptr, TO_ALL); + RS.Queue.AddToQueue(2, act_queue, "A sonorous throbbing fills your surroundings, and then all is deathly silent.", ch, nullptr, nullptr, TO_ALL); affect_remove(ch, af); @@ -1293,7 +1293,7 @@ void check_unholy_communion(CHAR_DATA *ch, char *argument) *typeptr = type; *demonptr = demon; - RS.Queue.AddToNewQueue(3, demon_appear, ch, demonptr, typeptr); + RS.Queue.AddToQueue(3, demon_appear, ch, demonptr, typeptr); } void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) @@ -1383,58 +1383,58 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) switch (demon) { case LESSER_BARBAS: - RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"roars with anger and beats his meaty fists against his chest!"); - RS.Queue.AddToNewQueue(4, act_queue, "Still growling, $N peers toward you with a sneering rictus of despite.", ch, nullptr, mob, TO_CHAR); - RS.Queue.AddToNewQueue(6, do_say_queue, mob, "Summon me, you fool? Summon ME!?"); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, "I'll bet me reputation an' a slice o' me power that I'm about ta beat you senseless!"); - RS.Queue.AddToNewQueue(10, do_murder, mob, ch->name); - RS.Queue.AddToNewQueue(10, act_queue, "With a feral leap and a scream, $N is suddenly upon you!", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(2, do_emote, mob, (char *)"roars with anger and beats his meaty fists against his chest!"); + RS.Queue.AddToQueue(4, act_queue, "Still growling, $N peers toward you with a sneering rictus of despite.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(6, do_say_queue, mob, "Summon me, you fool? Summon ME!?"); + RS.Queue.AddToQueue(8, do_say_queue, mob, "I'll bet me reputation an' a slice o' me power that I'm about ta beat you senseless!"); + RS.Queue.AddToQueue(10, do_murder, mob, ch->name); + RS.Queue.AddToQueue(10, act_queue, "With a feral leap and a scream, $N is suddenly upon you!", ch, nullptr, mob, TO_CHAR); af.duration = -1; affect_to_char(mob, &af); break; case LESSER_AAMON: WAIT_STATE(ch, 5 * PULSE_VIOLENCE); - RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"twitches violently as he stares around, bewildered."); - RS.Queue.AddToNewQueue(4, do_whisper, mob, (char *)"And where am I now, precisely?"); - RS.Queue.AddToNewQueue(6, act_queue, "Jerking suddenly as if to watch in all directions at once, the demon spins.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, "You've summoned me! And now you will answer my riddle, yes!"); - RS.Queue.AddToNewQueue(10, do_emote, mob, (char *)"clears his throat and glances around pensively."); - RS.Queue.AddToNewQueue(12, do_say_queue, mob, "Most often by hoes and by gardeners I'm chased, "); - RS.Queue.AddToNewQueue(13, do_say_queue, mob, "They cut off my head and then smash it to paste;"); - RS.Queue.AddToNewQueue(14, do_say_queue, mob, "Against them, however, my body is braced, "); - RS.Queue.AddToNewQueue(15, do_say_queue, mob, "For always I'm growing due south of the waist."); - RS.Queue.AddToNewQueue(16, do_say_queue, mob, "Now then... what am I?"); + RS.Queue.AddToQueue(2, do_emote, mob, (char *)"twitches violently as he stares around, bewildered."); + RS.Queue.AddToQueue(4, do_whisper, mob, (char *)"And where am I now, precisely?"); + RS.Queue.AddToQueue(6, act_queue, "Jerking suddenly as if to watch in all directions at once, the demon spins.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, do_say_queue, mob, "You've summoned me! And now you will answer my riddle, yes!"); + RS.Queue.AddToQueue(10, do_emote, mob, (char *)"clears his throat and glances around pensively."); + RS.Queue.AddToQueue(12, do_say_queue, mob, "Most often by hoes and by gardeners I'm chased, "); + RS.Queue.AddToQueue(13, do_say_queue, mob, "They cut off my head and then smash it to paste;"); + RS.Queue.AddToQueue(14, do_say_queue, mob, "Against them, however, my body is braced, "); + RS.Queue.AddToQueue(15, do_say_queue, mob, "For always I'm growing due south of the waist."); + RS.Queue.AddToQueue(16, do_say_queue, mob, "Now then... what am I?"); af.duration = 8; af.modifier = 0; affect_to_char(mob, &af); break; case LESSER_MALAPHAR: - RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"'s eyes light up as he realizes where he is."); - RS.Queue.AddToNewQueue(4, do_say_queue, mob, "My friend! My friend, my patron, my emptor!"); - RS.Queue.AddToNewQueue(6, act_queue, "Malaphar sidles up to you, and with a conspiratorial wink, waves his hand.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToNewQueue(8, do_whisper, mob, (char *)"I have something... something in which you would most undoubtedly be interested."); - RS.Queue.AddToNewQueue(10, do_say_queue, mob, "Sale or trade only, I'm afraid, no credit. And don't waste my time offering me paltry trifles."); + RS.Queue.AddToQueue(2, do_emote, mob, (char *)"'s eyes light up as he realizes where he is."); + RS.Queue.AddToQueue(4, do_say_queue, mob, "My friend! My friend, my patron, my emptor!"); + RS.Queue.AddToQueue(6, act_queue, "Malaphar sidles up to you, and with a conspiratorial wink, waves his hand.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(8, do_whisper, mob, (char *)"I have something... something in which you would most undoubtedly be interested."); + RS.Queue.AddToQueue(10, do_say_queue, mob, "Sale or trade only, I'm afraid, no credit. And don't waste my time offering me paltry trifles."); af.duration = 7; affect_to_char(mob, &af); break; case LESSER_FURCAS: - RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"appears shocked, and he winces away from you automatically."); - RS.Queue.AddToNewQueue(4, act_queue, "Pawing his way around you, viewing you from all angles, Furcas blinks.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToNewQueue(6, do_whisper, mob, (char *)"...can it find us? We think it cannot. We hope it tries its hardest."); - RS.Queue.AddToNewQueue(8, act_queue, "Suddenly, you blink and Furcas has vanished, leaving a cold sniff in the air!", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(9, furcas_vanish, ch, mob); + RS.Queue.AddToQueue(2, do_emote, mob, (char *)"appears shocked, and he winces away from you automatically."); + RS.Queue.AddToQueue(4, act_queue, "Pawing his way around you, viewing you from all angles, Furcas blinks.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(6, do_whisper, mob, (char *)"...can it find us? We think it cannot. We hope it tries its hardest."); + RS.Queue.AddToQueue(8, act_queue, "Suddenly, you blink and Furcas has vanished, leaving a cold sniff in the air!", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(9, furcas_vanish, ch, mob); af.duration = 24; affect_to_char(mob, &af); break; case LESSER_IPOS: - RS.Queue.AddToNewQueue(2, act_queue, "$n, still steaming, looks around him with a small smile on his face.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(4, act_queue, "His gaze settles upon you, and his smile broadens to a genuine grin.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToNewQueue(6, do_say_queue, mob, "Greetings my rageful, irascible friend! The time for your fury has come to an end."); - RS.Queue.AddToNewQueue(7, do_say_queue, mob, "For a moment at least, for you see, I am weary of warriors bleak and dark paladins dreary."); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, "Instead, it's my wish as I put pen to paper, that you'll indulge me with a frolicsome caper."); - RS.Queue.AddToNewQueue(9, do_say_queue, mob, "Be mindful, my ears are accustomed to rhymes; I hope you are willing to speak me four lines...."); - RS.Queue.AddToNewQueue(10, do_emote, mob, (char *)"thrusts forward, anticipating your poem with an evil gleam in his eye."); + RS.Queue.AddToQueue(2, act_queue, "$n, still steaming, looks around him with a small smile on his face.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(4, act_queue, "His gaze settles upon you, and his smile broadens to a genuine grin.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(6, do_say_queue, mob, "Greetings my rageful, irascible friend! The time for your fury has come to an end."); + RS.Queue.AddToQueue(7, do_say_queue, mob, "For a moment at least, for you see, I am weary of warriors bleak and dark paladins dreary."); + RS.Queue.AddToQueue(8, do_say_queue, mob, "Instead, it's my wish as I put pen to paper, that you'll indulge me with a frolicsome caper."); + RS.Queue.AddToQueue(9, do_say_queue, mob, "Be mindful, my ears are accustomed to rhymes; I hope you are willing to speak me four lines...."); + RS.Queue.AddToQueue(10, do_emote, mob, (char *)"thrusts forward, anticipating your poem with an evil gleam in his eye."); af.modifier = 0; af.duration = 8; affect_to_char(mob, &af); @@ -1457,63 +1457,63 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) switch (demon) { case GREATER_OZE: - RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"nearly collapses as he doubles over in sudden agony, howling pitifully."); - RS.Queue.AddToNewQueue(3, do_say_queue, mob, "What have you done...? What have you DONE?"); - RS.Queue.AddToNewQueue(4, act_queue, "Blubbering like a child, $n slowly composes $mself and rises to $s \"feet.\"", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(6, act_queue, "$e points a hideously deformed arm toward you, dripping blood and bits of sinew.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, "I charge you, mortal, with returning me to the abyss. I have been plucked from a place... a place from whence I should not have been plucked."); - RS.Queue.AddToNewQueue(10, do_emote, mob, (char *)"shudders slightly before continuing."); - RS.Queue.AddToNewQueue(11, do_say_queue, mob, "I require your blood, meddler, in order that I might survive long enough to return.... Speak the words, whelp. Yes or no?"); + RS.Queue.AddToQueue(2, do_emote, mob, (char *)"nearly collapses as he doubles over in sudden agony, howling pitifully."); + RS.Queue.AddToQueue(3, do_say_queue, mob, "What have you done...? What have you DONE?"); + RS.Queue.AddToQueue(4, act_queue, "Blubbering like a child, $n slowly composes $mself and rises to $s \"feet.\"", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(6, act_queue, "$e points a hideously deformed arm toward you, dripping blood and bits of sinew.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, do_say_queue, mob, "I charge you, mortal, with returning me to the abyss. I have been plucked from a place... a place from whence I should not have been plucked."); + RS.Queue.AddToQueue(10, do_emote, mob, (char *)"shudders slightly before continuing."); + RS.Queue.AddToQueue(11, do_say_queue, mob, "I require your blood, meddler, in order that I might survive long enough to return.... Speak the words, whelp. Yes or no?"); af.duration = 6; affect_to_char(mob, &af); break; case GREATER_GAMYGYN: - RS.Queue.AddToNewQueue(2, act_queue, "The undulating, shimmering form before you rings with unearthly sound.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(4, act_queue, "Swooping toward your face, $n seems to peer directly into your eyes.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(6, do_tell, mob, buf); - RS.Queue.AddToNewQueue(6, sprintf, buf, (char *)"%s I see you, mortal.", ch->name); - RS.Queue.AddToNewQueue(6, act_queue, "A sudden voice echoes unsettlingly in your mind:", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(7, act_queue, "You wince involuntarily, pictures of transactions gone wrong in your mind's eye.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(9, do_tell, mob, buf); - RS.Queue.AddToNewQueue(9, sprintf, buf, (char *)"%s I will not devour you; you may yet entertain me. Rewards shall be yours if you provide me with the dead flesh of one of your aberrant lightwalking kin. Do you submit yourself to my desire?", ch->name); + RS.Queue.AddToQueue(2, act_queue, "The undulating, shimmering form before you rings with unearthly sound.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(4, act_queue, "Swooping toward your face, $n seems to peer directly into your eyes.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(6, do_tell, mob, buf); + RS.Queue.AddToQueue(6, sprintf, buf, (char *)"%s I see you, mortal.", ch->name); + RS.Queue.AddToQueue(6, act_queue, "A sudden voice echoes unsettlingly in your mind:", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(7, act_queue, "You wince involuntarily, pictures of transactions gone wrong in your mind's eye.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(9, do_tell, mob, buf); + RS.Queue.AddToQueue(9, sprintf, buf, (char *)"%s I will not devour you; you may yet entertain me. Rewards shall be yours if you provide me with the dead flesh of one of your aberrant lightwalking kin. Do you submit yourself to my desire?", ch->name); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_OROBAS: - RS.Queue.AddToNewQueue(2, act_queue, "Orobas' many faces stare around the area, nonplussed by your summoning.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(4, do_say_queue, mob, "I see."); - RS.Queue.AddToNewQueue(6, act_queue, "A great howling sound boils into existence as Orobas' limbs flail wildly!", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, "I am displeased to be here."); - RS.Queue.AddToNewQueue(9, do_say_queue, mob, "You will do my bidding, mortal, or I shall inform the abyss of your grievous error at once."); - RS.Queue.AddToNewQueue(10, act_queue, "The choir of blurred and screaming heads reaches a new pitch of fervor.", mob, nullptr, nullptr, TO_ALL); - RS.Queue.AddToNewQueue(12, do_whisper, mob, (char *)"Speak now, or forever mourn your decision. Do you submit?"); + RS.Queue.AddToQueue(2, act_queue, "Orobas' many faces stare around the area, nonplussed by your summoning.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(4, do_say_queue, mob, "I see."); + RS.Queue.AddToQueue(6, act_queue, "A great howling sound boils into existence as Orobas' limbs flail wildly!", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, do_say_queue, mob, "I am displeased to be here."); + RS.Queue.AddToQueue(9, do_say_queue, mob, "You will do my bidding, mortal, or I shall inform the abyss of your grievous error at once."); + RS.Queue.AddToQueue(10, act_queue, "The choir of blurred and screaming heads reaches a new pitch of fervor.", mob, nullptr, nullptr, TO_ALL); + RS.Queue.AddToQueue(12, do_whisper, mob, (char *)"Speak now, or forever mourn your decision. Do you submit?"); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_GERYON: - RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"smiles pleasantly, extending a cool, dry hand to shake your own."); - RS.Queue.AddToNewQueue(4, do_say_queue, mob, "It's wonderful to be back here, I must say. It's been far too long. Who was the last fellow? Ah, yes...."); - RS.Queue.AddToNewQueue(5, do_emote, mob, (char *)"seems to finger something in his pocket, his eyes alight with pleasure."); - RS.Queue.AddToNewQueue(6, act_queue, "An uncomfortable sensation crawls over you as you eye this well-dressed demon.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, "But enough of my reminiscing! I imagine you have something you wanted to discuss, yes? Power, no doubt!"); - RS.Queue.AddToNewQueue(10, do_emote, mob, (char *)"'s smile expands to a wider grin, and his eyes flicker red for a moment."); - RS.Queue.AddToNewQueue(11, act_queue, "...though it may have been a trick of the light.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(12, do_say_queue, mob, "So, to business. What shall it be, then? An eye or a finger?"); + RS.Queue.AddToQueue(2, do_emote, mob, (char *)"smiles pleasantly, extending a cool, dry hand to shake your own."); + RS.Queue.AddToQueue(4, do_say_queue, mob, "It's wonderful to be back here, I must say. It's been far too long. Who was the last fellow? Ah, yes...."); + RS.Queue.AddToQueue(5, do_emote, mob, (char *)"seems to finger something in his pocket, his eyes alight with pleasure."); + RS.Queue.AddToQueue(6, act_queue, "An uncomfortable sensation crawls over you as you eye this well-dressed demon.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, do_say_queue, mob, "But enough of my reminiscing! I imagine you have something you wanted to discuss, yes? Power, no doubt!"); + RS.Queue.AddToQueue(10, do_emote, mob, (char *)"'s smile expands to a wider grin, and his eyes flicker red for a moment."); + RS.Queue.AddToQueue(11, act_queue, "...though it may have been a trick of the light.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(12, do_say_queue, mob, "So, to business. What shall it be, then? An eye or a finger?"); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_CIMERIES: WAIT_STATE(ch, 5 * PULSE_VIOLENCE); - RS.Queue.AddToNewQueue(2, do_emote, mob, (char *)"rises to his feet, and in a sudden panic attempts to flee by air."); - RS.Queue.AddToNewQueue(3, act_queue, "The greater demon's pathetic wings, completely impotent, flap helplessly.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(4, act_queue, "You stave off a pang of guilt at having summoned this massive beast to flounder.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(6, act_queue, "Your misplaced guilt quickly turns to fear as Cimeries rounds on you savagely!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(7, act_queue, "Before you can react, Cimeries has clamped your head between two massive claws!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(9, act_queue, "You gasp in pain, blood running down your face, as his talons pierce your nose and ear!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(10, act_queue, "$n speaks in a low grunting language, and you cannot understand a word.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(11, act_queue, "$n tugs harshly on your ear and nose in turn, eliciting another gasp of pain.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(13, act_queue, "Suddenly, his cruel choice for you becomes clear: ear or nose?", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(15, act_queue, "A shiver runs down your spine while you contemplate your fate.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(2, do_emote, mob, (char *)"rises to his feet, and in a sudden panic attempts to flee by air."); + RS.Queue.AddToQueue(3, act_queue, "The greater demon's pathetic wings, completely impotent, flap helplessly.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(4, act_queue, "You stave off a pang of guilt at having summoned this massive beast to flounder.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, act_queue, "Your misplaced guilt quickly turns to fear as Cimeries rounds on you savagely!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(7, act_queue, "Before you can react, Cimeries has clamped your head between two massive claws!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(9, act_queue, "You gasp in pain, blood running down your face, as his talons pierce your nose and ear!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(10, act_queue, "$n speaks in a low grunting language, and you cannot understand a word.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(11, act_queue, "$n tugs harshly on your ear and nose in turn, eliciting another gasp of pain.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(13, act_queue, "Suddenly, his cruel choice for you becomes clear: ear or nose?", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(15, act_queue, "A shiver runs down your spine while you contemplate your fate.", mob, nullptr, ch, TO_VICT); af.duration = 4; affect_to_char(mob, &af); break; @@ -1565,9 +1565,9 @@ void lesser_demon_tick(CHAR_DATA *mob, AFFECT_DATA *af) if (af->duration == 1) { do_emote(mob, "laughs giddily and whirls to leave."); - RS.Queue.AddToNewQueue(1, do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts. You'll never know the answer to my riddle."); - RS.Queue.AddToNewQueue(2, act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(1, do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts. You'll never know the answer to my riddle."); + RS.Queue.AddToQueue(2, act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, delay_extract, mob); break; } case MOB_VNUM_MALAPHAR: @@ -2150,7 +2150,7 @@ void do_breath_mephisto(CHAR_DATA *ch, char *argument) act("You begin building up the intense cold within you.", ch, 0, 0, TO_CHAR); act("$n's skin shifts to a shade of blue.", ch, 0, 0, TO_ROOM); - RS.Queue.AddToNewQueue(3, mephisto_two, ch, victim, argument); + RS.Queue.AddToQueue(3, mephisto_two, ch, victim, argument); } void mephisto_two(CHAR_DATA *ch, CHAR_DATA *victim, char *argument) diff --git a/code/characterClasses/chrono.c b/code/characterClasses/chrono.c index 4ea9a8b..e20cbe8 100644 --- a/code/characterClasses/chrono.c +++ b/code/characterClasses/chrono.c @@ -88,7 +88,7 @@ void spell_stasis_wall(int sn, int level, CHAR_DATA *ch, void *vo, int target) usually make sure the lag on the rune is at least as long as the lag on the draw_rune queue */ - RS.Queue.AddToNewQueue(9, draw_rune_queue, rune, rune->owner); + RS.Queue.AddToQueue(9, draw_rune_queue, rune, rune->owner); } bool trigger_stasis_wall(void *vo, void *vo2, void *vo3, void *vo4) diff --git a/code/characterClasses/druid.c b/code/characterClasses/druid.c index 711e8bc..c63f54c 100644 --- a/code/characterClasses/druid.c +++ b/code/characterClasses/druid.c @@ -100,15 +100,15 @@ void spell_tangleroot(int sn, int level, CHAR_DATA *ch, void *vo, int target) if (number_percent() > 10) { - RS.Queue.AddToNewQueue(2, LAG_CHAR, victim, (2 * PULSE_VIOLENCE)); - RS.Queue.AddToNewQueue(2, damage_queue, ch, victim, dam, DAM_BASH, HIT_UNBLOCKABLE, HIT_NOADD, HIT_NOMULT, (char *)"entangling roots*"); - RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_NOTVICT); - RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles you!", ch, nullptr, victim, TO_VICT); - RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_CHAR); + RS.Queue.AddToQueue(2, LAG_CHAR, victim, (2 * PULSE_VIOLENCE)); + RS.Queue.AddToQueue(2, damage_queue, ch, victim, dam, DAM_BASH, HIT_UNBLOCKABLE, HIT_NOADD, HIT_NOMULT, (char *)"entangling roots*"); + RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_NOTVICT); + RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles you!", ch, nullptr, victim, TO_VICT); + RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_CHAR); return; } - RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_NOTVICT); - RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground, but you manage to avoid it!", ch, nullptr, victim, TO_VICT); - RS.Queue.AddToNewQueue(2, act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_CHAR); + RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_NOTVICT); + RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground, but you manage to avoid it!", ch, nullptr, victim, TO_VICT); + RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_CHAR); } diff --git a/code/characterClasses/necro.c b/code/characterClasses/necro.c index b6dbcbc..b03229f 100644 --- a/code/characterClasses/necro.c +++ b/code/characterClasses/necro.c @@ -82,16 +82,16 @@ void spell_dark_vessel(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n plunges a hand into $p's chest cavity, and removes the heart.", ch, corpse, 0, TO_ROOM); - RS.Queue.AddToNewQueue(2, act_queue, "$n holds the heart aloft as it visibly begins to harden.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, act_queue, "$n holds the heart aloft as it visibly begins to harden.", ch, nullptr, nullptr, TO_ROOM); send_to_char("You remove the corpse's heart and squeeze the blood out of it, hardening it into a solid object.\n\r", ch); - RS.Queue.AddToNewQueue(4, make_urn, ch, corpse); + RS.Queue.AddToQueue(4, make_urn, ch, corpse); if(isNewUrn == false) { - RS.Queue.AddToNewQueue(6, send_to_char, "You drink the remaining blood from your old vessel, expelling each drop into the new one as your body convulses!\n\r The old vessel drops from your hand as it turns to ash.\n\r", ch); - RS.Queue.AddToNewQueue(7, act_queue, "$n drinks a thick fluid from a sanguine object and begins convulsing as they expel the fluid into the newly made vessel!", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(8, act_queue, "$n shudders, releasing the sanguine object as it turns to ash.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(6, send_to_char, "You drink the remaining blood from your old vessel, expelling each drop into the new one as your body convulses!\n\r The old vessel drops from your hand as it turns to ash.\n\r", ch); + RS.Queue.AddToQueue(7, act_queue, "$n drinks a thick fluid from a sanguine object and begins convulsing as they expel the fluid into the newly made vessel!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, act_queue, "$n shudders, releasing the sanguine object as it turns to ash.", ch, nullptr, nullptr, TO_ROOM); } } @@ -400,7 +400,7 @@ void spell_animate_dead(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("You kneel before $p, chanting softly in an arcane language.", ch, corpse, 0, TO_CHAR); act("$n kneels before $p, chanting softly in an unintelligible language.", ch, corpse, 0, TO_ROOM); - RS.Queue.AddToNewQueue(2, animate_two, ch, corpse); + RS.Queue.AddToQueue(2, animate_two, ch, corpse); } void animate_two(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -430,7 +430,7 @@ void animate_two(CHAR_DATA *ch, OBJ_DATA *corpse) act("You carve elaborate runes onto the torso of $p.", ch, corpse, nullptr, TO_CHAR); act("$n carves elaborate runes onto the torso of $p.", ch, corpse, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(2, animate_three, ch, corpse); + RS.Queue.AddToQueue(2, animate_three, ch, corpse); } void animate_three(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -459,7 +459,7 @@ void animate_three(CHAR_DATA *ch, OBJ_DATA *corpse) act("The flesh of the corpse begins to decay rapidly, its skin left bloated and sagging.", ch, nullptr, nullptr, TO_ALL); - RS.Queue.AddToNewQueue(2, animate_four, ch, corpse); + RS.Queue.AddToQueue(2, animate_four, ch, corpse); } void animate_four(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -681,7 +681,7 @@ void spell_visceral(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n slices open three corpses, spreading their entrails upon the ground.", ch, 0, 0, TO_ROOM); act("You slice open three corpses, spreading their entrails upon the ground.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToNewQueue(6, visceral_two, ch); + RS.Queue.AddToQueue(6, visceral_two, ch); } void visceral_two(CHAR_DATA *ch) @@ -696,7 +696,7 @@ void visceral_two(CHAR_DATA *ch) act("Upon this gore, $n pours a generous amount of blood, saturating it.", ch, 0, 0, TO_ROOM); act("Upon this gore, you pour a generous amount of blood, saturating it.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToNewQueue(6, visceral_three, ch); + RS.Queue.AddToQueue(6, visceral_three, ch); } void visceral_three(CHAR_DATA *ch) @@ -719,7 +719,7 @@ void visceral_three(CHAR_DATA *ch) act("$n and $s minions blissfully writhe in the carnage, praising the Dark Gods.", ch, 0, 0, TO_ROOM); act("You blissfully writhe in the carnage, praising the Dark Gods.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToNewQueue(6, visceral_four, ch); + RS.Queue.AddToQueue(6, visceral_four, ch); } void visceral_four(CHAR_DATA *ch) @@ -802,7 +802,7 @@ void spell_ritual_soul(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n begins to spread out some infernal relics and charms.", ch, 0, 0, TO_ROOM); act("You begin to spread out some infernal relics and charms.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToNewQueue(3, ritual_two, ch, victim); + RS.Queue.AddToQueue(3, ritual_two, ch, victim); } void ritual_two(CHAR_DATA *ch, CHAR_DATA *victim) @@ -821,7 +821,7 @@ void ritual_two(CHAR_DATA *ch, CHAR_DATA *victim) act("$n pours some blood onto the floor from $s urn, and chants quietly.", ch, 0, 0, TO_ROOM); act("You spill out blood from your urn, chanting softly in an arcane tongue.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToNewQueue(3, ritual_three, ch, victim); + RS.Queue.AddToQueue(3, ritual_three, ch, victim); } void ritual_three(CHAR_DATA *ch, CHAR_DATA *victim) @@ -843,7 +843,7 @@ void ritual_three(CHAR_DATA *ch, CHAR_DATA *victim) ch->mana = (short)(ch->mana * .8); ch->move = (short)(ch->move * .5); - RS.Queue.AddToNewQueue(3, ritual_four, ch, victim); + RS.Queue.AddToQueue(3, ritual_four, ch, victim); } void ritual_four(CHAR_DATA *ch, CHAR_DATA *victim) @@ -929,7 +929,7 @@ void spell_ritual_flesh(int sn, int level, CHAR_DATA *ch, void *vo, int target) ch->disrupted= false; - RS.Queue.AddToNewQueue(3, flesh_two, ch, victim); + RS.Queue.AddToQueue(3, flesh_two, ch, victim); act("You prepare to make an unholy sacrifice to the Dark Gods!", ch, 0, 0, TO_CHAR); } @@ -945,7 +945,7 @@ void flesh_two(CHAR_DATA *ch, CHAR_DATA *victim) act("$n pours blood onto the floor, chanting softly in an undecipherable tongue.", ch, 0, 0, TO_ROOM); act("You pour blood onto the floor, chanting softly in an arcane tongue.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToNewQueue(3, flesh_three, ch, victim); + RS.Queue.AddToQueue(3, flesh_three, ch, victim); } void flesh_three(CHAR_DATA *ch, CHAR_DATA *victim) @@ -964,7 +964,7 @@ void flesh_three(CHAR_DATA *ch, CHAR_DATA *victim) ch->hit = (short)(ch->hit * 0.8); - RS.Queue.AddToNewQueue(3, flesh_four, ch, victim); + RS.Queue.AddToQueue(3, flesh_four, ch, victim); } void flesh_four(CHAR_DATA *ch, CHAR_DATA *victim) diff --git a/code/characterClasses/sorcerer.c b/code/characterClasses/sorcerer.c index a248bb2..1bbc3fe 100644 --- a/code/characterClasses/sorcerer.c +++ b/code/characterClasses/sorcerer.c @@ -5054,7 +5054,7 @@ void spell_concave_shell(int sn, int level, CHAR_DATA *ch, void *vo, int target) dirptr = (int *)talloc_struct(sizeof(int)); *dirptr = dir; - RS.Queue.AddToNewQueue(6, concave_shell_move, ch, dirptr, ch->in_room); + RS.Queue.AddToQueue(6, concave_shell_move, ch, dirptr, ch->in_room); act("Air begins to swirl rapidly around you.", ch, 0, 0, TO_CHAR); act("Swirling winds begin to mass near $n.", ch, 0, 0, TO_ROOM); @@ -7999,13 +7999,13 @@ void spell_mana_infusion(int sn, int level, CHAR_DATA *ch, void *vo, int target) af1.owner = ch; new_affect_to_char(victim, &af1); - RS.Queue.AddToNewQueue(2, damage_queue, ch, victim, level, DAM_OTHER, HIT_UNBLOCKABLE, HIT_NOADD, dammod, (char *)"the escaping mana*"); - RS.Queue.AddToNewQueue(2, affect_strip, victim, gsn_mana_infusion); - RS.Queue.AddToNewQueue(2, act_queue, "You scream in pain as the mana rushes from your body!", victim, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToNewQueue(2, act_queue, "As the mana rushes out of $n's body, $e cries out in pain!", victim, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, damage_queue, ch, victim, level, DAM_OTHER, HIT_UNBLOCKABLE, HIT_NOADD, dammod, (char *)"the escaping mana*"); + RS.Queue.AddToQueue(2, affect_strip, victim, gsn_mana_infusion); + RS.Queue.AddToQueue(2, act_queue, "You scream in pain as the mana rushes from your body!", victim, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(2, act_queue, "As the mana rushes out of $n's body, $e cries out in pain!", victim, nullptr, nullptr, TO_ROOM); if (ch->level > 40 && number_percent() > 50 && !is_affected(victim, gsn_mana_sickness) && victim->hit > level + 30) - RS.Queue.AddToNewQueue(3, mana_infusion_helper, ch, victim); + RS.Queue.AddToQueue(3, mana_infusion_helper, ch, victim); } void infusion_tick(CHAR_DATA *ch, AFFECT_DATA *af) diff --git a/code/characterClasses/warrior.c b/code/characterClasses/warrior.c index 5ea2681..5816712 100644 --- a/code/characterClasses/warrior.c +++ b/code/characterClasses/warrior.c @@ -2710,8 +2710,8 @@ void do_brace(CHAR_DATA *ch, char *arg) braceptr = (float *)talloc_struct(sizeof(float)); *braceptr = bracemod; - RS.Queue.AddToNewQueue(8, brace_helper_undo, ch, braceptr); - RS.Queue.AddToNewQueue(8, act_queue, "You are no longer bracing yourself against incoming blows.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(8, brace_helper_undo, ch, braceptr); + RS.Queue.AddToQueue(8, act_queue, "You are no longer bracing yourself against incoming blows.", ch, nullptr, nullptr, TO_CHAR); check_improve(ch, gsn_brace, true, 3); } } @@ -4712,7 +4712,7 @@ void do_retreat(CHAR_DATA *ch, char *arg) dirptr = (int *)talloc_struct(sizeof(int)); *dirptr = direction; - RS.Queue.AddToNewQueue(3, execute_retreat, ch, dirptr); + RS.Queue.AddToQueue(3, execute_retreat, ch, dirptr); WAIT_STATE(ch, PULSE_VIOLENCE); } diff --git a/code/comm.c b/code/comm.c index 9631a33..40c5fd1 100644 --- a/code/comm.c +++ b/code/comm.c @@ -2724,7 +2724,7 @@ void nanny(DESCRIPTOR_DATA *d, char *argument) } ch->gold = 500; - RS.Queue.AddToNewQueue(3, create_academy_pet, ch); + RS.Queue.AddToQueue(3, create_academy_pet, ch); // academy pet here, on queue } else if (ch->in_room != nullptr) diff --git a/code/handler.c b/code/handler.c index e7a60f7..b8919e6 100644 --- a/code/handler.c +++ b/code/handler.c @@ -2317,10 +2317,10 @@ void extract_char(CHAR_DATA *ch, bool fPull) char_from_room(ch); - if (is_npc(ch) && RS.Queue.HasNewQueuePending(ch)) + if (is_npc(ch) && RS.Queue.HasQueuePending(ch)) { RS.Logger.Warn("Attempt at extracting mob {} while it has queue events pending. Deleting events.", ch->pIndexData->vnum); - RS.Queue.DeleteNewQueuedEventsInvolving(ch); + RS.Queue.DeleteQueuedEventsInvolving(ch); } /* Death room is set in the cabal table now */ diff --git a/code/iprog.c b/code/iprog.c index 677fa2f..3274e69 100644 --- a/code/iprog.c +++ b/code/iprog.c @@ -1630,14 +1630,14 @@ void verb_prog_antava_touch_hand(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) if (ch->in_room->vnum != 462) return; - RS.Queue.AddToNewQueue(14, act_queue, "Darkness closes back in upon the antechamber as the stone above you shuts abruptly!", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToNewQueue(9, do_look_queue, ch, "auto"); - RS.Queue.AddToNewQueue(9, act_queue, "$n suddenly slides down from above!", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(9, char_to_room, ch, tomb); - RS.Queue.AddToNewQueue(9, char_from_room, ch); - RS.Queue.AddToNewQueue(9, act_queue, "You suddenly feel the ground drop out from under you!", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToNewQueue(9, act_queue, "The sound of grinding granite fills the air as $n suddenly drops out of sight!", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(2, WAIT_STATE, ch, PULSE_VIOLENCE * 5); + RS.Queue.AddToQueue(14, act_queue, "Darkness closes back in upon the antechamber as the stone above you shuts abruptly!", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(9, do_look_queue, ch, "auto"); + RS.Queue.AddToQueue(9, act_queue, "$n suddenly slides down from above!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(9, char_to_room, ch, tomb); + RS.Queue.AddToQueue(9, char_from_room, ch); + RS.Queue.AddToQueue(9, act_queue, "You suddenly feel the ground drop out from under you!", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(9, act_queue, "The sound of grinding granite fills the air as $n suddenly drops out of sight!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, WAIT_STATE, ch, PULSE_VIOLENCE * 5); } void verb_prog_sidhe_climb_vine(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) @@ -1737,8 +1737,8 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) { row = RS.SQL.GetRow(); temp = palloc_string(row[0]); - RS.Queue.AddToNewQueue(inc * 5, free, temp); - RS.Queue.AddToNewQueue(inc * 5, say_to, fat, ch, (char *)"Just do yourself a favor, and watch out for $t.", temp); + RS.Queue.AddToQueue(inc * 5, free, temp); + RS.Queue.AddToQueue(inc * 5, say_to, fat, ch, (char *)"Just do yourself a favor, and watch out for $t.", temp); } } else if (rand == 2) @@ -1764,8 +1764,8 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) mysql_free_result(res2); } } - RS.Queue.AddToNewQueue(inc*4, free,temp); - RS.Queue.AddToNewQueue(inc*4, say_to, fat, ch, (char*)"Haha, $t got him again! By Rygath's teeth, that's a fine thief...", temp); + RS.Queue.AddToQueue(inc*4, free,temp); + RS.Queue.AddToQueue(inc*4, say_to, fat, ch, (char*)"Haha, $t got him again! By Rygath's teeth, that's a fine thief...", temp); */ } /* @@ -1834,7 +1834,7 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) tc = i; } - RS.Queue.AddToNewQueue(inc*6, say_to, violet, ch, + RS.Queue.AddToQueue(inc*6, say_to, violet, ch, (char*)"Well then, I suppose it's only a matter of time before we're all members of $t", cabal_table[tc].name); mprog_say(inc*7,"They're really cleaning house out there.", violet, ch); */ @@ -2670,7 +2670,7 @@ void verb_prog_touch_obelisk(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) ch->pcdata->condition[COND_HUNGER] = 1; ch->pcdata->condition[COND_THIRST] = 1; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); } void communion_handler(CHAR_DATA *ch) @@ -2700,7 +2700,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 2: sprintf(buf, "%sThe sonorous tone of a ramshorn booms through the void surrounding you.%s\n\r", @@ -2709,7 +2709,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 3: sprintf(buf, "%sA pearly luminescence begins to coalesce before your eyes, suspended in the darkness that rushes past as you plummet.%s\n\r", @@ -2718,7 +2718,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 4: sprintf(buf, "%sWithin the light, humanoid outlines begin to take shape.%s\n\r", @@ -2727,7 +2727,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 5: sprintf(buf, "%sYou see a behemoth of a man, gird in naught but animal hides and a belt adorned with human scalps.%s\n\r", @@ -2736,7 +2736,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 6: sprintf(buf, "%sThe stillness is shattered by a deafening battlecry, as the figures blur into motion.%s\n\r", @@ -2745,7 +2745,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 7: sprintf(buf, "%sA spray of blood follows his axe's arcing path through the air, light glinting off the silver blade.%s\n\r", @@ -2754,7 +2754,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 8: sprintf(buf, "%sYou have the sensation of being lifted higher, as your field of vision broadens.%s\n\r", @@ -2763,7 +2763,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 9: sprintf(buf, "%sA battlefield is spread out beneath you, the combat just witnessed but a part of the larger picture.%s\n\r", @@ -2772,7 +2772,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 10: sprintf(buf, "%sA small band of barbarians appear to have been trapped by a well-armored force of vastly superior numbers, a sheer cliffside at their backs.%s\n\r", @@ -2781,7 +2781,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 11: sprintf(buf, "%sFierce men and women, of all the races of Shalar, the barbarian horde raise their voices in a single outcry.%s\n\r", @@ -2790,7 +2790,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 12: sprintf(buf, "%sTheir bellowed warcry rippling out over the plains, they launch themselves into the heart of the enemy formation.%s\n\r", @@ -2799,7 +2799,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 13: sprintf(buf, "%sThe clash of steel upon steel and the horrible cries of dying men rise from the melee below...%s\n\r", @@ -2808,7 +2808,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 14: sprintf(buf, "%s...and the pungent odor of blood and death fills the air as the earth is stained a deep crimson.%s\n\r", @@ -2817,7 +2817,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 15: sprintf(buf, "%sThe barbarian horde cleaves a swath of terrible carnage through the heart of the fray, destruction trailing in their wake.%s\n\r", @@ -2826,7 +2826,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 16: sprintf(buf, "%sThe once-superior force, now decimated, turns to flee, a cacophony of shouts from the barbarians at their backs.%s\n\r", @@ -2835,7 +2835,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 17: sprintf(buf, "%sAs suddenly as the scene appeared, it is gone, the figures sinking into the earth and fading from sight entirely.%s\n\r", @@ -2844,7 +2844,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 18: SET_BIT(ch->comm, COMM_PROMPT); @@ -2858,7 +2858,7 @@ void communion_handler(CHAR_DATA *ch) ch->pcdata->tribe = tribe; af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 19: af->modifier++; @@ -2881,7 +2881,7 @@ void communion_handler(CHAR_DATA *ch) do_look(ch, "auto"); } - RS.Queue.AddToNewQueue(2, communion_handler, ch); + RS.Queue.AddToQueue(2, communion_handler, ch); break; case 20: sprintf(buf, "%sYou see a blur of motion streaking towards you from the edge of the forest.%s\n\r", @@ -2890,7 +2890,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToNewQueue(2, communion_handler, ch); + RS.Queue.AddToQueue(2, communion_handler, ch); break; case 21: af->modifier++; @@ -2997,7 +2997,7 @@ void communion_handler(CHAR_DATA *ch) } af->modifier++; - RS.Queue.AddToNewQueue(8, communion_handler, ch); + RS.Queue.AddToQueue(8, communion_handler, ch); break; case 23: sprintf(buf, "%sRays of light pierce your eyelids as they flutter open, and you groggily stagger to your feet.%s\n\r", @@ -3010,7 +3010,7 @@ void communion_handler(CHAR_DATA *ch) ch->position = POS_STANDING; af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 24: sprintf(buf, "%sA trophy belt is fastened securely about your waist, and you sense the weight of a massive pelt upon your back.%s\n\r", @@ -3093,7 +3093,7 @@ void communion_handler(CHAR_DATA *ch) equip_char(ch, obj, WEAR_ABOUT, false); - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 25: sprintf(buf, "%sEven as your mind reels, trying to make sense of all you have seen, you feel infused with newfound vigor.%s\n\r", @@ -3105,7 +3105,7 @@ void communion_handler(CHAR_DATA *ch) ch->mana = ch->max_mana; af->modifier++; - RS.Queue.AddToNewQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, communion_handler, ch); break; case 26: sprintf(buf, @@ -3170,7 +3170,7 @@ void verb_prog_feed_baby(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) act("$n's baby greedily begins to feed.", ch, 0, 0, TO_ROOM); milk->value[1] = 0; - RS.Queue.AddToNewQueue(12, act_queue, "$p drifts off to sleep.", ch, obj, nullptr, TO_CHAR); + RS.Queue.AddToQueue(12, act_queue, "$p drifts off to sleep.", ch, obj, nullptr, TO_CHAR); init_affect_obj(&af); af.where = TO_OBJ_APPLY; @@ -3711,13 +3711,13 @@ void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument if (!lRoom->exit[eDir]->u1.to_room) { // call elevator SIR! - RS.Queue.AddToNewQueue(2, act_to_room, mmsg, lRoom); - RS.Queue.AddToNewQueue(2, act_to_room, mmsg, tRoom); - RS.Queue.AddToNewQueue(2, act_to_room, mmsg, eleRoom); - RS.Queue.AddToNewQueue(3, close_elevator, eleRoom); - RS.Queue.AddToNewQueue(5, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); - RS.Queue.AddToNewQueue(9, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); - RS.Queue.AddToNewQueue(10, open_elevator, eleRoom, lRoom); + RS.Queue.AddToQueue(2, act_to_room, mmsg, lRoom); + RS.Queue.AddToQueue(2, act_to_room, mmsg, tRoom); + RS.Queue.AddToQueue(2, act_to_room, mmsg, eleRoom); + RS.Queue.AddToQueue(3, close_elevator, eleRoom); + RS.Queue.AddToQueue(5, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); + RS.Queue.AddToQueue(9, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); + RS.Queue.AddToQueue(10, open_elevator, eleRoom, lRoom); act("You pull the lever into the down position.", ch, 0, 0, TO_CHAR); act("$n pulls the lever into the down position.", ch, 0, 0, TO_ROOM); @@ -3725,13 +3725,13 @@ void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument else if (lRoom->exit[eDir]->u1.to_room) { // elevator is here, we can send it back up tRoom = get_room_index(obj->value[1]); - RS.Queue.AddToNewQueue(2, act_to_room, mmsg, lRoom); - RS.Queue.AddToNewQueue(2, act_to_room, mmsg, tRoom); - RS.Queue.AddToNewQueue(2, act_to_room, mmsg, eleRoom); - RS.Queue.AddToNewQueue(3, close_elevator, eleRoom); - RS.Queue.AddToNewQueue(5, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); - RS.Queue.AddToNewQueue(9, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); - RS.Queue.AddToNewQueue(10, open_elevator, eleRoom, tRoom); + RS.Queue.AddToQueue(2, act_to_room, mmsg, lRoom); + RS.Queue.AddToQueue(2, act_to_room, mmsg, tRoom); + RS.Queue.AddToQueue(2, act_to_room, mmsg, eleRoom); + RS.Queue.AddToQueue(3, close_elevator, eleRoom); + RS.Queue.AddToQueue(5, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); + RS.Queue.AddToQueue(9, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); + RS.Queue.AddToQueue(10, open_elevator, eleRoom, tRoom); act("You pull the lever into the up position.", ch, 0, 0, TO_CHAR); act("$n pulls the lever into the up position.", ch, 0, 0, TO_ROOM); @@ -3945,9 +3945,9 @@ void verb_prog_turn_wyntran(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) act("The temperature in the room drops rapidly as a darkened portal opens overhead.", ch, 0, 0, TO_ROOM); act("The temperature in the room drops rapidly as a darkened portal opens overhead.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToNewQueue(3, act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToNewQueue(3, act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(4, char_to_room, victim, ch->in_room); + RS.Queue.AddToQueue(3, act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(3, act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(4, char_to_room, victim, ch->in_room); WAIT_STATE(ch, PULSE_VIOLENCE * 2); } diff --git a/code/magic.c b/code/magic.c index 7115878..0fd6df4 100644 --- a/code/magic.c +++ b/code/magic.c @@ -4351,7 +4351,7 @@ void spell_summon(int sn, int level, CHAR_DATA *ch, void *vo, int target) return; } - RS.Queue.AddToNewQueue(3, summon_char, ch, victim); + RS.Queue.AddToQueue(3, summon_char, ch, victim); act("You begin the summoning of $N.", ch, 0, victim, TO_CHAR); @@ -4672,7 +4672,7 @@ void spell_word_of_recall(int sn, int level, CHAR_DATA *ch, void *vo, int target if (ch != victim) act("You prepare to send $N home.", ch, 0, victim, TO_CHAR); - RS.Queue.AddToNewQueue(6, recall_execute, victim, location); + RS.Queue.AddToQueue(6, recall_execute, victim, location); send_to_char("A tingling feeling runs down your spine for a moment.\n\r", victim); diff --git a/code/mprog.c b/code/mprog.c index 76afdd6..5784769 100644 --- a/code/mprog.c +++ b/code/mprog.c @@ -157,19 +157,19 @@ const struct improg_type mprog_table[] = void mprog_tell(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { auto buffer = fmt::format("{} tells you '{}{}{}'", mob->short_descr, get_char_color(ch, "tells"), arg, END_COLOR(ch)); - RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } void mprog_say(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); - RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } void mprog_emote(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { auto buffer = fmt::format("{} {}", mob->short_descr, arg); - RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } int mprog_drop(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) @@ -179,12 +179,12 @@ int mprog_drop(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) if (arg) { auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); - RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } - RS.Queue.AddToNewQueue(inc, obj_to_room, obj, mob->in_room); - RS.Queue.AddToNewQueue(inc, obj_from_char, obj); - RS.Queue.AddToNewQueue(inc, act_queue, "$n drops $p.", mob, obj, nullptr, TO_ROOM); + RS.Queue.AddToQueue(inc, obj_to_room, obj, mob->in_room); + RS.Queue.AddToQueue(inc, obj_from_char, obj); + RS.Queue.AddToQueue(inc, act_queue, "$n drops $p.", mob, obj, nullptr, TO_ROOM); return 0; } @@ -195,12 +195,12 @@ int mprog_give(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) if (arg) { auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); - RS.Queue.AddToNewQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } - RS.Queue.AddToNewQueue(inc, obj_to_char, obj, ch); - RS.Queue.AddToNewQueue(inc, obj_from_char, obj); - RS.Queue.AddToNewQueue(inc, act_queue, "$n gives you $p.", mob, obj, ch, TO_VICT); + RS.Queue.AddToQueue(inc, obj_to_char, obj, ch); + RS.Queue.AddToQueue(inc, obj_from_char, obj); + RS.Queue.AddToQueue(inc, act_queue, "$n gives you $p.", mob, obj, ch, TO_VICT); return 0; } @@ -618,9 +618,9 @@ void pulse_prog_arangird_patrol(CHAR_DATA *mob) void greet_prog_profteacher(CHAR_DATA *mob, CHAR_DATA *ch) { if (number_percent() > 50) - RS.Queue.AddToNewQueue(2, act_queue, "$N beckons you to approach $M.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(2, act_queue, "$N beckons you to approach $M.", ch, nullptr, mob, TO_CHAR); else - RS.Queue.AddToNewQueue(2, act_queue, "$N meets your eyes thoughtfully, nodding slightly.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(2, act_queue, "$N meets your eyes thoughtfully, nodding slightly.", ch, nullptr, mob, TO_CHAR); } void greet_prog_ruins_spirit(CHAR_DATA *mob, CHAR_DATA *ch) @@ -1562,7 +1562,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToNewQueue(1, delay_extract, mob); + RS.Queue.AddToQueue(1, delay_extract, mob); af->owner->pcdata->lesserdata[LESSER_BARBAS] = FAVOR_NONE; return; } @@ -1602,7 +1602,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToNewQueue(1, delay_extract, mob); + RS.Queue.AddToQueue(1, delay_extract, mob); return; } @@ -1642,7 +1642,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToNewQueue(1, delay_extract, mob); + RS.Queue.AddToQueue(1, delay_extract, mob); return; } @@ -1773,9 +1773,9 @@ void speech_prog_aamon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) break; default: do_emote(mob, "laughs giddily and whirls to leave."); - RS.Queue.AddToNewQueue(1, do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts! You'll never know the answer to my riddle."); - RS.Queue.AddToNewQueue(2, act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(1, do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts! You'll never know the answer to my riddle."); + RS.Queue.AddToQueue(2, act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, delay_extract, mob); ch->pcdata->lesserdata[LESSER_AAMON] = FAVOR_FAILED; break; } @@ -1889,7 +1889,7 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act(" $t", mob, mob->speechbuf[2], 0, TO_ROOM); act(" $t", mob, mob->speechbuf[3], 0, TO_ROOM); - RS.Queue.AddToNewQueue(2, do_say_queue, mob, "Quite the worst bit of garbage I've ever had the joyless task of committing to memory. Good day, my rhythmless friend."); + RS.Queue.AddToQueue(2, do_say_queue, mob, "Quite the worst bit of garbage I've ever had the joyless task of committing to memory. Good day, my rhythmless friend."); do_note(mob, "to anti-paladin"); do_note(mob, "subject Verse, the Worst"); @@ -1914,7 +1914,7 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_note(mob, "+ [at the bottom of the scroll, in florid script, is a single 'I']"); do_note(mob, "send"); - RS.Queue.AddToNewQueue(4, send_to_char, (char *)"You feel suddenly overcome with a desire to lash out at someone verbally.\n\r", ch); + RS.Queue.AddToQueue(4, send_to_char, (char *)"You feel suddenly overcome with a desire to lash out at someone verbally.\n\r", ch); ch->pcdata->lesserdata[LESSER_IPOS] = FAVOR_GRANTED; ch->pcdata->learned[skill_lookup("taunt")] = 1; @@ -1924,8 +1924,8 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) free_pstring(mob->speechbuf[i]); } - RS.Queue.AddToNewQueue(5, act_queue, "With a derisive snort, $n steps through a gate and vanishes without a trace.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(6, delay_extract, mob); + RS.Queue.AddToQueue(5, act_queue, "With a derisive snort, $n steps through a gate and vanishes without a trace.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(6, delay_extract, mob); } } @@ -1951,11 +1951,11 @@ void speech_prog_oze(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) stop_fighting(mob, true); - RS.Queue.AddToNewQueue(3, act_queue, "Suddenly rejuvenated, Oze begins to growl deep in his torso of exposed organs.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(5, do_say_queue, mob, "I would say that your deed would be remembered... but as you were the one who put me here in the first place, I doubt very much that you would wish it so. I take my leave."); - RS.Queue.AddToNewQueue(7, act_queue, "With a squelching sound, Oze thins into a gout of blood and shoots into the sky.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(8, delay_extract, mob); - RS.Queue.AddToNewQueue(8, save_char_obj, ch); + RS.Queue.AddToQueue(3, act_queue, "Suddenly rejuvenated, Oze begins to growl deep in his torso of exposed organs.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(5, do_say_queue, mob, "I would say that your deed would be remembered... but as you were the one who put me here in the first place, I doubt very much that you would wish it so. I take my leave."); + RS.Queue.AddToQueue(7, act_queue, "With a squelching sound, Oze thins into a gout of blood and shoots into the sky.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, delay_extract, mob); + RS.Queue.AddToQueue(8, save_char_obj, ch); ch->pcdata->greaterdata[GREATER_OZE] = FAVOR_GRANTED; ch->pcdata->learned[skill_lookup("leech")] = 1; ch->pcdata->perm_hit -= 70; @@ -1969,8 +1969,8 @@ void speech_prog_oze(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) sprintf(buf, "The abyss will not forget this treachery, %s.", ch->name); do_whisper(mob, buf); - RS.Queue.AddToNewQueue(1, act_queue, "The puddle of gore before you that was once a greater demon dissolves into the earth.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(2, delay_extract, mob); + RS.Queue.AddToQueue(1, act_queue, "The puddle of gore before you that was once a greater demon dissolves into the earth.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, delay_extract, mob); ch->pcdata->greaterdata[GREATER_OZE] = FAVOR_FAILED; return; } @@ -1995,11 +1995,11 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("Roaring suddenly with a thunder not unlike a thousand horses, $n rises.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToNewQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into your midsection as you scream involuntarily.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into $N's midsection as $E screams.", mob, nullptr, ch, TO_NOTVICT); - RS.Queue.AddToNewQueue(3, delay_extract, mob); - RS.Queue.AddToNewQueue(3, send_to_char, buf, ch); - RS.Queue.AddToNewQueue(3, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "blue"), END_COLOR(ch)); + RS.Queue.AddToQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into your midsection as you scream involuntarily.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into $N's midsection as $E screams.", mob, nullptr, ch, TO_NOTVICT); + RS.Queue.AddToQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(3, send_to_char, buf, ch); + RS.Queue.AddToQueue(3, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "blue"), END_COLOR(ch)); init_affect(&af); af.where = TO_AFFECTS; @@ -2021,10 +2021,10 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("With a flourishing fanfare which seems nonetheless foreboding, $n rises.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToNewQueue(1, do_tell, mob, buf); - RS.Queue.AddToNewQueue(1, sprintf, buf, (char *)"%s You may yet live to regret your rash decision. Doubtless the seeds of realization sprout within you now.", ch->name); - RS.Queue.AddToNewQueue(2, act_queue, "Flashing a great dark light, $n vanishes from sight.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(1, do_tell, mob, buf); + RS.Queue.AddToQueue(1, sprintf, buf, (char *)"%s You may yet live to regret your rash decision. Doubtless the seeds of realization sprout within you now.", ch->name); + RS.Queue.AddToQueue(2, act_queue, "Flashing a great dark light, $n vanishes from sight.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, delay_extract, mob); ch->pcdata->greaterdata[GREATER_GAMYGYN] = FAVOR_FAILED; } @@ -2047,17 +2047,17 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_emote(mob, "smiles deviously, and you grow confused attempting to locate his lips."); - RS.Queue.AddToNewQueue(1, do_say, mob, buf); - RS.Queue.AddToNewQueue(1, sprintf, buf, (char *)"Very well. I shall watch over you. I require the corpse of another anti-paladin to warm my feet, %s... I trust you shall not disappoint.", ch->name); - RS.Queue.AddToNewQueue(2, act_queue, "Before you realize what's happening, $n has planted a firm grip on your arm.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(3, act_queue, "The terrible demon's many hands begin grappling with your frame.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(5, act_queue, "A multitude of taloned fingers dig deeply into your flesh.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(6, act_queue, "$n draws $mself toward you and you scream involuntarily!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(8, act_queue, "You writhe in agony and pure horror as $n reaches down your throat...", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(10, act_queue, "In a few moments, $n has vanished entirely into your body.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(11, delay_extract, mob); - RS.Queue.AddToNewQueue(12, send_to_char, buf, ch); - RS.Queue.AddToNewQueue(12, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "red"), END_COLOR(ch)); + RS.Queue.AddToQueue(1, do_say, mob, buf); + RS.Queue.AddToQueue(1, sprintf, buf, (char *)"Very well. I shall watch over you. I require the corpse of another anti-paladin to warm my feet, %s... I trust you shall not disappoint.", ch->name); + RS.Queue.AddToQueue(2, act_queue, "Before you realize what's happening, $n has planted a firm grip on your arm.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(3, act_queue, "The terrible demon's many hands begin grappling with your frame.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, act_queue, "A multitude of taloned fingers dig deeply into your flesh.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, act_queue, "$n draws $mself toward you and you scream involuntarily!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, act_queue, "You writhe in agony and pure horror as $n reaches down your throat...", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(10, act_queue, "In a few moments, $n has vanished entirely into your body.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(11, delay_extract, mob); + RS.Queue.AddToQueue(12, send_to_char, buf, ch); + RS.Queue.AddToQueue(12, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "red"), END_COLOR(ch)); init_affect(&af); af.where = TO_AFFECTS; @@ -2080,9 +2080,9 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("Shrieks of outrage rise up from $n, arms and legs kicking out toward you.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToNewQueue(1, do_say_queue, mob, "I expected nothing else."); - RS.Queue.AddToNewQueue(2, act_queue, "With a fierce snarl and many assorted whispers, $n streaks into the darkness.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(1, do_say_queue, mob, "I expected nothing else."); + RS.Queue.AddToQueue(2, act_queue, "With a fierce snarl and many assorted whispers, $n streaks into the darkness.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, delay_extract, mob); ch->pcdata->greaterdata[GREATER_OROBAS] = FAVOR_FAILED; } @@ -2107,15 +2107,15 @@ void speech_prog_geryon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_say(mob, buf); do_emote(mob, "smiles pleasantly once more, reaching to his belt for a small metal tool."); - RS.Queue.AddToNewQueue(2, act_queue, "Cupping one hand around the back of your head, Geryon plunges with the tool....", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(4, act_queue, "The greater demon's even, pearly teeth are the last thing your left eye sees.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(5, act_queue, "The next thing your right eye sees is a hand moving away, holding a bloody orb.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(6, act_queue, "You stifle a scream as the suddenness of the operation becomes realization.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(8, act_queue, "Geryon drops your left eye into a bag at his belt, still smiling.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(10, do_say_queue, mob, "That's a good lad! Do try not to cry just yet, there's nothing quite like the sting of tears in an open eye socket. Now, then...."); - RS.Queue.AddToNewQueue(11, send_to_char, (char *)"The warmth of suffused power tingles through your fingers.\n\r", ch); - RS.Queue.AddToNewQueue(12, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); - RS.Queue.AddToNewQueue(13, delay_extract, mob); + RS.Queue.AddToQueue(2, act_queue, "Cupping one hand around the back of your head, Geryon plunges with the tool....", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(4, act_queue, "The greater demon's even, pearly teeth are the last thing your left eye sees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, act_queue, "The next thing your right eye sees is a hand moving away, holding a bloody orb.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, act_queue, "You stifle a scream as the suddenness of the operation becomes realization.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, act_queue, "Geryon drops your left eye into a bag at his belt, still smiling.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(10, do_say_queue, mob, "That's a good lad! Do try not to cry just yet, there's nothing quite like the sting of tears in an open eye socket. Now, then...."); + RS.Queue.AddToQueue(11, send_to_char, (char *)"The warmth of suffused power tingles through your fingers.\n\r", ch); + RS.Queue.AddToQueue(12, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); + RS.Queue.AddToQueue(13, delay_extract, mob); ch->pcdata->greaterdata[GREATER_GERYON] = GERYON_EYE; return; @@ -2129,16 +2129,16 @@ void speech_prog_geryon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_say(mob, buf); do_emote(mob, "smiles pleasantly once more, reaching to his belt for a very sharp knife."); - RS.Queue.AddToNewQueue(2, act_queue, "Seizing your hand abruptly, Geryon places the blade of his knife against it.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(4, act_queue, "With a quick sawing motion, the greater demon looses your left index finger!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(5, act_queue, "Blood pounding in your ears, you're unsure whether the scream you hear is yours.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(6, act_queue, "Catching the flying finger in his hand, Geryon places it into a bag at his belt.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(7, act_queue, "Geryon releases your wrist, and gouts of blood begin to pour from the wound.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(8, act_queue, "Geryon flashes his handsome smile and pushes stray hair back from his face.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(10, do_say_queue, mob, "Well done, my boy. Just stop up that stump you've got, or you'll bleed to death before I've gone! Now, then..."); - RS.Queue.AddToNewQueue(11, send_to_char, (char *)"The warmth of suffused power tingles through your eyes.\n\r", ch); - RS.Queue.AddToNewQueue(12, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); - RS.Queue.AddToNewQueue(13, delay_extract, mob); + RS.Queue.AddToQueue(2, act_queue, "Seizing your hand abruptly, Geryon places the blade of his knife against it.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(4, act_queue, "With a quick sawing motion, the greater demon looses your left index finger!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, act_queue, "Blood pounding in your ears, you're unsure whether the scream you hear is yours.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, act_queue, "Catching the flying finger in his hand, Geryon places it into a bag at his belt.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(7, act_queue, "Geryon releases your wrist, and gouts of blood begin to pour from the wound.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, act_queue, "Geryon flashes his handsome smile and pushes stray hair back from his face.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(10, do_say_queue, mob, "Well done, my boy. Just stop up that stump you've got, or you'll bleed to death before I've gone! Now, then..."); + RS.Queue.AddToQueue(11, send_to_char, (char *)"The warmth of suffused power tingles through your eyes.\n\r", ch); + RS.Queue.AddToQueue(12, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); + RS.Queue.AddToQueue(13, delay_extract, mob); ch->pcdata->greaterdata[GREATER_GERYON] = GERYON_FINGER; return; @@ -2161,12 +2161,12 @@ void speech_prog_cimeries(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) send_to_char("The sound of Cimeries' claw grinding against your skull fills your soul...", ch); - RS.Queue.AddToNewQueue(2, act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your ear away from your head.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(3, act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(5, act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(6, act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(8, act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(9, delay_extract, mob); + RS.Queue.AddToQueue(2, act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your ear away from your head.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(3, act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(9, delay_extract, mob); ch->pcdata->greaterdata[GREATER_CIMERIES] = CIMERIES_EAR; ch->pcdata->beauty = std::max(1, ch->pcdata->beauty - 4); @@ -2179,12 +2179,12 @@ void speech_prog_cimeries(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) send_to_char("You feel Cimeries' claw dig into the bridge of your nose and pull...", ch); - RS.Queue.AddToNewQueue(2, act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your nose away from your head.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(3, act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(5, act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(6, act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToNewQueue(8, act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(9, delay_extract, mob); + RS.Queue.AddToQueue(2, act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your nose away from your head.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(3, act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(9, delay_extract, mob); ch->pcdata->greaterdata[GREATER_CIMERIES] = CIMERIES_NOSE; ch->pcdata->beauty = std::max(1, ch->pcdata->beauty - 4); @@ -2461,8 +2461,8 @@ void greet_prog_tower_shopkeeper(CHAR_DATA *mob, CHAR_DATA *ch) act("$N glances over his shoulder at $n and grumbles.", ch, 0, mob, TO_ROOM); act("$n glances over his shoulder at you and grumbles.", mob, 0, ch, TO_VICT); - RS.Queue.AddToNewQueue(4, do_say_queue, mob, "Well, are ye goin' to buy somethin' or are ye just going t'stand there and stare at me!?"); - RS.Queue.AddToNewQueue(24, do_astrip, mob, (char *)""); + RS.Queue.AddToQueue(4, do_say_queue, mob, "Well, are ye goin' to buy somethin' or are ye just going t'stand there and stare at me!?"); + RS.Queue.AddToQueue(24, do_astrip, mob, (char *)""); } void pulse_prog_wizard_summon(CHAR_DATA *mob) @@ -2515,7 +2515,7 @@ void pulse_prog_wizard_summon(CHAR_DATA *mob) do_look(vch, "auto"); - RS.Queue.AddToNewQueue(1, do_say_queue, mob, "Please be more careful, and examine your surroundings. You'll live longer."); + RS.Queue.AddToQueue(1, do_say_queue, mob, "Please be more careful, and examine your surroundings. You'll live longer."); affect_remove(mob, paf); } @@ -3167,15 +3167,15 @@ void fight_prog_law_subdue(CHAR_DATA *mob, CHAR_DATA *ch) char_from_room(ch); char_to_room(ch, get_room_index(5)); - RS.Queue.AddToNewQueue(10, send_to_char, (char *)"You are dimly aware of being dragged along the ground...\n\r", ch); - RS.Queue.AddToNewQueue(19, wake_up, ch); - RS.Queue.AddToNewQueue(19, affect_strip, ch, gsn_subdue); - RS.Queue.AddToNewQueue(19, char_to_room, ch, pRoom); - RS.Queue.AddToNewQueue(19, char_from_room, ch); - RS.Queue.AddToNewQueue(20, send_to_char, (char *)"You are shaken awake by a fuzzy man, as seen through your own personal haze.\n\r", ch); - RS.Queue.AddToNewQueue(20, act_queue, "$N comes to $S knees holding the back of $S head.", nullptr, nullptr, ch, TO_NOTVICT); - RS.Queue.AddToNewQueue(21, send_to_char, buf, ch); - RS.Queue.AddToNewQueue(21, sprintf, buf, (char *)"A Hydra trooper tells you '%sAnd stay out of Cimar, ye %s!%s'\n\r", get_char_color(ch, "tells"), get_insult(ch), END_COLOR(ch)); + RS.Queue.AddToQueue(10, send_to_char, (char *)"You are dimly aware of being dragged along the ground...\n\r", ch); + RS.Queue.AddToQueue(19, wake_up, ch); + RS.Queue.AddToQueue(19, affect_strip, ch, gsn_subdue); + RS.Queue.AddToQueue(19, char_to_room, ch, pRoom); + RS.Queue.AddToQueue(19, char_from_room, ch); + RS.Queue.AddToQueue(20, send_to_char, (char *)"You are shaken awake by a fuzzy man, as seen through your own personal haze.\n\r", ch); + RS.Queue.AddToQueue(20, act_queue, "$N comes to $S knees holding the back of $S head.", nullptr, nullptr, ch, TO_NOTVICT); + RS.Queue.AddToQueue(21, send_to_char, buf, ch); + RS.Queue.AddToQueue(21, sprintf, buf, (char *)"A Hydra trooper tells you '%sAnd stay out of Cimar, ye %s!%s'\n\r", get_char_color(ch, "tells"), get_insult(ch), END_COLOR(ch)); } else { diff --git a/code/mspec.c b/code/mspec.c index a2443c8..30094cb 100644 --- a/code/mspec.c +++ b/code/mspec.c @@ -127,8 +127,8 @@ BEGIN_SPEC(mspec_horde_tanner) mprog_say(1, "Ya jus give me a sec and I'll hack this up for ya.", mob, ch); mprog_emote(3, "slams the corpse on his work table and begins cutting it up.", mob, ch); - RS.Queue.AddToNewQueue(5, act_queue, "$N hands $n a stack of sliced raw meat.", ch, nullptr, mob, TO_ROOM); - RS.Queue.AddToNewQueue(5, act_queue, "$N hands you a stack of sliced raw meat.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(5, act_queue, "$N hands $n a stack of sliced raw meat.", ch, nullptr, mob, TO_ROOM); + RS.Queue.AddToQueue(5, act_queue, "$N hands you a stack of sliced raw meat.", ch, nullptr, mob, TO_CHAR); extract_obj(obj); } @@ -264,19 +264,19 @@ void create_academy_pet(CHAR_DATA *ch) mob->leader = ch; ch->pet = mob; - RS.Queue.AddToNewQueue(3, do_say_queue, mob, + RS.Queue.AddToQueue(3, do_say_queue, mob, "I can aid you in finding food, water, a boat, and a place to practice. If you need to find "\ "somewhere to fight for learning, I can help with that, as well as a few other things."); char tbuf[MSL], *tref; - RS.Queue.AddToNewQueue(5, do_say_queue, mob, "To ask for my aid, direct your question to me."); + RS.Queue.AddToQueue(5, do_say_queue, mob, "To ask for my aid, direct your question to me."); sprintf(tbuf, "%s, I need to find food.", mob->short_descr); tref = talloc_string(tbuf); - RS.Queue.AddToNewQueue(8, do_say, ch, tref); + RS.Queue.AddToQueue(8, do_say, ch, tref); } void apet_force(CHAR_DATA *ch, const char *cmd, int delay) @@ -287,8 +287,8 @@ void apet_force(CHAR_DATA *ch, const char *cmd, int delay) tal = talloc_string(buf); - RS.Queue.AddToNewQueue(delay, interpret_queue, ch, std::string(cmd)); - RS.Queue.AddToNewQueue(delay, send_to_char, tal, ch); + RS.Queue.AddToQueue(delay, interpret_queue, ch, std::string(cmd)); + RS.Queue.AddToQueue(delay, send_to_char, tal, ch); ch->wait = std::min((int)ch->wait, 20); } @@ -364,7 +364,7 @@ void apet_walk_to_room(CHAR_DATA *ch, int vnum) WAIT_STATE(ch->leader, PULSE_VIOLENCE); - RS.Queue.AddToNewQueue(2, apet_walk_to_room, ch, vnum); + RS.Queue.AddToQueue(2, apet_walk_to_room, ch, vnum); } BEGIN_SPEC(mspec_academy_pet) @@ -541,13 +541,13 @@ BEGIN_SPEC(mspec_academy_pet) if (ch->alignment > -1) { - RS.Queue.AddToNewQueue(2, do_say_queue, mob, + RS.Queue.AddToQueue(2, do_say_queue, mob, "A good place to fight for us might be the Dying Forest. I understand the trolls there "\ "are good opponents."); - RS.Queue.AddToNewQueue(4, do_say_queue, mob, + RS.Queue.AddToQueue(4, do_say_queue, mob, "You can reach it by going out the eastern gate of Cimar along the Cimarrite Causeway, "\ "then south through the Stunted Forest to the Dying Forest."); - RS.Queue.AddToNewQueue(6, do_say_queue, mob, + RS.Queue.AddToQueue(6, do_say_queue, mob, "On the other hand, I've heard rumors of a crypt accessible through the Cimar Library "\ "north of the water fountain, where you can fight the undead. I'm not sure how you get "\ "in, but I bet you could find it if you looked there."); @@ -555,25 +555,25 @@ BEGIN_SPEC(mspec_academy_pet) if (ch->alignment == -1000) { - RS.Queue.AddToNewQueue(2, do_say_queue, mob, "We can slay the fool dryads in the Emerald Forest!"); - RS.Queue.AddToNewQueue(4, do_say_queue, mob, + RS.Queue.AddToQueue(2, do_say_queue, mob, "We can slay the fool dryads in the Emerald Forest!"); + RS.Queue.AddToQueue(4, do_say_queue, mob, "To reach it, first you should go to the major city of Melcene, out the eastern gate of "\ "Cimar along the Cimarrite Causeway, along the Great Shalaran Road."); - RS.Queue.AddToNewQueue(6, do_say_queue, mob, + RS.Queue.AddToQueue(6, do_say_queue, mob, "Then, when you're before the Gates of Melcene, head north all the way, east as far as you "\ "can, north, and east all the way into the village square of the Emerald Forest."); } if (get_skill(ch, gsn_enhanced_damage) < 1) { - RS.Queue.AddToNewQueue(7, do_say_queue, mob, + RS.Queue.AddToQueue(7, do_say_queue, mob, "Although... I've heard of caves around Iseldheim. Caves where there are zombies nearly "\ "impervious to physical attacks: they can rematerialize at the touch of metal.. but if you "\ "can think of a way around that - magic, maybe - you'd be good to go."); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, + RS.Queue.AddToQueue(8, do_say_queue, mob, "To get there, first head to the great Northern City of Iseldheim. Leave Cimar by the Northern Gate, then "\ "head all north and east through the village along the North Cimar Road."); - RS.Queue.AddToNewQueue(9, do_say_queue, mob, + RS.Queue.AddToQueue(9, do_say_queue, mob, "Once you're in Iseldheim, go up to the top level, out the eastern gate, and go northeast "\ "till you reach a woodland trail. Caves should be around there... but be careful."); } diff --git a/code/newmem.c b/code/newmem.c index a599b60..25a20b7 100644 --- a/code/newmem.c +++ b/code/newmem.c @@ -197,7 +197,7 @@ void do_memtest(CHAR_DATA *ch, char *argument) char buf[MSL]; CHAR_DATA *qch; argument = one_argument(argument, buf); - RS.Queue.AddToNewQueue(6, do_bash_queue, ch, "Calenduil"); + RS.Queue.AddToQueue(6, do_bash_queue, ch, "Calenduil"); return; //TODO: what the what??? diff --git a/code/prof.c b/code/prof.c index 879f6f9..1d10778 100644 --- a/code/prof.c +++ b/code/prof.c @@ -404,10 +404,10 @@ void CProficiencies::TrainProficiency(char_data* ch, char_data* trainer, char* a END_COLOR(ch)); char *tptr = talloc_string(buffer.c_str()); - RS.Queue.AddToNewQueue((i + 1) * 2, send_to_char, tptr, ch); + RS.Queue.AddToQueue((i + 1) * 2, send_to_char, tptr, ch); } - RS.Queue.AddToNewQueue((i + 1) * 2, act_queue, prof_msg_table[prof].learning_msgs[i], ch, nullptr, trainer, TO_CHAR); + RS.Queue.AddToQueue((i + 1) * 2, act_queue, prof_msg_table[prof].learning_msgs[i], ch, nullptr, trainer, TO_CHAR); } ch->Profs()->DeductPoints(proficiency.cost); @@ -1024,11 +1024,11 @@ void prof_firestart(CHAR_DATA *ch, char *argument) act("$n begins to build a campfire, gathering sticks and twigs from $s surroundings.", ch, 0, 0, TO_ROOM); ch->move -= ch->level; - RS.Queue.AddToNewQueue(1, send_to_char, "You rub two sticks together, trying to produce a flame.\n\r", ch); - RS.Queue.AddToNewQueue(1, act_queue, "$n rubs two sticks together, trying to produce a flame.", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(3, send_to_char, "The sticks begin to smoke, and soon you produce a spark.\n\r", ch); - RS.Queue.AddToNewQueue(3, act_queue, "The sticks begin to smoke, and soon $n produces a spark.", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToNewQueue(5, build_fire, ch, dur); + RS.Queue.AddToQueue(1, send_to_char, "You rub two sticks together, trying to produce a flame.\n\r", ch); + RS.Queue.AddToQueue(1, act_queue, "$n rubs two sticks together, trying to produce a flame.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, send_to_char, "The sticks begin to smoke, and soon you produce a spark.\n\r", ch); + RS.Queue.AddToQueue(3, act_queue, "The sticks begin to smoke, and soon $n produces a spark.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(5, build_fire, ch, dur); WAIT_STATE(ch, PULSE_VIOLENCE * 2); } diff --git a/code/quest.c b/code/quest.c index e9aeeec..d88d782 100644 --- a/code/quest.c +++ b/code/quest.c @@ -466,15 +466,15 @@ void speech_prog_ilopheth_shack(ROOM_INDEX_DATA *room, CHAR_DATA *ch, char *spee do_look(ch, "auto"); do_say(mob, "So he told you my name, did he? You're here to learn, eh? They always are. Always coming, "\ "wanting what's mine. Wanting, taking, with their grubby minds and dull hands, yes."); - RS.Queue.AddToNewQueue(5, do_say_queue, mob, "Well you can't have it!"); - RS.Queue.AddToNewQueue(8, do_emote, mob, (char *)"pauses for a moment and strokes his long, ragged beard."); - RS.Queue.AddToNewQueue(10, do_say_queue, mob, "Unless.... Yes, yes... you can help me! Ah, my turn to grub!"); - RS.Queue.AddToNewQueue(13, do_say_queue, mob, + RS.Queue.AddToQueue(5, do_say_queue, mob, "Well you can't have it!"); + RS.Queue.AddToQueue(8, do_emote, mob, (char *)"pauses for a moment and strokes his long, ragged beard."); + RS.Queue.AddToQueue(10, do_say_queue, mob, "Unless.... Yes, yes... you can help me! Ah, my turn to grub!"); + RS.Queue.AddToQueue(13, do_say_queue, mob, "Can't go out there, or they'd tear me to pieces, yes! Crack my skull open "\ "and snatch my brains and all their knowledge! But I need something...."); - RS.Queue.AddToNewQueue(15, do_say_queue, mob, "Moss! Not just any moss. Special moss. White moss. Glows, it does."); - RS.Queue.AddToNewQueue(17, do_say_queue, mob, "So, you'll get it for me, yes?"); - RS.Queue.AddToNewQueue(18, do_emote, mob, (char *)"peers at you expectantly."); + RS.Queue.AddToQueue(15, do_say_queue, mob, "Moss! Not just any moss. Special moss. White moss. Glows, it does."); + RS.Queue.AddToQueue(17, do_say_queue, mob, "So, you'll get it for me, yes?"); + RS.Queue.AddToQueue(18, do_emote, mob, (char *)"peers at you expectantly."); } break; @@ -625,47 +625,47 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) extract_obj(obj); /* moss */ do_emote(mob, "'s eyes beam as he gingerly handles the white moss in his hands."); - RS.Queue.AddToNewQueue(3, do_say_queue, mob, + RS.Queue.AddToQueue(3, do_say_queue, mob, "This is it! You've found it! Oh yes, yes! A fine specimen indeed! Not bad for "\ "some grubber, no, no, not bad at all!"); - RS.Queue.AddToNewQueue(7, do_emote, mob, (char *)"pauses in his examination of the moss and peers at you."); - RS.Queue.AddToNewQueue(10, do_say_queue, mob, + RS.Queue.AddToQueue(7, do_emote, mob, (char *)"pauses in his examination of the moss and peers at you."); + RS.Queue.AddToQueue(10, do_say_queue, mob, "Oh yes! You want me to help you. With magic, yes? Knowledge... powerful "\ "magic, perhaps you can handle it. Perhaps... perhaps not! Perhaps your head "\ "will crack like a delicate little egg, hee hee!"); - RS.Queue.AddToNewQueue(15, do_emote, mob, + RS.Queue.AddToQueue(15, do_emote, mob, (char *)"goes over to a towering stack of books and scraps in a far corner of the shack, "\ "and begins to rummage."); - RS.Queue.AddToNewQueue(18, do_say_queue, mob, + RS.Queue.AddToQueue(18, do_say_queue, mob, "Mysteries... no... not this one. Arcane... no. Curses of Ba... hrm, hee hee, "\ "no not that one either. Ah, here we go! Secrets of the Talismanic Powers."); - RS.Queue.AddToNewQueue(23, do_emote, mob, (char *)"slowly straightens and totters toward you, cradling the tome in his hands."); - RS.Queue.AddToNewQueue(27, do_say_queue, mob, + RS.Queue.AddToQueue(23, do_emote, mob, (char *)"slowly straightens and totters toward you, cradling the tome in his hands."); + RS.Queue.AddToQueue(27, do_say_queue, mob, "Here it is... right on page... what the... grubbers! The page.. it's stolen! "\ "Gone! Vanished into thin air! You stole it! I'll kill you!"); - RS.Queue.AddToNewQueue(31, do_say_queue, mob, "Oh, wait. No, you didn't. Yes, yes, I know. Those grubbers must've got it!"); - RS.Queue.AddToNewQueue(34, do_emote, mob, (char *)"waves his arms around wildly. VERY wildly. He must be seriously perturbed."); - RS.Queue.AddToNewQueue(37, do_say_queue, mob, + RS.Queue.AddToQueue(31, do_say_queue, mob, "Oh, wait. No, you didn't. Yes, yes, I know. Those grubbers must've got it!"); + RS.Queue.AddToQueue(34, do_emote, mob, (char *)"waves his arms around wildly. VERY wildly. He must be seriously perturbed."); + RS.Queue.AddToQueue(37, do_say_queue, mob, "Grubbers! Well, a secret I'll tell you. Yes, a secret! I didn't always used "\ "to live here! No no!"); - RS.Queue.AddToNewQueue(42, do_say_queue, mob, + RS.Queue.AddToQueue(42, do_say_queue, mob, "I lived deep in a forest bit east of that big city. Silmur or something. That "\ "city. Anyway... nice trees. Very nice. Very quiet, too."); - RS.Queue.AddToNewQueue(48, do_say_queue, mob, + RS.Queue.AddToQueue(48, do_say_queue, mob, "Well, except for the bandits. Bastardly grubbers, I tell you. Woke up one "\ "morning, and they were in my shack, goin' right through my things! Trying to get "\ "my secrets! Oh yes, the precious secrets, hee hee!"); - RS.Queue.AddToNewQueue(53, do_say_queue, mob, + RS.Queue.AddToQueue(53, do_say_queue, mob, "So I moved. Here. To this wretched place. But my secrets are safe here! Oh "\ "yes, yes, hee hee! Safe until you came in here, you grubber! And stole 'em!"); - RS.Queue.AddToNewQueue(58, do_say_queue, mob, + RS.Queue.AddToQueue(58, do_say_queue, mob, "Oh, wait. No, you didn't. I said I'd give it to you. But yes yes, you need to find that page! "\ "Bring it back here, and I'll give you what you want, you grubber!"); - RS.Queue.AddToNewQueue(70, do_say_queue, mob, "Are you still here? Go on, and find that page! Now out you go, hee hee!"); - RS.Queue.AddToNewQueue(71, do_look_queue, ch, "auto"); - RS.Queue.AddToNewQueue(71, char_to_room, ch, outside); - RS.Queue.AddToNewQueue(71, char_from_room, ch); - RS.Queue.AddToNewQueue(71, do_emote, mob, (char *)"hustles you rapidly out of his shack."); + RS.Queue.AddToQueue(70, do_say_queue, mob, "Are you still here? Go on, and find that page! Now out you go, hee hee!"); + RS.Queue.AddToQueue(71, do_look_queue, ch, "auto"); + RS.Queue.AddToQueue(71, char_to_room, ch, outside); + RS.Queue.AddToQueue(71, char_from_room, ch); + RS.Queue.AddToQueue(71, do_emote, mob, (char *)"hustles you rapidly out of his shack."); ch->pcdata->quests[TALISMANIC_QUEST] = 4; return; @@ -675,33 +675,33 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) { /* page */ do_emote(mob, "scrunches his haggard face up at he peers intently at the page."); - RS.Queue.AddToNewQueue(3, do_say_queue, mob, + RS.Queue.AddToQueue(3, do_say_queue, mob, "This is the missing page! So you're the one who stole it! You dirty grubber, "\ "you'll pay for this!"); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, + RS.Queue.AddToQueue(8, do_say_queue, mob, "Oh, wait. No you didn't. Now I can show you what I've been meaning to all this "\ "time, hee hee. I think you'll like it, oh yes you will."); - RS.Queue.AddToNewQueue(13, do_emote, mob, (char *)"inserts the page into the book, confirming the perfect fit with a glance."); - RS.Queue.AddToNewQueue(16, do_emote, mob, (char *)"totters over to your side and begins to murmur softly."); - RS.Queue.AddToNewQueue(20, do_emote, mob, + RS.Queue.AddToQueue(13, do_emote, mob, (char *)"inserts the page into the book, confirming the perfect fit with a glance."); + RS.Queue.AddToQueue(16, do_emote, mob, (char *)"totters over to your side and begins to murmur softly."); + RS.Queue.AddToQueue(20, do_emote, mob, (char *)"speaks with remarkable lucidity for one so seemingly deranged, guiding you "\ "through an explanation of the arcane tome."); - RS.Queue.AddToNewQueue(25, send_to_char, + RS.Queue.AddToQueue(25, send_to_char, (char *)"You suddenly have a flash of insight, and understand precisely what Pelamon is "\ "attempting to teach. Amazing... a protective spell of remarkable power!\n\r", ch); - RS.Queue.AddToNewQueue(36, talismanic_reward, ch); - RS.Queue.AddToNewQueue(30, do_say_queue, mob, + RS.Queue.AddToQueue(36, talismanic_reward, ch); + RS.Queue.AddToQueue(30, do_say_queue, mob, "Ah, I see you've got it, yes yes! And no cracks in your head, hee hee! Maybe "\ "you're not such a grubber after all."); - RS.Queue.AddToNewQueue(34, do_say_queue, mob, + RS.Queue.AddToQueue(34, do_say_queue, mob, "Well, you've taken enough of my time. You'll have to be on your way now... I'm "\ "expecting company, hee hee!"); - RS.Queue.AddToNewQueue(37, do_emote, mob, (char *)"winks mischievously."); - RS.Queue.AddToNewQueue(40, do_look_queue, ch, "auto"); - RS.Queue.AddToNewQueue(40, char_to_room, ch, outside); - RS.Queue.AddToNewQueue(40, char_from_room, ch); - RS.Queue.AddToNewQueue(40, do_emote, mob, (char *)"hustles you rapidly out of his shack."); - RS.Queue.AddToNewQueue(41, talismanic_reward, ch); + RS.Queue.AddToQueue(37, do_emote, mob, (char *)"winks mischievously."); + RS.Queue.AddToQueue(40, do_look_queue, ch, "auto"); + RS.Queue.AddToQueue(40, char_to_room, ch, outside); + RS.Queue.AddToQueue(40, char_from_room, ch); + RS.Queue.AddToQueue(40, do_emote, mob, (char *)"hustles you rapidly out of his shack."); + RS.Queue.AddToQueue(41, talismanic_reward, ch); } if (found) @@ -917,13 +917,13 @@ void give_prog_drow_scribe(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) do_emote(mob, "returns to his work."); - RS.Queue.AddToNewQueue(2, do_say_queue, mob, "Well, while you're here..."); - RS.Queue.AddToNewQueue(4, do_say_queue, mob, + RS.Queue.AddToQueue(2, do_say_queue, mob, "Well, while you're here..."); + RS.Queue.AddToQueue(4, do_say_queue, mob, "I have a scroll made up for a master mage on the fourth floor... Deliver it to "\ "him, and he'll surely tip you."); - RS.Queue.AddToNewQueue(6, do_say_queue, mob, + RS.Queue.AddToQueue(6, do_say_queue, mob, "I offer this to you only because you didn't seem very pleased with the tip that I gave you."); - RS.Queue.AddToNewQueue(8, do_say_queue, mob, "Do you accept?"); + RS.Queue.AddToQueue(8, do_say_queue, mob, "Do you accept?"); ch->pcdata->quests[SCRIBE_QUEST] = 4; } @@ -1121,7 +1121,7 @@ BEGIN_SPEC(mspec_academy_smith) mprog_say(2, "Good! I'm in short bloody supply of materials to work with these days.", mob, ch); mprog_say(4, "If yer can find me some, I'll keep half for myself and use the other half to strengthen yer weapon.", mob, ch); mprog_say(6, "I need four raw metals. Iandia said there might be some secreted in the Outlying Wilds and thereabouts.", mob, ch); - RS.Queue.AddToNewQueue(8, act_queue, "$N returns to his forge, turning his back to you.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(8, act_queue, "$N returns to his forge, turning his back to you.", ch, nullptr, mob, TO_CHAR); SET_STAGE(ch, 2); END_EVENT @@ -1180,9 +1180,9 @@ BEGIN_SPEC(mspec_academy_smith) char buf[MSL], *tptr; sprintf(buf, "%s", obj->short_descr); tptr = talloc_string(buf); - RS.Queue.AddToNewQueue(1, act, "Accepting $t, $N turns to the forge, preparing his tools.", ch, tptr, mob, TO_CHAR); - RS.Queue.AddToNewQueue(3, act, "$N begins to reshape $t, the hammering ringing loud in your ears.", ch, tptr, mob, TO_CHAR); - RS.Queue.AddToNewQueue(7, act, "Hefting it with a flourish, $N turns to you.", ch, obj, mob, TO_CHAR); + RS.Queue.AddToQueue(1, act, "Accepting $t, $N turns to the forge, preparing his tools.", ch, tptr, mob, TO_CHAR); + RS.Queue.AddToQueue(3, act, "$N begins to reshape $t, the hammering ringing loud in your ears.", ch, tptr, mob, TO_CHAR); + RS.Queue.AddToQueue(7, act, "Hefting it with a flourish, $N turns to you.", ch, obj, mob, TO_CHAR); if (improved == 0) mprog_say(8, "Har! This piece o' duergar dung might actually be worth using now.", mob, ch); else @@ -1200,8 +1200,8 @@ BEGIN_SPEC(mspec_academy_smith) if (get_quest_val(ch, SMITH_QUEST_COMP_ACQUIRED) >= 15) // all done { SET_STAGE(ch, 4); - RS.Queue.AddToNewQueue(10, gain_exp, ch, 3000); - RS.Queue.AddToNewQueue(10, send_to_char, + RS.Queue.AddToQueue(10, gain_exp, ch, 3000); + RS.Queue.AddToQueue(10, send_to_char, "Handling your newly completed weapon, you feel ready to take on the world!\n\r", ch); mprog_say(10, "That's about all I can do with the thing. Good luck, ye flamin' elfhugger.", mob, ch); delete_quest_val(ch, SMITH_QUEST_COMP_ACQUIRED); diff --git a/code/queue.c b/code/queue.c deleted file mode 100644 index 69f93d1..0000000 --- a/code/queue.c +++ /dev/null @@ -1,127 +0,0 @@ -// #include "queue.h" -// #define NOP asm volatile("nop"); - -// CQueue *CQueue::queue_first = 0; /*null*/ - -// CQueue::CQueue() -// { -// } - -// CQueue::~CQueue() -// { -// } -// void CQueue::ProcessQueue() -// { -// int i; -// void *j; -// CQueue *qf, *qf_next; -// for(qf = queue_first; qf; qf = qf_next) -// { -// qf_next = qf->queue_next; -// if(qf->queue_delay < 0) /* weird bug i don't want to find, probably a fucked up addtoq somewhere in the code */ -// { -// qf->FreeQueue(); -// continue; -// } -// if(--qf->queue_delay == 0) -// { -// switch(qf->queue_numargs) -// { -// case 0: -// (*qf->queue_function)(); -// break; -// case 1: -// (*qf->queue_function)(qf->queue_args[0]); -// break; -// case 2: -// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1]); -// break; -// case 3: -// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2]); -// break; -// case 4: -// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3]); -// break; -// case 5: -// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4]); -// break; -// case 6: -// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5]); -// break; -// case 7: -// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5],qf->queue_args[6]); -// break; -// case 8: -// (*qf->queue_function)(qf->queue_args[0],qf->queue_args[1],qf->queue_args[2],qf->queue_args[3],qf->queue_args[4],qf->queue_args[5],qf->queue_args[6],qf->queue_args[7]); -// break; -// } - -// qf->FreeQueue(); -// } -// } -// } -// void CQueue::AddToQueue(int nTimer, int nArgs, ...) -// { -// va_list ap; -// int i; -// void *hax[MAX_QUEUE_ARGS]; - -// if(nTimer < 0) -// Logger.Warn("Negative Queue Timer - NumArgs: {}", nArgs); -// CQueue *nq = new CQueue; -// nq->queue_delay = nTimer; -// nq->queue_numargs = nArgs; -// nq->queue_next = queue_first; -// queue_first = nq; -// va_start(ap, nArgs); -// nq->queue_function = (QUEUE_FUNCTION)va_arg(ap, void *); -// for(i = 0; i < MAX_QUEUE_ARGS; i++) -// nq->queue_args[i] = va_arg(ap, void *); -// va_end(ap); -// } - -// void CQueue::FreeQueue(void) -// { -// if(this == queue_first) -// { -// queue_first = this->queue_next; -// delete this; -// return; -// } -// CQueue *r; -// for(r = queue_first; r && r->queue_next != this; r = r->queue_next) -// ; -// if(!r) -// throw("FreeQueue(): Invalid linked list"); -// r->queue_next = this->queue_next; -// delete this; -// } - -// bool CQueue::HasQueuePending(void *qChar) -// { -// CQueue *r; -// for(r = queue_first; r; r = r->queue_next) -// for(int i = 0; i < r->queue_numargs; i++) -// if(r->queue_args[i] == qChar && r->queue_delay > 0) -// return true; -// return false; -// } - -// void CQueue::DeleteQueuedEventsInvolving(void *qChar) -// { -// CQueue *r, *r_next = 0;//null -// int deleted = 0; -// for(r = queue_first; r != 0 /*null*/; r = r_next) -// { -// r_next = r->queue_next; -// for(int i = 0; i < r->queue_numargs; i++) -// if(r->queue_args[i] == qChar && r->queue_delay > 0) -// { -// r->FreeQueue(); -// deleted++; -// break; -// } -// } - -// Logger.Warn("{} events deleted.", deleted); -// } diff --git a/code/queue.h b/code/queue.h index b657577..fd2b5d4 100644 --- a/code/queue.h +++ b/code/queue.h @@ -25,7 +25,7 @@ class CQueue /// @param func: The function to execute at the specified time. /// @param ...args: Variadic arguments used to call the function. template - void AddToNewQueue(int nTimer, Func func, Args &&...args) + void AddToQueue(int nTimer, Func func, Args &&...args) { if(nTimer < 0) Logger.Warn("Negative Queue Timer - NumArgs: {}", sizeof...(Args)); @@ -41,7 +41,7 @@ class CQueue /// Processes all items on the queue. Any entry that has a timer of zero gets executed. /// Once all items are processed, those functions that have executed are removed from the queue. - void ProcessNewQueue() + void ProcessQueue() { newQueue.erase( std::remove_if(newQueue.begin(), newQueue.end(), [](const auto& item) @@ -65,7 +65,7 @@ class CQueue /// This function applies to both directions (eg. either character being affected or is affecting another pc or environment). /// @param qChar: The character to lookup in the queue. /// @return true if there are entries related to the character in the queue; otherwise false. - bool HasNewQueuePending(CHAR_DATA *qChar) + bool HasQueuePending(CHAR_DATA *qChar) { for (auto& q : newQueue) { @@ -81,7 +81,7 @@ class CQueue /// Deletes all entries in the queue pertaining to the specified character. /// @param qChar: The character to lookup in the queue. - void DeleteNewQueuedEventsInvolving(CHAR_DATA *qChar) + void DeleteQueuedEventsInvolving(CHAR_DATA *qChar) { int deleted = 0; newQueue.erase( diff --git a/code/update.c b/code/update.c index 3bdc741..8acb3d2 100644 --- a/code/update.c +++ b/code/update.c @@ -2179,7 +2179,7 @@ void update_handler(void) else iprog_pulse_update(false); - RS.Queue.ProcessNewQueue(); + RS.Queue.ProcessQueue(); // execute_queue(); //execute queue every second. } diff --git a/tests/queue_tests.c b/tests/queue_tests.c index 9bbf004..3225327 100644 --- a/tests/queue_tests.c +++ b/tests/queue_tests.c @@ -17,11 +17,11 @@ SCENARIO("Testing queueing functions", "[AddToQueue]") CQueue sut; char_data *mockPlayer = new char_data(); - sut.AddToNewQueue(timer, testQueueFunction, mockPlayer); + sut.AddToQueue(timer, testQueueFunction, mockPlayer); THEN("The queue should show a pending call") { - REQUIRE(sut.HasNewQueuePending(mockPlayer)); + REQUIRE(sut.HasQueuePending(mockPlayer)); } } } @@ -35,15 +35,15 @@ SCENARIO("Testing deleting queue entries with that involve character", "[DeleteQ char_data *mockPlayer = new char_data(); int timer = 3; // 3 tics - sut.AddToNewQueue(timer, testQueueFunction, mockPlayer); + sut.AddToQueue(timer, testQueueFunction, mockPlayer); WHEN("DeleteQueuedEventsInvolving is called with a specified character in the queue") { - sut.DeleteNewQueuedEventsInvolving(mockPlayer); + sut.DeleteQueuedEventsInvolving(mockPlayer); THEN("The queue should show a no pending calls") { - auto hasQueueEntries = sut.HasNewQueuePending(mockPlayer); + auto hasQueueEntries = sut.HasQueuePending(mockPlayer); REQUIRE(hasQueueEntries == false); } } @@ -65,8 +65,8 @@ SCENARIO("Testing queue processing", "[ProcessQueue]") char_data* tmpChar = new char_data(); tmpChar->id = 10107; long expected = 1337L; - sut.AddToNewQueue(timer, updateValueFunction, tmpChar, expected); - sut.ProcessNewQueue(); + sut.AddToQueue(timer, updateValueFunction, tmpChar, expected); + sut.ProcessQueue(); THEN("The function should update the value") { REQUIRE(tmpChar->id == expected); From e19560b5567024b77ab53933e687f7049c847579 Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Sun, 8 Sep 2024 22:27:51 +0000 Subject: [PATCH 05/10] Fixed issues where library calls were being placed on queue which could cause undefined behavior. Added a few more queue compliant functions --- code/act_comm.c | 20 +++++++++++++ code/act_comm.h | 4 +++ code/act_wiz.c | 5 ++++ code/act_wiz.h | 1 + code/aprog.c | 4 +-- code/characterClasses/ap.c | 44 ++++++++++++++-------------- code/characterClasses/druid.c | 2 +- code/characterClasses/sorcerer.c | 2 +- code/comm.c | 5 ++++ code/comm.h | 1 + code/dioextra.c | 5 ++++ code/dioextra.h | 1 + code/handler.c | 5 ++++ code/handler.h | 1 + code/iprog.c | 49 ++++++++++++++++---------------- code/iprog.h | 1 + code/mprog.c | 42 ++++++++++++++------------- code/quest.c | 20 ++++++------- 18 files changed, 134 insertions(+), 78 deletions(-) diff --git a/code/act_comm.c b/code/act_comm.c index 6ea4788..be0c87b 100644 --- a/code/act_comm.c +++ b/code/act_comm.c @@ -860,6 +860,11 @@ void say_to(CHAR_DATA *ch, CHAR_DATA *victim, char *argument, char *extra) } } +void say_to_queue (CHAR_DATA *ch, CHAR_DATA *victim, std::string argument, std::string extra) +{ + say_to(ch, victim, argument.data(), extra.data()); +} + void do_whisper(CHAR_DATA *ch, char *argument) /* whisper -- dioxide */ { if (!is_npc(ch) && argument[0] == '\0') @@ -937,6 +942,11 @@ void do_whisper(CHAR_DATA *ch, char *argument) /* whisper -- dioxide */ check_unholy_communion(ch, argument); } +void do_whisper_queue (CHAR_DATA *ch, std::string argument) +{ + do_whisper(ch, argument.data()); +} + void do_sing(CHAR_DATA *ch, char *argument) { if (argument[0] == '\0') @@ -1261,6 +1271,11 @@ void do_tell(CHAR_DATA *ch, char *argument) free_pstring(argument); } +void do_tell_queue (CHAR_DATA *ch, std::string argument) +{ + do_tell(ch, argument.data()); +} + void do_noreply(CHAR_DATA *ch, char *argument) { send_to_char("You concentrate and momentarily close your ears to the replies of others.\n\r", ch); @@ -1516,6 +1531,11 @@ void do_emote(CHAR_DATA *ch, char *argument) act("$n$T", ch, nullptr, buffer, TO_ALL); } +void do_emote_queue(CHAR_DATA *ch, std::string argument) +{ + do_emote(ch, argument.data()); +} + void do_pmote(CHAR_DATA *ch, char *argument) { if (!is_npc(ch) && IS_SET(ch->comm, COMM_NOEMOTE)) diff --git a/code/act_comm.h b/code/act_comm.h index 1bdc79f..c5814a7 100644 --- a/code/act_comm.h +++ b/code/act_comm.h @@ -38,15 +38,19 @@ const char *lowstring(const char *i); void do_say (CHAR_DATA *ch, char *argument); void do_say_queue (CHAR_DATA *ch, std::string argument); void say_to (CHAR_DATA *ch, CHAR_DATA *victim, char *argument, char *extra); +void say_to_queue (CHAR_DATA *ch, CHAR_DATA *victim, std::string argument, std::string extra); void do_whisper (CHAR_DATA *ch, char *argument); +void do_whisper_queue (CHAR_DATA *ch, std::string argument); void do_sing (CHAR_DATA *ch, char *argument); void do_pray (CHAR_DATA *ch, char *argument); void do_tell (CHAR_DATA *ch, char *argument); +void do_tell_queue (CHAR_DATA *ch, std::string argument); void do_noreply (CHAR_DATA *ch, char *argument); void do_reply (CHAR_DATA *ch, char *argument); void do_yell (CHAR_DATA *ch, char *argument); void do_myell (CHAR_DATA *ch, char *argument, CHAR_DATA *attacker); void do_emote (CHAR_DATA *ch, char *argument); +void do_emote_queue (CHAR_DATA *ch, std::string argument); void do_pmote (CHAR_DATA *ch, char *argument); /* Simple, yet brilliant. Notify immortals when players are using words that * are offensive/harassing or commonly associated with OOC speech. Immortals diff --git a/code/act_wiz.c b/code/act_wiz.c index 62d5073..81c2264 100644 --- a/code/act_wiz.c +++ b/code/act_wiz.c @@ -6322,6 +6322,11 @@ void do_astrip(CHAR_DATA *ch, char *argument) send_to_char("All affects stripped from yourself.\n\r", ch); } +void do_astrip_queue (CHAR_DATA *ch, std::string argument) +{ + do_astrip(ch, argument.data()); +} + void do_limcounter(CHAR_DATA *ch, char *argument) { OBJ_INDEX_DATA *pObjIndex; diff --git a/code/act_wiz.h b/code/act_wiz.h index 51e7b33..882bec3 100644 --- a/code/act_wiz.h +++ b/code/act_wiz.h @@ -118,6 +118,7 @@ void do_holylight (CHAR_DATA *ch, char *argument); void do_prefi (CHAR_DATA *ch, char *argument); void do_prefix (CHAR_DATA *ch, char *argument); void do_astrip (CHAR_DATA *ch,char *argument); +void do_astrip_queue (CHAR_DATA *ch, std::string argument); void do_limcounter (CHAR_DATA *ch,char *argument); void do_classes (CHAR_DATA *ch, char *argument); void do_rinfo (CHAR_DATA *ch,char *argument); diff --git a/code/aprog.c b/code/aprog.c index ba88f9f..a90a5c1 100644 --- a/code/aprog.c +++ b/code/aprog.c @@ -416,10 +416,10 @@ void sun_prog_ilopheth(AREA_DATA *area) switch (sun) { case SolarPosition::Sunrise: - RS.Queue.AddToQueue(15, zone_echo, area, (char *)"With the beginning of the day sounds of life fill the valley, as the forest comes alive."); + RS.Queue.AddToQueue(15, zone_echo_queue, area, "With the beginning of the day sounds of life fill the valley, as the forest comes alive."); break; case SolarPosition::Sunset: - RS.Queue.AddToQueue(15, zone_echo, area, (char *)"The forest grows still, as the night sky settles over the valley."); + RS.Queue.AddToQueue(15, zone_echo_queue, area, "The forest grows still, as the night sky settles over the valley."); break; } } diff --git a/code/characterClasses/ap.c b/code/characterClasses/ap.c index a50f382..9d192ec 100644 --- a/code/characterClasses/ap.c +++ b/code/characterClasses/ap.c @@ -1298,7 +1298,7 @@ void check_unholy_communion(CHAR_DATA *ch, char *argument) void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) { - char buf[MSL]; + std::string buffer; AFFECT_DATA af; int vnum = -1; int demon = *demonptr, type = *typeptr; @@ -1383,7 +1383,7 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) switch (demon) { case LESSER_BARBAS: - RS.Queue.AddToQueue(2, do_emote, mob, (char *)"roars with anger and beats his meaty fists against his chest!"); + RS.Queue.AddToQueue(2, do_emote_queue, mob, "roars with anger and beats his meaty fists against his chest!"); RS.Queue.AddToQueue(4, act_queue, "Still growling, $N peers toward you with a sneering rictus of despite.", ch, nullptr, mob, TO_CHAR); RS.Queue.AddToQueue(6, do_say_queue, mob, "Summon me, you fool? Summon ME!?"); RS.Queue.AddToQueue(8, do_say_queue, mob, "I'll bet me reputation an' a slice o' me power that I'm about ta beat you senseless!"); @@ -1394,11 +1394,11 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) break; case LESSER_AAMON: WAIT_STATE(ch, 5 * PULSE_VIOLENCE); - RS.Queue.AddToQueue(2, do_emote, mob, (char *)"twitches violently as he stares around, bewildered."); - RS.Queue.AddToQueue(4, do_whisper, mob, (char *)"And where am I now, precisely?"); + RS.Queue.AddToQueue(2, do_emote_queue, mob, "twitches violently as he stares around, bewildered."); + RS.Queue.AddToQueue(4, do_whisper_queue, mob, "And where am I now, precisely?"); RS.Queue.AddToQueue(6, act_queue, "Jerking suddenly as if to watch in all directions at once, the demon spins.", mob, nullptr, nullptr, TO_ROOM); RS.Queue.AddToQueue(8, do_say_queue, mob, "You've summoned me! And now you will answer my riddle, yes!"); - RS.Queue.AddToQueue(10, do_emote, mob, (char *)"clears his throat and glances around pensively."); + RS.Queue.AddToQueue(10, do_emote_queue, mob, "clears his throat and glances around pensively."); RS.Queue.AddToQueue(12, do_say_queue, mob, "Most often by hoes and by gardeners I'm chased, "); RS.Queue.AddToQueue(13, do_say_queue, mob, "They cut off my head and then smash it to paste;"); RS.Queue.AddToQueue(14, do_say_queue, mob, "Against them, however, my body is braced, "); @@ -1409,18 +1409,18 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) affect_to_char(mob, &af); break; case LESSER_MALAPHAR: - RS.Queue.AddToQueue(2, do_emote, mob, (char *)"'s eyes light up as he realizes where he is."); + RS.Queue.AddToQueue(2, do_emote_queue, mob, "'s eyes light up as he realizes where he is."); RS.Queue.AddToQueue(4, do_say_queue, mob, "My friend! My friend, my patron, my emptor!"); RS.Queue.AddToQueue(6, act_queue, "Malaphar sidles up to you, and with a conspiratorial wink, waves his hand.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(8, do_whisper, mob, (char *)"I have something... something in which you would most undoubtedly be interested."); + RS.Queue.AddToQueue(8, do_whisper_queue, mob, "I have something... something in which you would most undoubtedly be interested."); RS.Queue.AddToQueue(10, do_say_queue, mob, "Sale or trade only, I'm afraid, no credit. And don't waste my time offering me paltry trifles."); af.duration = 7; affect_to_char(mob, &af); break; case LESSER_FURCAS: - RS.Queue.AddToQueue(2, do_emote, mob, (char *)"appears shocked, and he winces away from you automatically."); + RS.Queue.AddToQueue(2, do_emote_queue, mob, "appears shocked, and he winces away from you automatically."); RS.Queue.AddToQueue(4, act_queue, "Pawing his way around you, viewing you from all angles, Furcas blinks.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(6, do_whisper, mob, (char *)"...can it find us? We think it cannot. We hope it tries its hardest."); + RS.Queue.AddToQueue(6, do_whisper_queue, mob, "...can it find us? We think it cannot. We hope it tries its hardest."); RS.Queue.AddToQueue(8, act_queue, "Suddenly, you blink and Furcas has vanished, leaving a cold sniff in the air!", mob, nullptr, nullptr, TO_ROOM); RS.Queue.AddToQueue(9, furcas_vanish, ch, mob); @@ -1434,7 +1434,7 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) RS.Queue.AddToQueue(7, do_say_queue, mob, "For a moment at least, for you see, I am weary of warriors bleak and dark paladins dreary."); RS.Queue.AddToQueue(8, do_say_queue, mob, "Instead, it's my wish as I put pen to paper, that you'll indulge me with a frolicsome caper."); RS.Queue.AddToQueue(9, do_say_queue, mob, "Be mindful, my ears are accustomed to rhymes; I hope you are willing to speak me four lines...."); - RS.Queue.AddToQueue(10, do_emote, mob, (char *)"thrusts forward, anticipating your poem with an evil gleam in his eye."); + RS.Queue.AddToQueue(10, do_emote_queue, mob, "thrusts forward, anticipating your poem with an evil gleam in his eye."); af.modifier = 0; af.duration = 8; affect_to_char(mob, &af); @@ -1457,12 +1457,12 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) switch (demon) { case GREATER_OZE: - RS.Queue.AddToQueue(2, do_emote, mob, (char *)"nearly collapses as he doubles over in sudden agony, howling pitifully."); + RS.Queue.AddToQueue(2, do_emote_queue, mob, "nearly collapses as he doubles over in sudden agony, howling pitifully."); RS.Queue.AddToQueue(3, do_say_queue, mob, "What have you done...? What have you DONE?"); RS.Queue.AddToQueue(4, act_queue, "Blubbering like a child, $n slowly composes $mself and rises to $s \"feet.\"", mob, nullptr, nullptr, TO_ROOM); RS.Queue.AddToQueue(6, act_queue, "$e points a hideously deformed arm toward you, dripping blood and bits of sinew.", mob, nullptr, nullptr, TO_ROOM); RS.Queue.AddToQueue(8, do_say_queue, mob, "I charge you, mortal, with returning me to the abyss. I have been plucked from a place... a place from whence I should not have been plucked."); - RS.Queue.AddToQueue(10, do_emote, mob, (char *)"shudders slightly before continuing."); + RS.Queue.AddToQueue(10, do_emote_queue, mob, "shudders slightly before continuing."); RS.Queue.AddToQueue(11, do_say_queue, mob, "I require your blood, meddler, in order that I might survive long enough to return.... Speak the words, whelp. Yes or no?"); af.duration = 6; affect_to_char(mob, &af); @@ -1470,12 +1470,14 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) case GREATER_GAMYGYN: RS.Queue.AddToQueue(2, act_queue, "The undulating, shimmering form before you rings with unearthly sound.", mob, nullptr, nullptr, TO_ROOM); RS.Queue.AddToQueue(4, act_queue, "Swooping toward your face, $n seems to peer directly into your eyes.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(6, do_tell, mob, buf); - RS.Queue.AddToQueue(6, sprintf, buf, (char *)"%s I see you, mortal.", ch->name); + + buffer = fmt::format("{} I see you, mortal.", ch->name); + RS.Queue.AddToQueue(6, do_tell_queue, mob, buffer); RS.Queue.AddToQueue(6, act_queue, "A sudden voice echoes unsettlingly in your mind:", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(7, act_queue, "You wince involuntarily, pictures of transactions gone wrong in your mind's eye.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(9, do_tell, mob, buf); - RS.Queue.AddToQueue(9, sprintf, buf, (char *)"%s I will not devour you; you may yet entertain me. Rewards shall be yours if you provide me with the dead flesh of one of your aberrant lightwalking kin. Do you submit yourself to my desire?", ch->name); + + buffer = fmt::format("{} I will not devour you; you may yet entertain me. Rewards shall be yours if you provide me with the dead flesh of one of your aberrant lightwalking kin. Do you submit yourself to my desire?", ch->name); + RS.Queue.AddToQueue(9, do_tell_queue, mob, buffer); af.duration = 5; affect_to_char(mob, &af); break; @@ -1486,17 +1488,17 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) RS.Queue.AddToQueue(8, do_say_queue, mob, "I am displeased to be here."); RS.Queue.AddToQueue(9, do_say_queue, mob, "You will do my bidding, mortal, or I shall inform the abyss of your grievous error at once."); RS.Queue.AddToQueue(10, act_queue, "The choir of blurred and screaming heads reaches a new pitch of fervor.", mob, nullptr, nullptr, TO_ALL); - RS.Queue.AddToQueue(12, do_whisper, mob, (char *)"Speak now, or forever mourn your decision. Do you submit?"); + RS.Queue.AddToQueue(12, do_whisper_queue, mob, "Speak now, or forever mourn your decision. Do you submit?"); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_GERYON: - RS.Queue.AddToQueue(2, do_emote, mob, (char *)"smiles pleasantly, extending a cool, dry hand to shake your own."); + RS.Queue.AddToQueue(2, do_emote_queue, mob, "smiles pleasantly, extending a cool, dry hand to shake your own."); RS.Queue.AddToQueue(4, do_say_queue, mob, "It's wonderful to be back here, I must say. It's been far too long. Who was the last fellow? Ah, yes...."); - RS.Queue.AddToQueue(5, do_emote, mob, (char *)"seems to finger something in his pocket, his eyes alight with pleasure."); + RS.Queue.AddToQueue(5, do_emote_queue, mob, "seems to finger something in his pocket, his eyes alight with pleasure."); RS.Queue.AddToQueue(6, act_queue, "An uncomfortable sensation crawls over you as you eye this well-dressed demon.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(8, do_say_queue, mob, "But enough of my reminiscing! I imagine you have something you wanted to discuss, yes? Power, no doubt!"); - RS.Queue.AddToQueue(10, do_emote, mob, (char *)"'s smile expands to a wider grin, and his eyes flicker red for a moment."); + RS.Queue.AddToQueue(10, do_emote_queue, mob, "'s smile expands to a wider grin, and his eyes flicker red for a moment."); RS.Queue.AddToQueue(11, act_queue, "...though it may have been a trick of the light.", mob, nullptr, nullptr, TO_ROOM); RS.Queue.AddToQueue(12, do_say_queue, mob, "So, to business. What shall it be, then? An eye or a finger?"); af.duration = 5; @@ -1504,7 +1506,7 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) break; case GREATER_CIMERIES: WAIT_STATE(ch, 5 * PULSE_VIOLENCE); - RS.Queue.AddToQueue(2, do_emote, mob, (char *)"rises to his feet, and in a sudden panic attempts to flee by air."); + RS.Queue.AddToQueue(2, do_emote_queue, mob, "rises to his feet, and in a sudden panic attempts to flee by air."); RS.Queue.AddToQueue(3, act_queue, "The greater demon's pathetic wings, completely impotent, flap helplessly.", mob, nullptr, nullptr, TO_ROOM); RS.Queue.AddToQueue(4, act_queue, "You stave off a pang of guilt at having summoned this massive beast to flounder.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(6, act_queue, "Your misplaced guilt quickly turns to fear as Cimeries rounds on you savagely!", mob, nullptr, ch, TO_VICT); diff --git a/code/characterClasses/druid.c b/code/characterClasses/druid.c index c63f54c..6a057ac 100644 --- a/code/characterClasses/druid.c +++ b/code/characterClasses/druid.c @@ -101,7 +101,7 @@ void spell_tangleroot(int sn, int level, CHAR_DATA *ch, void *vo, int target) if (number_percent() > 10) { RS.Queue.AddToQueue(2, LAG_CHAR, victim, (2 * PULSE_VIOLENCE)); - RS.Queue.AddToQueue(2, damage_queue, ch, victim, dam, DAM_BASH, HIT_UNBLOCKABLE, HIT_NOADD, HIT_NOMULT, (char *)"entangling roots*"); + RS.Queue.AddToQueue(2, damage_queued, ch, victim, dam, DAM_BASH, HIT_UNBLOCKABLE, HIT_NOADD, HIT_NOMULT, "entangling roots*"); RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_NOTVICT); RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles you!", ch, nullptr, victim, TO_VICT); RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_CHAR); diff --git a/code/characterClasses/sorcerer.c b/code/characterClasses/sorcerer.c index 1bbc3fe..0baacb8 100644 --- a/code/characterClasses/sorcerer.c +++ b/code/characterClasses/sorcerer.c @@ -7999,7 +7999,7 @@ void spell_mana_infusion(int sn, int level, CHAR_DATA *ch, void *vo, int target) af1.owner = ch; new_affect_to_char(victim, &af1); - RS.Queue.AddToQueue(2, damage_queue, ch, victim, level, DAM_OTHER, HIT_UNBLOCKABLE, HIT_NOADD, dammod, (char *)"the escaping mana*"); + RS.Queue.AddToQueue(2, damage_queued, ch, victim, level, DAM_OTHER, HIT_UNBLOCKABLE, HIT_NOADD, dammod, "the escaping mana*"); RS.Queue.AddToQueue(2, affect_strip, victim, gsn_mana_infusion); RS.Queue.AddToQueue(2, act_queue, "You scream in pain as the mana rushes from your body!", victim, nullptr, nullptr, TO_CHAR); RS.Queue.AddToQueue(2, act_queue, "As the mana rushes out of $n's body, $e cries out in pain!", victim, nullptr, nullptr, TO_ROOM); diff --git a/code/comm.c b/code/comm.c index 40c5fd1..a3c7d22 100644 --- a/code/comm.c +++ b/code/comm.c @@ -3027,6 +3027,11 @@ void send_to_char(const char *txt, CHAR_DATA *ch) write_to_buffer(ch->desc, txt, strlen(txt)); } +void send_to_char_queue (std::string txt, CHAR_DATA *ch) +{ + send_to_char(txt.c_str(), ch); +} + void send_to_chars(const char *txt, CHAR_DATA *ch, int min, ...) { if (txt != nullptr && ch->desc != nullptr) diff --git a/code/comm.h b/code/comm.h index 82b42f3..5edea49 100644 --- a/code/comm.h +++ b/code/comm.h @@ -162,6 +162,7 @@ void stop_idling (CHAR_DATA *ch); * Write to one char. */ void send_to_char (const char *txt, CHAR_DATA *ch); +void send_to_char_queue (std::string txt, CHAR_DATA *ch); void send_to_chars (const char *txt, CHAR_DATA *ch, int min, ...); /* * Send a page to one char. diff --git a/code/dioextra.c b/code/dioextra.c index b0df9df..f71e4c4 100644 --- a/code/dioextra.c +++ b/code/dioextra.c @@ -1755,6 +1755,11 @@ void zone_echo(AREA_DATA *area, char *echo) } } +void zone_echo_queue(AREA_DATA *area, std::string echo) +{ + zone_echo(area, echo.data()); +} + bool old_is_adjacent_area(AREA_DATA *area, AREA_DATA *area2) { ROOM_INDEX_DATA *to_room; diff --git a/code/dioextra.h b/code/dioextra.h index 7bc7930..bd38f8a 100644 --- a/code/dioextra.h +++ b/code/dioextra.h @@ -37,6 +37,7 @@ bool auto_check_multi (DESCRIPTOR_DATA *d_check, char *host); void do_pload (CHAR_DATA *ch,char *argument); void do_damage (CHAR_DATA *ch,char *argument); void zone_echo (AREA_DATA *area, char *echo); +void zone_echo_queue (AREA_DATA *area, std::string echo); bool old_is_adjacent_area (AREA_DATA *area, AREA_DATA *area2); bool is_adjacent_area (AREA_DATA *area, AREA_DATA *area2); bool is_adj_range (AREA_DATA *area, AREA_DATA *area2, int range); diff --git a/code/handler.c b/code/handler.c index b8919e6..cf68cd3 100644 --- a/code/handler.c +++ b/code/handler.c @@ -5079,3 +5079,8 @@ int damage_queue(CHAR_DATA *ch, CHAR_DATA *victim, int dam, int damtype, bool bl { return damage_new(ch, victim, dam, gsn_bash, damtype, true, blockable, add, mult, dnoun); } + +int damage_queued(CHAR_DATA *ch, CHAR_DATA *victim, int dam, int damtype, bool blockable, int add, int mult, std::string dnoun) +{ + return damage_new(ch, victim, dam, gsn_bash, damtype, true, blockable, add, mult, dnoun.data()); +} diff --git a/code/handler.h b/code/handler.h index 752aaf8..338ec02 100644 --- a/code/handler.h +++ b/code/handler.h @@ -355,5 +355,6 @@ void modify_location (CHAR_DATA *ch, int location, int mod, bool add); int get_align (CHAR_DATA *ch); int get_ethos (CHAR_DATA *ch); int damage_queue (CHAR_DATA *ch, CHAR_DATA *victim, int dam, int damtype, bool blockable, int add, int mult, char *dnoun); +int damage_queued (CHAR_DATA *ch, CHAR_DATA *victim, int dam, int damtype, bool blockable, int add, int mult, std::string dnoun); #endif /* HANDLER_H */ diff --git a/code/iprog.c b/code/iprog.c index 3274e69..5622036 100644 --- a/code/iprog.c +++ b/code/iprog.c @@ -1708,7 +1708,7 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) int i = 0, rand, inc = 2, tc = 0, cres = 0, ccount[MAX_CABAL]; CHAR_DATA *fat, *minotaur, *violet; char buf[MSL]; - char *temp = (char *)'\0'; + std::string temp; CRow row; rand = dice(1, 4); @@ -1736,9 +1736,8 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) if (cres) { row = RS.SQL.GetRow(); - temp = palloc_string(row[0]); - RS.Queue.AddToQueue(inc * 5, free, temp); - RS.Queue.AddToQueue(inc * 5, say_to, fat, ch, (char *)"Just do yourself a favor, and watch out for $t.", temp); + temp = std::string(row[0]); + RS.Queue.AddToQueue(inc * 5, say_to_queue, fat, ch, "Just do yourself a favor, and watch out for $t.", temp); } } else if (rand == 2) @@ -1760,12 +1759,11 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) if(atoi(row2[0]) > tc) { tc = atoi(row2[0]); - temp = palloc_string(row[0]); + temp = std::string(row[0]); mysql_free_result(res2); } } - RS.Queue.AddToQueue(inc*4, free,temp); - RS.Queue.AddToQueue(inc*4, say_to, fat, ch, (char*)"Haha, $t got him again! By Rygath's teeth, that's a fine thief...", temp); + RS.Queue.AddToQueue(inc*4, say_to_queue, fat, ch, "Haha, $t got him again! By Rygath's teeth, that's a fine thief...", temp); */ } /* @@ -1796,13 +1794,12 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) if(atoi(row2[0]) > tc) { tc = atoi(row2[0]); - temp = talloc_string(row[0]); + temp = std::string(row[0]); mysql_free_result(res2); } } - add_one_to_queue(inc*4,free,temp); - add_four_to_queue(inc*4,say_to,fat,ch,"$t has been inducting people like mad, and I think I've got a shot.", temp); + add_four_to_queue(inc*4,say_to_queue,fat,ch,"$t has been inducting people like mad, and I think I've got a shot.", temp); mprog_emote(inc*5,"gurgles quietly into his drink.", minotaur, ch); } */ @@ -1834,8 +1831,8 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) tc = i; } - RS.Queue.AddToQueue(inc*6, say_to, violet, ch, - (char*)"Well then, I suppose it's only a matter of time before we're all members of $t", cabal_table[tc].name); + RS.Queue.AddToQueue(inc*6, say_to_queue, violet, ch, + "Well then, I suppose it's only a matter of time before we're all members of $t", std::string(cabal_table[tc].name)); mprog_say(inc*7,"They're really cleaning house out there.", violet, ch); */ } @@ -3672,13 +3669,17 @@ void act_to_room(void *vo1, void *vo2) act((char *)vo1, pRoom->people, 0, 0, TO_ALL); } +void act_to_room_queue(std::string format, ROOM_INDEX_DATA *room) +{ + act_to_room((void *)format.data(), (void *)room); +} + void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) { ROOM_INDEX_DATA *lRoom = ch->in_room, *eleRoom, *tRoom = nullptr; int eDir = obj->value[0], i; bool elInTransit = true; - char *mmsg; eleRoom = get_room_index(obj->value[2]); if (!eleRoom) @@ -3706,17 +3707,17 @@ void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument return; } - mmsg = talloc_string("A loud grinding noise can be heard as the gears above the lift begin to turn."); + auto mmsg = std::string("A loud grinding noise can be heard as the gears above the lift begin to turn."); eleRoom->mana_rate = 101; // ele in use if (!lRoom->exit[eDir]->u1.to_room) { // call elevator SIR! - RS.Queue.AddToQueue(2, act_to_room, mmsg, lRoom); - RS.Queue.AddToQueue(2, act_to_room, mmsg, tRoom); - RS.Queue.AddToQueue(2, act_to_room, mmsg, eleRoom); + RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, lRoom); + RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, tRoom); + RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, eleRoom); RS.Queue.AddToQueue(3, close_elevator, eleRoom); - RS.Queue.AddToQueue(5, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); - RS.Queue.AddToQueue(9, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); + RS.Queue.AddToQueue(5, act_to_room_queue, "With a lurch, the lift begins to accelerate.", eleRoom); + RS.Queue.AddToQueue(9, act_to_room_queue, "The lift shudders as it slowly comes to a halt.", eleRoom); RS.Queue.AddToQueue(10, open_elevator, eleRoom, lRoom); act("You pull the lever into the down position.", ch, 0, 0, TO_CHAR); @@ -3725,12 +3726,12 @@ void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument else if (lRoom->exit[eDir]->u1.to_room) { // elevator is here, we can send it back up tRoom = get_room_index(obj->value[1]); - RS.Queue.AddToQueue(2, act_to_room, mmsg, lRoom); - RS.Queue.AddToQueue(2, act_to_room, mmsg, tRoom); - RS.Queue.AddToQueue(2, act_to_room, mmsg, eleRoom); + RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, lRoom); + RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, tRoom); + RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, eleRoom); RS.Queue.AddToQueue(3, close_elevator, eleRoom); - RS.Queue.AddToQueue(5, act_to_room, (char *)"With a lurch, the lift begins to accelerate.", eleRoom); - RS.Queue.AddToQueue(9, act_to_room, (char *)"The lift shudders as it slowly comes to a halt.", eleRoom); + RS.Queue.AddToQueue(5, act_to_room_queue, "With a lurch, the lift begins to accelerate.", eleRoom); + RS.Queue.AddToQueue(9, act_to_room_queue, "The lift shudders as it slowly comes to a halt.", eleRoom); RS.Queue.AddToQueue(10, open_elevator, eleRoom, tRoom); act("You pull the lever into the up position.", ch, 0, 0, TO_CHAR); diff --git a/code/iprog.h b/code/iprog.h index 1becad5..a88ab6a 100644 --- a/code/iprog.h +++ b/code/iprog.h @@ -103,6 +103,7 @@ void verb_prog_roll_tablet (OBJ_DATA *obj, CHAR_DATA *ch, char *argument); void close_elevator (ROOM_INDEX_DATA *pRoom); void open_elevator (ROOM_INDEX_DATA *eleRoom, ROOM_INDEX_DATA *toRoom); void act_to_room( void *vo1, void *vo2); +void act_to_room_queue(std::string format, ROOM_INDEX_DATA *room); void verb_prog_iseldheim_lever_pull (OBJ_DATA *obj, CHAR_DATA *ch, char *argument); void fight_prog_bugzapper (OBJ_DATA *obj, CHAR_DATA *ch); void fight_prog_arms_light (OBJ_DATA *obj, CHAR_DATA *ch); diff --git a/code/mprog.c b/code/mprog.c index 5784769..c2ddf97 100644 --- a/code/mprog.c +++ b/code/mprog.c @@ -1914,7 +1914,7 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_note(mob, "+ [at the bottom of the scroll, in florid script, is a single 'I']"); do_note(mob, "send"); - RS.Queue.AddToQueue(4, send_to_char, (char *)"You feel suddenly overcome with a desire to lash out at someone verbally.\n\r", ch); + RS.Queue.AddToQueue(4, send_to_char_queue, "You feel suddenly overcome with a desire to lash out at someone verbally.\n\r", ch); ch->pcdata->lesserdata[LESSER_IPOS] = FAVOR_GRANTED; ch->pcdata->learned[skill_lookup("taunt")] = 1; @@ -1982,6 +1982,7 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) { AFFECT_DATA *paf = affect_find(mob->affected, gsn_greater_demon), af; char buf[MSL]; + std::string buffer; if (!paf || !paf->owner) return; @@ -1998,8 +1999,9 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) RS.Queue.AddToQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into your midsection as you scream involuntarily.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into $N's midsection as $E screams.", mob, nullptr, ch, TO_NOTVICT); RS.Queue.AddToQueue(3, delay_extract, mob); - RS.Queue.AddToQueue(3, send_to_char, buf, ch); - RS.Queue.AddToQueue(3, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "blue"), END_COLOR(ch)); + + buffer = fmt::format("{}A dark soul writhes within you, discomfited, and you remember your bargain.{}\n\r", get_char_color(ch, "blue"), END_COLOR(ch)); + RS.Queue.AddToQueue(3, send_to_char_queue, buffer, ch); init_affect(&af); af.where = TO_AFFECTS; @@ -2021,8 +2023,8 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("With a flourishing fanfare which seems nonetheless foreboding, $n rises.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(1, do_tell, mob, buf); - RS.Queue.AddToQueue(1, sprintf, buf, (char *)"%s You may yet live to regret your rash decision. Doubtless the seeds of realization sprout within you now.", ch->name); + buffer = fmt::format("{} You may yet live to regret your rash decision. Doubtless the seeds of realization sprout within you now.", ch->name); + RS.Queue.AddToQueue(1, do_tell_queue, mob, buffer); RS.Queue.AddToQueue(2, act_queue, "Flashing a great dark light, $n vanishes from sight.", mob, nullptr, nullptr, TO_ROOM); RS.Queue.AddToQueue(3, delay_extract, mob); @@ -2034,6 +2036,7 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) { AFFECT_DATA *paf = affect_find(mob->affected, gsn_greater_demon), af; char buf[MSL]; + std::string buffer; if (!paf || !paf->owner) return; @@ -2047,8 +2050,8 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_emote(mob, "smiles deviously, and you grow confused attempting to locate his lips."); - RS.Queue.AddToQueue(1, do_say, mob, buf); - RS.Queue.AddToQueue(1, sprintf, buf, (char *)"Very well. I shall watch over you. I require the corpse of another anti-paladin to warm my feet, %s... I trust you shall not disappoint.", ch->name); + buffer = fmt::format("Very well. I shall watch over you. I require the corpse of another anti-paladin to warm my feet, {}... I trust you shall not disappoint.", ch->name); + RS.Queue.AddToQueue(1, do_say_queue, mob, buffer); RS.Queue.AddToQueue(2, act_queue, "Before you realize what's happening, $n has planted a firm grip on your arm.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(3, act_queue, "The terrible demon's many hands begin grappling with your frame.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(5, act_queue, "A multitude of taloned fingers dig deeply into your flesh.", mob, nullptr, ch, TO_VICT); @@ -2056,8 +2059,9 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) RS.Queue.AddToQueue(8, act_queue, "You writhe in agony and pure horror as $n reaches down your throat...", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(10, act_queue, "In a few moments, $n has vanished entirely into your body.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(11, delay_extract, mob); - RS.Queue.AddToQueue(12, send_to_char, buf, ch); - RS.Queue.AddToQueue(12, sprintf, buf, (char *)"%sA dark soul writhes within you, discomfited, and you remember your bargain.%s\n\r", get_char_color(ch, "red"), END_COLOR(ch)); + + buffer = fmt::format("{}A dark soul writhes within you, discomfited, and you remember your bargain.{}\n\r", get_char_color(ch, "red"), END_COLOR(ch)); + RS.Queue.AddToQueue(12, send_to_char_queue, buffer, ch); init_affect(&af); af.where = TO_AFFECTS; @@ -2113,8 +2117,8 @@ void speech_prog_geryon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) RS.Queue.AddToQueue(6, act_queue, "You stifle a scream as the suddenness of the operation becomes realization.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(8, act_queue, "Geryon drops your left eye into a bag at his belt, still smiling.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(10, do_say_queue, mob, "That's a good lad! Do try not to cry just yet, there's nothing quite like the sting of tears in an open eye socket. Now, then...."); - RS.Queue.AddToQueue(11, send_to_char, (char *)"The warmth of suffused power tingles through your fingers.\n\r", ch); - RS.Queue.AddToQueue(12, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); + RS.Queue.AddToQueue(11, send_to_char_queue, "The warmth of suffused power tingles through your fingers.\n\r", ch); + RS.Queue.AddToQueue(12, do_emote_queue, mob, "bows deeply and disappears, leaving you alone with your dark thoughts."); RS.Queue.AddToQueue(13, delay_extract, mob); ch->pcdata->greaterdata[GREATER_GERYON] = GERYON_EYE; @@ -2136,8 +2140,8 @@ void speech_prog_geryon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) RS.Queue.AddToQueue(7, act_queue, "Geryon releases your wrist, and gouts of blood begin to pour from the wound.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(8, act_queue, "Geryon flashes his handsome smile and pushes stray hair back from his face.", mob, nullptr, ch, TO_VICT); RS.Queue.AddToQueue(10, do_say_queue, mob, "Well done, my boy. Just stop up that stump you've got, or you'll bleed to death before I've gone! Now, then..."); - RS.Queue.AddToQueue(11, send_to_char, (char *)"The warmth of suffused power tingles through your eyes.\n\r", ch); - RS.Queue.AddToQueue(12, do_emote, mob, (char *)"bows deeply and disappears, leaving you alone with your dark thoughts."); + RS.Queue.AddToQueue(11, send_to_char_queue, "The warmth of suffused power tingles through your eyes.\n\r", ch); + RS.Queue.AddToQueue(12, do_emote_queue, mob, "bows deeply and disappears, leaving you alone with your dark thoughts."); RS.Queue.AddToQueue(13, delay_extract, mob); ch->pcdata->greaterdata[GREATER_GERYON] = GERYON_FINGER; @@ -2462,7 +2466,7 @@ void greet_prog_tower_shopkeeper(CHAR_DATA *mob, CHAR_DATA *ch) act("$N glances over his shoulder at $n and grumbles.", ch, 0, mob, TO_ROOM); act("$n glances over his shoulder at you and grumbles.", mob, 0, ch, TO_VICT); RS.Queue.AddToQueue(4, do_say_queue, mob, "Well, are ye goin' to buy somethin' or are ye just going t'stand there and stare at me!?"); - RS.Queue.AddToQueue(24, do_astrip, mob, (char *)""); + RS.Queue.AddToQueue(24, do_astrip_queue, mob, ""); } void pulse_prog_wizard_summon(CHAR_DATA *mob) @@ -2916,7 +2920,6 @@ void fight_prog_law_subdue(CHAR_DATA *mob, CHAR_DATA *ch) int hydra_vnum, dragon_vnum, vnum = 0, num; ROOM_INDEX_DATA *pRoom; AFFECT_DATA af; - char buf[MSL]; float chance; switch (mob->pIndexData->vnum) @@ -3167,15 +3170,16 @@ void fight_prog_law_subdue(CHAR_DATA *mob, CHAR_DATA *ch) char_from_room(ch); char_to_room(ch, get_room_index(5)); - RS.Queue.AddToQueue(10, send_to_char, (char *)"You are dimly aware of being dragged along the ground...\n\r", ch); + RS.Queue.AddToQueue(10, send_to_char_queue, "You are dimly aware of being dragged along the ground...\n\r", ch); RS.Queue.AddToQueue(19, wake_up, ch); RS.Queue.AddToQueue(19, affect_strip, ch, gsn_subdue); RS.Queue.AddToQueue(19, char_to_room, ch, pRoom); RS.Queue.AddToQueue(19, char_from_room, ch); - RS.Queue.AddToQueue(20, send_to_char, (char *)"You are shaken awake by a fuzzy man, as seen through your own personal haze.\n\r", ch); + RS.Queue.AddToQueue(20, send_to_char_queue, "You are shaken awake by a fuzzy man, as seen through your own personal haze.\n\r", ch); RS.Queue.AddToQueue(20, act_queue, "$N comes to $S knees holding the back of $S head.", nullptr, nullptr, ch, TO_NOTVICT); - RS.Queue.AddToQueue(21, send_to_char, buf, ch); - RS.Queue.AddToQueue(21, sprintf, buf, (char *)"A Hydra trooper tells you '%sAnd stay out of Cimar, ye %s!%s'\n\r", get_char_color(ch, "tells"), get_insult(ch), END_COLOR(ch)); + + auto buffer = fmt::format("A Hydra trooper tells you '{}And stay out of Cimar, ye {}!{}'\n\r", get_char_color(ch, "tells"), get_insult(ch), END_COLOR(ch)); + RS.Queue.AddToQueue(21, send_to_char_queue, buffer, ch); } else { diff --git a/code/quest.c b/code/quest.c index d88d782..ff1e62c 100644 --- a/code/quest.c +++ b/code/quest.c @@ -467,14 +467,14 @@ void speech_prog_ilopheth_shack(ROOM_INDEX_DATA *room, CHAR_DATA *ch, char *spee do_say(mob, "So he told you my name, did he? You're here to learn, eh? They always are. Always coming, "\ "wanting what's mine. Wanting, taking, with their grubby minds and dull hands, yes."); RS.Queue.AddToQueue(5, do_say_queue, mob, "Well you can't have it!"); - RS.Queue.AddToQueue(8, do_emote, mob, (char *)"pauses for a moment and strokes his long, ragged beard."); + RS.Queue.AddToQueue(8, do_emote_queue, mob, "pauses for a moment and strokes his long, ragged beard."); RS.Queue.AddToQueue(10, do_say_queue, mob, "Unless.... Yes, yes... you can help me! Ah, my turn to grub!"); RS.Queue.AddToQueue(13, do_say_queue, mob, "Can't go out there, or they'd tear me to pieces, yes! Crack my skull open "\ "and snatch my brains and all their knowledge! But I need something...."); RS.Queue.AddToQueue(15, do_say_queue, mob, "Moss! Not just any moss. Special moss. White moss. Glows, it does."); RS.Queue.AddToQueue(17, do_say_queue, mob, "So, you'll get it for me, yes?"); - RS.Queue.AddToQueue(18, do_emote, mob, (char *)"peers at you expectantly."); + RS.Queue.AddToQueue(18, do_emote_queue, mob, "peers at you expectantly."); } break; @@ -628,7 +628,7 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) RS.Queue.AddToQueue(3, do_say_queue, mob, "This is it! You've found it! Oh yes, yes! A fine specimen indeed! Not bad for "\ "some grubber, no, no, not bad at all!"); - RS.Queue.AddToQueue(7, do_emote, mob, (char *)"pauses in his examination of the moss and peers at you."); + RS.Queue.AddToQueue(7, do_emote_queue, mob, "pauses in his examination of the moss and peers at you."); RS.Queue.AddToQueue(10, do_say_queue, mob, "Oh yes! You want me to help you. With magic, yes? Knowledge... powerful "\ "magic, perhaps you can handle it. Perhaps... perhaps not! Perhaps your head "\ @@ -639,12 +639,12 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) RS.Queue.AddToQueue(18, do_say_queue, mob, "Mysteries... no... not this one. Arcane... no. Curses of Ba... hrm, hee hee, "\ "no not that one either. Ah, here we go! Secrets of the Talismanic Powers."); - RS.Queue.AddToQueue(23, do_emote, mob, (char *)"slowly straightens and totters toward you, cradling the tome in his hands."); + RS.Queue.AddToQueue(23, do_emote_queue, mob, "slowly straightens and totters toward you, cradling the tome in his hands."); RS.Queue.AddToQueue(27, do_say_queue, mob, "Here it is... right on page... what the... grubbers! The page.. it's stolen! "\ "Gone! Vanished into thin air! You stole it! I'll kill you!"); RS.Queue.AddToQueue(31, do_say_queue, mob, "Oh, wait. No, you didn't. Yes, yes, I know. Those grubbers must've got it!"); - RS.Queue.AddToQueue(34, do_emote, mob, (char *)"waves his arms around wildly. VERY wildly. He must be seriously perturbed."); + RS.Queue.AddToQueue(34, do_emote_queue, mob, "waves his arms around wildly. VERY wildly. He must be seriously perturbed."); RS.Queue.AddToQueue(37, do_say_queue, mob, "Grubbers! Well, a secret I'll tell you. Yes, a secret! I didn't always used "\ "to live here! No no!"); @@ -665,7 +665,7 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) RS.Queue.AddToQueue(71, do_look_queue, ch, "auto"); RS.Queue.AddToQueue(71, char_to_room, ch, outside); RS.Queue.AddToQueue(71, char_from_room, ch); - RS.Queue.AddToQueue(71, do_emote, mob, (char *)"hustles you rapidly out of his shack."); + RS.Queue.AddToQueue(71, do_emote_queue, mob, "hustles you rapidly out of his shack."); ch->pcdata->quests[TALISMANIC_QUEST] = 4; return; @@ -681,8 +681,8 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) RS.Queue.AddToQueue(8, do_say_queue, mob, "Oh, wait. No you didn't. Now I can show you what I've been meaning to all this "\ "time, hee hee. I think you'll like it, oh yes you will."); - RS.Queue.AddToQueue(13, do_emote, mob, (char *)"inserts the page into the book, confirming the perfect fit with a glance."); - RS.Queue.AddToQueue(16, do_emote, mob, (char *)"totters over to your side and begins to murmur softly."); + RS.Queue.AddToQueue(13, do_emote_queue, mob, "inserts the page into the book, confirming the perfect fit with a glance."); + RS.Queue.AddToQueue(16, do_emote_queue, mob, "totters over to your side and begins to murmur softly."); RS.Queue.AddToQueue(20, do_emote, mob, (char *)"speaks with remarkable lucidity for one so seemingly deranged, guiding you "\ "through an explanation of the arcane tome."); @@ -696,11 +696,11 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) RS.Queue.AddToQueue(34, do_say_queue, mob, "Well, you've taken enough of my time. You'll have to be on your way now... I'm "\ "expecting company, hee hee!"); - RS.Queue.AddToQueue(37, do_emote, mob, (char *)"winks mischievously."); + RS.Queue.AddToQueue(37, do_emote_queue, mob, "winks mischievously."); RS.Queue.AddToQueue(40, do_look_queue, ch, "auto"); RS.Queue.AddToQueue(40, char_to_room, ch, outside); RS.Queue.AddToQueue(40, char_from_room, ch); - RS.Queue.AddToQueue(40, do_emote, mob, (char *)"hustles you rapidly out of his shack."); + RS.Queue.AddToQueue(40, do_emote_queue, mob, "hustles you rapidly out of his shack."); RS.Queue.AddToQueue(41, talismanic_reward, ch); } From 4d48c4603979dc73adb2f6843792182c513dea63 Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Mon, 9 Sep 2024 02:13:56 +0000 Subject: [PATCH 06/10] added fixes --- code/mspec.c | 10 +++------- code/quest.c | 6 +++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/code/mspec.c b/code/mspec.c index 30094cb..07783bd 100644 --- a/code/mspec.c +++ b/code/mspec.c @@ -19,6 +19,7 @@ #include "devextra.h" #include "utility.h" #include "room.h" +#include "./include/spdlog/fmt/bundled/format.h" BEGIN_MSPECS DEF_SPEC(mspec_academy_smith, TRAP_MGREET | TRAP_MGIVE | TRAP_MSPEECH) /* smith quest */ @@ -268,15 +269,10 @@ void create_academy_pet(CHAR_DATA *ch) "I can aid you in finding food, water, a boat, and a place to practice. If you need to find "\ "somewhere to fight for learning, I can help with that, as well as a few other things."); - char tbuf[MSL], *tref; - RS.Queue.AddToQueue(5, do_say_queue, mob, "To ask for my aid, direct your question to me."); - sprintf(tbuf, "%s, I need to find food.", mob->short_descr); - - tref = talloc_string(tbuf); - - RS.Queue.AddToQueue(8, do_say, ch, tref); + auto buffer = fmt::format("{}, I need to find food.", mob->short_descr); + RS.Queue.AddToQueue(8, do_say_queue, ch, buffer); } void apet_force(CHAR_DATA *ch, const char *cmd, int delay) diff --git a/code/quest.c b/code/quest.c index ff1e62c..0dad225 100644 --- a/code/quest.c +++ b/code/quest.c @@ -633,9 +633,9 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) "Oh yes! You want me to help you. With magic, yes? Knowledge... powerful "\ "magic, perhaps you can handle it. Perhaps... perhaps not! Perhaps your head "\ "will crack like a delicate little egg, hee hee!"); - RS.Queue.AddToQueue(15, do_emote, mob, - (char *)"goes over to a towering stack of books and scraps in a far corner of the shack, "\ - "and begins to rummage."); + RS.Queue.AddToQueue(15, do_emote_queue, mob, + "goes over to a towering stack of books and scraps in a far corner of the shack, "\ + "and begins to rummage."); RS.Queue.AddToQueue(18, do_say_queue, mob, "Mysteries... no... not this one. Arcane... no. Curses of Ba... hrm, hee hee, "\ "no not that one either. Ah, here we go! Secrets of the Talismanic Powers."); From aaca09899b131a292569ec096313b1dfd2582238 Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Fri, 13 Sep 2024 00:21:32 +0000 Subject: [PATCH 07/10] checkpoint --- .vscode/launch.json | 10 +- code/CMakeLists.txt | 1 + code/act_comm.c | 18 ++- code/act_move.c | 8 +- code/act_obj.c | 4 + code/act_wiz.c | 2 +- code/aprog.c | 8 +- code/characterClasses/ap.c | 156 +++++++++++++------------- code/characterClasses/chrono.c | 2 +- code/characterClasses/druid.c | 16 +-- code/characterClasses/necro.c | 34 +++--- code/characterClasses/sorcerer.c | 12 +- code/characterClasses/warrior.c | 6 +- code/comm.c | 2 +- code/iprog.c | 114 +++++++++---------- code/magic.c | 4 +- code/mprog.c | 182 +++++++++++++++---------------- code/mspec.c | 47 ++++---- code/newmem.c | 2 +- code/prof.c | 16 +-- code/quest.c | 122 ++++++++++----------- code/queue.c | 135 +++++++++++++++++++++++ code/queue.h | 85 +++++---------- tests/queue_tests.c | 25 ++++- 24 files changed, 585 insertions(+), 426 deletions(-) create mode 100644 code/queue.c diff --git a/.vscode/launch.json b/.vscode/launch.json index a99c38f..6b37b92 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,10 +10,16 @@ "stopAtEntry": false, "cwd": "${workspaceRoot}/code/", "environment": [], - "externalConsole": true, + //"externalConsole": true, // "miDebuggerPath": "/bin", "linux": { - "MIMode": "gdb" + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [{ + "text": "-enable-pretty-printing", + "description": "enable pretty printing", + "ignoreFailures": true + }] }, "osx": { "MIMode": "lldb" diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 6736ed2..50e5224 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -34,6 +34,7 @@ set(RIFT_SOURCE config.cpp skills.c tables.c update.c + queue.c tattoo.c dioextra.c cabal.c diff --git a/code/act_comm.c b/code/act_comm.c index be0c87b..c281c1a 100644 --- a/code/act_comm.c +++ b/code/act_comm.c @@ -658,6 +658,8 @@ const char *lowstring(const char *i) /// void do_say(CHAR_DATA *ch, char *argument) { +// RS.Logger.Info("entered do_say args => {}", argument); + if (argument[0] == '\0') { send_to_char("Say what?\n\r", ch); @@ -665,6 +667,8 @@ void do_say(CHAR_DATA *ch, char *argument) } check_ooc(ch, argument, "SAY"); +// RS.Logger.Info("entered do_say args region"); + #pragma region Reasons you should not be able to talk if (is_affected(ch, gsn_silence)) { @@ -713,6 +717,8 @@ void do_say(CHAR_DATA *ch, char *argument) return; } +// RS.Logger.Info("entered do_say args build buffer"); + char saymsg[MAX_STRING_LENGTH]; if (argument[strlen(argument) - 1] == '!') sprintf(saymsg, "exclaim"); @@ -724,6 +730,8 @@ void do_say(CHAR_DATA *ch, char *argument) auto buffer = fmt::format("You {} '{}$T{}'", saymsg, get_char_color(ch, "speech"), END_COLOR(ch)); act(buffer.c_str(), ch, nullptr, argument, TO_CHAR); +// RS.Logger.Info("entered do_say args loop 1"); + for (auto victim = ch->in_room->people; victim != nullptr; victim = victim->next_in_room) { if (is_awake(victim)) @@ -743,6 +751,8 @@ void do_say(CHAR_DATA *ch, char *argument) } } +// RS.Logger.Info("entered do_say args loop 2"); + if (IS_SET(ch->in_room->progtypes, RPROG_SPEECH)) ch->in_room->rprogs->speech_prog(ch->in_room, ch, argument); @@ -755,6 +765,8 @@ void do_say(CHAR_DATA *ch, char *argument) CALL_MEVENT(room_char, TRAP_MSPEECH, ch, room_char, argument); } +// RS.Logger.Info("entered do_say args loop 3"); + report_cabal_items(ch, argument); if (is_affected(ch, gsn_unholy_communion) && (ch->Class()->name == "anti-paladin")) @@ -769,6 +781,8 @@ void do_say(CHAR_DATA *ch, char *argument) CALL_IEVENT(char_obj, TRAP_ISPEECH, ch, char_obj, argument); } +// RS.Logger.Info("entered do_say args loop 4"); + for (auto char_obj = ch->in_room->contents; char_obj != nullptr; char_obj = char_obj->next_content) { if (IS_SET(char_obj->progtypes, IPROG_SPEECH) && char_obj->pIndexData->iprogs) @@ -781,6 +795,7 @@ void do_say(CHAR_DATA *ch, char *argument) void do_say_queue(CHAR_DATA *ch, std::string argument) { + RS.Logger.Info("entered do_say_queue args => {}", argument); do_say(ch, argument.data()); } @@ -2617,8 +2632,7 @@ void speech_handler(CHAR_DATA *ch, CHAR_DATA *mob, SPEECH_DATA *speech) return; } - //RS.Queue.AddToQueue(speech->current_line->delay, 3, speech_handler, ch, mob, speech); - RS.Queue.AddToQueue(speech->current_line->delay, speech_handler, ch, mob, speech); + RS.Queue.AddToQueue(speech->current_line->delay, "speech_handler", "speech_handler", speech_handler, ch, mob, speech); } /* diff --git a/code/act_move.c b/code/act_move.c index d673775..e61636a 100644 --- a/code/act_move.c +++ b/code/act_move.c @@ -1002,7 +1002,7 @@ void move_char(CHAR_DATA *ch, int door, bool automatic, bool fcharm) if (td != nullptr && td->trap && td->trap->armed && ch->Profs()->ProfEffect("trap detecting") >= td->trap->quality) { - RS.Queue.AddToQueue(1, send_to_char, "Something about your surroundings suddenly makes you feel wary.\n\r", ch); + RS.Queue.AddToQueue(1, "move_char", "send_to_char_queue", send_to_char_queue, "Something about your surroundings suddenly makes you feel wary.\n\r", ch); break; } } @@ -1048,7 +1048,7 @@ void move_char(CHAR_DATA *ch, int door, bool automatic, bool fcharm) } else if (is_npc(fch) && fch->last_fought == ch) { - RS.Queue.AddToQueue((number_percent() > 25) ? 1 : 2, track_attack, fch, ch); + RS.Queue.AddToQueue((number_percent() > 25) ? 1 : 2, "move_char", "track_attack", track_attack, fch, ch); } /* Greet trigger for mobs */ @@ -1215,7 +1215,7 @@ void trip_trap(CHAR_DATA *ch, ROOM_INDEX_DATA *room, TRAP_DATA *trap) if (ch->Profs()->GetProf("trap detecting") / 2 >= trap->quality) { ch->Profs()->CheckImprove("trap detecting", 400); - RS.Queue.AddToQueue(1, send_to_char, "As you carefully advance, you spot a trap and quickly sidestep it!\n\r", ch); + RS.Queue.AddToQueue(1, "trip_trap", "send_to_char_queue", send_to_char_queue, "As you carefully advance, you spot a trap and quickly sidestep it!\n\r", ch); return; } else @@ -1229,7 +1229,7 @@ void trip_trap(CHAR_DATA *ch, ROOM_INDEX_DATA *room, TRAP_DATA *trap) if (trap->timer) { act(trap->trig_echo, ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(trap->timer, trap_execute, nullptr, room, trap); + RS.Queue.AddToQueue(trap->timer, "do_down", "trap_execute", trap_execute, nullptr, room, trap); } else { diff --git a/code/act_obj.c b/code/act_obj.c index 1001125..eeb6f36 100644 --- a/code/act_obj.c +++ b/code/act_obj.c @@ -2906,6 +2906,8 @@ void do_quaff(CHAR_DATA *ch, char *argument) if (!check_deny_magic(ch)) { RS.Queue.AddToQueue(nDelay, + "do_quaff", + "quaff_potion", quaff_potion, ch, obj->value[0], @@ -2949,6 +2951,8 @@ void do_quaff(CHAR_DATA *ch, char *argument) if (!check_deny_magic(ch)) { RS.Queue.AddToQueue(nDelay, + "do_quaff", + "quaff_potion", quaff_potion, ch, obj->value[0], diff --git a/code/act_wiz.c b/code/act_wiz.c index 81c2264..bc25237 100644 --- a/code/act_wiz.c +++ b/code/act_wiz.c @@ -3454,7 +3454,7 @@ void start_reboot(CHAR_DATA *ch) do_echo(ch, buf); reboot_num--; - RS.Queue.AddToQueue(60, start_reboot, ch); + RS.Queue.AddToQueue(60, "start_reboot", "start_reboot", start_reboot, ch); } } } diff --git a/code/aprog.c b/code/aprog.c index a90a5c1..70b8d30 100644 --- a/code/aprog.c +++ b/code/aprog.c @@ -282,8 +282,8 @@ void tick_prog_ilopheth(AREA_DATA *area) END_COLOR(pedroom->people)); act(buf, pedroom->people, 0, 0, TO_ALL); - RS.Queue.AddToQueue(4, act_queue, "The opacity of the crystal sphere appears to fade, and it begins to glow a brilliant white!", pedroom->people, nullptr, nullptr, TO_ALL); - RS.Queue.AddToQueue(7, act_queue, "To the northwest, an immense pillar of light ascends from the forest into the heavens!", pedroom->people, nullptr, nullptr, TO_ALL); + RS.Queue.AddToQueue(4, "tick_prog_ilopheth", "act_queue", act_queue, "The opacity of the crystal sphere appears to fade, and it begins to glow a brilliant white!", pedroom->people, nullptr, nullptr, TO_ALL); + RS.Queue.AddToQueue(7, "tick_prog_ilopheth", "act_queue", act_queue, "To the northwest, an immense pillar of light ascends from the forest into the heavens!", pedroom->people, nullptr, nullptr, TO_ALL); } for (obj = portroom->contents; obj; obj = obj->next_content) @@ -416,10 +416,10 @@ void sun_prog_ilopheth(AREA_DATA *area) switch (sun) { case SolarPosition::Sunrise: - RS.Queue.AddToQueue(15, zone_echo_queue, area, "With the beginning of the day sounds of life fill the valley, as the forest comes alive."); + RS.Queue.AddToQueue(15, "sun_prog_ilopheth", "zone_echo_queue", zone_echo_queue, area, "With the beginning of the day sounds of life fill the valley, as the forest comes alive."); break; case SolarPosition::Sunset: - RS.Queue.AddToQueue(15, zone_echo_queue, area, "The forest grows still, as the night sky settles over the valley."); + RS.Queue.AddToQueue(15, "sun_prog_ilopheth", "zone_echo_queue", zone_echo_queue, area, "The forest grows still, as the night sky settles over the valley."); break; } } diff --git a/code/characterClasses/ap.c b/code/characterClasses/ap.c index 9d192ec..d9e374c 100644 --- a/code/characterClasses/ap.c +++ b/code/characterClasses/ap.c @@ -713,7 +713,7 @@ void command_execute(CHAR_DATA *ch) sprintf(buf, "An irresistible urge forces you to '%s'.\n\r", ch->pcdata->command[1]); send_to_char(buf, ch); - RS.Queue.AddToQueue(1, command_execute_delay, ch, ch->pcdata->command[1]); + RS.Queue.AddToQueue(1, "command_execute", "command_execute_delay", command_execute_delay, ch, ch->pcdata->command[1]); WAIT_STATE(ch, PULSE_PER_SECOND + 1); @@ -1283,7 +1283,7 @@ void check_unholy_communion(CHAR_DATA *ch, char *argument) act("As the name of the $t demon escapes your lips, the shadows writhe violently.", ch, (type == LESSER_DEMON) ? "lesser" : "greater", 0, TO_CHAR); - RS.Queue.AddToQueue(2, act_queue, "A sonorous throbbing fills your surroundings, and then all is deathly silent.", ch, nullptr, nullptr, TO_ALL); + RS.Queue.AddToQueue(2, "check_unholy_communion", "act_queue", act_queue, "A sonorous throbbing fills your surroundings, and then all is deathly silent.", ch, nullptr, nullptr, TO_ALL); affect_remove(ch, af); @@ -1293,7 +1293,7 @@ void check_unholy_communion(CHAR_DATA *ch, char *argument) *typeptr = type; *demonptr = demon; - RS.Queue.AddToQueue(3, demon_appear, ch, demonptr, typeptr); + RS.Queue.AddToQueue(3, "check_unholy_communion", "demon_appear", demon_appear, ch, demonptr, typeptr); } void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) @@ -1383,58 +1383,58 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) switch (demon) { case LESSER_BARBAS: - RS.Queue.AddToQueue(2, do_emote_queue, mob, "roars with anger and beats his meaty fists against his chest!"); - RS.Queue.AddToQueue(4, act_queue, "Still growling, $N peers toward you with a sneering rictus of despite.", ch, nullptr, mob, TO_CHAR); - RS.Queue.AddToQueue(6, do_say_queue, mob, "Summon me, you fool? Summon ME!?"); - RS.Queue.AddToQueue(8, do_say_queue, mob, "I'll bet me reputation an' a slice o' me power that I'm about ta beat you senseless!"); - RS.Queue.AddToQueue(10, do_murder, mob, ch->name); - RS.Queue.AddToQueue(10, act_queue, "With a feral leap and a scream, $N is suddenly upon you!", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(2, "demon_appear", "do_emote_queue", do_emote_queue, mob, "roars with anger and beats his meaty fists against his chest!"); + RS.Queue.AddToQueue(4, "demon_appear", "act_queue", act_queue, "Still growling, $N peers toward you with a sneering rictus of despite.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(6, "demon_appear", "do_say_queue", do_say_queue, mob, "Summon me, you fool? Summon ME!?"); + RS.Queue.AddToQueue(8, "demon_appear", "do_say_queue", do_say_queue, mob, "I'll bet me reputation an' a slice o' me power that I'm about ta beat you senseless!"); + RS.Queue.AddToQueue(10, "demon_appear", "do_murder", do_murder, mob, ch->name); + RS.Queue.AddToQueue(10, "demon_appear", "act_queue", act_queue, "With a feral leap and a scream, $N is suddenly upon you!", ch, nullptr, mob, TO_CHAR); af.duration = -1; affect_to_char(mob, &af); break; case LESSER_AAMON: WAIT_STATE(ch, 5 * PULSE_VIOLENCE); - RS.Queue.AddToQueue(2, do_emote_queue, mob, "twitches violently as he stares around, bewildered."); - RS.Queue.AddToQueue(4, do_whisper_queue, mob, "And where am I now, precisely?"); - RS.Queue.AddToQueue(6, act_queue, "Jerking suddenly as if to watch in all directions at once, the demon spins.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(8, do_say_queue, mob, "You've summoned me! And now you will answer my riddle, yes!"); - RS.Queue.AddToQueue(10, do_emote_queue, mob, "clears his throat and glances around pensively."); - RS.Queue.AddToQueue(12, do_say_queue, mob, "Most often by hoes and by gardeners I'm chased, "); - RS.Queue.AddToQueue(13, do_say_queue, mob, "They cut off my head and then smash it to paste;"); - RS.Queue.AddToQueue(14, do_say_queue, mob, "Against them, however, my body is braced, "); - RS.Queue.AddToQueue(15, do_say_queue, mob, "For always I'm growing due south of the waist."); - RS.Queue.AddToQueue(16, do_say_queue, mob, "Now then... what am I?"); + RS.Queue.AddToQueue(2, "demon_appear", "do_emote_queue", do_emote_queue, mob, "twitches violently as he stares around, bewildered."); + RS.Queue.AddToQueue(4, "demon_appear", "do_whisper_queue", do_whisper_queue, mob, "And where am I now, precisely?"); + RS.Queue.AddToQueue(6, "demon_appear", "act_queue", act_queue, "Jerking suddenly as if to watch in all directions at once, the demon spins.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, "demon_appear", "do_say_queue", do_say_queue, mob, "You've summoned me! And now you will answer my riddle, yes!"); + RS.Queue.AddToQueue(10, "demon_appear", "do_emote_queue", do_emote_queue, mob, "clears his throat and glances around pensively."); + RS.Queue.AddToQueue(12, "demon_appear", "do_say_queue", do_say_queue, mob, "Most often by hoes and by gardeners I'm chased, "); + RS.Queue.AddToQueue(13, "demon_appear", "do_say_queue", do_say_queue, mob, "They cut off my head and then smash it to paste;"); + RS.Queue.AddToQueue(14, "demon_appear", "do_say_queue", do_say_queue, mob, "Against them, however, my body is braced, "); + RS.Queue.AddToQueue(15, "demon_appear", "do_say_queue", do_say_queue, mob, "For always I'm growing due south of the waist."); + RS.Queue.AddToQueue(16, "demon_appear", "do_say_queue", do_say_queue, mob, "Now then... what am I?"); af.duration = 8; af.modifier = 0; affect_to_char(mob, &af); break; case LESSER_MALAPHAR: - RS.Queue.AddToQueue(2, do_emote_queue, mob, "'s eyes light up as he realizes where he is."); - RS.Queue.AddToQueue(4, do_say_queue, mob, "My friend! My friend, my patron, my emptor!"); - RS.Queue.AddToQueue(6, act_queue, "Malaphar sidles up to you, and with a conspiratorial wink, waves his hand.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(8, do_whisper_queue, mob, "I have something... something in which you would most undoubtedly be interested."); - RS.Queue.AddToQueue(10, do_say_queue, mob, "Sale or trade only, I'm afraid, no credit. And don't waste my time offering me paltry trifles."); + RS.Queue.AddToQueue(2, "demon_appear", "do_emote_queue", do_emote_queue, mob, "'s eyes light up as he realizes where he is."); + RS.Queue.AddToQueue(4, "demon_appear", "do_say_queue", do_say_queue, mob, "My friend! My friend, my patron, my emptor!"); + RS.Queue.AddToQueue(6, "demon_appear", "act_queue", act_queue, "Malaphar sidles up to you, and with a conspiratorial wink, waves his hand.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(8, "demon_appear", "do_whisper_queue", do_whisper_queue, mob, "I have something... something in which you would most undoubtedly be interested."); + RS.Queue.AddToQueue(10, "demon_appear", "do_say_queue", do_say_queue, mob, "Sale or trade only, I'm afraid, no credit. And don't waste my time offering me paltry trifles."); af.duration = 7; affect_to_char(mob, &af); break; case LESSER_FURCAS: - RS.Queue.AddToQueue(2, do_emote_queue, mob, "appears shocked, and he winces away from you automatically."); - RS.Queue.AddToQueue(4, act_queue, "Pawing his way around you, viewing you from all angles, Furcas blinks.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(6, do_whisper_queue, mob, "...can it find us? We think it cannot. We hope it tries its hardest."); - RS.Queue.AddToQueue(8, act_queue, "Suddenly, you blink and Furcas has vanished, leaving a cold sniff in the air!", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(9, furcas_vanish, ch, mob); + RS.Queue.AddToQueue(2, "demon_appear", "do_emote_queue", do_emote_queue, mob, "appears shocked, and he winces away from you automatically."); + RS.Queue.AddToQueue(4, "demon_appear", "act_queue", act_queue, "Pawing his way around you, viewing you from all angles, Furcas blinks.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(6, "demon_appear", "do_whisper_queue", do_whisper_queue, mob, "...can it find us? We think it cannot. We hope it tries its hardest."); + RS.Queue.AddToQueue(8, "demon_appear", "act_queue", act_queue, "Suddenly, you blink and Furcas has vanished, leaving a cold sniff in the air!", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(9, "demon_appear", "furcas_vanish", furcas_vanish, ch, mob); af.duration = 24; affect_to_char(mob, &af); break; case LESSER_IPOS: - RS.Queue.AddToQueue(2, act_queue, "$n, still steaming, looks around him with a small smile on his face.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(4, act_queue, "His gaze settles upon you, and his smile broadens to a genuine grin.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(6, do_say_queue, mob, "Greetings my rageful, irascible friend! The time for your fury has come to an end."); - RS.Queue.AddToQueue(7, do_say_queue, mob, "For a moment at least, for you see, I am weary of warriors bleak and dark paladins dreary."); - RS.Queue.AddToQueue(8, do_say_queue, mob, "Instead, it's my wish as I put pen to paper, that you'll indulge me with a frolicsome caper."); - RS.Queue.AddToQueue(9, do_say_queue, mob, "Be mindful, my ears are accustomed to rhymes; I hope you are willing to speak me four lines...."); - RS.Queue.AddToQueue(10, do_emote_queue, mob, "thrusts forward, anticipating your poem with an evil gleam in his eye."); + RS.Queue.AddToQueue(2, "demon_appear", "act_queue", act_queue, "$n, still steaming, looks around him with a small smile on his face.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(4, "demon_appear", "act_queue", act_queue, "His gaze settles upon you, and his smile broadens to a genuine grin.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(6, "demon_appear", "do_say_queue", do_say_queue, mob, "Greetings my rageful, irascible friend! The time for your fury has come to an end."); + RS.Queue.AddToQueue(7, "demon_appear", "do_say_queue", do_say_queue, mob, "For a moment at least, for you see, I am weary of warriors bleak and dark paladins dreary."); + RS.Queue.AddToQueue(8, "demon_appear", "do_say_queue", do_say_queue, mob, "Instead, it's my wish as I put pen to paper, that you'll indulge me with a frolicsome caper."); + RS.Queue.AddToQueue(9, "demon_appear", "do_say_queue", do_say_queue, mob, "Be mindful, my ears are accustomed to rhymes; I hope you are willing to speak me four lines...."); + RS.Queue.AddToQueue(10, "demon_appear", "do_emote_queue", do_emote_queue, mob, "thrusts forward, anticipating your poem with an evil gleam in his eye."); af.modifier = 0; af.duration = 8; affect_to_char(mob, &af); @@ -1457,65 +1457,65 @@ void demon_appear(CHAR_DATA *ch, int *demonptr, int *typeptr) switch (demon) { case GREATER_OZE: - RS.Queue.AddToQueue(2, do_emote_queue, mob, "nearly collapses as he doubles over in sudden agony, howling pitifully."); - RS.Queue.AddToQueue(3, do_say_queue, mob, "What have you done...? What have you DONE?"); - RS.Queue.AddToQueue(4, act_queue, "Blubbering like a child, $n slowly composes $mself and rises to $s \"feet.\"", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(6, act_queue, "$e points a hideously deformed arm toward you, dripping blood and bits of sinew.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(8, do_say_queue, mob, "I charge you, mortal, with returning me to the abyss. I have been plucked from a place... a place from whence I should not have been plucked."); - RS.Queue.AddToQueue(10, do_emote_queue, mob, "shudders slightly before continuing."); - RS.Queue.AddToQueue(11, do_say_queue, mob, "I require your blood, meddler, in order that I might survive long enough to return.... Speak the words, whelp. Yes or no?"); + RS.Queue.AddToQueue(2, "demon_appear", "do_emote_queue", do_emote_queue, mob, "nearly collapses as he doubles over in sudden agony, howling pitifully."); + RS.Queue.AddToQueue(3, "demon_appear", "do_say_queue", do_say_queue, mob, "What have you done...? What have you DONE?"); + RS.Queue.AddToQueue(4, "demon_appear", "act_queue", act_queue, "Blubbering like a child, $n slowly composes $mself and rises to $s \"feet.\"", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(6, "demon_appear", "act_queue", act_queue, "$e points a hideously deformed arm toward you, dripping blood and bits of sinew.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, "demon_appear", "do_say_queue", do_say_queue, mob, "I charge you, mortal, with returning me to the abyss. I have been plucked from a place... a place from whence I should not have been plucked."); + RS.Queue.AddToQueue(10, "demon_appear", "do_emote_queue", do_emote_queue, mob, "shudders slightly before continuing."); + RS.Queue.AddToQueue(11, "demon_appear", "do_say_queue", do_say_queue, mob, "I require your blood, meddler, in order that I might survive long enough to return.... Speak the words, whelp. Yes or no?"); af.duration = 6; affect_to_char(mob, &af); break; case GREATER_GAMYGYN: - RS.Queue.AddToQueue(2, act_queue, "The undulating, shimmering form before you rings with unearthly sound.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(4, act_queue, "Swooping toward your face, $n seems to peer directly into your eyes.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, "demon_appear", "act_queue", act_queue, "The undulating, shimmering form before you rings with unearthly sound.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(4, "demon_appear", "act_queue", act_queue, "Swooping toward your face, $n seems to peer directly into your eyes.", mob, nullptr, nullptr, TO_ROOM); buffer = fmt::format("{} I see you, mortal.", ch->name); - RS.Queue.AddToQueue(6, do_tell_queue, mob, buffer); - RS.Queue.AddToQueue(6, act_queue, "A sudden voice echoes unsettlingly in your mind:", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(7, act_queue, "You wince involuntarily, pictures of transactions gone wrong in your mind's eye.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, "demon_appear", "do_tell_queue", do_tell_queue, mob, buffer); + RS.Queue.AddToQueue(6, "demon_appear", "act_queue", act_queue, "A sudden voice echoes unsettlingly in your mind:", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(7, "demon_appear", "act_queue", act_queue, "You wince involuntarily, pictures of transactions gone wrong in your mind's eye.", mob, nullptr, ch, TO_VICT); buffer = fmt::format("{} I will not devour you; you may yet entertain me. Rewards shall be yours if you provide me with the dead flesh of one of your aberrant lightwalking kin. Do you submit yourself to my desire?", ch->name); - RS.Queue.AddToQueue(9, do_tell_queue, mob, buffer); + RS.Queue.AddToQueue(9, "demon_appear", "do_tell_queue", do_tell_queue, mob, buffer); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_OROBAS: - RS.Queue.AddToQueue(2, act_queue, "Orobas' many faces stare around the area, nonplussed by your summoning.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(4, do_say_queue, mob, "I see."); - RS.Queue.AddToQueue(6, act_queue, "A great howling sound boils into existence as Orobas' limbs flail wildly!", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(8, do_say_queue, mob, "I am displeased to be here."); - RS.Queue.AddToQueue(9, do_say_queue, mob, "You will do my bidding, mortal, or I shall inform the abyss of your grievous error at once."); - RS.Queue.AddToQueue(10, act_queue, "The choir of blurred and screaming heads reaches a new pitch of fervor.", mob, nullptr, nullptr, TO_ALL); - RS.Queue.AddToQueue(12, do_whisper_queue, mob, "Speak now, or forever mourn your decision. Do you submit?"); + RS.Queue.AddToQueue(2, "demon_appear", "act_queue", act_queue, "Orobas' many faces stare around the area, nonplussed by your summoning.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(4, "demon_appear", "do_say_queue", do_say_queue, mob, "I see."); + RS.Queue.AddToQueue(6, "demon_appear", "act_queue", act_queue, "A great howling sound boils into existence as Orobas' limbs flail wildly!", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, "demon_appear", "do_say_queue", do_say_queue, mob, "I am displeased to be here."); + RS.Queue.AddToQueue(9, "demon_appear", "do_say_queue", do_say_queue, mob, "You will do my bidding, mortal, or I shall inform the abyss of your grievous error at once."); + RS.Queue.AddToQueue(10, "demon_appear", "act_queue", act_queue, "The choir of blurred and screaming heads reaches a new pitch of fervor.", mob, nullptr, nullptr, TO_ALL); + RS.Queue.AddToQueue(12, "demon_appear", "do_whisper_queue", do_whisper_queue, mob, "Speak now, or forever mourn your decision. Do you submit?"); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_GERYON: - RS.Queue.AddToQueue(2, do_emote_queue, mob, "smiles pleasantly, extending a cool, dry hand to shake your own."); - RS.Queue.AddToQueue(4, do_say_queue, mob, "It's wonderful to be back here, I must say. It's been far too long. Who was the last fellow? Ah, yes...."); - RS.Queue.AddToQueue(5, do_emote_queue, mob, "seems to finger something in his pocket, his eyes alight with pleasure."); - RS.Queue.AddToQueue(6, act_queue, "An uncomfortable sensation crawls over you as you eye this well-dressed demon.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(8, do_say_queue, mob, "But enough of my reminiscing! I imagine you have something you wanted to discuss, yes? Power, no doubt!"); - RS.Queue.AddToQueue(10, do_emote_queue, mob, "'s smile expands to a wider grin, and his eyes flicker red for a moment."); - RS.Queue.AddToQueue(11, act_queue, "...though it may have been a trick of the light.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(12, do_say_queue, mob, "So, to business. What shall it be, then? An eye or a finger?"); + RS.Queue.AddToQueue(2, "demon_appear", "do_emote_queue", do_emote_queue, mob, "smiles pleasantly, extending a cool, dry hand to shake your own."); + RS.Queue.AddToQueue(4, "demon_appear", "do_say_queue", do_say_queue, mob, "It's wonderful to be back here, I must say. It's been far too long. Who was the last fellow? Ah, yes...."); + RS.Queue.AddToQueue(5, "demon_appear", "do_emote_queue", do_emote_queue, mob, "seems to finger something in his pocket, his eyes alight with pleasure."); + RS.Queue.AddToQueue(6, "demon_appear", "act_queue", act_queue, "An uncomfortable sensation crawls over you as you eye this well-dressed demon.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, "demon_appear", "do_say_queue", do_say_queue, mob, "But enough of my reminiscing! I imagine you have something you wanted to discuss, yes? Power, no doubt!"); + RS.Queue.AddToQueue(10, "demon_appear", "do_emote_queue", do_emote_queue, mob, "'s smile expands to a wider grin, and his eyes flicker red for a moment."); + RS.Queue.AddToQueue(11, "demon_appear", "act_queue", act_queue, "...though it may have been a trick of the light.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(12, "demon_appear", "do_say_queue", do_say_queue, mob, "So, to business. What shall it be, then? An eye or a finger?"); af.duration = 5; affect_to_char(mob, &af); break; case GREATER_CIMERIES: WAIT_STATE(ch, 5 * PULSE_VIOLENCE); - RS.Queue.AddToQueue(2, do_emote_queue, mob, "rises to his feet, and in a sudden panic attempts to flee by air."); - RS.Queue.AddToQueue(3, act_queue, "The greater demon's pathetic wings, completely impotent, flap helplessly.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(4, act_queue, "You stave off a pang of guilt at having summoned this massive beast to flounder.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(6, act_queue, "Your misplaced guilt quickly turns to fear as Cimeries rounds on you savagely!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(7, act_queue, "Before you can react, Cimeries has clamped your head between two massive claws!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(9, act_queue, "You gasp in pain, blood running down your face, as his talons pierce your nose and ear!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(10, act_queue, "$n speaks in a low grunting language, and you cannot understand a word.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(11, act_queue, "$n tugs harshly on your ear and nose in turn, eliciting another gasp of pain.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(13, act_queue, "Suddenly, his cruel choice for you becomes clear: ear or nose?", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(15, act_queue, "A shiver runs down your spine while you contemplate your fate.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(2, "demon_appear", "do_emote_queue", do_emote_queue, mob, "rises to his feet, and in a sudden panic attempts to flee by air."); + RS.Queue.AddToQueue(3, "demon_appear", "act_queue", act_queue, "The greater demon's pathetic wings, completely impotent, flap helplessly.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(4, "demon_appear", "act_queue", act_queue, "You stave off a pang of guilt at having summoned this massive beast to flounder.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, "demon_appear", "act_queue", act_queue, "Your misplaced guilt quickly turns to fear as Cimeries rounds on you savagely!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(7, "demon_appear", "act_queue", act_queue, "Before you can react, Cimeries has clamped your head between two massive claws!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(9, "demon_appear", "act_queue", act_queue, "You gasp in pain, blood running down your face, as his talons pierce your nose and ear!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(10, "demon_appear", "act_queue", act_queue, "$n speaks in a low grunting language, and you cannot understand a word.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(11, "demon_appear", "act_queue", act_queue, "$n tugs harshly on your ear and nose in turn, eliciting another gasp of pain.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(13, "demon_appear", "act_queue", act_queue, "Suddenly, his cruel choice for you becomes clear: ear or nose?", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(15, "demon_appear", "act_queue", act_queue, "A shiver runs down your spine while you contemplate your fate.", mob, nullptr, ch, TO_VICT); af.duration = 4; affect_to_char(mob, &af); break; @@ -1567,9 +1567,9 @@ void lesser_demon_tick(CHAR_DATA *mob, AFFECT_DATA *af) if (af->duration == 1) { do_emote(mob, "laughs giddily and whirls to leave."); - RS.Queue.AddToQueue(1, do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts. You'll never know the answer to my riddle."); - RS.Queue.AddToQueue(2, act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(1, "lesser_demon_tick", "do_say_queue", do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts. You'll never know the answer to my riddle."); + RS.Queue.AddToQueue(2, "lesser_demon_tick", "act_queue", act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, "lesser_demon_tick", "delay_extract", delay_extract, mob); break; } case MOB_VNUM_MALAPHAR: @@ -2152,7 +2152,7 @@ void do_breath_mephisto(CHAR_DATA *ch, char *argument) act("You begin building up the intense cold within you.", ch, 0, 0, TO_CHAR); act("$n's skin shifts to a shade of blue.", ch, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(3, mephisto_two, ch, victim, argument); + RS.Queue.AddToQueue(3, "do_breath_mephisto", "mephisto_two", mephisto_two, ch, victim, argument); } void mephisto_two(CHAR_DATA *ch, CHAR_DATA *victim, char *argument) diff --git a/code/characterClasses/chrono.c b/code/characterClasses/chrono.c index e20cbe8..ffdbcac 100644 --- a/code/characterClasses/chrono.c +++ b/code/characterClasses/chrono.c @@ -88,7 +88,7 @@ void spell_stasis_wall(int sn, int level, CHAR_DATA *ch, void *vo, int target) usually make sure the lag on the rune is at least as long as the lag on the draw_rune queue */ - RS.Queue.AddToQueue(9, draw_rune_queue, rune, rune->owner); + RS.Queue.AddToQueue(9, "spell_stasis_wall", "draw_rune_queue", draw_rune_queue, rune, rune->owner); } bool trigger_stasis_wall(void *vo, void *vo2, void *vo3, void *vo4) diff --git a/code/characterClasses/druid.c b/code/characterClasses/druid.c index 6a057ac..b0c8b9b 100644 --- a/code/characterClasses/druid.c +++ b/code/characterClasses/druid.c @@ -100,15 +100,15 @@ void spell_tangleroot(int sn, int level, CHAR_DATA *ch, void *vo, int target) if (number_percent() > 10) { - RS.Queue.AddToQueue(2, LAG_CHAR, victim, (2 * PULSE_VIOLENCE)); - RS.Queue.AddToQueue(2, damage_queued, ch, victim, dam, DAM_BASH, HIT_UNBLOCKABLE, HIT_NOADD, HIT_NOMULT, "entangling roots*"); - RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_NOTVICT); - RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles you!", ch, nullptr, victim, TO_VICT); - RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_CHAR); + RS.Queue.AddToQueue(2, "spell_tangleroot", "LAG_CHAR", LAG_CHAR, victim, (2 * PULSE_VIOLENCE)); + RS.Queue.AddToQueue(2, "spell_tangleroot", "damaged_queued", damage_queued, ch, victim, dam, DAM_BASH, HIT_UNBLOCKABLE, HIT_NOADD, HIT_NOMULT, "entangling roots*"); + RS.Queue.AddToQueue(2, "spell_tangleroot", "act_queue", act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_NOTVICT); + RS.Queue.AddToQueue(2, "spell_tangleroot", "act_queue", act_queue, "A tangleroot bursts out of the ground and entangles you!", ch, nullptr, victim, TO_VICT); + RS.Queue.AddToQueue(2, "spell_tangleroot", "act_queue", act_queue, "A tangleroot bursts out of the ground and entangles $N!", ch, nullptr, victim, TO_CHAR); return; } - RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_NOTVICT); - RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground, but you manage to avoid it!", ch, nullptr, victim, TO_VICT); - RS.Queue.AddToQueue(2, act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_CHAR); + RS.Queue.AddToQueue(2, "spell_tangleroot", "act_queue", act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_NOTVICT); + RS.Queue.AddToQueue(2, "spell_tangleroot", "act_queue", act_queue, "A tangleroot bursts out of the ground, but you manage to avoid it!", ch, nullptr, victim, TO_VICT); + RS.Queue.AddToQueue(2, "spell_tangleroot", "act_queue", act_queue, "A tangleroot bursts out of the ground, but $N avoids it!", ch, nullptr, victim, TO_CHAR); } diff --git a/code/characterClasses/necro.c b/code/characterClasses/necro.c index b03229f..474ef1d 100644 --- a/code/characterClasses/necro.c +++ b/code/characterClasses/necro.c @@ -82,16 +82,16 @@ void spell_dark_vessel(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n plunges a hand into $p's chest cavity, and removes the heart.", ch, corpse, 0, TO_ROOM); - RS.Queue.AddToQueue(2, act_queue, "$n holds the heart aloft as it visibly begins to harden.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, "spell_dark_vessel", "act_queue", act_queue, "$n holds the heart aloft as it visibly begins to harden.", ch, nullptr, nullptr, TO_ROOM); send_to_char("You remove the corpse's heart and squeeze the blood out of it, hardening it into a solid object.\n\r", ch); - RS.Queue.AddToQueue(4, make_urn, ch, corpse); + RS.Queue.AddToQueue(4, "spell_dark_vessel", "make_urn", make_urn, ch, corpse); if(isNewUrn == false) { - RS.Queue.AddToQueue(6, send_to_char, "You drink the remaining blood from your old vessel, expelling each drop into the new one as your body convulses!\n\r The old vessel drops from your hand as it turns to ash.\n\r", ch); - RS.Queue.AddToQueue(7, act_queue, "$n drinks a thick fluid from a sanguine object and begins convulsing as they expel the fluid into the newly made vessel!", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(8, act_queue, "$n shudders, releasing the sanguine object as it turns to ash.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(6, "spell_dark_vessel", "send_to_char_queue", send_to_char_queue, "You drink the remaining blood from your old vessel, expelling each drop into the new one as your body convulses!\n\r The old vessel drops from your hand as it turns to ash.\n\r", ch); + RS.Queue.AddToQueue(7, "spell_dark_vessel", "act_queue", act_queue, "$n drinks a thick fluid from a sanguine object and begins convulsing as they expel the fluid into the newly made vessel!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, "spell_dark_vessel", "act_queue", act_queue, "$n shudders, releasing the sanguine object as it turns to ash.", ch, nullptr, nullptr, TO_ROOM); } } @@ -400,7 +400,7 @@ void spell_animate_dead(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("You kneel before $p, chanting softly in an arcane language.", ch, corpse, 0, TO_CHAR); act("$n kneels before $p, chanting softly in an unintelligible language.", ch, corpse, 0, TO_ROOM); - RS.Queue.AddToQueue(2, animate_two, ch, corpse); + RS.Queue.AddToQueue(2, "spell_animate_dead", "animate_two", animate_two, ch, corpse); } void animate_two(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -430,7 +430,7 @@ void animate_two(CHAR_DATA *ch, OBJ_DATA *corpse) act("You carve elaborate runes onto the torso of $p.", ch, corpse, nullptr, TO_CHAR); act("$n carves elaborate runes onto the torso of $p.", ch, corpse, nullptr, TO_ROOM); - RS.Queue.AddToQueue(2, animate_three, ch, corpse); + RS.Queue.AddToQueue(2, "animate_two", "animate_three", animate_three, ch, corpse); } void animate_three(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -459,7 +459,7 @@ void animate_three(CHAR_DATA *ch, OBJ_DATA *corpse) act("The flesh of the corpse begins to decay rapidly, its skin left bloated and sagging.", ch, nullptr, nullptr, TO_ALL); - RS.Queue.AddToQueue(2, animate_four, ch, corpse); + RS.Queue.AddToQueue(2, "animate_three", "animate_four", animate_four, ch, corpse); } void animate_four(CHAR_DATA *ch, OBJ_DATA *corpse) @@ -681,7 +681,7 @@ void spell_visceral(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n slices open three corpses, spreading their entrails upon the ground.", ch, 0, 0, TO_ROOM); act("You slice open three corpses, spreading their entrails upon the ground.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(6, visceral_two, ch); + RS.Queue.AddToQueue(6, "spell_visceral", "visceral_two", visceral_two, ch); } void visceral_two(CHAR_DATA *ch) @@ -696,7 +696,7 @@ void visceral_two(CHAR_DATA *ch) act("Upon this gore, $n pours a generous amount of blood, saturating it.", ch, 0, 0, TO_ROOM); act("Upon this gore, you pour a generous amount of blood, saturating it.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(6, visceral_three, ch); + RS.Queue.AddToQueue(6, "visceral_two", "visceral_three", visceral_three, ch); } void visceral_three(CHAR_DATA *ch) @@ -719,7 +719,7 @@ void visceral_three(CHAR_DATA *ch) act("$n and $s minions blissfully writhe in the carnage, praising the Dark Gods.", ch, 0, 0, TO_ROOM); act("You blissfully writhe in the carnage, praising the Dark Gods.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(6, visceral_four, ch); + RS.Queue.AddToQueue(6, "visceral_three", "visceral_four", visceral_four, ch); } void visceral_four(CHAR_DATA *ch) @@ -802,7 +802,7 @@ void spell_ritual_soul(int sn, int level, CHAR_DATA *ch, void *vo, int target) act("$n begins to spread out some infernal relics and charms.", ch, 0, 0, TO_ROOM); act("You begin to spread out some infernal relics and charms.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, ritual_two, ch, victim); + RS.Queue.AddToQueue(3, "spell_ritual_soul", "ritual_two", ritual_two, ch, victim); } void ritual_two(CHAR_DATA *ch, CHAR_DATA *victim) @@ -821,7 +821,7 @@ void ritual_two(CHAR_DATA *ch, CHAR_DATA *victim) act("$n pours some blood onto the floor from $s urn, and chants quietly.", ch, 0, 0, TO_ROOM); act("You spill out blood from your urn, chanting softly in an arcane tongue.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, ritual_three, ch, victim); + RS.Queue.AddToQueue(3, "ritual_two", "ritual_three", ritual_three, ch, victim); } void ritual_three(CHAR_DATA *ch, CHAR_DATA *victim) @@ -843,7 +843,7 @@ void ritual_three(CHAR_DATA *ch, CHAR_DATA *victim) ch->mana = (short)(ch->mana * .8); ch->move = (short)(ch->move * .5); - RS.Queue.AddToQueue(3, ritual_four, ch, victim); + RS.Queue.AddToQueue(3, "ritual_three", "ritual_four", ritual_four, ch, victim); } void ritual_four(CHAR_DATA *ch, CHAR_DATA *victim) @@ -929,7 +929,7 @@ void spell_ritual_flesh(int sn, int level, CHAR_DATA *ch, void *vo, int target) ch->disrupted= false; - RS.Queue.AddToQueue(3, flesh_two, ch, victim); + RS.Queue.AddToQueue(3, "spell_ritual_flesh", "flesh_two", flesh_two, ch, victim); act("You prepare to make an unholy sacrifice to the Dark Gods!", ch, 0, 0, TO_CHAR); } @@ -945,7 +945,7 @@ void flesh_two(CHAR_DATA *ch, CHAR_DATA *victim) act("$n pours blood onto the floor, chanting softly in an undecipherable tongue.", ch, 0, 0, TO_ROOM); act("You pour blood onto the floor, chanting softly in an arcane tongue.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, flesh_three, ch, victim); + RS.Queue.AddToQueue(3, "flesh_two", "flesh_three", flesh_three, ch, victim); } void flesh_three(CHAR_DATA *ch, CHAR_DATA *victim) @@ -964,7 +964,7 @@ void flesh_three(CHAR_DATA *ch, CHAR_DATA *victim) ch->hit = (short)(ch->hit * 0.8); - RS.Queue.AddToQueue(3, flesh_four, ch, victim); + RS.Queue.AddToQueue(3, "flesh_three", "flesh_four", flesh_four, ch, victim); } void flesh_four(CHAR_DATA *ch, CHAR_DATA *victim) diff --git a/code/characterClasses/sorcerer.c b/code/characterClasses/sorcerer.c index 0baacb8..7a99640 100644 --- a/code/characterClasses/sorcerer.c +++ b/code/characterClasses/sorcerer.c @@ -5054,7 +5054,7 @@ void spell_concave_shell(int sn, int level, CHAR_DATA *ch, void *vo, int target) dirptr = (int *)talloc_struct(sizeof(int)); *dirptr = dir; - RS.Queue.AddToQueue(6, concave_shell_move, ch, dirptr, ch->in_room); + RS.Queue.AddToQueue(6, "spell_concave_shell", "concave_shell_move", concave_shell_move, ch, dirptr, ch->in_room); act("Air begins to swirl rapidly around you.", ch, 0, 0, TO_CHAR); act("Swirling winds begin to mass near $n.", ch, 0, 0, TO_ROOM); @@ -7999,13 +7999,13 @@ void spell_mana_infusion(int sn, int level, CHAR_DATA *ch, void *vo, int target) af1.owner = ch; new_affect_to_char(victim, &af1); - RS.Queue.AddToQueue(2, damage_queued, ch, victim, level, DAM_OTHER, HIT_UNBLOCKABLE, HIT_NOADD, dammod, "the escaping mana*"); - RS.Queue.AddToQueue(2, affect_strip, victim, gsn_mana_infusion); - RS.Queue.AddToQueue(2, act_queue, "You scream in pain as the mana rushes from your body!", victim, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(2, act_queue, "As the mana rushes out of $n's body, $e cries out in pain!", victim, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, "spell_mana_infusion", "damage_queued", damage_queued, ch, victim, level, DAM_OTHER, HIT_UNBLOCKABLE, HIT_NOADD, dammod, "the escaping mana*"); + RS.Queue.AddToQueue(2, "spell_mana_infusion", "affect_strip", affect_strip, victim, gsn_mana_infusion); + RS.Queue.AddToQueue(2, "spell_mana_infusion", "act_queue", act_queue, "You scream in pain as the mana rushes from your body!", victim, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(2, "spell_mana_infusion", "act_queue", act_queue, "As the mana rushes out of $n's body, $e cries out in pain!", victim, nullptr, nullptr, TO_ROOM); if (ch->level > 40 && number_percent() > 50 && !is_affected(victim, gsn_mana_sickness) && victim->hit > level + 30) - RS.Queue.AddToQueue(3, mana_infusion_helper, ch, victim); + RS.Queue.AddToQueue(3, "spell_mana_infusion", "mana_infusion_helper", mana_infusion_helper, ch, victim); } void infusion_tick(CHAR_DATA *ch, AFFECT_DATA *af) diff --git a/code/characterClasses/warrior.c b/code/characterClasses/warrior.c index 5816712..e52fa4c 100644 --- a/code/characterClasses/warrior.c +++ b/code/characterClasses/warrior.c @@ -2710,8 +2710,8 @@ void do_brace(CHAR_DATA *ch, char *arg) braceptr = (float *)talloc_struct(sizeof(float)); *braceptr = bracemod; - RS.Queue.AddToQueue(8, brace_helper_undo, ch, braceptr); - RS.Queue.AddToQueue(8, act_queue, "You are no longer bracing yourself against incoming blows.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(8, "do_brace", "brace_helper_undo", brace_helper_undo, ch, braceptr); + RS.Queue.AddToQueue(8, "do_brace", "act_queue", act_queue, "You are no longer bracing yourself against incoming blows.", ch, nullptr, nullptr, TO_CHAR); check_improve(ch, gsn_brace, true, 3); } } @@ -4712,7 +4712,7 @@ void do_retreat(CHAR_DATA *ch, char *arg) dirptr = (int *)talloc_struct(sizeof(int)); *dirptr = direction; - RS.Queue.AddToQueue(3, execute_retreat, ch, dirptr); + RS.Queue.AddToQueue(3, "do_retreat", "execute_retreat", execute_retreat, ch, dirptr); WAIT_STATE(ch, PULSE_VIOLENCE); } diff --git a/code/comm.c b/code/comm.c index a3c7d22..d8f479b 100644 --- a/code/comm.c +++ b/code/comm.c @@ -2724,7 +2724,7 @@ void nanny(DESCRIPTOR_DATA *d, char *argument) } ch->gold = 500; - RS.Queue.AddToQueue(3, create_academy_pet, ch); + RS.Queue.AddToQueue(3, "nanny", "create_academy_pet", create_academy_pet, ch); // academy pet here, on queue } else if (ch->in_room != nullptr) diff --git a/code/iprog.c b/code/iprog.c index 5622036..87d1cbc 100644 --- a/code/iprog.c +++ b/code/iprog.c @@ -1630,14 +1630,14 @@ void verb_prog_antava_touch_hand(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) if (ch->in_room->vnum != 462) return; - RS.Queue.AddToQueue(14, act_queue, "Darkness closes back in upon the antechamber as the stone above you shuts abruptly!", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(9, do_look_queue, ch, "auto"); - RS.Queue.AddToQueue(9, act_queue, "$n suddenly slides down from above!", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(9, char_to_room, ch, tomb); - RS.Queue.AddToQueue(9, char_from_room, ch); - RS.Queue.AddToQueue(9, act_queue, "You suddenly feel the ground drop out from under you!", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(9, act_queue, "The sound of grinding granite fills the air as $n suddenly drops out of sight!", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(2, WAIT_STATE, ch, PULSE_VIOLENCE * 5); + RS.Queue.AddToQueue(14,"verb_prog_antava_touch_hand", "act_queue", act_queue, "Darkness closes back in upon the antechamber as the stone above you shuts abruptly!", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(9, "verb_prog_antava_touch_hand", "do_look_queue", do_look_queue, ch, "auto"); + RS.Queue.AddToQueue(9, "verb_prog_antava_touch_hand", "act_queue", act_queue, "$n suddenly slides down from above!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(9, "verb_prog_antava_touch_hand", "char_to_room", char_to_room, ch, tomb); + RS.Queue.AddToQueue(9, "verb_prog_antava_touch_hand", "char_from_room", char_from_room, ch); + RS.Queue.AddToQueue(9, "verb_prog_antava_touch_hand", "act_queue", act_queue, "You suddenly feel the ground drop out from under you!", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(9, "verb_prog_antava_touch_hand", "act_queue", act_queue, "The sound of grinding granite fills the air as $n suddenly drops out of sight!", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, "verb_prog_antava_touch_hand", "WAIT_STATE", WAIT_STATE, ch, PULSE_VIOLENCE * 5); } void verb_prog_sidhe_climb_vine(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) @@ -1737,7 +1737,7 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) { row = RS.SQL.GetRow(); temp = std::string(row[0]); - RS.Queue.AddToQueue(inc * 5, say_to_queue, fat, ch, "Just do yourself a favor, and watch out for $t.", temp); + RS.Queue.AddToQueue(inc * 5, "verb_prog_listen_conversation", "say_to_queue", say_to_queue, fat, ch, "Just do yourself a favor, and watch out for $t.", temp); } } else if (rand == 2) @@ -1763,7 +1763,7 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) mysql_free_result(res2); } } - RS.Queue.AddToQueue(inc*4, say_to_queue, fat, ch, "Haha, $t got him again! By Rygath's teeth, that's a fine thief...", temp); + RS.Queue.AddToQueue(inc*4, "verb_prog_listen_conversation", "say_to_queue", say_to_queue, fat, ch, "Haha, $t got him again! By Rygath's teeth, that's a fine thief...", temp); */ } /* @@ -1831,7 +1831,7 @@ void verb_prog_listen_conversation(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) tc = i; } - RS.Queue.AddToQueue(inc*6, say_to_queue, violet, ch, + RS.Queue.AddToQueue(inc*6, "verb_prog_listen_conversation", "say_to_queue", say_to_queue, violet, ch, "Well then, I suppose it's only a matter of time before we're all members of $t", std::string(cabal_table[tc].name)); mprog_say(inc*7,"They're really cleaning house out there.", violet, ch); */ @@ -2667,7 +2667,7 @@ void verb_prog_touch_obelisk(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) ch->pcdata->condition[COND_HUNGER] = 1; ch->pcdata->condition[COND_THIRST] = 1; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "verb_prog_touch_obelisk", "communion_handler", communion_handler, ch); } void communion_handler(CHAR_DATA *ch) @@ -2697,7 +2697,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 2: sprintf(buf, "%sThe sonorous tone of a ramshorn booms through the void surrounding you.%s\n\r", @@ -2706,7 +2706,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 3: sprintf(buf, "%sA pearly luminescence begins to coalesce before your eyes, suspended in the darkness that rushes past as you plummet.%s\n\r", @@ -2715,7 +2715,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 4: sprintf(buf, "%sWithin the light, humanoid outlines begin to take shape.%s\n\r", @@ -2724,7 +2724,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 5: sprintf(buf, "%sYou see a behemoth of a man, gird in naught but animal hides and a belt adorned with human scalps.%s\n\r", @@ -2733,7 +2733,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 6: sprintf(buf, "%sThe stillness is shattered by a deafening battlecry, as the figures blur into motion.%s\n\r", @@ -2742,7 +2742,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 7: sprintf(buf, "%sA spray of blood follows his axe's arcing path through the air, light glinting off the silver blade.%s\n\r", @@ -2751,7 +2751,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 8: sprintf(buf, "%sYou have the sensation of being lifted higher, as your field of vision broadens.%s\n\r", @@ -2760,7 +2760,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 9: sprintf(buf, "%sA battlefield is spread out beneath you, the combat just witnessed but a part of the larger picture.%s\n\r", @@ -2769,7 +2769,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 10: sprintf(buf, "%sA small band of barbarians appear to have been trapped by a well-armored force of vastly superior numbers, a sheer cliffside at their backs.%s\n\r", @@ -2778,7 +2778,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 11: sprintf(buf, "%sFierce men and women, of all the races of Shalar, the barbarian horde raise their voices in a single outcry.%s\n\r", @@ -2787,7 +2787,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 12: sprintf(buf, "%sTheir bellowed warcry rippling out over the plains, they launch themselves into the heart of the enemy formation.%s\n\r", @@ -2796,7 +2796,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 13: sprintf(buf, "%sThe clash of steel upon steel and the horrible cries of dying men rise from the melee below...%s\n\r", @@ -2805,7 +2805,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 14: sprintf(buf, "%s...and the pungent odor of blood and death fills the air as the earth is stained a deep crimson.%s\n\r", @@ -2814,7 +2814,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 15: sprintf(buf, "%sThe barbarian horde cleaves a swath of terrible carnage through the heart of the fray, destruction trailing in their wake.%s\n\r", @@ -2823,7 +2823,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 16: sprintf(buf, "%sThe once-superior force, now decimated, turns to flee, a cacophony of shouts from the barbarians at their backs.%s\n\r", @@ -2832,7 +2832,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 17: sprintf(buf, "%sAs suddenly as the scene appeared, it is gone, the figures sinking into the earth and fading from sight entirely.%s\n\r", @@ -2841,7 +2841,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 18: SET_BIT(ch->comm, COMM_PROMPT); @@ -2855,7 +2855,7 @@ void communion_handler(CHAR_DATA *ch) ch->pcdata->tribe = tribe; af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 19: af->modifier++; @@ -2878,7 +2878,7 @@ void communion_handler(CHAR_DATA *ch) do_look(ch, "auto"); } - RS.Queue.AddToQueue(2, communion_handler, ch); + RS.Queue.AddToQueue(2, "communion_handler", "communion_handler", communion_handler, ch); break; case 20: sprintf(buf, "%sYou see a blur of motion streaking towards you from the edge of the forest.%s\n\r", @@ -2887,7 +2887,7 @@ void communion_handler(CHAR_DATA *ch) send_to_char(buf, ch); af->modifier++; - RS.Queue.AddToQueue(2, communion_handler, ch); + RS.Queue.AddToQueue(2, "communion_handler", "communion_handler", communion_handler, ch); break; case 21: af->modifier++; @@ -2994,7 +2994,7 @@ void communion_handler(CHAR_DATA *ch) } af->modifier++; - RS.Queue.AddToQueue(8, communion_handler, ch); + RS.Queue.AddToQueue(8, "communion_handler", "communion_handler", communion_handler, ch); break; case 23: sprintf(buf, "%sRays of light pierce your eyelids as they flutter open, and you groggily stagger to your feet.%s\n\r", @@ -3007,7 +3007,7 @@ void communion_handler(CHAR_DATA *ch) ch->position = POS_STANDING; af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 24: sprintf(buf, "%sA trophy belt is fastened securely about your waist, and you sense the weight of a massive pelt upon your back.%s\n\r", @@ -3090,7 +3090,7 @@ void communion_handler(CHAR_DATA *ch) equip_char(ch, obj, WEAR_ABOUT, false); - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 25: sprintf(buf, "%sEven as your mind reels, trying to make sense of all you have seen, you feel infused with newfound vigor.%s\n\r", @@ -3102,7 +3102,7 @@ void communion_handler(CHAR_DATA *ch) ch->mana = ch->max_mana; af->modifier++; - RS.Queue.AddToQueue(5, communion_handler, ch); + RS.Queue.AddToQueue(5, "communion_handler", "communion_handler", communion_handler, ch); break; case 26: sprintf(buf, @@ -3167,7 +3167,7 @@ void verb_prog_feed_baby(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) act("$n's baby greedily begins to feed.", ch, 0, 0, TO_ROOM); milk->value[1] = 0; - RS.Queue.AddToQueue(12, act_queue, "$p drifts off to sleep.", ch, obj, nullptr, TO_CHAR); + RS.Queue.AddToQueue(12, "verb_prog_feed_baby", "act_queue", act_queue, "$p drifts off to sleep.", ch, obj, nullptr, TO_CHAR); init_affect_obj(&af); af.where = TO_OBJ_APPLY; @@ -3671,7 +3671,11 @@ void act_to_room(void *vo1, void *vo2) void act_to_room_queue(std::string format, ROOM_INDEX_DATA *room) { - act_to_room((void *)format.data(), (void *)room); + act_to_room((void *)format.c_str(), (void *)room); + if (!room->people) + return; + + act(format.c_str(), room->people, nullptr, nullptr, TO_ALL); } void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) @@ -3712,13 +3716,13 @@ void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument if (!lRoom->exit[eDir]->u1.to_room) { // call elevator SIR! - RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, lRoom); - RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, tRoom); - RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, eleRoom); - RS.Queue.AddToQueue(3, close_elevator, eleRoom); - RS.Queue.AddToQueue(5, act_to_room_queue, "With a lurch, the lift begins to accelerate.", eleRoom); - RS.Queue.AddToQueue(9, act_to_room_queue, "The lift shudders as it slowly comes to a halt.", eleRoom); - RS.Queue.AddToQueue(10, open_elevator, eleRoom, lRoom); + RS.Queue.AddToQueue(2, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, mmsg, lRoom); + RS.Queue.AddToQueue(2, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, mmsg, tRoom); + RS.Queue.AddToQueue(2, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, mmsg, eleRoom); + RS.Queue.AddToQueue(3, "verb_prog_iseldheim_lever_pull", "close_elevator", close_elevator, eleRoom); + RS.Queue.AddToQueue(5, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, "With a lurch, the lift begins to accelerate.", eleRoom); + RS.Queue.AddToQueue(9, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, "The lift shudders as it slowly comes to a halt.", eleRoom); + RS.Queue.AddToQueue(10, "verb_prog_iseldheim_lever_pull", "open_elevator", open_elevator, eleRoom, lRoom); act("You pull the lever into the down position.", ch, 0, 0, TO_CHAR); act("$n pulls the lever into the down position.", ch, 0, 0, TO_ROOM); @@ -3726,13 +3730,13 @@ void verb_prog_iseldheim_lever_pull(OBJ_DATA *obj, CHAR_DATA *ch, char *argument else if (lRoom->exit[eDir]->u1.to_room) { // elevator is here, we can send it back up tRoom = get_room_index(obj->value[1]); - RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, lRoom); - RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, tRoom); - RS.Queue.AddToQueue(2, act_to_room_queue, mmsg, eleRoom); - RS.Queue.AddToQueue(3, close_elevator, eleRoom); - RS.Queue.AddToQueue(5, act_to_room_queue, "With a lurch, the lift begins to accelerate.", eleRoom); - RS.Queue.AddToQueue(9, act_to_room_queue, "The lift shudders as it slowly comes to a halt.", eleRoom); - RS.Queue.AddToQueue(10, open_elevator, eleRoom, tRoom); + RS.Queue.AddToQueue(2, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, mmsg, lRoom); + RS.Queue.AddToQueue(2, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, mmsg, tRoom); + RS.Queue.AddToQueue(2, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, mmsg, eleRoom); + RS.Queue.AddToQueue(3, "verb_prog_iseldheim_lever_pull", "close_elevator", close_elevator, eleRoom); + RS.Queue.AddToQueue(5, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, "With a lurch, the lift begins to accelerate.", eleRoom); + RS.Queue.AddToQueue(9, "verb_prog_iseldheim_lever_pull", "act_to_room_queue", act_to_room_queue, "The lift shudders as it slowly comes to a halt.", eleRoom); + RS.Queue.AddToQueue(10, "verb_prog_iseldheim_lever_pull", "open_elevator", open_elevator, eleRoom, tRoom); act("You pull the lever into the up position.", ch, 0, 0, TO_CHAR); act("$n pulls the lever into the up position.", ch, 0, 0, TO_ROOM); @@ -3946,9 +3950,9 @@ void verb_prog_turn_wyntran(OBJ_DATA *obj, CHAR_DATA *ch, char *argument) act("The temperature in the room drops rapidly as a darkened portal opens overhead.", ch, 0, 0, TO_ROOM); act("The temperature in the room drops rapidly as a darkened portal opens overhead.", ch, 0, 0, TO_CHAR); - RS.Queue.AddToQueue(3, act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_CHAR); - RS.Queue.AddToQueue(3, act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(4, char_to_room, victim, ch->in_room); + RS.Queue.AddToQueue(3, "verb_prog_turn_wyntran", "act_queue", act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(3, "verb_prog_turn_wyntran", "act_queue", act_queue, "Accompanied by peals of thunder a shrouded being descends from the portal.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(4, "verb_prog_turn_wyntran", "char_to_room", char_to_room, victim, ch->in_room); WAIT_STATE(ch, PULSE_VIOLENCE * 2); } diff --git a/code/magic.c b/code/magic.c index 0fd6df4..3a5481a 100644 --- a/code/magic.c +++ b/code/magic.c @@ -4351,7 +4351,7 @@ void spell_summon(int sn, int level, CHAR_DATA *ch, void *vo, int target) return; } - RS.Queue.AddToQueue(3, summon_char, ch, victim); + RS.Queue.AddToQueue(3, "spell_summon", "summon_char", summon_char, ch, victim); act("You begin the summoning of $N.", ch, 0, victim, TO_CHAR); @@ -4672,7 +4672,7 @@ void spell_word_of_recall(int sn, int level, CHAR_DATA *ch, void *vo, int target if (ch != victim) act("You prepare to send $N home.", ch, 0, victim, TO_CHAR); - RS.Queue.AddToQueue(6, recall_execute, victim, location); + RS.Queue.AddToQueue(6, "spell_word_of_recall", "recall_execute", recall_execute, victim, location); send_to_char("A tingling feeling runs down your spine for a moment.\n\r", victim); diff --git a/code/mprog.c b/code/mprog.c index c2ddf97..b3b2015 100644 --- a/code/mprog.c +++ b/code/mprog.c @@ -157,19 +157,19 @@ const struct improg_type mprog_table[] = void mprog_tell(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { auto buffer = fmt::format("{} tells you '{}{}{}'", mob->short_descr, get_char_color(ch, "tells"), arg, END_COLOR(ch)); - RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, "mprog_tell", "act_queue", act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } void mprog_say(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); - RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, "mprog_say", "act_queue", act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } void mprog_emote(int inc, char *arg, CHAR_DATA *mob, CHAR_DATA *ch) { auto buffer = fmt::format("{} {}", mob->short_descr, arg); - RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, "mprog_emote", "act_queue", act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } int mprog_drop(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) @@ -179,12 +179,12 @@ int mprog_drop(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) if (arg) { auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); - RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, "mprog_drop", "act_queue", act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } - RS.Queue.AddToQueue(inc, obj_to_room, obj, mob->in_room); - RS.Queue.AddToQueue(inc, obj_from_char, obj); - RS.Queue.AddToQueue(inc, act_queue, "$n drops $p.", mob, obj, nullptr, TO_ROOM); + RS.Queue.AddToQueue(inc, "mprog_drop", "obj_to_room", obj_to_room, obj, mob->in_room); + RS.Queue.AddToQueue(inc, "mprog_drop", "obj_from_char", obj_from_char, obj); + RS.Queue.AddToQueue(inc, "mprog_drop", "act_queue", act_queue, "$n drops $p.", mob, obj, nullptr, TO_ROOM); return 0; } @@ -195,12 +195,12 @@ int mprog_give(int inc, char *arg, OBJ_DATA *obj, CHAR_DATA *mob, CHAR_DATA *ch) if (arg) { auto buffer = fmt::format("{} says '{}{}{}'", mob->short_descr, get_char_color(ch, "speech"), arg, END_COLOR(ch)); - RS.Queue.AddToQueue(inc, act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); + RS.Queue.AddToQueue(inc, "mprog_give", "act_queue", act_queue, buffer, ch, nullptr, nullptr, TO_CHAR); } - RS.Queue.AddToQueue(inc, obj_to_char, obj, ch); - RS.Queue.AddToQueue(inc, obj_from_char, obj); - RS.Queue.AddToQueue(inc, act_queue, "$n gives you $p.", mob, obj, ch, TO_VICT); + RS.Queue.AddToQueue(inc, "mprog_give", "obj_to_char", obj_to_char, obj, ch); + RS.Queue.AddToQueue(inc, "mprog_give", "obj_from_char", obj_from_char, obj); + RS.Queue.AddToQueue(inc, "mprog_give", "act_queue", act_queue, "$n gives you $p.", mob, obj, ch, TO_VICT); return 0; } @@ -618,9 +618,9 @@ void pulse_prog_arangird_patrol(CHAR_DATA *mob) void greet_prog_profteacher(CHAR_DATA *mob, CHAR_DATA *ch) { if (number_percent() > 50) - RS.Queue.AddToQueue(2, act_queue, "$N beckons you to approach $M.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(2, "greet_prog_profteacher", "act_queue", act_queue, "$N beckons you to approach $M.", ch, nullptr, mob, TO_CHAR); else - RS.Queue.AddToQueue(2, act_queue, "$N meets your eyes thoughtfully, nodding slightly.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(2, "greet_prog_profteacher", "act_queue", act_queue, "$N meets your eyes thoughtfully, nodding slightly.", ch, nullptr, mob, TO_CHAR); } void greet_prog_ruins_spirit(CHAR_DATA *mob, CHAR_DATA *ch) @@ -1562,7 +1562,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToQueue(1, delay_extract, mob); + RS.Queue.AddToQueue(1, "attack_prog_lesser_demon", "delay_extract", delay_extract, mob); af->owner->pcdata->lesserdata[LESSER_BARBAS] = FAVOR_NONE; return; } @@ -1602,7 +1602,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToQueue(1, delay_extract, mob); + RS.Queue.AddToQueue(1, "attack_prog_lesser_demon", "delay_extract", delay_extract, mob); return; } @@ -1642,7 +1642,7 @@ void attack_prog_lesser_demon(CHAR_DATA *mob, CHAR_DATA *attacker) char_from_room(mob); char_to_room(mob, get_room_index(3)); - RS.Queue.AddToQueue(1, delay_extract, mob); + RS.Queue.AddToQueue(1, "attack_prog_lesser_demon", "delay_extract", delay_extract, mob); return; } @@ -1773,9 +1773,9 @@ void speech_prog_aamon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) break; default: do_emote(mob, "laughs giddily and whirls to leave."); - RS.Queue.AddToQueue(1, do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts! You'll never know the answer to my riddle."); - RS.Queue.AddToQueue(2, act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(1, "speech_prog_aamon", "do_say_queue", do_say_queue, mob, "I'll be leaving now, and leaving you to your thoughts! You'll never know the answer to my riddle."); + RS.Queue.AddToQueue(2, "speech_prog_aamon", "act_queue", act_queue, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, "speech_prog_aamon", "delay_extract", delay_extract, mob); ch->pcdata->lesserdata[LESSER_AAMON] = FAVOR_FAILED; break; } @@ -1889,7 +1889,7 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act(" $t", mob, mob->speechbuf[2], 0, TO_ROOM); act(" $t", mob, mob->speechbuf[3], 0, TO_ROOM); - RS.Queue.AddToQueue(2, do_say_queue, mob, "Quite the worst bit of garbage I've ever had the joyless task of committing to memory. Good day, my rhythmless friend."); + RS.Queue.AddToQueue(2, "speech_prog_ipos", "do_say_queue", do_say_queue, mob, "Quite the worst bit of garbage I've ever had the joyless task of committing to memory. Good day, my rhythmless friend."); do_note(mob, "to anti-paladin"); do_note(mob, "subject Verse, the Worst"); @@ -1914,7 +1914,7 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_note(mob, "+ [at the bottom of the scroll, in florid script, is a single 'I']"); do_note(mob, "send"); - RS.Queue.AddToQueue(4, send_to_char_queue, "You feel suddenly overcome with a desire to lash out at someone verbally.\n\r", ch); + RS.Queue.AddToQueue(4, "speech_prog_ipos", "send_to_char_queue", send_to_char_queue, "You feel suddenly overcome with a desire to lash out at someone verbally.\n\r", ch); ch->pcdata->lesserdata[LESSER_IPOS] = FAVOR_GRANTED; ch->pcdata->learned[skill_lookup("taunt")] = 1; @@ -1924,8 +1924,8 @@ void speech_prog_ipos(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) free_pstring(mob->speechbuf[i]); } - RS.Queue.AddToQueue(5, act_queue, "With a derisive snort, $n steps through a gate and vanishes without a trace.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(6, delay_extract, mob); + RS.Queue.AddToQueue(5, "speech_prog_ipos", "act_queue", act_queue, "With a derisive snort, $n steps through a gate and vanishes without a trace.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(6, "speech_prog_ipos", "delay_extract", delay_extract, mob); } } @@ -1951,11 +1951,11 @@ void speech_prog_oze(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) stop_fighting(mob, true); - RS.Queue.AddToQueue(3, act_queue, "Suddenly rejuvenated, Oze begins to growl deep in his torso of exposed organs.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(5, do_say_queue, mob, "I would say that your deed would be remembered... but as you were the one who put me here in the first place, I doubt very much that you would wish it so. I take my leave."); - RS.Queue.AddToQueue(7, act_queue, "With a squelching sound, Oze thins into a gout of blood and shoots into the sky.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(8, delay_extract, mob); - RS.Queue.AddToQueue(8, save_char_obj, ch); + RS.Queue.AddToQueue(3, "speech_prog_oze", "act_queue", act_queue, "Suddenly rejuvenated, Oze begins to growl deep in his torso of exposed organs.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(5, "speech_prog_oze", "do_say_queue", do_say_queue, mob, "I would say that your deed would be remembered... but as you were the one who put me here in the first place, I doubt very much that you would wish it so. I take my leave."); + RS.Queue.AddToQueue(7, "speech_prog_oze", "act_queue", act_queue, "With a squelching sound, Oze thins into a gout of blood and shoots into the sky.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(8, "speech_prog_oze", "delay_extract", delay_extract, mob); + RS.Queue.AddToQueue(8, "speech_prog_oze", "save_char_obj", save_char_obj, ch); ch->pcdata->greaterdata[GREATER_OZE] = FAVOR_GRANTED; ch->pcdata->learned[skill_lookup("leech")] = 1; ch->pcdata->perm_hit -= 70; @@ -1969,8 +1969,8 @@ void speech_prog_oze(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) sprintf(buf, "The abyss will not forget this treachery, %s.", ch->name); do_whisper(mob, buf); - RS.Queue.AddToQueue(1, act_queue, "The puddle of gore before you that was once a greater demon dissolves into the earth.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(2, delay_extract, mob); + RS.Queue.AddToQueue(1, "speech_prog_oze", "act_queue", act_queue, "The puddle of gore before you that was once a greater demon dissolves into the earth.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(2, "speech_prog_oze", "delay_extract", delay_extract, mob); ch->pcdata->greaterdata[GREATER_OZE] = FAVOR_FAILED; return; } @@ -1996,12 +1996,12 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("Roaring suddenly with a thunder not unlike a thousand horses, $n rises.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into your midsection as you scream involuntarily.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(2, act_queue, "Plunging suddenly headlong, the demon dissolves into $N's midsection as $E screams.", mob, nullptr, ch, TO_NOTVICT); - RS.Queue.AddToQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(2, "speech_prog_gamygyn", "act_queue", act_queue, "Plunging suddenly headlong, the demon dissolves into your midsection as you scream involuntarily.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(2, "speech_prog_gamygyn", "act_queue", act_queue, "Plunging suddenly headlong, the demon dissolves into $N's midsection as $E screams.", mob, nullptr, ch, TO_NOTVICT); + RS.Queue.AddToQueue(3, "speech_prog_gamygyn", "delay_extract", delay_extract, mob); buffer = fmt::format("{}A dark soul writhes within you, discomfited, and you remember your bargain.{}\n\r", get_char_color(ch, "blue"), END_COLOR(ch)); - RS.Queue.AddToQueue(3, send_to_char_queue, buffer, ch); + RS.Queue.AddToQueue(3, "speech_prog_gamygyn", "send_to_char_queue", send_to_char_queue, buffer, ch); init_affect(&af); af.where = TO_AFFECTS; @@ -2024,9 +2024,9 @@ void speech_prog_gamygyn(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("With a flourishing fanfare which seems nonetheless foreboding, $n rises.", mob, 0, 0, TO_ROOM); buffer = fmt::format("{} You may yet live to regret your rash decision. Doubtless the seeds of realization sprout within you now.", ch->name); - RS.Queue.AddToQueue(1, do_tell_queue, mob, buffer); - RS.Queue.AddToQueue(2, act_queue, "Flashing a great dark light, $n vanishes from sight.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(1, "speech_prog_gamygyn", "do_tell_queue", do_tell_queue, mob, buffer); + RS.Queue.AddToQueue(2, "speech_prog_gamygyn", "act_queue", act_queue, "Flashing a great dark light, $n vanishes from sight.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, "speech_prog_gamygyn", "delay_extract", delay_extract, mob); ch->pcdata->greaterdata[GREATER_GAMYGYN] = FAVOR_FAILED; } @@ -2051,17 +2051,17 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_emote(mob, "smiles deviously, and you grow confused attempting to locate his lips."); buffer = fmt::format("Very well. I shall watch over you. I require the corpse of another anti-paladin to warm my feet, {}... I trust you shall not disappoint.", ch->name); - RS.Queue.AddToQueue(1, do_say_queue, mob, buffer); - RS.Queue.AddToQueue(2, act_queue, "Before you realize what's happening, $n has planted a firm grip on your arm.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(3, act_queue, "The terrible demon's many hands begin grappling with your frame.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(5, act_queue, "A multitude of taloned fingers dig deeply into your flesh.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(6, act_queue, "$n draws $mself toward you and you scream involuntarily!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(8, act_queue, "You writhe in agony and pure horror as $n reaches down your throat...", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(10, act_queue, "In a few moments, $n has vanished entirely into your body.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(11, delay_extract, mob); + RS.Queue.AddToQueue(1, "speech_prog_orobas", "do_say_queue", do_say_queue, mob, buffer); + RS.Queue.AddToQueue(2, "speech_prog_orobas", "act_queue", act_queue, "Before you realize what's happening, $n has planted a firm grip on your arm.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(3, "speech_prog_orobas", "act_queue", act_queue, "The terrible demon's many hands begin grappling with your frame.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, "speech_prog_orobas", "act_queue", act_queue, "A multitude of taloned fingers dig deeply into your flesh.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, "speech_prog_orobas", "act_queue", act_queue, "$n draws $mself toward you and you scream involuntarily!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, "speech_prog_orobas", "act_queue", act_queue, "You writhe in agony and pure horror as $n reaches down your throat...", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(10, "speech_prog_orobas", "act_queue", act_queue, "In a few moments, $n has vanished entirely into your body.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(11, "speech_prog_orobas", "delay_extract", delay_extract, mob); buffer = fmt::format("{}A dark soul writhes within you, discomfited, and you remember your bargain.{}\n\r", get_char_color(ch, "red"), END_COLOR(ch)); - RS.Queue.AddToQueue(12, send_to_char_queue, buffer, ch); + RS.Queue.AddToQueue(12, "speech_prog_orobas", "send_to_char_queue", send_to_char_queue, buffer, ch); init_affect(&af); af.where = TO_AFFECTS; @@ -2084,9 +2084,9 @@ void speech_prog_orobas(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) act("Shrieks of outrage rise up from $n, arms and legs kicking out toward you.", mob, 0, 0, TO_ROOM); - RS.Queue.AddToQueue(1, do_say_queue, mob, "I expected nothing else."); - RS.Queue.AddToQueue(2, act_queue, "With a fierce snarl and many assorted whispers, $n streaks into the darkness.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(3, delay_extract, mob); + RS.Queue.AddToQueue(1, "speech_prog_orobas", "do_say_queue", do_say_queue, mob, "I expected nothing else."); + RS.Queue.AddToQueue(2, "speech_prog_orobas", "act_queue", act_queue, "With a fierce snarl and many assorted whispers, $n streaks into the darkness.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, "speech_prog_orobas", "delay_extract", delay_extract, mob); ch->pcdata->greaterdata[GREATER_OROBAS] = FAVOR_FAILED; } @@ -2111,15 +2111,15 @@ void speech_prog_geryon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_say(mob, buf); do_emote(mob, "smiles pleasantly once more, reaching to his belt for a small metal tool."); - RS.Queue.AddToQueue(2, act_queue, "Cupping one hand around the back of your head, Geryon plunges with the tool....", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(4, act_queue, "The greater demon's even, pearly teeth are the last thing your left eye sees.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(5, act_queue, "The next thing your right eye sees is a hand moving away, holding a bloody orb.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(6, act_queue, "You stifle a scream as the suddenness of the operation becomes realization.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(8, act_queue, "Geryon drops your left eye into a bag at his belt, still smiling.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(10, do_say_queue, mob, "That's a good lad! Do try not to cry just yet, there's nothing quite like the sting of tears in an open eye socket. Now, then...."); - RS.Queue.AddToQueue(11, send_to_char_queue, "The warmth of suffused power tingles through your fingers.\n\r", ch); - RS.Queue.AddToQueue(12, do_emote_queue, mob, "bows deeply and disappears, leaving you alone with your dark thoughts."); - RS.Queue.AddToQueue(13, delay_extract, mob); + RS.Queue.AddToQueue(2, "speech_prog_geryon", "act_queue", act_queue, "Cupping one hand around the back of your head, Geryon plunges with the tool....", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(4, "speech_prog_geryon", "act_queue", act_queue, "The greater demon's even, pearly teeth are the last thing your left eye sees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, "speech_prog_geryon", "act_queue", act_queue, "The next thing your right eye sees is a hand moving away, holding a bloody orb.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, "speech_prog_geryon", "act_queue", act_queue, "You stifle a scream as the suddenness of the operation becomes realization.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, "speech_prog_geryon", "act_queue", act_queue, "Geryon drops your left eye into a bag at his belt, still smiling.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(10, "speech_prog_geryon", "do_say_queue", do_say_queue, mob, "That's a good lad! Do try not to cry just yet, there's nothing quite like the sting of tears in an open eye socket. Now, then...."); + RS.Queue.AddToQueue(11, "speech_prog_geryon", "send_to_char_queue", send_to_char_queue, "The warmth of suffused power tingles through your fingers.\n\r", ch); + RS.Queue.AddToQueue(12, "speech_prog_geryon", "do_emote_queue", do_emote_queue, mob, "bows deeply and disappears, leaving you alone with your dark thoughts."); + RS.Queue.AddToQueue(13, "speech_prog_geryon", "delay_extract", delay_extract, mob); ch->pcdata->greaterdata[GREATER_GERYON] = GERYON_EYE; return; @@ -2133,16 +2133,16 @@ void speech_prog_geryon(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) do_say(mob, buf); do_emote(mob, "smiles pleasantly once more, reaching to his belt for a very sharp knife."); - RS.Queue.AddToQueue(2, act_queue, "Seizing your hand abruptly, Geryon places the blade of his knife against it.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(4, act_queue, "With a quick sawing motion, the greater demon looses your left index finger!", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(5, act_queue, "Blood pounding in your ears, you're unsure whether the scream you hear is yours.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(6, act_queue, "Catching the flying finger in his hand, Geryon places it into a bag at his belt.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(7, act_queue, "Geryon releases your wrist, and gouts of blood begin to pour from the wound.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(8, act_queue, "Geryon flashes his handsome smile and pushes stray hair back from his face.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(10, do_say_queue, mob, "Well done, my boy. Just stop up that stump you've got, or you'll bleed to death before I've gone! Now, then..."); - RS.Queue.AddToQueue(11, send_to_char_queue, "The warmth of suffused power tingles through your eyes.\n\r", ch); - RS.Queue.AddToQueue(12, do_emote_queue, mob, "bows deeply and disappears, leaving you alone with your dark thoughts."); - RS.Queue.AddToQueue(13, delay_extract, mob); + RS.Queue.AddToQueue(2, "speech_prog_geryon", "act_queue", act_queue, "Seizing your hand abruptly, Geryon places the blade of his knife against it.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(4, "speech_prog_geryon", "act_queue", act_queue, "With a quick sawing motion, the greater demon looses your left index finger!", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, "speech_prog_geryon", "act_queue", act_queue, "Blood pounding in your ears, you're unsure whether the scream you hear is yours.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, "speech_prog_geryon", "act_queue", act_queue, "Catching the flying finger in his hand, Geryon places it into a bag at his belt.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(7, "speech_prog_geryon", "act_queue", act_queue, "Geryon releases your wrist, and gouts of blood begin to pour from the wound.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, "speech_prog_geryon", "act_queue", act_queue, "Geryon flashes his handsome smile and pushes stray hair back from his face.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(10, "speech_prog_geryon", "do_say_queue", do_say_queue, mob, "Well done, my boy. Just stop up that stump you've got, or you'll bleed to death before I've gone! Now, then..."); + RS.Queue.AddToQueue(11, "speech_prog_geryon", "send_to_char_queue", send_to_char_queue, "The warmth of suffused power tingles through your eyes.\n\r", ch); + RS.Queue.AddToQueue(12, "speech_prog_geryon", "do_emote_queue", do_emote_queue, mob, "bows deeply and disappears, leaving you alone with your dark thoughts."); + RS.Queue.AddToQueue(13, "speech_prog_geryon", "delay_extract", delay_extract, mob); ch->pcdata->greaterdata[GREATER_GERYON] = GERYON_FINGER; return; @@ -2165,12 +2165,12 @@ void speech_prog_cimeries(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) send_to_char("The sound of Cimeries' claw grinding against your skull fills your soul...", ch); - RS.Queue.AddToQueue(2, act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your ear away from your head.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(3, act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(5, act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(6, act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(8, act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(9, delay_extract, mob); + RS.Queue.AddToQueue(2, "speech_prog_cimeries", "act_queue", act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your ear away from your head.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(3, "speech_prog_cimeries", "act_queue", act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, "speech_prog_cimeries", "act_queue", act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, "speech_prog_cimeries", "act_queue", act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, "speech_prog_cimeries", "act_queue", act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(9, "speech_prog_cimeries", "delay_extract", delay_extract, mob); ch->pcdata->greaterdata[GREATER_CIMERIES] = CIMERIES_EAR; ch->pcdata->beauty = std::max(1, ch->pcdata->beauty - 4); @@ -2183,12 +2183,12 @@ void speech_prog_cimeries(CHAR_DATA *mob, CHAR_DATA *ch, char *speech) send_to_char("You feel Cimeries' claw dig into the bridge of your nose and pull...", ch); - RS.Queue.AddToQueue(2, act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your nose away from your head.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(3, act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(5, act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(6, act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); - RS.Queue.AddToQueue(8, act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(9, delay_extract, mob); + RS.Queue.AddToQueue(2, "speech_prog_cimeries", "act_queue", act_queue, "Slowly, with a disgusting grin, Cimeries scrapes your nose away from your head.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(3, "speech_prog_cimeries", "act_queue", act_queue, "The sound of tearing flesh nearly makes you vomit, and pain buckles your knees.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(5, "speech_prog_cimeries", "act_queue", act_queue, "Finally, having finished his hideous operation, Cimeries strikes your chest.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(6, "speech_prog_cimeries", "act_queue", act_queue, "You seem to absorb the blow more readily than you'd have thought possible.", mob, nullptr, ch, TO_VICT); + RS.Queue.AddToQueue(8, "speech_prog_cimeries", "act_queue", act_queue, "Suddenly, the monstrous demon fades into shadows and dissipates.", mob, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(9, "speech_prog_cimeries", "delay_extract", delay_extract, mob); ch->pcdata->greaterdata[GREATER_CIMERIES] = CIMERIES_NOSE; ch->pcdata->beauty = std::max(1, ch->pcdata->beauty - 4); @@ -2465,8 +2465,8 @@ void greet_prog_tower_shopkeeper(CHAR_DATA *mob, CHAR_DATA *ch) act("$N glances over his shoulder at $n and grumbles.", ch, 0, mob, TO_ROOM); act("$n glances over his shoulder at you and grumbles.", mob, 0, ch, TO_VICT); - RS.Queue.AddToQueue(4, do_say_queue, mob, "Well, are ye goin' to buy somethin' or are ye just going t'stand there and stare at me!?"); - RS.Queue.AddToQueue(24, do_astrip_queue, mob, ""); + RS.Queue.AddToQueue(4, "greet_prog_tower_shopkeeper", "do_say_queue", do_say_queue, mob, "Well, are ye goin' to buy somethin' or are ye just going t'stand there and stare at me!?"); + RS.Queue.AddToQueue(24, "greet_prog_tower_shopkeeper", "do_astrip_queue", do_astrip_queue, mob, ""); } void pulse_prog_wizard_summon(CHAR_DATA *mob) @@ -2519,7 +2519,7 @@ void pulse_prog_wizard_summon(CHAR_DATA *mob) do_look(vch, "auto"); - RS.Queue.AddToQueue(1, do_say_queue, mob, "Please be more careful, and examine your surroundings. You'll live longer."); + RS.Queue.AddToQueue(1, "pulse_prog_wizard_summon", "do_say_queue", do_say_queue, mob, "Please be more careful, and examine your surroundings. You'll live longer."); affect_remove(mob, paf); } @@ -3170,16 +3170,16 @@ void fight_prog_law_subdue(CHAR_DATA *mob, CHAR_DATA *ch) char_from_room(ch); char_to_room(ch, get_room_index(5)); - RS.Queue.AddToQueue(10, send_to_char_queue, "You are dimly aware of being dragged along the ground...\n\r", ch); - RS.Queue.AddToQueue(19, wake_up, ch); - RS.Queue.AddToQueue(19, affect_strip, ch, gsn_subdue); - RS.Queue.AddToQueue(19, char_to_room, ch, pRoom); - RS.Queue.AddToQueue(19, char_from_room, ch); - RS.Queue.AddToQueue(20, send_to_char_queue, "You are shaken awake by a fuzzy man, as seen through your own personal haze.\n\r", ch); - RS.Queue.AddToQueue(20, act_queue, "$N comes to $S knees holding the back of $S head.", nullptr, nullptr, ch, TO_NOTVICT); + RS.Queue.AddToQueue(10, "fight_prog_law_subdue", "send_to_char_queue", send_to_char_queue, "You are dimly aware of being dragged along the ground...\n\r", ch); + RS.Queue.AddToQueue(19, "fight_prog_law_subdue", "wake_up", wake_up, ch); + RS.Queue.AddToQueue(19, "fight_prog_law_subdue", "affect_strip", affect_strip, ch, gsn_subdue); + RS.Queue.AddToQueue(19, "fight_prog_law_subdue", "char_to_room", char_to_room, ch, pRoom); + RS.Queue.AddToQueue(19, "fight_prog_law_subdue", "char_from_room", char_from_room, ch); + RS.Queue.AddToQueue(20, "fight_prog_law_subdue", "send_to_char_queue", send_to_char_queue, "You are shaken awake by a fuzzy man, as seen through your own personal haze.\n\r", ch); + RS.Queue.AddToQueue(20, "fight_prog_law_subdue", "act_queue", act_queue, "$N comes to $S knees holding the back of $S head.", nullptr, nullptr, ch, TO_NOTVICT); auto buffer = fmt::format("A Hydra trooper tells you '{}And stay out of Cimar, ye {}!{}'\n\r", get_char_color(ch, "tells"), get_insult(ch), END_COLOR(ch)); - RS.Queue.AddToQueue(21, send_to_char_queue, buffer, ch); + RS.Queue.AddToQueue(21, "fight_prog_law_subdue", "send_to_char_queue", send_to_char_queue, buffer, ch); } else { diff --git a/code/mspec.c b/code/mspec.c index 07783bd..112f97b 100644 --- a/code/mspec.c +++ b/code/mspec.c @@ -128,8 +128,8 @@ BEGIN_SPEC(mspec_horde_tanner) mprog_say(1, "Ya jus give me a sec and I'll hack this up for ya.", mob, ch); mprog_emote(3, "slams the corpse on his work table and begins cutting it up.", mob, ch); - RS.Queue.AddToQueue(5, act_queue, "$N hands $n a stack of sliced raw meat.", ch, nullptr, mob, TO_ROOM); - RS.Queue.AddToQueue(5, act_queue, "$N hands you a stack of sliced raw meat.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(5, "sname", "act_queue", act_queue, "$N hands $n a stack of sliced raw meat.", ch, nullptr, mob, TO_ROOM); + RS.Queue.AddToQueue(5, "sname", "act_queue", act_queue, "$N hands you a stack of sliced raw meat.", ch, nullptr, mob, TO_CHAR); extract_obj(obj); } @@ -138,17 +138,20 @@ END_SPEC void create_academy_pet(CHAR_DATA *ch) { + RS.Logger.Info("entered create_academy_pet"); CHAR_DATA *mob = create_mobile(get_mob_index(ACADEMY_PET)); char *name; if (!mob) return; + RS.Logger.Info("entered create_academy_pet free"); free_pstring(mob->name); free_pstring(mob->short_descr); free_pstring(mob->long_descr); free_pstring(mob->description); + RS.Logger.Info("entered create_academy_pet switch name"); switch (number_range(0, 16)) { case 0: @@ -206,6 +209,7 @@ void create_academy_pet(CHAR_DATA *ch) char namebuf[MSL], ldesc[MSL]; + RS.Logger.Info("entered create_academy_pet switch align"); switch (ch->alignment) { case 0: @@ -236,6 +240,7 @@ void create_academy_pet(CHAR_DATA *ch) break; } + RS.Logger.Info("entered create_academy_pet setup"); mob->name = palloc_string(namebuf); mob->short_descr = palloc_string(name); mob->long_descr = palloc_string(ldesc); @@ -244,6 +249,7 @@ void create_academy_pet(CHAR_DATA *ch) char_to_room(mob, ch->in_room); + RS.Logger.Info("entered create_academy_pet greetings"); if (ch->alignment == 1000) { do_say(mob, "Greetings, friend. I have been sent to help you become acclimated to the perils of these lands, "\ @@ -265,26 +271,25 @@ void create_academy_pet(CHAR_DATA *ch) mob->leader = ch; ch->pet = mob; - RS.Queue.AddToQueue(3, do_say_queue, mob, + RS.Logger.Info("entered create_academy_pet queue"); + RS.Queue.AddToQueue(3, "create_academy_pet", "do_say_queue_1", do_say_queue, mob, "I can aid you in finding food, water, a boat, and a place to practice. If you need to find "\ "somewhere to fight for learning, I can help with that, as well as a few other things."); - RS.Queue.AddToQueue(5, do_say_queue, mob, "To ask for my aid, direct your question to me."); + RS.Queue.AddToQueue(5, "create_academy_pet", "do_say_queue_2", do_say_queue, mob, "To ask for my aid, direct your question to me."); auto buffer = fmt::format("{}, I need to find food.", mob->short_descr); - RS.Queue.AddToQueue(8, do_say_queue, ch, buffer); + RS.Queue.AddToQueue(8, "create_academy_pet", "do_say_queue_3", do_say_queue, ch, buffer); } void apet_force(CHAR_DATA *ch, const char *cmd, int delay) { - char buf[MSL], *tal, *tcmd; + char *tcmd; - sprintf(buf, "You feel the irresistible urge to '%s'.\n\r", cmd); + auto buffer = fmt::format("You feel the irresistible urge to '{}}'.\n\r", cmd); - tal = talloc_string(buf); - - RS.Queue.AddToQueue(delay, interpret_queue, ch, std::string(cmd)); - RS.Queue.AddToQueue(delay, send_to_char, tal, ch); + RS.Queue.AddToQueue(delay, "apet_force", "interpret_queue", interpret_queue, ch, std::string(cmd)); + RS.Queue.AddToQueue(delay, "apet_force", "send_to_char_queue", send_to_char_queue, buffer, ch); ch->wait = std::min((int)ch->wait, 20); } @@ -360,7 +365,7 @@ void apet_walk_to_room(CHAR_DATA *ch, int vnum) WAIT_STATE(ch->leader, PULSE_VIOLENCE); - RS.Queue.AddToQueue(2, apet_walk_to_room, ch, vnum); + RS.Queue.AddToQueue(2, "apet_walk_to_room", "apet_walk_to_room", apet_walk_to_room, ch, vnum); } BEGIN_SPEC(mspec_academy_pet) @@ -537,13 +542,13 @@ BEGIN_SPEC(mspec_academy_pet) if (ch->alignment > -1) { - RS.Queue.AddToQueue(2, do_say_queue, mob, + RS.Queue.AddToQueue(2, "sname", "do_say_queue", do_say_queue, mob, "A good place to fight for us might be the Dying Forest. I understand the trolls there "\ "are good opponents."); - RS.Queue.AddToQueue(4, do_say_queue, mob, + RS.Queue.AddToQueue(4, "sname", "do_say_queue", do_say_queue, mob, "You can reach it by going out the eastern gate of Cimar along the Cimarrite Causeway, "\ "then south through the Stunted Forest to the Dying Forest."); - RS.Queue.AddToQueue(6, do_say_queue, mob, + RS.Queue.AddToQueue(6, "sname", "do_say_queue", do_say_queue, mob, "On the other hand, I've heard rumors of a crypt accessible through the Cimar Library "\ "north of the water fountain, where you can fight the undead. I'm not sure how you get "\ "in, but I bet you could find it if you looked there."); @@ -551,25 +556,25 @@ BEGIN_SPEC(mspec_academy_pet) if (ch->alignment == -1000) { - RS.Queue.AddToQueue(2, do_say_queue, mob, "We can slay the fool dryads in the Emerald Forest!"); - RS.Queue.AddToQueue(4, do_say_queue, mob, + RS.Queue.AddToQueue(2, "sname", "do_say_queue", do_say_queue, mob, "We can slay the fool dryads in the Emerald Forest!"); + RS.Queue.AddToQueue(4, "sname", "do_say_queue", do_say_queue, mob, "To reach it, first you should go to the major city of Melcene, out the eastern gate of "\ "Cimar along the Cimarrite Causeway, along the Great Shalaran Road."); - RS.Queue.AddToQueue(6, do_say_queue, mob, + RS.Queue.AddToQueue(6, "sname", "do_say_queue", do_say_queue, mob, "Then, when you're before the Gates of Melcene, head north all the way, east as far as you "\ "can, north, and east all the way into the village square of the Emerald Forest."); } if (get_skill(ch, gsn_enhanced_damage) < 1) { - RS.Queue.AddToQueue(7, do_say_queue, mob, + RS.Queue.AddToQueue(7, "sname", "do_say_queue", do_say_queue, mob, "Although... I've heard of caves around Iseldheim. Caves where there are zombies nearly "\ "impervious to physical attacks: they can rematerialize at the touch of metal.. but if you "\ "can think of a way around that - magic, maybe - you'd be good to go."); - RS.Queue.AddToQueue(8, do_say_queue, mob, + RS.Queue.AddToQueue(8, "sname", "do_say_queue", do_say_queue, mob, "To get there, first head to the great Northern City of Iseldheim. Leave Cimar by the Northern Gate, then "\ "head all north and east through the village along the North Cimar Road."); - RS.Queue.AddToQueue(9, do_say_queue, mob, + RS.Queue.AddToQueue(9, "sname", "do_say_queue", do_say_queue, mob, "Once you're in Iseldheim, go up to the top level, out the eastern gate, and go northeast "\ "till you reach a woodland trail. Caves should be around there... but be careful."); } diff --git a/code/newmem.c b/code/newmem.c index 25a20b7..927a0e9 100644 --- a/code/newmem.c +++ b/code/newmem.c @@ -197,7 +197,7 @@ void do_memtest(CHAR_DATA *ch, char *argument) char buf[MSL]; CHAR_DATA *qch; argument = one_argument(argument, buf); - RS.Queue.AddToQueue(6, do_bash_queue, ch, "Calenduil"); + RS.Queue.AddToQueue(6, "do_memtest", "do_bash_queue", do_bash_queue, ch, "Calenduil"); return; //TODO: what the what??? diff --git a/code/prof.c b/code/prof.c index 1d10778..3d97dbc 100644 --- a/code/prof.c +++ b/code/prof.c @@ -403,11 +403,11 @@ void CProficiencies::TrainProficiency(char_data* ch, char_data* trainer, char* a proficiency.name, END_COLOR(ch)); - char *tptr = talloc_string(buffer.c_str()); - RS.Queue.AddToQueue((i + 1) * 2, send_to_char, tptr, ch); + RS.Queue.AddToQueue((i + 1) * 2, "TrainProficiency", "send_to_char_queue", send_to_char_queue, buffer, ch); } - RS.Queue.AddToQueue((i + 1) * 2, act_queue, prof_msg_table[prof].learning_msgs[i], ch, nullptr, trainer, TO_CHAR); + auto message = std::string(prof_msg_table[prof].learning_msgs[i]); + RS.Queue.AddToQueue((i + 1) * 2, "TrainProficiency", "act_queue", act_queue, message, ch, nullptr, trainer, TO_CHAR); } ch->Profs()->DeductPoints(proficiency.cost); @@ -1024,11 +1024,11 @@ void prof_firestart(CHAR_DATA *ch, char *argument) act("$n begins to build a campfire, gathering sticks and twigs from $s surroundings.", ch, 0, 0, TO_ROOM); ch->move -= ch->level; - RS.Queue.AddToQueue(1, send_to_char, "You rub two sticks together, trying to produce a flame.\n\r", ch); - RS.Queue.AddToQueue(1, act_queue, "$n rubs two sticks together, trying to produce a flame.", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(3, send_to_char, "The sticks begin to smoke, and soon you produce a spark.\n\r", ch); - RS.Queue.AddToQueue(3, act_queue, "The sticks begin to smoke, and soon $n produces a spark.", ch, nullptr, nullptr, TO_ROOM); - RS.Queue.AddToQueue(5, build_fire, ch, dur); + RS.Queue.AddToQueue(1, "prof_firestart", "send_to_char_queue", send_to_char_queue, "You rub two sticks together, trying to produce a flame.\n\r", ch); + RS.Queue.AddToQueue(1, "prof_firestart", "act_queue", act_queue, "$n rubs two sticks together, trying to produce a flame.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(3, "prof_firestart", "send_to_char_queue", send_to_char_queue, "The sticks begin to smoke, and soon you produce a spark.\n\r", ch); + RS.Queue.AddToQueue(3, "prof_firestart", "act_queue", act_queue, "The sticks begin to smoke, and soon $n produces a spark.", ch, nullptr, nullptr, TO_ROOM); + RS.Queue.AddToQueue(5, "prof_firestart", "build_fire", build_fire, ch, dur); WAIT_STATE(ch, PULSE_VIOLENCE * 2); } diff --git a/code/quest.c b/code/quest.c index 0dad225..c20323c 100644 --- a/code/quest.c +++ b/code/quest.c @@ -25,6 +25,7 @@ #include "act_comm.h" #include "act_info.h" #include "fight.h" +#include "./include/spdlog/fmt/bundled/format.h" #define STAGE(ch) ch->pcdata->quests[nQuestIndex] #define SET_STAGE(ch, i) ch->pcdata->quests[nQuestIndex] = i @@ -466,15 +467,15 @@ void speech_prog_ilopheth_shack(ROOM_INDEX_DATA *room, CHAR_DATA *ch, char *spee do_look(ch, "auto"); do_say(mob, "So he told you my name, did he? You're here to learn, eh? They always are. Always coming, "\ "wanting what's mine. Wanting, taking, with their grubby minds and dull hands, yes."); - RS.Queue.AddToQueue(5, do_say_queue, mob, "Well you can't have it!"); - RS.Queue.AddToQueue(8, do_emote_queue, mob, "pauses for a moment and strokes his long, ragged beard."); - RS.Queue.AddToQueue(10, do_say_queue, mob, "Unless.... Yes, yes... you can help me! Ah, my turn to grub!"); - RS.Queue.AddToQueue(13, do_say_queue, mob, + RS.Queue.AddToQueue(5, "speech_prog_ilopheth_shack", "do_say_queue", do_say_queue, mob, "Well you can't have it!"); + RS.Queue.AddToQueue(8, "speech_prog_ilopheth_shack", "do_emote_queue", do_emote_queue, mob, "pauses for a moment and strokes his long, ragged beard."); + RS.Queue.AddToQueue(10, "speech_prog_ilopheth_shack", "do_say_queue", do_say_queue, mob, "Unless.... Yes, yes... you can help me! Ah, my turn to grub!"); + RS.Queue.AddToQueue(13, "speech_prog_ilopheth_shack", "do_say_queue", do_say_queue, mob, "Can't go out there, or they'd tear me to pieces, yes! Crack my skull open "\ "and snatch my brains and all their knowledge! But I need something...."); - RS.Queue.AddToQueue(15, do_say_queue, mob, "Moss! Not just any moss. Special moss. White moss. Glows, it does."); - RS.Queue.AddToQueue(17, do_say_queue, mob, "So, you'll get it for me, yes?"); - RS.Queue.AddToQueue(18, do_emote_queue, mob, "peers at you expectantly."); + RS.Queue.AddToQueue(15, "speech_prog_ilopheth_shack", "do_say_queue", do_say_queue, mob, "Moss! Not just any moss. Special moss. White moss. Glows, it does."); + RS.Queue.AddToQueue(17, "speech_prog_ilopheth_shack", "do_say_queue", do_say_queue, mob, "So, you'll get it for me, yes?"); + RS.Queue.AddToQueue(18, "speech_prog_ilopheth_shack", "do_emote_queue", do_emote_queue, mob, "peers at you expectantly."); } break; @@ -625,47 +626,47 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) extract_obj(obj); /* moss */ do_emote(mob, "'s eyes beam as he gingerly handles the white moss in his hands."); - RS.Queue.AddToQueue(3, do_say_queue, mob, + RS.Queue.AddToQueue(3, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "This is it! You've found it! Oh yes, yes! A fine specimen indeed! Not bad for "\ "some grubber, no, no, not bad at all!"); - RS.Queue.AddToQueue(7, do_emote_queue, mob, "pauses in his examination of the moss and peers at you."); - RS.Queue.AddToQueue(10, do_say_queue, mob, + RS.Queue.AddToQueue(7, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "pauses in his examination of the moss and peers at you."); + RS.Queue.AddToQueue(10, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Oh yes! You want me to help you. With magic, yes? Knowledge... powerful "\ "magic, perhaps you can handle it. Perhaps... perhaps not! Perhaps your head "\ "will crack like a delicate little egg, hee hee!"); - RS.Queue.AddToQueue(15, do_emote_queue, mob, + RS.Queue.AddToQueue(15, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "goes over to a towering stack of books and scraps in a far corner of the shack, "\ "and begins to rummage."); - RS.Queue.AddToQueue(18, do_say_queue, mob, + RS.Queue.AddToQueue(18, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Mysteries... no... not this one. Arcane... no. Curses of Ba... hrm, hee hee, "\ "no not that one either. Ah, here we go! Secrets of the Talismanic Powers."); - RS.Queue.AddToQueue(23, do_emote_queue, mob, "slowly straightens and totters toward you, cradling the tome in his hands."); - RS.Queue.AddToQueue(27, do_say_queue, mob, + RS.Queue.AddToQueue(23, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "slowly straightens and totters toward you, cradling the tome in his hands."); + RS.Queue.AddToQueue(27, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Here it is... right on page... what the... grubbers! The page.. it's stolen! "\ "Gone! Vanished into thin air! You stole it! I'll kill you!"); - RS.Queue.AddToQueue(31, do_say_queue, mob, "Oh, wait. No, you didn't. Yes, yes, I know. Those grubbers must've got it!"); - RS.Queue.AddToQueue(34, do_emote_queue, mob, "waves his arms around wildly. VERY wildly. He must be seriously perturbed."); - RS.Queue.AddToQueue(37, do_say_queue, mob, + RS.Queue.AddToQueue(31, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Oh, wait. No, you didn't. Yes, yes, I know. Those grubbers must've got it!"); + RS.Queue.AddToQueue(34, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "waves his arms around wildly. VERY wildly. He must be seriously perturbed."); + RS.Queue.AddToQueue(37, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Grubbers! Well, a secret I'll tell you. Yes, a secret! I didn't always used "\ "to live here! No no!"); - RS.Queue.AddToQueue(42, do_say_queue, mob, + RS.Queue.AddToQueue(42, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "I lived deep in a forest bit east of that big city. Silmur or something. That "\ "city. Anyway... nice trees. Very nice. Very quiet, too."); - RS.Queue.AddToQueue(48, do_say_queue, mob, + RS.Queue.AddToQueue(48, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Well, except for the bandits. Bastardly grubbers, I tell you. Woke up one "\ "morning, and they were in my shack, goin' right through my things! Trying to get "\ "my secrets! Oh yes, the precious secrets, hee hee!"); - RS.Queue.AddToQueue(53, do_say_queue, mob, + RS.Queue.AddToQueue(53, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "So I moved. Here. To this wretched place. But my secrets are safe here! Oh "\ "yes, yes, hee hee! Safe until you came in here, you grubber! And stole 'em!"); - RS.Queue.AddToQueue(58, do_say_queue, mob, + RS.Queue.AddToQueue(58, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Oh, wait. No, you didn't. I said I'd give it to you. But yes yes, you need to find that page! "\ "Bring it back here, and I'll give you what you want, you grubber!"); - RS.Queue.AddToQueue(70, do_say_queue, mob, "Are you still here? Go on, and find that page! Now out you go, hee hee!"); - RS.Queue.AddToQueue(71, do_look_queue, ch, "auto"); - RS.Queue.AddToQueue(71, char_to_room, ch, outside); - RS.Queue.AddToQueue(71, char_from_room, ch); - RS.Queue.AddToQueue(71, do_emote_queue, mob, "hustles you rapidly out of his shack."); + RS.Queue.AddToQueue(70, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Are you still here? Go on, and find that page! Now out you go, hee hee!"); + RS.Queue.AddToQueue(71, "give_prog_ilopheth_hermit", "do_look_queue", do_look_queue, ch, "auto"); + RS.Queue.AddToQueue(71, "give_prog_ilopheth_hermit", "char_to_room", char_to_room, ch, outside); + RS.Queue.AddToQueue(71, "give_prog_ilopheth_hermit", "char_from_room", char_from_room, ch); + RS.Queue.AddToQueue(71, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "hustles you rapidly out of his shack."); ch->pcdata->quests[TALISMANIC_QUEST] = 4; return; @@ -675,33 +676,33 @@ void give_prog_ilopheth_hermit(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) { /* page */ do_emote(mob, "scrunches his haggard face up at he peers intently at the page."); - RS.Queue.AddToQueue(3, do_say_queue, mob, + RS.Queue.AddToQueue(3, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "This is the missing page! So you're the one who stole it! You dirty grubber, "\ "you'll pay for this!"); - RS.Queue.AddToQueue(8, do_say_queue, mob, + RS.Queue.AddToQueue(8, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Oh, wait. No you didn't. Now I can show you what I've been meaning to all this "\ "time, hee hee. I think you'll like it, oh yes you will."); - RS.Queue.AddToQueue(13, do_emote_queue, mob, "inserts the page into the book, confirming the perfect fit with a glance."); - RS.Queue.AddToQueue(16, do_emote_queue, mob, "totters over to your side and begins to murmur softly."); - RS.Queue.AddToQueue(20, do_emote, mob, - (char *)"speaks with remarkable lucidity for one so seemingly deranged, guiding you "\ - "through an explanation of the arcane tome."); - RS.Queue.AddToQueue(25, send_to_char, - (char *)"You suddenly have a flash of insight, and understand precisely what Pelamon is "\ - "attempting to teach. Amazing... a protective spell of remarkable power!\n\r", ch); - RS.Queue.AddToQueue(36, talismanic_reward, ch); - RS.Queue.AddToQueue(30, do_say_queue, mob, + RS.Queue.AddToQueue(13, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "inserts the page into the book, confirming the perfect fit with a glance."); + RS.Queue.AddToQueue(16, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "totters over to your side and begins to murmur softly."); + RS.Queue.AddToQueue(20, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, + "speaks with remarkable lucidity for one so seemingly deranged, guiding you "\ + "through an explanation of the arcane tome."); + RS.Queue.AddToQueue(25, "give_prog_ilopheth_hermit", "send_to_char_queue", send_to_char_queue, + "You suddenly have a flash of insight, and understand precisely what Pelamon is "\ + "attempting to teach. Amazing... a protective spell of remarkable power!\n\r", ch); + RS.Queue.AddToQueue(36, "give_prog_ilopheth_hermit", "talismanic_reward", talismanic_reward, ch); + RS.Queue.AddToQueue(30, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Ah, I see you've got it, yes yes! And no cracks in your head, hee hee! Maybe "\ "you're not such a grubber after all."); - RS.Queue.AddToQueue(34, do_say_queue, mob, + RS.Queue.AddToQueue(34, "give_prog_ilopheth_hermit", "do_say_queue", do_say_queue, mob, "Well, you've taken enough of my time. You'll have to be on your way now... I'm "\ "expecting company, hee hee!"); - RS.Queue.AddToQueue(37, do_emote_queue, mob, "winks mischievously."); - RS.Queue.AddToQueue(40, do_look_queue, ch, "auto"); - RS.Queue.AddToQueue(40, char_to_room, ch, outside); - RS.Queue.AddToQueue(40, char_from_room, ch); - RS.Queue.AddToQueue(40, do_emote_queue, mob, "hustles you rapidly out of his shack."); - RS.Queue.AddToQueue(41, talismanic_reward, ch); + RS.Queue.AddToQueue(37, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "winks mischievously."); + RS.Queue.AddToQueue(40, "give_prog_ilopheth_hermit", "do_look_queue", do_look_queue, ch, "auto"); + RS.Queue.AddToQueue(40, "give_prog_ilopheth_hermit", "char_to_room", char_to_room, ch, outside); + RS.Queue.AddToQueue(40, "give_prog_ilopheth_hermit", "char_from_room", char_from_room, ch); + RS.Queue.AddToQueue(40, "give_prog_ilopheth_hermit", "do_emote_queue", do_emote_queue, mob, "hustles you rapidly out of his shack."); + RS.Queue.AddToQueue(41, "give_prog_ilopheth_hermit", "talismanic_reward", talismanic_reward, ch); } if (found) @@ -917,13 +918,13 @@ void give_prog_drow_scribe(CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj) do_emote(mob, "returns to his work."); - RS.Queue.AddToQueue(2, do_say_queue, mob, "Well, while you're here..."); - RS.Queue.AddToQueue(4, do_say_queue, mob, + RS.Queue.AddToQueue(2, "give_prog_drow_scribe", "do_say_queue", do_say_queue, mob, "Well, while you're here..."); + RS.Queue.AddToQueue(4, "give_prog_drow_scribe", "do_say_queue", do_say_queue, mob, "I have a scroll made up for a master mage on the fourth floor... Deliver it to "\ "him, and he'll surely tip you."); - RS.Queue.AddToQueue(6, do_say_queue, mob, + RS.Queue.AddToQueue(6, "give_prog_drow_scribe", "do_say_queue", do_say_queue, mob, "I offer this to you only because you didn't seem very pleased with the tip that I gave you."); - RS.Queue.AddToQueue(8, do_say_queue, mob, "Do you accept?"); + RS.Queue.AddToQueue(8, "give_prog_drow_scribe", "do_say_queue", do_say_queue, mob, "Do you accept?"); ch->pcdata->quests[SCRIBE_QUEST] = 4; } @@ -1121,7 +1122,7 @@ BEGIN_SPEC(mspec_academy_smith) mprog_say(2, "Good! I'm in short bloody supply of materials to work with these days.", mob, ch); mprog_say(4, "If yer can find me some, I'll keep half for myself and use the other half to strengthen yer weapon.", mob, ch); mprog_say(6, "I need four raw metals. Iandia said there might be some secreted in the Outlying Wilds and thereabouts.", mob, ch); - RS.Queue.AddToQueue(8, act_queue, "$N returns to his forge, turning his back to you.", ch, nullptr, mob, TO_CHAR); + RS.Queue.AddToQueue(8, "sname", "act_queue", act_queue, "$N returns to his forge, turning his back to you.", ch, nullptr, mob, TO_CHAR); SET_STAGE(ch, 2); END_EVENT @@ -1177,31 +1178,30 @@ BEGIN_SPEC(mspec_academy_smith) { obj->value[1] = 4; obj->value[2] = 3; improved = 1;}*/ obj->value[1] = std::max(obj->value[1] + 1, 18); } - char buf[MSL], *tptr; - sprintf(buf, "%s", obj->short_descr); - tptr = talloc_string(buf); - RS.Queue.AddToQueue(1, act, "Accepting $t, $N turns to the forge, preparing his tools.", ch, tptr, mob, TO_CHAR); - RS.Queue.AddToQueue(3, act, "$N begins to reshape $t, the hammering ringing loud in your ears.", ch, tptr, mob, TO_CHAR); - RS.Queue.AddToQueue(7, act, "Hefting it with a flourish, $N turns to you.", ch, obj, mob, TO_CHAR); + + RS.Queue.AddToQueue(1, "sname", "act_queue", act_queue, "Accepting $t, $N turns to the forge, preparing his tools.", ch, obj, mob, TO_CHAR); + RS.Queue.AddToQueue(3, "sname", "act_queue", act_queue, "$N begins to reshape $t, the hammering ringing loud in your ears.", ch, obj, mob, TO_CHAR); + RS.Queue.AddToQueue(7, "sname", "act_queue", act_queue, "Hefting it with a flourish, $N turns to you.", ch, obj, mob, TO_CHAR); if (improved == 0) mprog_say(8, "Har! This piece o' duergar dung might actually be worth using now.", mob, ch); else mprog_say(8, "Har! Yer lucky to have the benefits of me skilled hands!", mob, ch); REMOVE_BIT(obj->extra_flags, ITEM_MELT_DROP); + std::string buffer; if (get_quest_val(ch, SMITH_QUEST_COMP_ACQUIRED) >= 15) - sprintf(buf, "a fully strengthened Academy %s", weapon_name_lookup(obj->value[0], "exotic")); + buffer = fmt::format("a fully strengthened Academy {}", weapon_name_lookup(obj->value[0], "exotic")); else - sprintf(buf, "a reinforced Academy %s", weapon_name_lookup(obj->value[0], "exotic")); + buffer = fmt::format("a reinforced Academy {}", weapon_name_lookup(obj->value[0], "exotic")); free_pstring(obj->short_descr); - obj->short_descr = palloc_string(buf); + obj->short_descr = buffer.data(); setbit_quest_val(ch, SMITH_QUEST_COMP_ACQUIRED, (comp_vnum - MIN_COMPONENT)); mprog_give(10, nullptr, obj, mob, ch); SET_STAGE(ch, 2); if (get_quest_val(ch, SMITH_QUEST_COMP_ACQUIRED) >= 15) // all done { SET_STAGE(ch, 4); - RS.Queue.AddToQueue(10, gain_exp, ch, 3000); - RS.Queue.AddToQueue(10, send_to_char, + RS.Queue.AddToQueue(10, "sname", "gain_exp", gain_exp, ch, 3000); + RS.Queue.AddToQueue(10, "sname", "send_to_char_queue", send_to_char_queue, "Handling your newly completed weapon, you feel ready to take on the world!\n\r", ch); mprog_say(10, "That's about all I can do with the thing. Good luck, ye flamin' elfhugger.", mob, ch); delete_quest_val(ch, SMITH_QUEST_COMP_ACQUIRED); diff --git a/code/queue.c b/code/queue.c new file mode 100644 index 0000000..1555bdd --- /dev/null +++ b/code/queue.c @@ -0,0 +1,135 @@ +#include "queue.h" +#include "merc.h" + +/// Processes all items on the queue. Any entry that has a timer of zero gets executed. +/// Once all items are processed, those functions that have executed are removed from the queue. +void CQueue::ProcessQueue() +{ + // newQueue.erase( + // std::remove_if(newQueue.begin(), newQueue.end(), [](const auto& item) + // { + // auto delay = std::get<0>(item); + // if (delay < 0) + // return true; + + // if (--delay == 0) + // { + // auto func = std::get<2>(item); + // func(); + // return true; + // } + + // return false; + // }), newQueue.end()); + + for (auto& item : newQueue) + { + // if (--std::get<0>(item) == 0) + if (--item.timer == 0) + { + // Logger.Warn("Processing funcs ==> from {} func {} timer {}", std::get<1>(item), std::get<2>(item), std::get<0>(item)); + Logger.Warn("Processing funcs ==> from {} func {} timer {}", item.callerFuncName, item.calleeFuncName, item.timer); + + // auto func = std::get<4>(item); + auto func = item.function; + func(); + } + } + + newQueue.erase( + std::remove_if(newQueue.begin(), newQueue.end(), [](const auto& item) + { + // Logger.Warn("Processing delete ==> {}", std::get<0>(item)); + Logger.Warn("Processing delete ==> {}", item.timer); + + // return std::get<0>(item) < 0; + return item.timer < 0; + }), newQueue.end()); + + + // auto it = newQueue.begin(); + // while (it != newQueue.end()) + // { + // Logger.Warn("Process size ==> {} / delay ==> {}", newQueue.size(), std::get<0>(*it)); + // //int ith = it - newQueue.begin(); + // //Logger.Warn("==> delay {}", std::get<0>(*it)); + // if (std::get<0>(*it) < 0) // remove rogue timer + // { + // it = newQueue.erase(it); + // continue; + // } + + // if (--std::get<0>(*it) == 0) // showtime + // { + // auto func = std::get<2>(*it); + // func(); + + // it = newQueue.erase(it); + // } + // else + // { + // it++; + // } + // } +} + +/// Determines if a specific character has any remaining entries in the queue. +/// This function applies to both directions (eg. either character being affected or is affecting another pc or environment). +/// @param qChar: The character to lookup in the queue. +/// @return true if there are entries related to the character in the queue; otherwise false. +bool CQueue::HasQueuePending(CHAR_DATA *qChar) +{ + for (auto& item : newQueue) + { + // auto delay = std::get<0>(item); + // auto v = std::get<3>(item); + auto delay = item.timer; + auto v = item.charList; + auto contains = std::find(v.begin(), v.end(), qChar) != v.end(); + // auto contains = std::find_if(v.begin(), v.end(), [&](auto& ch) + // { + // Logger.Warn("==> {}", ch->name); + // Logger.Warn("==> {}", qChar->name); + // return strcmp(ch->name, qChar->name) == 0; + // }) != v.end(); + + Logger.Warn("==> Has queue {} {}", contains, delay); + if (contains && delay > 0) + return true; + } + + return false; +} + +/// Deletes all entries in the queue pertaining to the specified character. +/// @param qChar: The character to lookup in the queue. +void CQueue::DeleteQueuedEventsInvolving(CHAR_DATA *qChar) +{ + int deleted = 0; + newQueue.erase( + std::remove_if(newQueue.begin(), newQueue.end(), [&](const auto& item) + { + // auto delay = std::get<0>(item); + // auto v = std::get<3>(item); + auto delay = item.timer; + auto v = item.charList; + auto contains = std::find(v.begin(), v.end(), qChar) != v.end(); + // auto contains = std::find_if(v.begin(), v.end(), [&](auto& ch) + // { + // Logger.Warn("==> {}", ch->name); + // Logger.Warn("==> {}", qChar->name); + // return strcmp(ch->name, qChar->name) == 0; + // }) != v.end(); + + Logger.Warn("==> Delete {} {}", contains, delay); + if (contains && delay > 0) + { + deleted++; + return true; + } + + return false; + }), newQueue.end()); + + Logger.Warn("{} events deleted.", deleted); +} diff --git a/code/queue.h b/code/queue.h index fd2b5d4..65d4076 100644 --- a/code/queue.h +++ b/code/queue.h @@ -4,6 +4,7 @@ #include "rift.h" #include "./stdlibs/clogger.h" #include + /* * DO NOT TOUCH ANYTHING * this is all in assembly and fucking around in queue.h or .c will break it @@ -22,88 +23,58 @@ class CQueue /// @tparam Func: Template type of the function to call. /// @tparam ...Args: Template parameter pack used to specify the variadic arguments. /// @param nTimer: The time (in ticks) which the function executes. + /// @param from: The name of the function that placed funcName on the queue. + /// @param funcName: The name of the function being placed on the queue. /// @param func: The function to execute at the specified time. /// @param ...args: Variadic arguments used to call the function. template - void AddToQueue(int nTimer, Func func, Args &&...args) + void AddToQueue(int nTimer, std::string from, std::string funcName, Func func, Args &&...args) { if(nTimer < 0) Logger.Warn("Negative Queue Timer - NumArgs: {}", sizeof...(Args)); // capture parameter pack - auto tuple = std::tuple(args...); + // //auto tuple = std::tuple::type...>(args...); + // auto tuple = std::tuple(args...); + // auto chs = GetCharacterData(tuple); + auto tuple = std::forward_as_tuple(std::forward(args)...); auto chs = GetCharacterData(tuple); // place on queue - auto qtip = std::make_tuple(nTimer, chs, [&]() { std::apply(func, tuple); }); - newQueue.push_back(qtip); + //auto qtip = std::make_tuple(nTimer, from, funcName, chs, [&]() { std::apply(func, tuple); }); + //newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, tuple); }}); + newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, std::move(tuple)); }}); + + Logger.Warn("Add => {} added {} with timer {}", from, funcName, nTimer); } /// Processes all items on the queue. Any entry that has a timer of zero gets executed. /// Once all items are processed, those functions that have executed are removed from the queue. - void ProcessQueue() - { - newQueue.erase( - std::remove_if(newQueue.begin(), newQueue.end(), [](const auto& item) - { - auto delay = std::get<0>(item); - if (delay < 0) - return true; - - if (--delay == 0) - { - auto func = std::get<2>(item); - func(); - return true; - } - - return false; - }), newQueue.end()); - } + void ProcessQueue(); /// Determines if a specific character has any remaining entries in the queue. /// This function applies to both directions (eg. either character being affected or is affecting another pc or environment). /// @param qChar: The character to lookup in the queue. /// @return true if there are entries related to the character in the queue; otherwise false. - bool HasQueuePending(CHAR_DATA *qChar) - { - for (auto& q : newQueue) - { - auto delay = std::get<0>(q); - auto v = std::get<1>(q); - auto contains = std::find(v.begin(), v.end(), qChar) != v.end(); - if (contains && delay > 0) - return true; - } - - return false; - } + bool HasQueuePending(CHAR_DATA *qChar); /// Deletes all entries in the queue pertaining to the specified character. /// @param qChar: The character to lookup in the queue. - void DeleteQueuedEventsInvolving(CHAR_DATA *qChar) - { - int deleted = 0; - newQueue.erase( - std::remove_if(newQueue.begin(), newQueue.end(), [&](const auto& item) - { - auto delay = std::get<0>(item); - auto v = std::get<1>(item); - auto contains = std::find(v.begin(), v.end(), qChar) != v.end(); - if (contains && delay > 0) - { - deleted++; - return true; - } - - return false; - }), newQueue.end()); - - Logger.Warn("{} events deleted.", deleted); - } + void DeleteQueuedEventsInvolving(CHAR_DATA *qChar); private: inline static CLogger Logger = CLogger(); - std::vector, std::function>> newQueue; + + struct queueEntry_t + { + int timer; + std::string callerFuncName; + std::string calleeFuncName; + std::vector charList; + std::function function; + }; + + // std::vector, std::function>> newQueue; + std::vector newQueue; /// Helper function used to extract character data from the specfied tuple. /// @note Main use is for extracting character data sent to the AddToQueue method. diff --git a/tests/queue_tests.c b/tests/queue_tests.c index 3225327..ce8a08a 100644 --- a/tests/queue_tests.c +++ b/tests/queue_tests.c @@ -1,6 +1,7 @@ #include "catch.hpp" #include "../code/queue.h" #include "../code/merc.h" +#include "../code/act_comm.h" void testQueueFunction(char_data *qChar) { return; @@ -16,8 +17,9 @@ SCENARIO("Testing queueing functions", "[AddToQueue]") { CQueue sut; char_data *mockPlayer = new char_data(); + mockPlayer->name = "Test"; - sut.AddToQueue(timer, testQueueFunction, mockPlayer); + sut.AddToQueue(timer, "queue_test", "testQueueFunction", testQueueFunction, mockPlayer); THEN("The queue should show a pending call") { @@ -33,9 +35,11 @@ SCENARIO("Testing deleting queue entries with that involve character", "[DeleteQ { CQueue sut; char_data *mockPlayer = new char_data(); + mockPlayer->name = "Test"; + int timer = 3; // 3 tics - sut.AddToQueue(timer, testQueueFunction, mockPlayer); + sut.AddToQueue(timer, "queue_test", "testQueueFunction", testQueueFunction, mockPlayer); WHEN("DeleteQueuedEventsInvolving is called with a specified character in the queue") { @@ -65,7 +69,22 @@ SCENARIO("Testing queue processing", "[ProcessQueue]") char_data* tmpChar = new char_data(); tmpChar->id = 10107; long expected = 1337L; - sut.AddToQueue(timer, updateValueFunction, tmpChar, expected); + sut.AddToQueue(timer, "queue_test", "updateValueFunction", updateValueFunction, tmpChar, expected); + sut.ProcessQueue(); + THEN("The function should update the value") + { + REQUIRE(tmpChar->id == expected); + } + } + + GIVEN("A function with a timer greater than one") + { + CQueue sut; + char_data* tmpChar = new char_data(); + tmpChar->name = "Test"; + tmpChar->id = 10107; + long expected = 1337L; + sut.AddToQueue(1, "queue_test", "updateValueFunction", updateValueFunction, tmpChar, expected); sut.ProcessQueue(); THEN("The function should update the value") { From 91f3b8d219d8671626ec659e289b8955c26eacad Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Sat, 14 Sep 2024 01:17:51 +0000 Subject: [PATCH 08/10] fixed issue where wrong mob was talking --- code/act_comm.c | 2 +- code/queue.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/act_comm.c b/code/act_comm.c index c281c1a..2e3d11a 100644 --- a/code/act_comm.c +++ b/code/act_comm.c @@ -719,7 +719,7 @@ void do_say(CHAR_DATA *ch, char *argument) // RS.Logger.Info("entered do_say args build buffer"); - char saymsg[MAX_STRING_LENGTH]; + char saymsg[MAX_STRING_LENGTH] = {0}; if (argument[strlen(argument) - 1] == '!') sprintf(saymsg, "exclaim"); else if (argument[strlen(argument) - 1] == '?') diff --git a/code/queue.h b/code/queue.h index 65d4076..6da8be9 100644 --- a/code/queue.h +++ b/code/queue.h @@ -35,15 +35,15 @@ class CQueue // capture parameter pack // //auto tuple = std::tuple::type...>(args...); - // auto tuple = std::tuple(args...); - // auto chs = GetCharacterData(tuple); - auto tuple = std::forward_as_tuple(std::forward(args)...); + //auto tuple = std::forward_as_tuple(std::forward(args)...); + auto tuple = std::tuple(args...); auto chs = GetCharacterData(tuple); // place on queue //auto qtip = std::make_tuple(nTimer, from, funcName, chs, [&]() { std::apply(func, tuple); }); //newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, tuple); }}); - newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, std::move(tuple)); }}); + //newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, std::move(tuple)); }}); + newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, std::forward_as_tuple(std::forward(args)...)); }}); Logger.Warn("Add => {} added {} with timer {}", from, funcName, nTimer); } From 5ab779ac7f6eda29ca013c54028fef30db92e4ef Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Mon, 16 Sep 2024 01:54:28 +0000 Subject: [PATCH 09/10] changed from reference lambda to mutable lambda. --- code/act_comm.c | 14 +++++++------- code/queue.h | 16 ++++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/code/act_comm.c b/code/act_comm.c index 2e3d11a..11549ea 100644 --- a/code/act_comm.c +++ b/code/act_comm.c @@ -658,7 +658,7 @@ const char *lowstring(const char *i) /// void do_say(CHAR_DATA *ch, char *argument) { -// RS.Logger.Info("entered do_say args => {}", argument); + RS.Logger.Info("entered do_say args => {}", argument); if (argument[0] == '\0') { @@ -667,7 +667,7 @@ void do_say(CHAR_DATA *ch, char *argument) } check_ooc(ch, argument, "SAY"); -// RS.Logger.Info("entered do_say args region"); + RS.Logger.Info("entered do_say args region"); #pragma region Reasons you should not be able to talk if (is_affected(ch, gsn_silence)) @@ -717,7 +717,7 @@ void do_say(CHAR_DATA *ch, char *argument) return; } -// RS.Logger.Info("entered do_say args build buffer"); + RS.Logger.Info("entered do_say args build buffer"); char saymsg[MAX_STRING_LENGTH] = {0}; if (argument[strlen(argument) - 1] == '!') @@ -730,7 +730,7 @@ void do_say(CHAR_DATA *ch, char *argument) auto buffer = fmt::format("You {} '{}$T{}'", saymsg, get_char_color(ch, "speech"), END_COLOR(ch)); act(buffer.c_str(), ch, nullptr, argument, TO_CHAR); -// RS.Logger.Info("entered do_say args loop 1"); + RS.Logger.Info("entered do_say args loop 1"); for (auto victim = ch->in_room->people; victim != nullptr; victim = victim->next_in_room) { @@ -751,7 +751,7 @@ void do_say(CHAR_DATA *ch, char *argument) } } -// RS.Logger.Info("entered do_say args loop 2"); + RS.Logger.Info("entered do_say args loop 2"); if (IS_SET(ch->in_room->progtypes, RPROG_SPEECH)) ch->in_room->rprogs->speech_prog(ch->in_room, ch, argument); @@ -765,7 +765,7 @@ void do_say(CHAR_DATA *ch, char *argument) CALL_MEVENT(room_char, TRAP_MSPEECH, ch, room_char, argument); } -// RS.Logger.Info("entered do_say args loop 3"); + RS.Logger.Info("entered do_say args loop 3"); report_cabal_items(ch, argument); @@ -781,7 +781,7 @@ void do_say(CHAR_DATA *ch, char *argument) CALL_IEVENT(char_obj, TRAP_ISPEECH, ch, char_obj, argument); } -// RS.Logger.Info("entered do_say args loop 4"); + RS.Logger.Info("entered do_say args loop 4"); for (auto char_obj = ch->in_room->contents; char_obj != nullptr; char_obj = char_obj->next_content) { diff --git a/code/queue.h b/code/queue.h index 6da8be9..aa722d7 100644 --- a/code/queue.h +++ b/code/queue.h @@ -4,6 +4,7 @@ #include "rift.h" #include "./stdlibs/clogger.h" #include +#include /* * DO NOT TOUCH ANYTHING @@ -33,17 +34,20 @@ class CQueue if(nTimer < 0) Logger.Warn("Negative Queue Timer - NumArgs: {}", sizeof...(Args)); + // print parameters + //((std::cout << ' ' << args << std::endl), ...); + // capture parameter pack - // //auto tuple = std::tuple::type...>(args...); - //auto tuple = std::forward_as_tuple(std::forward(args)...); auto tuple = std::tuple(args...); auto chs = GetCharacterData(tuple); // place on queue - //auto qtip = std::make_tuple(nTimer, from, funcName, chs, [&]() { std::apply(func, tuple); }); - //newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, tuple); }}); - //newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, std::move(tuple)); }}); - newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, std::forward_as_tuple(std::forward(args)...)); }}); + //newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, std::forward_as_tuple(std::forward(args)...)); }}); + + newQueue.push_back({nTimer, from, funcName, chs, [=] () mutable + { + std::apply(func, std::forward_as_tuple(std::forward(args)...)); + }}); Logger.Warn("Add => {} added {} with timer {}", from, funcName, nTimer); } From e07ef87e3c8435e6f752ed9e1b08b78f8f084112 Mon Sep 17 00:00:00 2001 From: Sean Gilliam Date: Mon, 16 Sep 2024 18:05:15 +0000 Subject: [PATCH 10/10] cleanup --- code/act_comm.c | 15 ------------ code/mspec.c | 12 +++------- code/queue.c | 64 ------------------------------------------------- code/queue.h | 3 --- 4 files changed, 3 insertions(+), 91 deletions(-) diff --git a/code/act_comm.c b/code/act_comm.c index 11549ea..bc8c540 100644 --- a/code/act_comm.c +++ b/code/act_comm.c @@ -658,8 +658,6 @@ const char *lowstring(const char *i) /// void do_say(CHAR_DATA *ch, char *argument) { - RS.Logger.Info("entered do_say args => {}", argument); - if (argument[0] == '\0') { send_to_char("Say what?\n\r", ch); @@ -667,8 +665,6 @@ void do_say(CHAR_DATA *ch, char *argument) } check_ooc(ch, argument, "SAY"); - RS.Logger.Info("entered do_say args region"); - #pragma region Reasons you should not be able to talk if (is_affected(ch, gsn_silence)) { @@ -717,8 +713,6 @@ void do_say(CHAR_DATA *ch, char *argument) return; } - RS.Logger.Info("entered do_say args build buffer"); - char saymsg[MAX_STRING_LENGTH] = {0}; if (argument[strlen(argument) - 1] == '!') sprintf(saymsg, "exclaim"); @@ -730,8 +724,6 @@ void do_say(CHAR_DATA *ch, char *argument) auto buffer = fmt::format("You {} '{}$T{}'", saymsg, get_char_color(ch, "speech"), END_COLOR(ch)); act(buffer.c_str(), ch, nullptr, argument, TO_CHAR); - RS.Logger.Info("entered do_say args loop 1"); - for (auto victim = ch->in_room->people; victim != nullptr; victim = victim->next_in_room) { if (is_awake(victim)) @@ -751,8 +743,6 @@ void do_say(CHAR_DATA *ch, char *argument) } } - RS.Logger.Info("entered do_say args loop 2"); - if (IS_SET(ch->in_room->progtypes, RPROG_SPEECH)) ch->in_room->rprogs->speech_prog(ch->in_room, ch, argument); @@ -765,8 +755,6 @@ void do_say(CHAR_DATA *ch, char *argument) CALL_MEVENT(room_char, TRAP_MSPEECH, ch, room_char, argument); } - RS.Logger.Info("entered do_say args loop 3"); - report_cabal_items(ch, argument); if (is_affected(ch, gsn_unholy_communion) && (ch->Class()->name == "anti-paladin")) @@ -781,8 +769,6 @@ void do_say(CHAR_DATA *ch, char *argument) CALL_IEVENT(char_obj, TRAP_ISPEECH, ch, char_obj, argument); } - RS.Logger.Info("entered do_say args loop 4"); - for (auto char_obj = ch->in_room->contents; char_obj != nullptr; char_obj = char_obj->next_content) { if (IS_SET(char_obj->progtypes, IPROG_SPEECH) && char_obj->pIndexData->iprogs) @@ -795,7 +781,6 @@ void do_say(CHAR_DATA *ch, char *argument) void do_say_queue(CHAR_DATA *ch, std::string argument) { - RS.Logger.Info("entered do_say_queue args => {}", argument); do_say(ch, argument.data()); } diff --git a/code/mspec.c b/code/mspec.c index 112f97b..c6acac0 100644 --- a/code/mspec.c +++ b/code/mspec.c @@ -138,20 +138,17 @@ END_SPEC void create_academy_pet(CHAR_DATA *ch) { - RS.Logger.Info("entered create_academy_pet"); CHAR_DATA *mob = create_mobile(get_mob_index(ACADEMY_PET)); char *name; if (!mob) return; - RS.Logger.Info("entered create_academy_pet free"); free_pstring(mob->name); free_pstring(mob->short_descr); free_pstring(mob->long_descr); free_pstring(mob->description); - RS.Logger.Info("entered create_academy_pet switch name"); switch (number_range(0, 16)) { case 0: @@ -209,7 +206,6 @@ void create_academy_pet(CHAR_DATA *ch) char namebuf[MSL], ldesc[MSL]; - RS.Logger.Info("entered create_academy_pet switch align"); switch (ch->alignment) { case 0: @@ -240,7 +236,6 @@ void create_academy_pet(CHAR_DATA *ch) break; } - RS.Logger.Info("entered create_academy_pet setup"); mob->name = palloc_string(namebuf); mob->short_descr = palloc_string(name); mob->long_descr = palloc_string(ldesc); @@ -249,7 +244,6 @@ void create_academy_pet(CHAR_DATA *ch) char_to_room(mob, ch->in_room); - RS.Logger.Info("entered create_academy_pet greetings"); if (ch->alignment == 1000) { do_say(mob, "Greetings, friend. I have been sent to help you become acclimated to the perils of these lands, "\ @@ -272,14 +266,14 @@ void create_academy_pet(CHAR_DATA *ch) ch->pet = mob; RS.Logger.Info("entered create_academy_pet queue"); - RS.Queue.AddToQueue(3, "create_academy_pet", "do_say_queue_1", do_say_queue, mob, + RS.Queue.AddToQueue(3, "create_academy_pet", "do_say_queue", do_say_queue, mob, "I can aid you in finding food, water, a boat, and a place to practice. If you need to find "\ "somewhere to fight for learning, I can help with that, as well as a few other things."); - RS.Queue.AddToQueue(5, "create_academy_pet", "do_say_queue_2", do_say_queue, mob, "To ask for my aid, direct your question to me."); + RS.Queue.AddToQueue(5, "create_academy_pet", "do_say_queue", do_say_queue, mob, "To ask for my aid, direct your question to me."); auto buffer = fmt::format("{}, I need to find food.", mob->short_descr); - RS.Queue.AddToQueue(8, "create_academy_pet", "do_say_queue_3", do_say_queue, ch, buffer); + RS.Queue.AddToQueue(8, "create_academy_pet", "do_say_queue", do_say_queue, ch, buffer); } void apet_force(CHAR_DATA *ch, const char *cmd, int delay) diff --git a/code/queue.c b/code/queue.c index 1555bdd..a1b329f 100644 --- a/code/queue.c +++ b/code/queue.c @@ -5,32 +5,12 @@ /// Once all items are processed, those functions that have executed are removed from the queue. void CQueue::ProcessQueue() { - // newQueue.erase( - // std::remove_if(newQueue.begin(), newQueue.end(), [](const auto& item) - // { - // auto delay = std::get<0>(item); - // if (delay < 0) - // return true; - - // if (--delay == 0) - // { - // auto func = std::get<2>(item); - // func(); - // return true; - // } - - // return false; - // }), newQueue.end()); - for (auto& item : newQueue) { - // if (--std::get<0>(item) == 0) if (--item.timer == 0) { - // Logger.Warn("Processing funcs ==> from {} func {} timer {}", std::get<1>(item), std::get<2>(item), std::get<0>(item)); Logger.Warn("Processing funcs ==> from {} func {} timer {}", item.callerFuncName, item.calleeFuncName, item.timer); - // auto func = std::get<4>(item); auto func = item.function; func(); } @@ -39,38 +19,10 @@ void CQueue::ProcessQueue() newQueue.erase( std::remove_if(newQueue.begin(), newQueue.end(), [](const auto& item) { - // Logger.Warn("Processing delete ==> {}", std::get<0>(item)); Logger.Warn("Processing delete ==> {}", item.timer); - // return std::get<0>(item) < 0; return item.timer < 0; }), newQueue.end()); - - - // auto it = newQueue.begin(); - // while (it != newQueue.end()) - // { - // Logger.Warn("Process size ==> {} / delay ==> {}", newQueue.size(), std::get<0>(*it)); - // //int ith = it - newQueue.begin(); - // //Logger.Warn("==> delay {}", std::get<0>(*it)); - // if (std::get<0>(*it) < 0) // remove rogue timer - // { - // it = newQueue.erase(it); - // continue; - // } - - // if (--std::get<0>(*it) == 0) // showtime - // { - // auto func = std::get<2>(*it); - // func(); - - // it = newQueue.erase(it); - // } - // else - // { - // it++; - // } - // } } /// Determines if a specific character has any remaining entries in the queue. @@ -81,17 +33,9 @@ bool CQueue::HasQueuePending(CHAR_DATA *qChar) { for (auto& item : newQueue) { - // auto delay = std::get<0>(item); - // auto v = std::get<3>(item); auto delay = item.timer; auto v = item.charList; auto contains = std::find(v.begin(), v.end(), qChar) != v.end(); - // auto contains = std::find_if(v.begin(), v.end(), [&](auto& ch) - // { - // Logger.Warn("==> {}", ch->name); - // Logger.Warn("==> {}", qChar->name); - // return strcmp(ch->name, qChar->name) == 0; - // }) != v.end(); Logger.Warn("==> Has queue {} {}", contains, delay); if (contains && delay > 0) @@ -109,17 +53,9 @@ void CQueue::DeleteQueuedEventsInvolving(CHAR_DATA *qChar) newQueue.erase( std::remove_if(newQueue.begin(), newQueue.end(), [&](const auto& item) { - // auto delay = std::get<0>(item); - // auto v = std::get<3>(item); auto delay = item.timer; auto v = item.charList; auto contains = std::find(v.begin(), v.end(), qChar) != v.end(); - // auto contains = std::find_if(v.begin(), v.end(), [&](auto& ch) - // { - // Logger.Warn("==> {}", ch->name); - // Logger.Warn("==> {}", qChar->name); - // return strcmp(ch->name, qChar->name) == 0; - // }) != v.end(); Logger.Warn("==> Delete {} {}", contains, delay); if (contains && delay > 0) diff --git a/code/queue.h b/code/queue.h index aa722d7..7dbfe65 100644 --- a/code/queue.h +++ b/code/queue.h @@ -42,8 +42,6 @@ class CQueue auto chs = GetCharacterData(tuple); // place on queue - //newQueue.push_back({nTimer, from, funcName, chs, [&]() { std::apply(func, std::forward_as_tuple(std::forward(args)...)); }}); - newQueue.push_back({nTimer, from, funcName, chs, [=] () mutable { std::apply(func, std::forward_as_tuple(std::forward(args)...)); @@ -77,7 +75,6 @@ class CQueue std::function function; }; - // std::vector, std::function>> newQueue; std::vector newQueue; /// Helper function used to extract character data from the specfied tuple.