rosapps/games/ArchBlackmann
diff -u -r1.2 -r1.3
--- ArchBlackmann.cpp 22 Dec 2004 21:53:02 -0000 1.2
+++ ArchBlackmann.cpp 23 Dec 2004 02:24:04 -0000 1.3
@@ -17,11 +17,63 @@
const char* ArchBlackmann = "ArchBlackmann";
-vector<string> tech_replies;
+vector<string> tech, module, dev, stru, period;
-const char* TechReply()
+void ImportList ( vector<string>& 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<string>& 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 @@
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 @@
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 );
rosapps/games/ArchBlackmann
diff -u -r1.1 -r1.2
--- tech.txt 22 Dec 2004 18:57:09 -0000 1.1
+++ tech.txt 23 Dec 2004 02:24:04 -0000 1.2
@@ -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 @@
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 @@
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