Public Member Functions | |
tConfItem_key () | |
~tConfItem_key () | |
virtual void | WriteVal (std::ostream &s) |
virtual void | ReadVal (std::istream &s) |
Definition at line 277 of file uInput.cpp.
tConfItem_key::tConfItem_key | ( | ) | [inline] |
tConfItem_key::~tConfItem_key | ( | ) | [inline] |
virtual void tConfItem_key::WriteVal | ( | std::ostream & | s | ) | [inline, virtual] |
Implements tConfItemBase.
Definition at line 283 of file uInput.cpp.
References su_inputs.
00284 { 00285 int first=1; 00286 for ( uInputs::const_iterator i = su_inputs.begin(); i != su_inputs.end(); ++i ) 00287 { 00288 if ( !(*i)->GetBind() ) 00289 continue; 00290 00291 std::string const & id = (*i)->PersistentID(); 00292 00293 if (!first) 00294 s << "\nKEYBOARD\t"; 00295 else 00296 first=0; 00297 00298 s << id << '\t'; 00299 (*i)->GetBind()->Write(s); 00300 } 00301 if (first) 00302 s << "-1";
virtual void tConfItem_key::ReadVal | ( | std::istream & | s | ) | [inline, virtual] |
Implements tConfItemBase.
Definition at line 305 of file uInput.cpp.
References c, in, uBindPlayer::IsKeyWord(), uBindPlayer::NewBind(), uInput::SetBind(), su_GetInput(), su_inputs, su_NewInput(), and tASSERT.
00307 { 00308 tString in; 00309 std::string id; 00310 s >> id; 00311 if ( id != "-1" ) 00312 { 00313 // try to fetch the uInput belonging to the id 00314 uInput * input = su_GetInput( id ); 00315 00316 if ( !input ) 00317 { 00318 // if the id is a number, the setting is in a legacy format. 00319 std::istringstream readValue( id ); 00320 int value = -1; 00321 readValue >> value; 00322 00323 if ( value >= 0 && value < (int)su_inputs.size() ) 00324 { 00325 input = su_inputs[ value ]; 00326 } 00327 } 00328 00329 if ( !input ) 00330 { 00331 input = su_NewInput( id, tString("") ); 00332 } 00333 00334 tASSERT( input ); 00335 00336 s >> in; 00337 if (uBindPlayer::IsKeyWord(in)) 00338 { 00339 tJUST_CONTROLLED_PTR< uBind > bind = uBindPlayer::NewBind(s); 00340 if ( bind->act ) 00341 { 00342 input->SetBind( bind ); 00343 } 00344 } 00345 } 00346 char c=' '; 00347 while (c!='\n' && s.good() && !s.eof()) c=s.get();