text: //Copyright (c) 2008, Tarn Adams
  //All rights reserved.  See game.cpp or license.txt for more information.
  
  #include "game_g.h"
  #include "game_extv.h"
  
  void command_linest::init(const string &str)
  {
  	original=str;
  
  	//BUILD THE TOKEN LIST
  	long pos=0;
  	while(grab_arg(original,pos));
  
  	//HANDLE EACH TOKEN
  	long l;
  	for(l=0;l<arg_vect.str.size();l++)
  		{
  		handle_arg(arg_vect.str[l]->dat);
  		}
  }
  
  char command_linest::grab_arg(string &source,long &pos)
  {
  	string dest;
  
  	while(pos<source.length())
  		{
  		//HIT A NEW ARGUMENT?  RETURN, OTHERWISE SKIP AND START UP
  		if(source[pos]=='-')
  			{
  			if(dest.empty()){pos++;continue;}
  			else
  				{
  				pos++;
  				arg_vect.add_string(dest);
  				return 1;
  				}
  			}
  
  		dest+=source[pos];
  
  		pos++;
  		}
  
  	if(!dest.empty())arg_vect.add_string(dest);
  	return 0;
  }
  
  void command_linest::handle_arg(string &arg)
  {
  	long pos=0;
  	string dest;
  
  	grab_token_string_pos(dest,arg,pos,' ');
  	pos+=dest.length();
  
  	/*
  	short arg_pos=0;
  	if(dest=="gen")
  		{
  		//KEEP GOING FOR A NUMBER
  		while(pos<arg.length())
  			{
  			dest.erase();
  			pos++;grab_token_string_pos(dest,arg,pos,' ');
  			pos+=dest.length();
  
  			if(!dest.empty())
  				{
  				if(arg_pos==0)gen_id=convert_string_to_long(dest);
  				if(arg_pos==1)
  					{
  					if(dest!="RANDOM")
  						{
  						world_seed=convert_string_to_ulong(dest);
  						use_seed=1;
  						}
  					}
  				if(arg_pos==2)
  					{
  					if(dest!="NONE")
  						{
  						world_param=dest;
  						use_param=1;
  						}
  					}
  
  				arg_pos++;
  				}
  			}
  		}
  		*/
  }