WAGE: const goodness

This commit is contained in:
Eugene Sandulenko 2016-02-14 13:52:05 +01:00
parent c5a01f3f38
commit c0697f7f2b
4 changed files with 10 additions and 10 deletions

View File

@ -571,7 +571,7 @@ Common::String *WageEngine::getGroundItemsList(Scene *scene) {
return NULL;
}
void WageEngine::appendObjNames(Common::String &str, ObjArray &objs) {
void WageEngine::appendObjNames(Common::String &str, const ObjArray &objs) {
for (uint i = 0; i < objs.size(); i++) {
Obj *obj = objs[i];
@ -849,7 +849,7 @@ bool WageEngine::handleOfferCommand(const char *target) {
return false;
}
bool WageEngine::tryAttack(Obj *weapon, Common::String &input) {
bool WageEngine::tryAttack(const Obj *weapon, const Common::String &input) {
Common::String w(weapon->_name);
w.toLowercase();
Common::String i(input);
@ -883,7 +883,7 @@ bool WageEngine::handleAttack(Obj *weapon) {
return true;
}
const char *const WageEngine::getPercentMessage(double percent) {
const char *WageEngine::getPercentMessage(double percent) {
if (percent < 0.40) {
return "very bad";
} else if (percent < 0.55) {

View File

@ -84,7 +84,7 @@ Common::Rect *readRect(Common::SeekableReadStream *in) {
return new Common::Rect(x1, y1, x2, y2);
}
const char *getIndefiniteArticle(Common::String &word) {
const char *getIndefiniteArticle(const Common::String &word) {
switch (word[0]) {
case 'a': case 'A':
case 'e': case 'E':

View File

@ -109,7 +109,7 @@ enum {
Common::String readPascalString(Common::SeekableReadStream *in);
Common::Rect *readRect(Common::SeekableReadStream *in);
const char *getIndefiniteArticle(Common::String &word);
const char *getIndefiniteArticle(const Common::String &word);
const char *prependGenderSpecificPronoun(int gender);
const char *getGenderSpecificPronoun(int gender, bool capitalize);
@ -158,7 +158,7 @@ public:
bool handleMoveCommand(Directions dir, const char *dirName);
bool handleLookCommand();
Common::String *getGroundItemsList(Scene *scene);
void appendObjNames(Common::String &str, ObjArray &objs);
void appendObjNames(Common::String &str, const ObjArray &objs);
bool handleInventoryCommand();
bool handleStatusCommand();
bool handleRestCommand();
@ -172,11 +172,11 @@ public:
void wearObj(Obj *o, int pos);
bool tryAttack(Obj *weapon, Common::String &input);
bool tryAttack(const Obj *weapon, const Common::String &input);
bool handleAttack(Obj *weapon);
void printPlayerCondition(Chr *player);
const char *const getPercentMessage(double percent);
const char *getPercentMessage(double percent);
public:
Common::RandomSource *_rnd;

View File

@ -385,7 +385,7 @@ Common::String *World::loadStringFromDITL(Common::MacResManager *resMan, int res
return NULL;
}
bool InvComparator(Obj *l, Obj *r) {
static bool InvComparator(const Obj *l, const Obj *r) {
return l->_index < r->_index;
}
@ -402,7 +402,7 @@ void World::move(Obj *obj, Chr *chr) {
_engine->onMove(obj, from, chr);
}
bool ObjComparator(Obj *o1, Obj *o2) {
static bool ObjComparator(const Obj *o1, const Obj *o2) {
bool o1Immobile = (o1->_type == Obj::IMMOBILE_OBJECT);
bool o2Immobile = (o2->_type == Obj::IMMOBILE_OBJECT);
if (o1Immobile == o2Immobile) {