1) Added new attribute 'designer' to track, which is displayed if no

description is given (this simplified work for translators).
2) Changed the .track files to use designer instead of description
   (if applicable).
3) Updated .pot file
4) Minor clenaup in lisp parser.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1850 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2008-05-11 05:11:57 +00:00
parent 89617347fe
commit e295434afb
5 changed files with 936 additions and 937 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -28,6 +28,9 @@
#include "material_manager.hpp"
#include "unlock_manager.hpp"
#include "translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
enum WidgetTokens
{
@@ -100,9 +103,18 @@ void TrackSel::update(float dt)
SELECTED_TRACK < (int)track_manager->getTrackCount() )
{
const Track* TRACK = track_manager->getTrack( SELECTED_TRACK );
widget_manager->setWgtText( WTOK_AUTHOR, TRACK->getDescription() );
const std::string& description = TRACK->getDescription();
if(description!="")
{
widget_manager->setWgtText( WTOK_AUTHOR, TRACK->getDescription() );
}
else
{
char designedby[MAX_MESSAGE_LENGTH];
snprintf(designedby, MAX_MESSAGE_LENGTH,
"Designed by %s", TRACK->getDesigner().c_str());
widget_manager->setWgtText( WTOK_AUTHOR, designedby );
}
const std::string& screenshot = TRACK->getScreenshotFile();
const std::string& topview = TRACK->getTopviewFile();

View File

@@ -104,24 +104,24 @@ namespace lisp
}
case Lexer::TOKEN_TRANSLATION:
{
result = new Lisp(Lisp::TYPE_STRING);
m_token = m_lexer->getNextToken();
Lisp* next=read();
if(next->getType()!=Lisp::TYPE_STRING)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Parse Error at line %d: No string inside translation.",
m_lexer->getLineNumber());
throw std::runtime_error(msg);
}
const char* trans=_(next->m_v.m_string);
const size_t LEN = strlen(trans) + 1;
result->m_v.m_string = new char[LEN];
memcpy(result->m_v.m_string, trans, LEN);
delete next;
break;
}
result = new Lisp(Lisp::TYPE_STRING);
m_token = m_lexer->getNextToken();
Lisp* next=read();
if(next->getType()!=Lisp::TYPE_STRING)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Parse Error at line %d: No string inside translation.",
m_lexer->getLineNumber());
throw std::runtime_error(msg);
}
const char* trans=_(next->m_v.m_string);
const size_t LEN = strlen(trans) + 1;
result->m_v.m_string = new char[LEN];
memcpy(result->m_v.m_string, trans, LEN);
delete next;
break;
}
case Lexer::TOKEN_OPEN_PAREN:
result = new Lisp(Lisp::TYPE_CONS);

View File

@@ -59,6 +59,7 @@ Track::Track( std::string filename_, float w, float h, bool stretch )
m_track_2d_height = h;
m_do_stretch = stretch;
m_description = "";
m_designer = "";
m_screenshot = "";
m_top_view = "";
@@ -816,6 +817,7 @@ void Track::loadTrack(std::string filename_)
LISP->get ("name", m_name);
LISP->get ("description", m_description);
LISP->get ("designer", m_designer);
std::vector<std::string> filenames;
LISP->getVector("music", filenames);
getMusicInformation(filenames, m_music);

View File

@@ -49,6 +49,7 @@ private:
std::vector<float> m_start_x, m_start_y, m_start_z, m_start_heading;
std::string m_herring_style;
std::string m_description;
std::string m_designer;
std::string m_filename;
ssgBranch* m_model;
TriangleMesh* m_track_mesh;
@@ -186,6 +187,7 @@ public:
const float& getAICurveSpeedAdjustment() const {return m_AI_curve_speed_adjustment;}
const sgVec4& getSkyColor () const {return m_sky_color; }
const std::string& getDescription () const {return m_description; }
const std::string& getDesigner () const {return m_designer; }
const std::string& getTopviewFile () const {return m_top_view; }
const std::string& getScreenshotFile () const {return m_screenshot; }
const std::vector<SGfloat>& getWidth () const {return m_path_width; }