From eba02683e255b87a17619af5f7f52403dac8142d Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Thu, 23 Dec 2004 02:24:04 +0000 Subject: [PATCH] give Arch a little more variety svn path=/trunk/; revision=12296 --- rosapps/games/ArchBlackmann/ArchBlackmann.cpp | 70 ++++++++++++++++--- rosapps/games/ArchBlackmann/dev.txt | 14 ++++ rosapps/games/ArchBlackmann/module.txt | 13 ++++ rosapps/games/ArchBlackmann/period.txt | 11 +++ rosapps/games/ArchBlackmann/stru.txt | 7 ++ rosapps/games/ArchBlackmann/tech.txt | 29 +++++--- 6 files changed, 124 insertions(+), 20 deletions(-) create mode 100644 rosapps/games/ArchBlackmann/dev.txt create mode 100644 rosapps/games/ArchBlackmann/module.txt create mode 100644 rosapps/games/ArchBlackmann/period.txt create mode 100644 rosapps/games/ArchBlackmann/stru.txt diff --git a/rosapps/games/ArchBlackmann/ArchBlackmann.cpp b/rosapps/games/ArchBlackmann/ArchBlackmann.cpp index 069f4535cec..5d9898d2ef2 100644 --- a/rosapps/games/ArchBlackmann/ArchBlackmann.cpp +++ b/rosapps/games/ArchBlackmann/ArchBlackmann.cpp @@ -17,11 +17,63 @@ using std::vector; const char* ArchBlackmann = "ArchBlackmann"; -vector tech_replies; +vector tech, module, dev, stru, period; -const char* TechReply() +void ImportList ( vector& list, const char* filename ) { - return tech_replies[rand()%tech_replies.size()].c_str(); + File f ( filename, "r" ); + string line; + while ( f.next_line ( line, true ) ) + list.push_back ( line ); +} + +const char* ListRand ( const vector& list ) +{ + return list[rand()%list.size()].c_str(); +} + +string TechReply() +{ + string t = ListRand(tech); + string out; + const char* p = t.c_str(); + while ( *p ) + { + if ( *p == '%' ) + { + if ( !strnicmp ( p, "%dev%", 5 ) ) + { + out += ListRand(dev); + p += 5; + } + else if ( !strnicmp ( p, "%period%", 8 ) ) + { + out += ListRand(period); + p += 8; + } + else if ( !strnicmp ( p, "%module%", 8 ) ) + { + out += ListRand(module); + p += 8; + } + else if ( !strnicmp ( p, "%stru%", 6 ) ) + { + out += ListRand(stru); + p += 6; + } + else + out += *p++; + } + const char* p2 = strchr ( p, '%' ); + if ( !p2 ) + p2 = p + strlen(p); + if ( p2 > p ) + { + out += string ( p, p2-p ); + p = p2; + } + } + return out; } // do custom stuff with the IRCClient from your subclass via the provided callbacks... @@ -60,7 +112,7 @@ public: strlwr ( &text2[0] ); if ( !strnicmp ( text2.c_str(), ArchBlackmann, strlen(ArchBlackmann) ) ) { - string reply = ssprintf("%s: %s", from.c_str(), TechReply()); + string reply = ssprintf("%s: %s", from.c_str(), TechReply().c_str()); flog.printf ( "TECH-REPLY: %s\n", reply.c_str() ); return PrivMsg ( channel, reply ); } @@ -98,11 +150,11 @@ public: int main ( int argc, char** argv ) { srand ( time(NULL) ); - File f ( "tech.txt", "r" ); - string line; - while ( f.next_line ( line, true ) ) - tech_replies.push_back ( line ); - f.close(); + ImportList ( tech, "tech.txt" ); + ImportList ( stru, "stru.txt" ); + ImportList ( dev, "dev.txt" ); + ImportList ( period, "period.txt" ); + ImportList ( module, "module.txt" ); printf ( "initializing IRCClient debugging\n" ); IRCClient::SetDebug ( true ); diff --git a/rosapps/games/ArchBlackmann/dev.txt b/rosapps/games/ArchBlackmann/dev.txt new file mode 100644 index 00000000000..a41350d255e --- /dev/null +++ b/rosapps/games/ArchBlackmann/dev.txt @@ -0,0 +1,14 @@ +Royce3 +kjk_hyperion +tamlin +GvG +filip2307 +hardon +w3seek +arty +sedwards +Exception +blight_ +jimtabor +mtempel +Gge \ No newline at end of file diff --git a/rosapps/games/ArchBlackmann/module.txt b/rosapps/games/ArchBlackmann/module.txt new file mode 100644 index 00000000000..b9956a73854 --- /dev/null +++ b/rosapps/games/ArchBlackmann/module.txt @@ -0,0 +1,13 @@ +the kernel +ntoskrnl +win32k +msafd +ws2_32 +user32 +shell32 +the cache manager +tdi +the scheduler +the thread queue +the message queue +atapi \ No newline at end of file diff --git a/rosapps/games/ArchBlackmann/period.txt b/rosapps/games/ArchBlackmann/period.txt new file mode 100644 index 00000000000..380a6fefe38 --- /dev/null +++ b/rosapps/games/ArchBlackmann/period.txt @@ -0,0 +1,11 @@ +minute +hour +day +week +fortnight +month +year +decade +century +millenium +eon \ No newline at end of file diff --git a/rosapps/games/ArchBlackmann/stru.txt b/rosapps/games/ArchBlackmann/stru.txt new file mode 100644 index 00000000000..e3a9ccd728d --- /dev/null +++ b/rosapps/games/ArchBlackmann/stru.txt @@ -0,0 +1,7 @@ +FAST_MUTEX +KPCR +PEB +TEB +SPINLOCK +APC +DPC diff --git a/rosapps/games/ArchBlackmann/tech.txt b/rosapps/games/ArchBlackmann/tech.txt index 66f452342ba..0277ba7f7d2 100644 --- a/rosapps/games/ArchBlackmann/tech.txt +++ b/rosapps/games/ArchBlackmann/tech.txt @@ -1,11 +1,11 @@ What do you think I am, your personal tech support? -You *know* a FAST_MUTEX is non-re-entrant, right? +You *know* a %stru% is non-re-entrant, right? The answer to that is so simple, I'm not going to waste my time telling you. -Well, of course... if you're not below DISPATCH_LEVEL, ros is gonna explode on ya. +Well, of course... if you're not below DISPATCH_LEVEL, ros is gonna explode on ya when you try to do that ( duh! ). I don't think that functionality has been implemented, yet. What do you mean it crashed? It can't crash there! Wow. That's a new one. -Ask Filip, I bet he knows.. he knows everything... +Ask %dev%, I bet he knows.. he knows everything... When's the last time you rebuilt? Have you tried a make clean? Is it plugged in? @@ -17,23 +17,27 @@ Try surrounding it with parenthesis. Don't you know going around dereferncing null pointers all day can be hazardous to your health? Well, duh! There's a bit in cr3 for problems like that. -Just add a field to the PEB to keep track of it! +Just add a field to the %stru% to keep track of it! Don't worry about it... the garbage collector in the kernel will clean it up for you. Did I do that? +Didn't %dev% fix that already? Yes, I think I've seen that bug before... no... that was another program. I could tell you, but then I'd have to unlink() you. -Well if you'd get some sleep, maybe you'd figure it out... not all of us can keep the hours arty can... +Well if you'd get some sleep, maybe you'd figure it out... not all of us can keep the hours %dev% can... You did what? Uh oh... that can't be good. Well... I could tell you, but the answer's pretty complicated. Why don't you wait to read about it in the book I'm writing. Yeah, that's happened to me, before, too. All you have to do is wrap it in an SEH block and forget about it. +Just put a NULL dereference in there and commit it. It helps get bugs fixed fast! (Not that I would know) ASSERT is your friend! -I dunno.. but I bet GvG could find it for you. +I dunno.. but I bet %dev% could find it for you. I hereby declare that code is perfect. Your problem must be elsewhere. I wrote that code... it must be perfect. +$#@!$ One of these days I'm gonna throw %module% out the window!!! Sorry, what were you saying? maybe I broke it in my last commit. Maybe I did it on purpose... Have you tried debugging it? I got a can of Raid... +Just delete it, it can't be that important ( You should see all the useless cruft I got rid of in %module% ) Try queueing a work item... -My DPC fell in love with an APC in the scheduler, and the code has been hell since... +My %stru% fell in love with some %stru% in %module%, and %module% has been hell since... Maybe the PEB is getting corrupted. Try allocating a new PEB and overwriting the old one. That's what I did last time I had a bug like that. Hmm.. that seems to have been introduced by my last commit... I bet CVS mixed up the bits during the commit. It can't possibly be my fault, so I don't care. @@ -41,14 +45,17 @@ I'm not experiencing that problem, perhaps it's all in your mind. Well... like a good friend of mine said... "Don't Panic!" It just shows you how far ReactOS has come along! A year ago a bug like that wouldn't have even been possible! Just surround the code with an #if 0/#endif block, it solves all my problems! -You know.. if kjk_hyperion had implemented lsa for us, we wouldn't be having this problem. +You know.. if %dev% would just finish %module% for us, we wouldn't be having this problem. I say we move on to the next function, since we can't seem to figure this one out. Well, sure, that would have been my first guess, too.... TEN YEARS AGO :p yup, that sounds like a problem. If I wanted to talk about VB, I'd go bug Alex... -ask arty +ask %dev% Thank you for that amazingly keen insight, Commander Obvious. -I dont know about that, but I just fixed a problem in MSAFD for Arty. +Sorry, can't help you right now, trying to track down this bug %dev% caused in %module% +I dont know about that, but I just fixed a problem in %module% for %dev% How should I know? I'm still trying to figure out this main() thing... ooh! wanna see what I did in the kernel? lol! -*wink* \ No newline at end of file +*wink* +42 +It's gonna take me %period%s to fix all %dev%'s bugs in %module% :( \ No newline at end of file -- 2.17.1