ZVISION: Convert String pointers to const references

This commit is contained in:
richiesams 2013-07-30 14:28:47 -05:00
parent f1135292d0
commit 5e442c363e
3 changed files with 23 additions and 23 deletions

View File

@ -33,8 +33,8 @@ namespace ZVision {
// ActionAdd
//////////////////////////////////////////////////////////////////////////////
ActionAdd::ActionAdd(Common::String *line) {
sscanf(line->c_str(), ":add(%u,%hhu)", &_key, &_value);
ActionAdd::ActionAdd(const Common::String &line) {
}
ResultAction *ActionAdd::clone() const {
@ -51,8 +51,8 @@ bool ActionAdd::execute(ZVision *engine) {
// ActionAssign
//////////////////////////////////////////////////////////////////////////////
ActionAssign::ActionAssign(Common::String *line) {
sscanf(line->c_str(), ":assign(%u, %hhu)", &_key, &_value);
ActionAssign::ActionAssign(const Common::String &line) {
}
ResultAction *ActionAssign::clone() const {
@ -69,8 +69,8 @@ bool ActionAssign::execute(ZVision *engine) {
// ActionAttenuate
//////////////////////////////////////////////////////////////////////////////
ActionAttenuate::ActionAttenuate(Common::String *line) {
sscanf(line->c_str(), ":assign(%u, %hd)", &_key, &_attenuation);
ActionAttenuate::ActionAttenuate(const Common::String &line) {
}
ResultAction *ActionAttenuate::clone() const {
@ -87,8 +87,8 @@ bool ActionAttenuate::execute(ZVision *engine) {
// ActionChangeLocation
//////////////////////////////////////////////////////////////////////////////
ActionChangeLocation::ActionChangeLocation(Common::String *line) {
sscanf(line->c_str(), ":change_location(%c,%c,%c%c,%hu)", &_world, &_room, &_node, &_view, &_x);
ActionChangeLocation::ActionChangeLocation(const Common::String &line) {
}
ResultAction *ActionChangeLocation::clone() const {
@ -105,9 +105,9 @@ bool ActionChangeLocation::execute(ZVision *engine) {
// ActionCrossfade
//////////////////////////////////////////////////////////////////////////////
ActionCrossfade::ActionCrossfade(Common::String *line) {
sscanf(line->c_str(),
":crossfade(%u %u %hhu %hhu %hhu %hhu %hu)",
ActionCrossfade::ActionCrossfade(const Common::String &line) {
&_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis);
}
@ -125,9 +125,9 @@ bool ActionCrossfade::execute(ZVision *engine) {
// ActionPreloadAnimation
//////////////////////////////////////////////////////////////////////////////
ActionPreloadAnimation::ActionPreloadAnimation(Common::String *line) {
// The two %*hhu are always 0 and dont seem to have a use
sscanf(line->c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate);
ActionPreloadAnimation::ActionPreloadAnimation(const Common::String &line) {
}
ResultAction *ActionPreloadAnimation::clone() const {
@ -144,10 +144,10 @@ bool ActionPreloadAnimation::execute(ZVision *engine) {
// ActionPlayAnimation
//////////////////////////////////////////////////////////////////////////////
ActionPlayAnimation::ActionPlayAnimation(Common::String *line) {
// The two %*hhu are always 0 and dont seem to have a use
sscanf(line->c_str(),
":animplay:%u(%s %u %u %u %u %u %u %hhu %*hhu %*hhu %u %hhu)",
ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) {
&_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate);
}
@ -165,8 +165,8 @@ bool ActionPlayAnimation::execute(ZVision *engine) {
// ActionRandom
//////////////////////////////////////////////////////////////////////////////
ActionRandom::ActionRandom(Common::String *line) {
sscanf(line->c_str(), ":random:%u, %u)", &_key, &_max);
ActionRandom::ActionRandom(const Common::String &line) {
}
ResultAction *ActionRandom::clone() const {
@ -184,8 +184,8 @@ bool ActionRandom::execute(ZVision *engine) {
// ActionTimer
//////////////////////////////////////////////////////////////////////////////
ActionTimer::ActionTimer(Common::String *line) {
sscanf(line->c_str(), ":timer:%u(%hu)", &_key, &_time);
ActionTimer::ActionTimer(const Common::String &line) {
}
ResultAction *ActionTimer::clone() const {

View File

@ -73,7 +73,7 @@ public:
class ActionAdd : public ResultAction {
public:
ActionAdd(Common::String *line);
ActionAdd(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -84,7 +84,7 @@ private:
class ActionAssign : public ResultAction {
public:
ActionAssign(Common::String *line);
ActionAssign(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -95,7 +95,7 @@ private:
class ActionAttenuate : public ResultAction {
public:
ActionAttenuate(Common::String *line);
ActionAttenuate(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -106,7 +106,7 @@ private:
class ActionChangeLocation : public ResultAction {
public:
ActionChangeLocation(Common::String *line);
ActionChangeLocation(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -120,7 +120,7 @@ private:
class ActionCrossfade : public ResultAction {
public:
ActionCrossfade(Common::String *line);
ActionCrossfade(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -136,7 +136,7 @@ private:
class ActionDelayRender : public ResultAction {
public:
ActionDelayRender(Common::String *line);
ActionDelayRender(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -147,7 +147,7 @@ private:
class ActionPlayAnimation : public ResultAction {
public:
ActionPlayAnimation(Common::String *line);
ActionPlayAnimation(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -167,7 +167,7 @@ private:
class ActionPreloadAnimation : public ResultAction {
public:
ActionPreloadAnimation(Common::String *line);
ActionPreloadAnimation(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -181,13 +181,13 @@ private:
// TODO: See if this exists in ZGI. It doesn't in ZNem
//class ActionUnloadAnimation : public ResultAction {
//public:
// ActionUnloadAnimation(Common::String *line);
// ActionUnloadAnimation(const Common::String &line);
// bool execute(ZVision *engine);
//};
class ActionRandom : public ResultAction {
public:
ActionRandom(Common::String *line);
ActionRandom(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);
@ -198,7 +198,7 @@ private:
class ActionTimer : public ResultAction {
public:
ActionTimer(Common::String *line);
ActionTimer(const Common::String &line);
ResultAction *clone() const;
bool execute(ZVision *engine);

View File

@ -143,11 +143,11 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis
while (!line.contains('}')) {
// Parse for the action type
if (line.matchString("*:add*", true)) {
actionList.push_back(new ActionAdd(&line));
actionList.push_back(new ActionAdd(line));
} else if (line.matchString("*:animplay*", true)) {
actionList.push_back(new ActionPlayAnimation(&line));
actionList.push_back(new ActionPlayAnimation(line));
} else if (line.matchString("*:animpreload*", true)) {
actionList.push_back(new ActionPreloadAnimation(&line));
actionList.push_back(new ActionPreloadAnimation(line));
} else if (line.matchString("*:animunload*", true)) {