00001 /* CourseUtil - Utility functions that deal with Course. */ 00002 00003 #ifndef COURSEUTIL_H 00004 #define COURSEUTIL_H 00005 00006 #include "GameConstantsAndTypes.h" 00007 00008 class Course; 00009 class Profile; 00010 struct XNode; 00011 00012 namespace CourseUtil 00013 { 00014 void SortCoursePointerArrayByDifficulty( vector<Course*> &apCourses ); 00015 void SortCoursePointerArrayByType( vector<Course*> &apCourses ); 00016 void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCourses ); 00017 void SortCoursePointerArrayByTotalDifficulty( vector<Course*> &apCourses ); 00018 void SortCoursePointerArrayByRanking( vector<Course*> &apCourses ); 00019 void SortCoursePointerArrayByNumPlays( vector<Course*> &arrayCoursePointers, ProfileSlot slot, bool bDescending ); 00020 void SortCoursePointerArrayByNumPlays( vector<Course*> &arrayCoursePointers, const Profile* pProfile, bool bDescending ); 00021 00022 void MoveRandomToEnd( vector<Course*> &apCourses ); 00023 }; 00024 00025 class CourseID 00026 { 00027 CString sPath; 00028 CString sFullTitle; 00029 00030 public: 00031 CourseID() { Unset(); } 00032 void Unset() { FromCourse(NULL); } 00033 void FromCourse( const Course *p ); 00034 Course *ToCourse() const; 00035 bool operator<( const CourseID &other ) const 00036 { 00037 return sPath < other.sPath || sFullTitle < other.sFullTitle; 00038 } 00039 00040 XNode* CreateNode() const; 00041 void LoadFromNode( const XNode* pNode ); 00042 CString ToString() const; 00043 bool IsValid() const; 00044 }; 00045 00046 #endif 00047 00048 /* 00049 * (c) 2001-2004 Chris Danford 00050 * All rights reserved. 00051 * 00052 * Permission is hereby granted, free of charge, to any person obtaining a 00053 * copy of this software and associated documentation files (the 00054 * "Software"), to deal in the Software without restriction, including 00055 * without limitation the rights to use, copy, modify, merge, publish, 00056 * distribute, and/or sell copies of the Software, and to permit persons to 00057 * whom the Software is furnished to do so, provided that the above 00058 * copyright notice(s) and this permission notice appear in all copies of 00059 * the Software and that both the above copyright notice(s) and this 00060 * permission notice appear in supporting documentation. 00061 * 00062 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00063 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00064 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00065 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00066 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00067 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00068 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00069 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00070 * PERFORMANCE OF THIS SOFTWARE. 00071 */