[Scummvm-git-logs] scummvm master -> 3b3be12dcb6dafbea790594f0112cff95c804384
bluegr
noreply at scummvm.org
Sun Aug 7 19:57:08 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3b3be12dcb ULTIMA: Replace Std::stack with Common::Stack
Commit: 3b3be12dcb6dafbea790594f0112cff95c804384
https://github.com/scummvm/scummvm/commit/3b3be12dcb6dafbea790594f0112cff95c804384
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-08-07T22:57:05+03:00
Commit Message:
ULTIMA: Replace Std::stack with Common::Stack
Changed paths:
engines/ultima/nuvie/core/converse_interpret.cpp
engines/ultima/nuvie/core/converse_interpret.h
engines/ultima/nuvie/script/script.cpp
engines/ultima/shared/std/containers.h
engines/ultima/ultima8/world/map.cpp
diff --git a/engines/ultima/nuvie/core/converse_interpret.cpp b/engines/ultima/nuvie/core/converse_interpret.cpp
index d7422b6fa29..f6cf678eeb7 100644
--- a/engines/ultima/nuvie/core/converse_interpret.cpp
+++ b/engines/ultima/nuvie/core/converse_interpret.cpp
@@ -201,7 +201,7 @@ void ConverseInterpret::enter(converse_value c) {
ef->break_c = 0x00;
ef->start_c = c;
if (!b_frame)
- b_frame = new stack<struct convi_frame_s *>;
+ b_frame = new Common::Stack<struct convi_frame_s *>;
b_frame->push(ef);
#ifdef CONVERSE_DEBUG
DEBUG(1, LEVEL_DEBUGGING, "Converse: ...enter %02x...\n", ef->start_c);
@@ -363,7 +363,7 @@ string ConverseInterpret::get_formatted_text(const char *c_str) {
* which must have been evaluated already.)
*/
void ConverseInterpret::do_ctrl() {
- stack<converse_typed_value> st;
+ Common::Stack<converse_typed_value> st;
#ifdef CONVERSE_DEBUG
DEBUG(1, LEVEL_DEBUGGING, "Converse: %04x INSTR:", in_start);
for (uint32 v = 0; v < val_count(); v++)
@@ -448,7 +448,7 @@ converse_value ConverseInterpret::add_rstr(const char *s) {
/* Returns and removes top item from a value stack.
*/
-converse_value ConverseInterpret::pop_arg(stack<converse_typed_value> &vs) {
+converse_value ConverseInterpret::pop_arg(Common::Stack<converse_typed_value> &vs) {
converse_value ret = 0;
if (!vs.empty()) {
converse_typed_value val = vs.top();
@@ -458,7 +458,7 @@ converse_value ConverseInterpret::pop_arg(stack<converse_typed_value> &vs) {
return (ret);
}
-converse_typed_value ConverseInterpret::pop_typed_arg(stack<converse_typed_value> &vs) {
+converse_typed_value ConverseInterpret::pop_typed_arg(Common::Stack<converse_typed_value> &vs) {
converse_typed_value ret = {0, 0};
if (!vs.empty()) {
ret = vs.top();
@@ -468,7 +468,7 @@ converse_typed_value ConverseInterpret::pop_typed_arg(stack<converse_typed_value
}
#if 0
-bool MDTalkInterpret::op(stack<converse_value> &i) {
+bool MDTalkInterpret::op(Common::Stack<converse_value> &i) {
bool success = true;
converse_value v[4], in; // args
@@ -481,7 +481,7 @@ bool MDTalkInterpret::op(stack<converse_value> &i) {
}
#endif
-bool ConverseInterpret::op_create_new(stack<converse_typed_value> &i) {
+bool ConverseInterpret::op_create_new(Common::Stack<converse_typed_value> &i) {
converse_value v[4];
Actor *cnpc = NULL;
@@ -502,7 +502,7 @@ bool ConverseInterpret::op_create_new(stack<converse_typed_value> &i) {
return true;
}
-bool WOUConverseInterpret::op_create_new(stack<converse_typed_value> &i) {
+bool WOUConverseInterpret::op_create_new(Common::Stack<converse_typed_value> &i) {
converse_value v[4];
Actor *cnpc = NULL;
@@ -526,7 +526,7 @@ bool WOUConverseInterpret::op_create_new(stack<converse_typed_value> &i) {
/* Run control code with arguments/operands (arranged on a stack from
* top to bottom.)
*/
-bool ConverseInterpret::op(stack<converse_typed_value> &i) {
+bool ConverseInterpret::op(Common::Stack<converse_typed_value> &i) {
bool success = true;
converse_value v[4] = { 0, 0, 0, 0 }; // args
converse_value inVal;
@@ -813,7 +813,7 @@ bool ConverseInterpret::op(stack<converse_typed_value> &i) {
/* The other set of codes, these operate on the input values, so call them
* valops. Output goes back to the stack.
*/
-bool ConverseInterpret::evop(stack<converse_typed_value> &i) {
+bool ConverseInterpret::evop(Common::Stack<converse_typed_value> &i) {
bool success = true;
converse_value v[4]; // input
converse_typed_value inVal;
@@ -1118,7 +1118,7 @@ bool ConverseInterpret::evop(stack<converse_typed_value> &i) {
return (success);
}
-converse_value ConverseInterpret::evop_eq(stack<converse_typed_value> &vs) {
+converse_value ConverseInterpret::evop_eq(Common::Stack<converse_typed_value> &vs) {
converse_typed_value operand1 = pop_typed_arg(vs);
converse_typed_value operand2 = pop_typed_arg(vs);
converse_value out = 0;
@@ -1139,7 +1139,7 @@ converse_value ConverseInterpret::evop_eq(stack<converse_typed_value> &vs) {
* back to the input list, and replaces everything after and including `vi'.
*/
void ConverseInterpret::eval(uint32 vi) {
- stack<converse_typed_value> op_stk, r_stk;
+ Common::Stack<converse_typed_value> op_stk, r_stk;
uint32 v = vi;
#ifdef CONVERSE_DEBUG
DEBUG(1, LEVEL_DEBUGGING, "Converse: EVAL");
diff --git a/engines/ultima/nuvie/core/converse_interpret.h b/engines/ultima/nuvie/core/converse_interpret.h
index 67d9eba0b60..734248e7807 100644
--- a/engines/ultima/nuvie/core/converse_interpret.h
+++ b/engines/ultima/nuvie/core/converse_interpret.h
@@ -28,7 +28,6 @@ namespace Ultima {
namespace Nuvie {
using Std::string;
-using Std::stack;
using Std::vector;
/* Control and value opcodes for op() & evop() (U6) */
@@ -152,7 +151,7 @@ protected:
string ystring; // modified by SETNAME, accessed with "$Y"
uint8 decl_v; // declared/initialized variable number
uint8 decl_t; // declared variable type: 0x00=none,0xb2=int,0xb3=string
- stack<struct convi_frame_s *> *b_frame;
+ Common::Stack<struct convi_frame_s *> *b_frame;
bool db_lvar;
converse_value db_loc;
@@ -257,14 +256,14 @@ protected:
void do_ctrl();
void do_text();
string get_formatted_text(const char *c_str);
- converse_value pop_arg(stack<converse_typed_value> &vs);
- converse_typed_value pop_typed_arg(stack<converse_typed_value> &vs);
- virtual bool evop(stack<converse_typed_value> &i);
- virtual bool op(stack<converse_typed_value> &i);
+ converse_value pop_arg(Common::Stack<converse_typed_value> &vs);
+ converse_typed_value pop_typed_arg(Common::Stack<converse_typed_value> &vs);
+ virtual bool evop(Common::Stack<converse_typed_value> &i);
+ virtual bool op(Common::Stack<converse_typed_value> &i);
- virtual bool op_create_new(stack<converse_typed_value> &i);
+ virtual bool op_create_new(Common::Stack<converse_typed_value> &i);
- converse_value evop_eq(stack<converse_typed_value> &vs);
+ converse_value evop_eq(Common::Stack<converse_typed_value> &vs);
public:
virtual uint8 npc_num(uint32 n);//uint8 npc_num(uint32 n){return((n!=0xeb)?n:converse->npc_num);}
@@ -319,7 +318,7 @@ public:
WOUConverseInterpret(Converse *owner) : ConverseInterpret(owner) { }
protected:
- bool op_create_new(stack<converse_typed_value> &i) override;
+ bool op_create_new(Common::Stack<converse_typed_value> &i) override;
};
class SETalkInterpret : public ConverseInterpret {
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index 2e8a0b83d97..6c4ce275ed1 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -2269,8 +2269,8 @@ static int nscript_u6link_gc(lua_State *L) {
/* free up resources for a recursive U6Link iterator. */
static int nscript_u6link_recursive_gc(lua_State *L) {
- Std::stack<U6Link *> **s_stack = (Std::stack<U6Link *> **)luaL_checkudata(L, 1, "nuvie.U6LinkRecursive");
- Std::stack<U6Link *> *s = *s_stack;
+ Common::Stack<U6Link *> **s_stack = (Common::Stack<U6Link *> **)luaL_checkudata(L, 1, "nuvie.U6LinkRecursive");
+ Common::Stack<U6Link *> *s = *s_stack;
if (s->empty() == false) {
for (; !s->empty(); s->pop()) {
@@ -3796,8 +3796,8 @@ int nscript_u6llist_iter(lua_State *L) {
}
int nscript_u6llist_iter_recursive(lua_State *L) {
- Std::stack<U6Link *> **s_stack = (Std::stack<U6Link *> **)luaL_checkudata(L, 1, "nuvie.U6LinkRecursive");
- Std::stack<U6Link *> *s = *s_stack;
+ Common::Stack<U6Link *> **s_stack = (Common::Stack<U6Link *> **)luaL_checkudata(L, 1, "nuvie.U6LinkRecursive");
+ Common::Stack<U6Link *> *s = *s_stack;
if (s->empty() || s->top() == NULL)
return 0;
@@ -4386,8 +4386,8 @@ int nscript_init_u6link_iter(lua_State *L, U6LList *list, bool is_recursive) {
if (is_recursive) {
lua_pushcfunction(L, nscript_u6llist_iter_recursive);
- Std::stack<U6Link *> **p_stack = (Std::stack<U6Link *> **)lua_newuserdata(L, sizeof(Std::stack<U6Link *> *));
- *p_stack = new Std::stack<U6Link *>();
+ Common::Stack<U6Link *> **p_stack = (Common::Stack<U6Link *> **)lua_newuserdata(L, sizeof(Common::Stack<U6Link *> *));
+ *p_stack = new Common::Stack<U6Link *>();
(*p_stack)->push(link);
luaL_getmetatable(L, "nuvie.U6LinkRecursive");
diff --git a/engines/ultima/shared/std/containers.h b/engines/ultima/shared/std/containers.h
index b863c28cfa6..c959d890546 100644
--- a/engines/ultima/shared/std/containers.h
+++ b/engines/ultima/shared/std/containers.h
@@ -306,10 +306,6 @@ public:
}
};
-template<class VAL>
-class stack : public Common::Stack<VAL> {
-};
-
/**
* Queue ordered by a provided priority function
* NOTE: Unlike in the C std library, we have to provde a comparitor that sorts
diff --git a/engines/ultima/ultima8/world/map.cpp b/engines/ultima/ultima8/world/map.cpp
index 8b93e9c7ad2..788b17f52a2 100644
--- a/engines/ultima/ultima8/world/map.cpp
+++ b/engines/ultima/ultima8/world/map.cpp
@@ -211,7 +211,7 @@ void Map::loadFixedFormatObjects(Std::list<Item *> &itemlist,
uint32 itemcount = size / 16;
- Std::stack<Container *> cont;
+ Common::Stack<Container *> cont;
int contdepth = 0;
for (uint32 i = 0; i < itemcount; ++i) {
More information about the Scummvm-git-logs
mailing list