Back to index

supertuxkart  0.5+dfsg1
Public Member Functions
JungleFollow Class Reference

#include <jungle_follow.hpp>

Inheritance diagram for JungleFollow:
Inheritance graph
[legend]
Collaboration diagram for JungleFollow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 JungleFollow ()
virtual bool raceFinished ()
virtual void setRace () const
const std::string & getId () const
const std::string & getName () const
void addUnlockTrackReward (std::string track_name)
void addUnlockModeReward (std::string internal_mode_name, std::string user_mode_name)
void addUnlockGPReward (std::string gp_name)
void addUnlockDifficultyReward (std::string internal_name, std::string user_name)
const std::string getUnlockedMessage () const
const std::vector
< UnlockableFeature > & 
getFeatures () const
void setChallengeDescription (const std::string &d)
const std::string & getChallengeDescription () const
void addDependency (const std::string id)
bool isSolved () const
bool isActive () const
void setSolved ()
void setActive ()
const std::vector< std::string > & getPrerequisites () const
void load (const lisp::Lisp *config)
 Loads the state for a challenge object (esp.
void save (lisp::Writer *writer)
virtual void loadState (const lisp::Lisp *config)
virtual void saveState (lisp::Writer *writer)
virtual bool grandPrixFinished ()

Detailed Description

Definition at line 25 of file jungle_follow.hpp.


Constructor & Destructor Documentation

Definition at line 25 of file jungle_follow.cpp.

                           : Challenge("junglefollow", _("Follow the Leader in the Jungle"))
{
    setChallengeDescription(_("Win a Follow the Leader race\nwith 3 AI karts\nin the Amazonian Jungle."));
    addUnlockTrackReward("city");
    addDependency("penguinplaygroundgp");
    addDependency("racetracktime");
}   // JungleFollow

Here is the call graph for this function:


Member Function Documentation

void Challenge::addDependency ( const std::string  id) [inline, inherited]

Definition at line 72 of file challenge.hpp.

{m_prerequisites.push_back(id);  }

Here is the caller graph for this function:

void Challenge::addUnlockDifficultyReward ( std::string  internal_name,
std::string  user_name 
) [inherited]

Definition at line 87 of file challenge.cpp.

{
    UnlockableFeature feature;
    feature.name = internal_name;
    feature.type = UNLOCK_DIFFICULTY;
    feature.user_name = user_name;
    m_feature.push_back(feature);
}

Here is the caller graph for this function:

void Challenge::addUnlockGPReward ( std::string  gp_name) [inherited]

Definition at line 79 of file challenge.cpp.

{
    UnlockableFeature feature;
    feature.name = _(gp_name.c_str());
    feature.type = UNLOCK_GP;
    m_feature.push_back(feature);
}

Here is the caller graph for this function:

void Challenge::addUnlockModeReward ( std::string  internal_mode_name,
std::string  user_mode_name 
) [inherited]

Definition at line 70 of file challenge.cpp.

{
    UnlockableFeature feature;
    feature.name = internal_mode_name;
    feature.type = UNLOCK_MODE;
    feature.user_name = user_mode_name;
    m_feature.push_back(feature);
}

Here is the caller graph for this function:

void Challenge::addUnlockTrackReward ( std::string  track_name) [inherited]

Definition at line 62 of file challenge.cpp.

{
    UnlockableFeature feature;
    feature.name = track_name;
    feature.type = UNLOCK_TRACK;
    m_feature.push_back(feature);
}

Here is the caller graph for this function:

const std::string& Challenge::getChallengeDescription ( ) const [inline, inherited]

Definition at line 71 of file challenge.hpp.

const std::vector<UnlockableFeature>& Challenge::getFeatures ( ) const [inline, inherited]

Definition at line 67 of file challenge.hpp.

{return m_feature;               }

Here is the caller graph for this function:

const std::string& Challenge::getId ( ) const [inline, inherited]

Definition at line 57 of file challenge.hpp.

{return m_Id;                  }

Here is the caller graph for this function:

const std::string& Challenge::getName ( ) const [inline, inherited]

Definition at line 58 of file challenge.hpp.

{return m_Name;                }
const std::vector<std::string>& Challenge::getPrerequisites ( ) const [inline, inherited]

Definition at line 78 of file challenge.hpp.

{return m_prerequisites;         }
const std::string Challenge::getUnlockedMessage ( ) const [inherited]

Definition at line 96 of file challenge.cpp.

{
    std::string unlocked_message;
    
    const unsigned int amount = (unsigned int)m_feature.size();
    for(unsigned int n=0; n<amount; n++)
    {
        // add line break if we are showing multiple messages
        if(n>0) unlocked_message+='\n';
        
        char message[128];
        
        // write message depending on feature type
        switch(m_feature[n].type)
        {
            case UNLOCK_TRACK:
                {
                    Track* track = track_manager->getTrack( m_feature[n].name );
                    snprintf(message, 127, _("New track '%s'\nnow available"), gettext(track->getName()) );
                    break;
                }
            case UNLOCK_MODE:
                snprintf(message, 127, _("New game mode\n'%s'\nnow available"), m_feature[n].user_name.c_str() );
                break;
            case UNLOCK_GP:
                snprintf(message, 127, _("New Grand Prix '%s'\nnow available"), m_feature[n].name.c_str() );
                break;
            case UNLOCK_DIFFICULTY:
                snprintf(message, 127, _("New difficulty\n'%s'\nnow available"), m_feature[n].user_name.c_str() );
                break;
        }
        unlocked_message += message;
    }
    
    return unlocked_message;
}

Here is the call graph for this function:

virtual bool Challenge::grandPrixFinished ( ) [inline, virtual, inherited]

Reimplemented in MoonAndBackGP, WorldsEndGP, and PenguinPlaygroundGP.

Definition at line 91 of file challenge.hpp.

{return false;}   // end of a GP
bool Challenge::isActive ( ) const [inline, inherited]

Definition at line 74 of file challenge.hpp.

{return m_state==CH_ACTIVE;      }
bool Challenge::isSolved ( ) const [inline, inherited]

Definition at line 73 of file challenge.hpp.

{return m_state==CH_SOLVED;      }

Here is the caller graph for this function:

void Challenge::load ( const lisp::Lisp config) [inherited]

Loads the state for a challenge object (esp.

m_state), and calls the virtual function loadState for additional information

Definition at line 39 of file challenge.cpp.

{
    const lisp::Lisp* subnode= config->getLisp(getId());
    if(!subnode) return;
    
    // See if the challenge is solved (it's activated later from the
    // unlock_manager).
    bool finished=false;
    subnode->get("solved", finished);
    m_state = finished ? CH_SOLVED : CH_INACTIVE;
    if(!finished) loadState(subnode);
}   // load

Here is the call graph for this function:

virtual void Challenge::loadState ( const lisp::Lisp config) [inline, virtual, inherited]

Definition at line 84 of file challenge.hpp.

{};

Here is the caller graph for this function:

bool JungleFollow::raceFinished ( ) [virtual]

Reimplemented from Challenge.

Definition at line 44 of file jungle_follow.cpp.

{
    std::string track_name = world->getTrack()->getIdent();
    if(track_name!="jungle"      ) return false;    // wrong track
    if(race_manager->getNumKarts()<4) return false; //not enough AI karts
    //Check if player came first
    for(int i=0; i<(int)race_manager->getNumKarts(); i++)
    {
        const Kart* k=world->getKart(i);
        if(k->isPlayerKart()) return  k->getPosition()==2;
    }
    return false;

}   // raceFinished

Here is the call graph for this function:

void Challenge::save ( lisp::Writer writer) [inherited]

Definition at line 53 of file challenge.cpp.

{
    writer->beginList(getId());
    writer->write("solved", isSolved());
    if(!isSolved()) saveState(writer);
    writer->endList(getId());
}   // save

Here is the call graph for this function:

virtual void Challenge::saveState ( lisp::Writer writer) [inline, virtual, inherited]

Definition at line 85 of file challenge.hpp.

{};

Here is the caller graph for this function:

void Challenge::setActive ( ) [inline, inherited]

Definition at line 76 of file challenge.hpp.

void Challenge::setChallengeDescription ( const std::string &  d) [inline, inherited]

Definition at line 68 of file challenge.hpp.

Here is the caller graph for this function:

void JungleFollow::setRace ( ) const [virtual]

Implements Challenge.

Definition at line 34 of file jungle_follow.cpp.

Here is the call graph for this function:

void Challenge::setSolved ( ) [inline, inherited]

Definition at line 75 of file challenge.hpp.

Here is the caller graph for this function:


The documentation for this class was generated from the following files: