Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Code refactored, hilarity ensues

Sign in to follow this  


So, our Game class teacher gave us a list of suggestion that he'd like to see in our game. Nothing major, just some small changes...

...that require me to rewrite the entire AI system.

It's not as bad as it sounds, the AI system in place was in dire need of a rewrite anyway, and the new game play will be considerably easier to write an AI for. Still, it's going to be a long weekend.

You know what keeps me motivated to work on my school game? The hilarious shit I find in my teammates code when we have to refactor. Some gems I cam across today:

int i = 0;

//C++ is the stupidest language ever...
//Can't just do a simple memcpy with class data
Color* new_colors = new Color [length + 1];
for (i = 0; i < length; i++)
new_colors = chat_string_colors ;
new_colors [length] = c;

delete [] chat_string_colors;
chat_string_colors = new_colors;

So I guess if C++ is the stupidest language ever, everyone who uses it must be an idiot? If you want to be intelligent, use C! Bullocks to this new-fangled C++ mumbo jumbo!

The STL is the worst thing in history
Instead of simply doing one add and one multiply to
get to a location in memory, I have to do this crap...

unsigned int grab_index = atoi (recvPacket.strings [0]);

Dandellos_iter d = new_Dandes.begin ();
for (unsigned int i = 0; i < grab_index; i++)
d ++;

new_Dandes.erase (d);

So many things about this crack me up. It goes without saying that here is someone who does not have the faintest idea how to use the SC++L, yet feels qualified to bash it. But I think what gets me the most is that currently we are using a linked list to store Dandellos, so even if we weren't using the standard lib, you couldn't get to an arbitrary node by "simply doing one add and one multiply".

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!