.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Air Assault Task Force- Save $8.00
Bronze- Save $10.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: Starfury

Reply
 
Thread Tools Display Modes
  #1  
Old November 4th, 2003, 07:51 PM
Ed Kolis's Avatar

Ed Kolis Ed Kolis is offline
General
 
Join Date: Apr 2001
Location: Cincinnati, Ohio, USA
Posts: 4,547
Thanks: 1
Thanked 7 Times in 5 Posts
Ed Kolis is on a distinguished road
Default Re: Anyone working on a modding tool yet?

Though there are times when I am tempted to use it instead of more "sophisticated" programming techniques... I mean, which is easier to read:

Old-Style Quick & Dirty Gotos
code:
foreach (Array innerArray in outerArray)
{
foreach (Item i in innerArray)
{
if (i == target)
{
foundit = true;
goto done;
}
}
}
done:

"Sophisticated" Procedural Programming Workaround
code:
foreach (Array innerArray in outerArray)
{
foreach (Item i in innerArray)
{
if (i == target)
{
foundit = true;
// can't break out of more than one loop at once without a goto!
break;
}
}
// so I have to check again in each loop level to avoid wasting time searching for something I already found!
// not too annoying with only 2 levels, but with more...
if (foundit == true)
break;
}

OK, that wasn't the best example (when was the Last time you had more than 3 levels of nested loops anyway? ) but there ARE times when a goto would come in handy, but I couldn't make myself touch it for fear of being shunned for life
__________________
The Ed draws near! What dost thou deaux?
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On

Forum Jump


All times are GMT -4. The time now is 04:40 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.