Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Misc > Archive::Off Topic

Archive::Off Topic Archive area for Off Topic's posts that were moved here after an inactivity period of 90 days.

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 09-05-2004, 03:44 PM
Zkhava
Hill Giant
 
Join Date: Jul 2004
Posts: 206
Default C++

Heres Some Code for ya !

Code:
 #include 
using std::cout;
using std::string;

class Extension {
public:
   virtual ~Extension() { }
   void registerOwner( class Image* o ) { owner = o; }
protected:
   Image* owner;
};

class MosaicExtension : public Extension { public:
   void doMosaic();
};

class HeatExtension : public Extension { public:
   void doThermalSpectrum();
};


class Image {
   string name;
public:
   Image( string n ) : name(n) { }
   string getName()  { return name; }
   void display()    { cout getName() getName() registerOwner( this );
   }
   ~Lsat() { delete exten; }
   /*virtual*/ Extension* getExtension( const type_info& ti ) {
      if (typeid(MosaicExtension) == ti) return exten;
      return Image::getExtension( ti );
   }
};

class IR : public Image {
   Extension*  exten;
public:
   IR( string n, Extension* ex ) : Image( n ) {
      exten = ex;
      exten->registerOwner( this );
   }
   ~IR() { delete exten; }
   /*virtual*/ Extension* getExtension( const type_info& ti ) {
      if (typeid(HeatExtension) == ti) return exten;
      return Image::getExtension( ti );
   }
};


