mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-11 17:07:18 +00:00
Made the tokenizer return line number...
...and column numbers starting with 1 and not 0.
This commit is contained in:
parent
4e47d15371
commit
f6cc29a092
@ -218,8 +218,8 @@ void parser::parse_variable()
|
||||
// appropriate, although a proper one should
|
||||
// wait after string freeze.
|
||||
error(_("Unexpected characters after variable name (expected , or =)"));
|
||||
variables.push_back("");
|
||||
}
|
||||
variables.push_back("");
|
||||
break;
|
||||
default:
|
||||
error(_("Unexpected characters after variable name (expected , or =)"));
|
||||
|
@ -32,8 +32,6 @@ tokenizer::tokenizer(std::istream& in) :
|
||||
|
||||
const token& tokenizer::next_token()
|
||||
{
|
||||
tokenstart_lineno_ = lineno_;
|
||||
tokenstart_colno_ = colno_;
|
||||
token_.value = "";
|
||||
token_.leading_spaces = "";
|
||||
|
||||
@ -63,6 +61,9 @@ const token& tokenizer::next_token()
|
||||
}
|
||||
}
|
||||
|
||||
tokenstart_lineno_ = lineno_;
|
||||
tokenstart_colno_ = colno_;
|
||||
|
||||
switch(current_) {
|
||||
case EOF:
|
||||
token_.type = token::END;
|
||||
@ -148,12 +149,12 @@ bool tokenizer::is_alnum(int c)
|
||||
|
||||
const size_t tokenizer::get_line()
|
||||
{
|
||||
return tokenstart_lineno_;
|
||||
return tokenstart_lineno_ + 1;
|
||||
}
|
||||
|
||||
const size_t tokenizer::get_column()
|
||||
{
|
||||
return tokenstart_colno_;
|
||||
return tokenstart_colno_ + 1;
|
||||
}
|
||||
|
||||
std::string& tokenizer::textdomain()
|
||||
|
24
src/unit.cpp
24
src/unit.cpp
@ -77,18 +77,18 @@ unit_race::GENDER unit::generate_gender(const unit_type& type, bool gen)
|
||||
//constructor for creating a new unit
|
||||
unit::unit(const unit_type* t, int side, bool use_traits, bool dummy_unit, unit_race::GENDER gender) :
|
||||
gender_(dummy_unit ? gender : generate_gender(*t,use_traits)),
|
||||
type_(&t->get_gender_unit_type(gender_)), state_(STATE_NORMAL),
|
||||
hitpoints_(type_->hitpoints()),
|
||||
maxHitpoints_(type_->hitpoints()),
|
||||
backupMaxHitpoints_(type_->hitpoints()), experience_(0),
|
||||
maxExperience_(type_->experience_needed()),
|
||||
backupMaxExperience_(type_->experience_needed()),
|
||||
side_(side), moves_(0),
|
||||
user_end_turn_(false), facingLeft_(side != 1),
|
||||
maxMovement_(type_->movement()),
|
||||
backupMaxMovement_(type_->movement()),
|
||||
recruit_(false), attacks_(type_->attacks()),
|
||||
backupAttacks_(type_->attacks()),
|
||||
type_(&t->get_gender_unit_type(gender_)), state_(STATE_NORMAL),
|
||||
hitpoints_(type_->hitpoints()),
|
||||
maxHitpoints_(type_->hitpoints()),
|
||||
backupMaxHitpoints_(type_->hitpoints()), experience_(0),
|
||||
maxExperience_(type_->experience_needed()),
|
||||
backupMaxExperience_(type_->experience_needed()),
|
||||
side_(side), moves_(0),
|
||||
user_end_turn_(false), facingLeft_(side != 1),
|
||||
maxMovement_(type_->movement()),
|
||||
backupMaxMovement_(type_->movement()),
|
||||
recruit_(false), attacks_(type_->attacks()),
|
||||
backupAttacks_(type_->attacks()),
|
||||
guardian_(false), upkeep_(UPKEEP_FULL_PRICE),
|
||||
unrenamable_(false)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user