DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • July 31, 2010, 03:48:57 AM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: Tournament98 question  (Read 1241 times)
0 Members and 1 Guest are viewing this topic.
enderwiggin
Guest
« on: January 17, 2005, 07:18:34 PM »

I was taking a peak at the code for the .9.8 version of the Tournament module.  I'm planning on doing a Dwarf Toss module, and I was considering using the Tournament as somewhat of a template.  I don't know how to get ahold of the person who did the conversion, and Talisman says he doesn't know anything about the conversion.

There are two lines:

   case "dragonkill":
   case "namechange":

Shouldn't every case end with a break?  The dragonkill hook here is empty.  Was something planned here and not implemented?  Was something intentionally removed?

I'm just curious.
Logged
dvd871
Guest
« Reply #1 on: January 17, 2005, 08:44:52 PM »

The case does end with a break:
Code:
   case "dragonkill":
    case "namechange":
        if ($leader == $session['user']['acctid']) {
            invalidatedatacache("tournamentleader");
        }
        break;

You can have multiple cases in your switch, such as:
case 1: case 2:
.
.
.
break;

and also like the code fragment above. Smiley
Logged
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #2 on: January 19, 2005, 10:01:31 AM »

Exactly what dvd871 said.


By doing that he made both cases do the same thing. Instead of making two cases doing the exact same thing and wasting like 4 lines of space.

Example:

Instead of -
Code:
   case "dragonkill":
   if ($leader == $session['user']['acctid']) {
            invalidatedatacache("tournamentleader");
        }
        break;
     case "namechange":
          if ($leader == $session['user']['acctid']) {
            invalidatedatacache("tournamentleader");
        }
        break;

It was more efficient to do:
Code:
   case "dragonkill":
    case "namechange":
        if ($leader == $session['user']['acctid']) {
            invalidatedatacache("tournamentleader");
        }
        break;
« Last Edit: January 19, 2005, 10:01:52 AM by Arune » Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Who's Online
27 Guests, 1 User
spector
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search