void main( void ) {
   Image* images[4] = {
      new Lsat( "Western hemisphere", new MosaicExtension() ),
      new IR( "Desert Storm",         new MosaicExtension()   ),
      new Lsat( "Amazon rain forest", new HeatExtension() ),
      new IR( "Gulf of Oman",         new HeatExtension()   ) };
   Extension*        ext;
   MosaicExtension*  mosaicExt;
   HeatExtension*    heatExt;

   for (int i=0; i < 4; i++) {
      images[i]->display();
      if (ext = images[i]->getExtension( typeid(MosaicExtension) )) {
         if (mosaicExt = dynamic_cast( ext ))
            mosaicExt->doMosaic();
      } else if (ext = images[i]->getExtension( typeid(HeatExtension) )) {
         if (heatExt = dynamic_cast( ext ))
            heatExt->doThermalSpectrum();
   }  }
   for (i=0; i < 4; i++) delete images[i];
&

Code:
// Purpose: messages travel both up and down the layers, 
// message interface per layer per direction, 
// one concrete Facade per layer (implements 1 or 2 interfaces) 
// Singleton access to Facade objects 

#include 
using namespace std; 

class ChildOf3 { public: virtual void downMessage() = 0; }; 
class ParentOf2 { public: virtual void upMessage() = 0; }; 
class ChildOf2 { public: virtual void downMessage() = 0; }; 
class ParentOf1 { public: virtual void upMessage() = 0; }; 

class C : public ParentOf2 { public: 
void execute(); 
void upMessage(); 
}; 
class B : public ParentOf1, public ChildOf3 { public: 
void upMessage(); 
void downMessage(); 
}; 
class A : public ChildOf2 { public: 
void downMessage(); 
void execute(); 
}; 

class SC { // Singleton Collection 
public: 
static C& layer3() { return cObject; } 
static B& layer2() { return bObject; } 
static A& layer1() { return aObject; } 
private: 
static C cObject; static B bObject; static A aObject; 
}; 
C SC::cObject; B SC::bObject; A SC::aObject; 

void thirdParty( ChildOf2& obj1, ChildOf3& obj2, ParentOf2& obj3 ) { 
obj1.downMessage(); 
obj2.downMessage(); 
obj3.upMessage(); 
} 

void main( void ) { 
SC::layer3().execute(); 
SC::layer1().execute(); 
thirdParty( SC::layer1(), SC::layer2(), SC::layer3() ); 
} 

// C::execute // A::execute // A::downMessage 
// B::downMessage // B::upMessage // B::downMessage 
// A::downMessage // C::upMessage // A::downMessage 
// C::upMessage 

void C::execute() { cout
Developers..... These are for a Little game im making so msg me on msn or something !

Zkhava~!
  #2  
Old 09-05-2004, 04:10 PM
sotonin
Demi-God
 
Join Date: May 2004
Posts: 1,177
Default

couple questions.

1. What are you smoking?
2. Why do the developers care
3. Why would anybody care about a few random code snippets about *some* game u'r making without any explanation what it is or what you *think* this code does.
  #3  
Old 09-05-2004, 04:24 PM
Zkhava
Hill Giant
 
Join Date: Jul 2004
Posts: 206
Default

mmm maybe because i got c++ down a lil bit ... Im smoking nothing..... im showing developers bout that i know c++ & would try to get to junior developer ....


So stfu sotonin! argh...
  #4  
Old 09-05-2004, 05:11 PM
Anarchy's Avatar
Anarchy
Fire Beetle
 
Join Date: Jun 2004
Posts: 3
Default

i think sotonins title needs to be changed back to "I need to flame to feel self worthy"
this is what makes the project bad...
  #5  
Old 09-05-2004, 05:27 PM
molimo140
Hill Giant
 
Join Date: Dec 2003
Posts: 104
Default

Word.
__________________
Server-OP and host of Lord of the Rings [Legit-Custom] Server
  #6  
Old 09-05-2004, 05:31 PM
Zkhava
Hill Giant
 
Join Date: Jul 2004
Posts: 206
Default

Thx you 2


true......... sotonin is "Negative" !$!!!
  #7  
Old 09-05-2004, 05:47 PM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Er you just said that your friend knew C++ and not you....

Hmmm
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
  #8  
Old 09-05-2004, 06:14 PM
Zkhava
Hill Giant
 
Join Date: Jul 2004
Posts: 206
Default

We been friends for 1year now....... I collect c++ just from watching him......


Bout 1/10 of this is from him.......
  #9  
Old 09-05-2004, 06:51 PM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

mmmm

Code:
#include 
#include
??
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
  #10  
Old 09-05-2004, 07:03 PM
Charmy
Discordant
 
Join Date: May 2004
Location: The DeathStar of David
Posts: 337
Default

i am no C++ dev but doesn't
Code:
cout getName() getName() registerOwner( this );
require the stream insertion operator? &lt;&lt;?? i.e
Code:
 cout&lt;&lt;"Welcome BoB!!" &lt;&lt; functionoutput() &lt;&lt; function2output();
and as cisyouc pointed out what are you including?

Your program isn't very programmer portable friendly either, its hard to determine what exactly each of these A,B,C, Objects are suppose to represent, are they characters? are they npcs? are they animation sprites?
__________________
Mess with the Jews, and we will take all your money
Grunties Rule
And with that... I end
Any Other Questions, please refer to the Following:
http://iliilllli1.netfirms.com
  #11  
Old 09-05-2004, 07:27 PM
Zkhava
Hill Giant
 
Join Date: Jul 2004
Posts: 206
Default

Characters Charmy........
  #12  
Old 09-05-2004, 07:30 PM
Charmy
Discordant
 
Join Date: May 2004
Location: The DeathStar of David
Posts: 337
Default

So a game your making?

If its your game i take it you wrote the code?


Sadly i have no life at this time in the moring, and when i can't sleep i wander the internet looking at hawt male porn and searching for answers, and in my quest i found the following.

Code:
// Purpose: messages travel both up and down the layers,
//          message interface per layer per direction,
//          one concrete Facade per layer (implements 1 or 2 interfaces)
//          Singleton access to Facade objects

#include &lt;iostream>
using namespace std;

class ChildOf3  { public: virtual void downMessage() = 0; };
class ParentOf2 { public: virtual void upMessage()   = 0; };
class ChildOf2  { public: virtual void downMessage() = 0; };
class ParentOf1 { public: virtual void upMessage()   = 0; };

class C : public ParentOf2 { public:
   void execute();
   void upMessage();
};
class B : public ParentOf1, public ChildOf3 { public:
   void upMessage();
   void downMessage();
};
class A : public ChildOf2 { public:
   void downMessage();
   void execute();
};

class SC {   // Singleton Collection
public:
   static C&amp; layer3() { return cObject; }
   static B&amp; layer2() { return bObject; }
   static A&amp; layer1() { return aObject; }
private:
   static C cObject;  static B bObject;  static A aObject;
};
   C SC::cObject;     B SC::bObject;     A SC::aObject;

void thirdParty( ChildOf2&amp; obj1, ChildOf3&amp; obj2, ParentOf2&amp; obj3 ) {
   obj1.downMessage();
   obj2.downMessage();
   obj3.upMessage();
}

void main( void ) {
   SC::layer3().execute();
   SC::layer1().execute();
   thirdParty( SC::layer1(), SC::layer2(), SC::layer3() );
}

// C::execute          // A::execute        // A::downMessage
// B::downMessage      // B::upMessage      // B::downMessage
// A::downMessage      // C::upMessage      // A::downMessage
                                            // C::upMessage

void C::execute()     { cout &lt;&lt; "C::execute" &lt;&lt; endl;
                        SC::layer2().downMessage(); }
void C::upMessage()   { cout &lt;&lt; "C::upMessage" &lt;&lt; endl; }

void B::upMessage()   { cout &lt;&lt; "B::upMessage" &lt;&lt; endl;
                        SC::layer3().upMessage(); }
void B::downMessage() { cout &lt;&lt; "B::downMessage" &lt;&lt; endl;
                        SC::layer1().downMessage(); }

void A::execute()     { cout &lt;&lt; "A::execute" &lt;&lt; endl;
                        SC::layer2().upMessage(); }
void A::downMessage() { cout &lt;&lt; "A::downMessage" &lt;&lt; endl; }
looks familiar....

http://home.earthlink.net/~huston2/dp/layersCpp
http://home.earthlink.net/~huston2/d...nsionObjectCpp

Really, don't take credit for other ppls work, its not cool, infact in all of the code network sites they say if you use this code give credit where credit is due =/ you just went and ripped this off. that or you were trying to retype it with about a 1% accuracy.

The only other thing i can think of is you were taking a tutorial from this site or somthing, and got confused somewhere.

**Just a note, before you go and say this is your friends site you might want to double check what you wrote up a little earlier about only 1/10 of this code being written by him.**

I am not one to usually bring this up, but if there is one thing being a jew has taught me its don't take credit for shit you didn't do, it just pisses people off.

And Finally
Quote:
Characters Charmy........
As if its suppose to be obvious using variable names like objectA, ParentB and ChildC? errm.....
__________________
Mess with the Jews, and we will take all your money
Grunties Rule
And with that... I end
Any Other Questions, please refer to the Following:
http://iliilllli1.netfirms.com
  #13  
Old 09-05-2004, 08:49 PM
gayfag~
Banned
 
Join Date: Aug 2004
Posts: 86
Default

ownzed.

and he deserve sotonin's post for making this thread. if he wanst retarded he would talk to the dev on irc and pm them the code or something.
  #14  
Old 09-06-2004, 01:32 AM
bluejam
Hill Giant
 
Join Date: Apr 2004
Posts: 110
Default

Quote:
ownzed.
Hell yeah :)
  #15  
Old 09-06-2004, 03:01 AM
Melwin
Fire Beetle
 
Join Date: Jan 2005
Posts: 15
Default

Topic locked. Don't do this again.

I think the replies speak for themselves. Nice eDetective work there, Charmy. :P
__________________
Shards of Dalaya Staff Administrator
I have stairs in my house.
Closed Thread


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 04:27 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3