optional_emtpy() ?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • optional_emtpy() ?

      Hmm, maybe I missed it or something. But everywhere in the teepot code, you call optional_emtpy() as actorID, whats up with that?

      This whole actorID thing, I can't really get my grip around it, is that just some random number? Don't you need to keep trac of all other IDs that are used and so on?

      Hope this ain't a to stupid question.

      Best regards
      Jesper
    • RE: optional_emtpy() ?

      ActorID isn't random. It starts at 0 (set in the BaseGame constructor) and is incremented everytime a new actor is added (see BaseGame::VAddActor()). As you can see, it sets the new actor's id to m_LastActorId, then increments m_LastActorId.

      Really, it's just a way to uniquely identify each actor (critical to any game). In a real game, all this would be set inside data files. Rat Race uses strings to identify each actor (we call them Entities), which are all defined in XML files.

      I didn't check for the calls to optional_empty, but I'm pretty sure that's just initialization code. All the magic happens in TeapotWarsGame::VAddView() when a teapot is created with the CreateTeapot() call. This news up a BaseActor object and sends it to TeapotWarsBaseGame::VAddActor(), which calls BaseGame::VAddActor(). That's where the ID's are set and tweaked.

      Hope that helped! Okay, time to figure why Barbie isn't learning new interest topics. Learn damn you, LEARN!!! Off to the pixel mines with me....

      -Rez