Changeset 10664
- Timestamp:
- 01/14/12 19:16:25 (16 months ago)
- Location:
- main/trunk/src
- Files:
-
- 4 modified
-
challenges/challenge_data.cpp (modified) (7 diffs)
-
challenges/challenge_data.hpp (modified) (4 diffs)
-
states_screens/race_gui_overworld.cpp (modified) (5 diffs)
-
tracks/track.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/src/challenges/challenge_data.cpp
r10363 r10664 42 42 m_num_laps = -1; 43 43 m_num_karts = -1; 44 44 m_position = -1; 45 45 m_time = -1.0f; 46 m_track_ name= "";46 m_track_id = ""; 47 47 m_gp_id = ""; 48 48 m_energy = -1; … … 95 95 setName( s.c_str() ); 96 96 97 if(!root->get("description", &s) ) error("description");98 setChallengeDescription( s.c_str() );97 //if(!root->get("description", &s) ) error("description"); 98 //setChallengeDescription( s.c_str() ); 99 99 //std::cout << " // Challenge description = <" << s.c_str() << ">\n"; 100 100 101 102 101 103 if(!root->get("karts", &m_num_karts) ) error("karts"); 102 104 … … 125 127 if(m_major==RaceManager::MAJOR_MODE_SINGLE) 126 128 { 127 if (!root->get("track", &m_track_ name))129 if (!root->get("track", &m_track_id )) 128 130 { 129 131 error("track"); 130 132 } 131 if (track_manager->getTrack(m_track_ name) == NULL)133 if (track_manager->getTrack(m_track_id) == NULL) 132 134 { 133 135 error("track"); … … 164 166 delete root; 165 167 168 169 170 core::stringw description; 171 //I18N: number of laps to race in a challenge 172 description += _("Laps : %i", m_num_laps); 173 description += core::stringw(L"\n"); 174 //I18N: number of AI karts in a challenge 175 description += _("AI Karts : %i", m_num_karts - 1); 176 if (m_position > 0) 177 { 178 description += core::stringw(L"\n"); 179 //I18N: position required to win in a challenge 180 description += _("Required rank : %i", m_position); 181 } 182 if (m_time > 0) 183 { 184 description += core::stringw(L"\n"); 185 //I18N: time required to win a challenge 186 description += _("Time to achieve : %s", StringUtils::timeToString(m_time).c_str()); 187 } 188 if (m_energy > 0) 189 { 190 description += core::stringw(L"\n"); 191 //I18N: nitro points needed to win a challenge 192 description += _("Collect %i points of nitr", m_energy); 193 } 194 195 m_challenge_description = description; 166 196 } // ChallengeData 167 197 … … 189 219 try 190 220 { 191 track_manager->getTrack(m_track_ name);221 track_manager->getTrack(m_track_id); 192 222 } 193 223 catch(std::exception&) … … 271 301 { 272 302 race_manager->setMinorMode(m_minor); 273 race_manager->setTrack(m_track_ name);303 race_manager->setTrack(m_track_id); 274 304 race_manager->setDifficulty(m_difficulty); 275 305 race_manager->setNumLaps(m_num_laps); … … 299 329 World *world = World::getWorld(); 300 330 std::string track_name = world->getTrack()->getIdent(); 301 if(track_name!=m_track_ name) return false;331 if(track_name!=m_track_id ) return false; 302 332 if((int)world->getNumKarts()<m_num_karts ) return false; 303 333 Kart* kart = world->getPlayerKart(0); -
main/trunk/src/challenges/challenge_data.hpp
r10502 r10664 62 62 float m_time; 63 63 std::string m_gp_id; 64 std::string m_track_ name;64 std::string m_track_id; 65 65 int m_energy; 66 66 std::string m_filename; … … 106 106 getFeatures() const { return m_feature; } 107 107 108 void setChallengeDescription(const irr::core::stringw& d)109 {m_challenge_description=d; }110 111 108 const irr::core::stringw getChallengeDescription() const 112 109 {return _(m_challenge_description.c_str()); } … … 130 127 void setId(const std::string& s) { m_id = s; } 131 128 132 const std::string& getTrack Name() const { return m_track_name; }129 const std::string& getTrackId() const { return m_track_id; } 133 130 134 131 … … 142 139 const irr::core::stringw &user_name); 143 140 141 142 RaceManager::MajorRaceModeType getMajorMode() const { return m_major; } 143 RaceManager::MinorRaceModeType getMinorMode() const { return m_minor; } 144 RaceManager::Difficulty getDifficulty() const { return m_difficulty; } 145 int getNumLaps() const { return m_num_laps; } 146 int getPosition() const { return m_position; } 147 int getNumKarts() const { return m_num_karts; } 148 float getTime() const { return m_time; } 149 int getEnergy() const { return m_energy; } 150 144 151 }; // ChallengeData 145 152 -
main/trunk/src/states_screens/race_gui_overworld.cpp
r10660 r10664 42 42 #include "race/race_manager.hpp" 43 43 #include "tracks/track.hpp" 44 #include "tracks/track_manager.hpp" 44 45 #include "utils/constants.hpp" 45 46 #include "utils/string_utils.hpp" … … 244 245 245 246 Track* t = world->getTrack(); 247 248 Vec3 kart_xyz; 246 249 247 250 // In the first iteration, only draw AI karts, then only draw … … 259 262 if(kart->getController()->isPlayerController() 260 263 !=(only_draw_player_kart==1)) continue; 261 const Vec3& xyz= kart->getXYZ();264 kart_xyz= kart->getXYZ(); 262 265 Vec3 draw_at; 263 t->mapPoint2MiniMap( xyz, &draw_at);266 t->mapPoint2MiniMap(kart_xyz, &draw_at); 264 267 265 268 core::rect<s32> source(i *m_marker_rendered_size, … … 297 300 298 301 //const std::vector<OverworldChallenge>& challenges = t->getChallengeList(); 299 const std::vector<OverworldForceField>& challenges = t->getForceFieldList();300 301 for (unsigned int n=0; n< challenges.size(); n++)302 const std::vector<OverworldForceField>& forcefields = t->getForceFieldList(); 303 304 for (unsigned int n=0; n<forcefields.size(); n++) 302 305 { 303 306 Vec3 draw_at; 304 t->mapPoint2MiniMap( challenges[n].m_position, &draw_at);307 t->mapPoint2MiniMap(forcefields[n].m_position, &draw_at); 305 308 306 309 //const ChallengeData* c = unlock_manager->getChallenge(challenges[n].m_challenge_id); 307 310 // bool locked = (m_locked_challenges.find(c) != m_locked_challenges.end()); 308 bool locked = challenges[n].m_is_locked;311 bool locked = forcefields[n].m_is_locked; 309 312 310 313 const core::rect<s32> source(core::position2d<s32>(0,0), … … 318 321 dest, source, NULL, NULL, true); 319 322 } 323 324 325 // ---- Draw nearby challenge if any 326 const std::vector<OverworldChallenge>& challenges = t->getChallengeList(); 327 for (unsigned int n=0; n<challenges.size(); n++) 328 { 329 if ((kart_xyz - Vec3(challenges[n].m_position)).length2_2d() < 20) 330 { 331 core::rect<s32> pos(15, 332 10, 333 15 + UserConfigParams::m_width/2, 334 10 + GUIEngine::getTitleFontHeight()); 335 336 const ChallengeData* challenge = unlock_manager->getChallenge(challenges[n].m_challenge_id); 337 338 if (challenge == NULL) 339 { 340 fprintf(stderr, "[RaceGUIOverworld] ERROR: Cannot find challenge <%s>\n", 341 challenges[n].m_challenge_id.c_str()); 342 break; 343 } 344 345 Track* track = track_manager->getTrack(challenge->getTrackId()); 346 if (track == NULL) 347 { 348 fprintf(stderr, "[RaceGUIOverworld] ERROR: Cannot find track <%s>, " 349 "referenced from challenge <%s>\n", 350 challenge->getTrackId().c_str(), 351 challenges[n].m_challenge_id.c_str()); 352 break; 353 } 354 355 gui::ScalableFont* font = GUIEngine::getTitleFont(); 356 font->draw(track->getName(), pos, video::SColor(255,255,255,255), 357 false, true /* vcenter */, NULL); 358 359 360 pos.UpperLeftCorner.Y += GUIEngine::getTitleFontHeight(); 361 pos.LowerRightCorner.Y = UserConfigParams::m_height; 362 GUIEngine::getFont()->draw(challenge->getChallengeDescription().c_str(), 363 pos, video::SColor(255,255,255,255), 364 false, false /* vcenter */, NULL); 365 break; 366 } 367 } 368 320 369 } // drawGlobalMiniMap 321 370 -
main/trunk/src/tracks/track.cpp
r10660 r10664 858 858 m_challenges.push_back( OverworldChallenge(xyz, challenge) ); 859 859 860 Track* t = track_manager->getTrack(c->getTrack Name());860 Track* t = track_manager->getTrack(c->getTrackId()); 861 861 if (t == NULL) 862 862 { 863 fprintf(stderr, "[WARNING] Cannot find track named <%s>\n", c->getTrack Name().c_str());863 fprintf(stderr, "[WARNING] Cannot find track named <%s>\n", c->getTrackId().c_str()); 864 864 continue; 865 865 }