diff options
author | richiesams | 2013-07-17 19:24:39 -0500 |
---|---|---|
committer | richiesams | 2013-08-04 13:32:24 -0500 |
commit | 7644e00bf3e55c1b6b2ea0d74db89d8539cb9f31 (patch) | |
tree | 9d56de888108ee2395250b3e7637dc0b614f1cf0 | |
parent | e897a1bb2ae444cf812f2c11060585ccd2b48e4c (diff) | |
download | scummvm-rg350-7644e00bf3e55c1b6b2ea0d74db89d8539cb9f31.tar.gz scummvm-rg350-7644e00bf3e55c1b6b2ea0d74db89d8539cb9f31.tar.bz2 scummvm-rg350-7644e00bf3e55c1b6b2ea0d74db89d8539cb9f31.zip |
ZVISION: Convert ResultActions to take a String pointer in their constructors
There's no point in copying the String since it's just being parsed
-rw-r--r-- | engines/zvision/actions.cpp | 36 | ||||
-rw-r--r-- | engines/zvision/actions.h | 20 | ||||
-rw-r--r-- | engines/zvision/scr_file_handling.cpp | 6 |
3 files changed, 31 insertions, 31 deletions
diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index a5b1e951aa..791eda11e0 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -33,8 +33,8 @@ namespace ZVision { // ActionAdd ////////////////////////////////////////////////////////////////////////////// -ActionAdd::ActionAdd(Common::String line) { - sscanf(line.c_str(), ":add(%u,%hhu)", &_key, &_value); +ActionAdd::ActionAdd(Common::String *line) { + sscanf(line->c_str(), ":add(%u,%hhu)", &_key, &_value); } bool ActionAdd::execute(ZVision *engine) { @@ -47,8 +47,8 @@ bool ActionAdd::execute(ZVision *engine) { // ActionAssign ////////////////////////////////////////////////////////////////////////////// -ActionAssign::ActionAssign(Common::String line) { - sscanf(line.c_str(), ":assign(%u, %hhu)", &_key, &_value); +ActionAssign::ActionAssign(Common::String *line) { + sscanf(line->c_str(), ":assign(%u, %hhu)", &_key, &_value); } bool ActionAssign::execute(ZVision *engine) { @@ -61,8 +61,8 @@ bool ActionAssign::execute(ZVision *engine) { // ActionAttenuate ////////////////////////////////////////////////////////////////////////////// -ActionAttenuate::ActionAttenuate(Common::String line) { - sscanf(line.c_str(), ":assign(%u, %hd)", &_key, &_attenuation); +ActionAttenuate::ActionAttenuate(Common::String *line) { + sscanf(line->c_str(), ":assign(%u, %hd)", &_key, &_attenuation); } bool ActionAttenuate::execute(ZVision *engine) { @@ -75,8 +75,8 @@ bool ActionAttenuate::execute(ZVision *engine) { // ActionChangeLocation ////////////////////////////////////////////////////////////////////////////// -ActionChangeLocation::ActionChangeLocation(Common::String line) { - sscanf(line.c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x); +ActionChangeLocation::ActionChangeLocation(Common::String *line) { + sscanf(line->c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x); } bool ActionChangeLocation::execute(ZVision *engine) { @@ -89,8 +89,8 @@ bool ActionChangeLocation::execute(ZVision *engine) { // ActionCrossfade ////////////////////////////////////////////////////////////////////////////// -ActionCrossfade::ActionCrossfade(Common::String line) { - sscanf(line.c_str(), +ActionCrossfade::ActionCrossfade(Common::String *line) { + sscanf(line->c_str(), ":crossfade(%u %u %hhu %hhu %hhu %hhu %hu)", &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } @@ -105,9 +105,9 @@ bool ActionCrossfade::execute(ZVision *engine) { // ActionPreloadAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPreloadAnimation::ActionPreloadAnimation(Common::String line) { +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); + sscanf(line->c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate); } bool ActionPreloadAnimation::execute(ZVision *engine) { @@ -120,9 +120,9 @@ bool ActionPreloadAnimation::execute(ZVision *engine) { // ActionPlayAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPlayAnimation::ActionPlayAnimation(Common::String line) { +ActionPlayAnimation::ActionPlayAnimation(Common::String *line) { // The two %*hhu are always 0 and dont seem to have a use - sscanf(line.c_str(), + sscanf(line->c_str(), ":animplay:%u(%s %u %u %u %u %u %u %hhu %*hhu %*hhu %u %hhu)", &_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); } @@ -137,8 +137,8 @@ bool ActionPlayAnimation::execute(ZVision *engine) { // ActionRandom ////////////////////////////////////////////////////////////////////////////// -ActionRandom::ActionRandom(Common::String line) { - sscanf(line.c_str(), ":random:%u, %u)", &_key, &_max); +ActionRandom::ActionRandom(Common::String *line) { + sscanf(line->c_str(), ":random:%u, %u)", &_key, &_max); } bool ActionRandom::execute(ZVision *engine) { @@ -152,8 +152,8 @@ bool ActionRandom::execute(ZVision *engine) { // ActionTimer ////////////////////////////////////////////////////////////////////////////// -ActionTimer::ActionTimer(Common::String line) { - sscanf(line.c_str(), ":timer:%u(%hu)", &_key, &_time); +ActionTimer::ActionTimer(Common::String *line) { + sscanf(line->c_str(), ":timer:%u(%hu)", &_key, &_time); } bool ActionTimer::execute(ZVision *engine) { diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index aed8483ee7..9b2267df82 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -74,7 +74,7 @@ public: class ActionAdd : public ResultAction { public: - ActionAdd(Common::String line); + ActionAdd(Common::String *line); bool execute(ZVision *engine); private: @@ -84,7 +84,7 @@ private: class ActionAssign : public ResultAction { public: - ActionAssign(Common::String line); + ActionAssign(Common::String *line); bool execute(ZVision *engine); private: @@ -94,7 +94,7 @@ private: class ActionAttenuate : public ResultAction { public: - ActionAttenuate(Common::String line); + ActionAttenuate(Common::String *line); bool execute(ZVision *engine); private: @@ -104,7 +104,7 @@ private: class ActionChangeLocation : public ResultAction { public: - ActionChangeLocation(Common::String line); + ActionChangeLocation(Common::String *line); bool execute(ZVision *engine); private: @@ -116,7 +116,7 @@ private: class ActionCrossfade : public ResultAction { public: - ActionCrossfade(Common::String line); + ActionCrossfade(Common::String *line); bool execute(ZVision *engine); private: @@ -131,7 +131,7 @@ private: class ActionPlayAnimation : public ResultAction { public: - ActionPlayAnimation(Common::String line); + ActionPlayAnimation(Common::String *line); bool execute(ZVision *engine); private: @@ -150,7 +150,7 @@ private: class ActionPreloadAnimation : public ResultAction { public: - ActionPreloadAnimation(Common::String line); + ActionPreloadAnimation(Common::String *line); bool execute(ZVision *engine); private: @@ -163,13 +163,13 @@ private: // TODO: See if this exists in ZGI. It doesn't in ZNem //class ActionUnloadAnimation : public ResultAction { //public: -// ActionUnloadAnimation(Common::String line); +// ActionUnloadAnimation(Common::String *line); // bool execute(ZVision *engine); //}; class ActionRandom : public ResultAction { public: - ActionRandom(Common::String line); + ActionRandom(Common::String *line); bool execute(ZVision *engine); private: @@ -179,7 +179,7 @@ private: class ActionTimer : public ResultAction { public: - ActionTimer(Common::String line); + ActionTimer(Common::String *line); bool execute(ZVision *engine); private: diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 6a2e8cf701..168a6d830a 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -135,11 +135,11 @@ void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List 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)) { |