Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline AdrianeMapMaker  
#1 Posted : Monday, October 23, 2017 6:50:37 AM(UTC)
AdrianeMapMaker
General
C&C Labs Staff: Labs Staff MemberMaps Staff: Maps Staff Member
Joined: 3/8/2016(UTC)
Posts: 1,156
Philippines

Thanks: 312 times
Was thanked: 185 time(s) in 149 post(s)
Are Enum Are HardCoded


- What are these enum , what certain things that they can do?
A part of ZH worldbuilders map making community
https://discord.gg/tJ6zyGb

UserPostedImage





Sponsor
Offline acidbrain  
#2 Posted : Monday, October 23, 2017 7:32:53 AM(UTC)
acidbrain
General
Joined: 12/30/2011(UTC)
Posts: 982

Thanks: 95 times
Was thanked: 574 time(s) in 364 post(s)
Yip, enums(enumerations) are hardcoded...
It is something like this, I will do it in java code:
Code:

public enum Superweapons {
    NUCLEAR_MISSILE(Radioactivity),
    ANTHRAX_BOMB(Biohazard),
    FUEL_BOMB(Firestorm);

  private String damage;

  Superweapons(String damage) {
    this.damage = damage;
  }

  public String getDamage() {  // :P
    return damage;
  }
}

public class SWDemo {
  public static void main(String args(square brackets here)) {
    // Display damage of nuclear missile superweapon, prints ´Radioactivity´
    System.out.println(Superweapons.NUCLEAR_MISSILE.getDamage()); 

    // Display all sw´s and damages.
    System.out.println("All Superweapon damages:");
    for (Superweapons sw : Superweapons.values())
      System.out.println(sw + " gives " + sw.getDamage() + " damage.");
  }
}


You can tie certain characteristics to an enum such as a texture for example, usually enums and other final parameters are capitalized, e.g. NUCLEAR_MISSILE.

Cheers

Edited by user Friday, November 10, 2017 12:10:15 PM(UTC)  | Reason: Secret

Panem et kirkinses
thanks 1 user thanked acidbrain for this useful post.
CommieDog on 10/24/2017(UTC)
Offline AdrianeMapMaker  
#3 Posted : Monday, October 23, 2017 7:57:55 AM(UTC)
AdrianeMapMaker
General
C&C Labs Staff: Labs Staff MemberMaps Staff: Maps Staff Member
Joined: 3/8/2016(UTC)
Posts: 1,156
Philippines

Thanks: 312 times
Was thanked: 185 time(s) in 149 post(s)
can we make our own enum and use it to generals? you think?
A part of ZH worldbuilders map making community
https://discord.gg/tJ6zyGb

UserPostedImage





Offline acidbrain  
#4 Posted : Monday, October 23, 2017 12:08:19 PM(UTC)
acidbrain
General
Joined: 12/30/2011(UTC)
Posts: 982

Thanks: 95 times
Was thanked: 574 time(s) in 364 post(s)
Nope
Panem et kirkinses
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.