Skip to content

Commit d6f2ec4

Browse files
authored
[GEN] Backport OCL first object returns from Zero Hour (#751)
1 parent 79630dd commit d6f2ec4

File tree

2 files changed

+111
-42
lines changed

2 files changed

+111
-42
lines changed

Generals/Code/GameEngine/Include/GameLogic/ObjectCreationList.h

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
// Desc: General Effects Descriptions
2828
///////////////////////////////////////////////////////////////////////////////////////////////////
2929

30+
// Kris: August 23, 2003
31+
// All OCLs return the first object that is created (or NULL if not applicable).
32+
3033
#pragma once
3134

3235
#ifndef _ObjectCreationList_H_
@@ -81,19 +84,19 @@ class ObjectCreationNugget : public MemoryPoolObject
8184
needed. Note that primary can be null, so you must check for this.
8285
Bool useOwner determines whether we are creating the the master object or not (for deliverpayload)
8386
*/
84-
virtual void create( const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, UnsignedInt lifetimeFrames = 0 ) const = 0;
87+
virtual Object* create( const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, UnsignedInt lifetimeFrames = 0 ) const = 0;
8588

8689
/**
8790
the object-based version... by default, just call the location-based implementation.
8891
Note that primary can be null, so you must check for this.
8992
*/
90-
virtual void create( const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 ) const;
93+
virtual Object* create( const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 ) const;
9194

9295
/**
9396
A variation used by DeliverPayload -- the createOwner Bool specifies whether we are creating the transport
9497
object, or using the existing one.
9598
*/
96-
virtual void create( const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 ) const;
99+
virtual Object* create( const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 ) const;
97100
};
98101
EMPTY_DTOR(ObjectCreationNugget)
99102

@@ -132,30 +135,44 @@ class ObjectCreationList
132135

133136
void addObjectCreationNugget(ObjectCreationNugget* nugget);
134137

135-
inline static void create( const ObjectCreationList* ocl, const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 )
138+
// Kris: August 23, 2003
139+
// All OCLs return the first object that is created (or NULL if not applicable).
140+
inline static Object* create( const ObjectCreationList* ocl, const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 )
136141
{
137-
if (ocl) ocl->create( primaryObj, primary, secondary, createOwner, lifetimeFrames );
142+
if( ocl )
143+
return ocl->createInternal( primaryObj, primary, secondary, createOwner, lifetimeFrames );
144+
return NULL;
138145
}
139146

147+
// Kris: August 23, 2003
148+
// All OCLs return the first object that is created (or NULL if not applicable).
140149
/// inline convenience method to avoid having to check for null.
141-
inline static void create(const ObjectCreationList* ocl, const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, UnsignedInt lifetimeFrames = 0 )
150+
inline static Object* create(const ObjectCreationList* ocl, const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, UnsignedInt lifetimeFrames = 0 )
142151
{
143-
if (ocl) ocl->create( primaryObj, primary, secondary, lifetimeFrames );
152+
if (ocl)
153+
return ocl->createInternal( primaryObj, primary, secondary, lifetimeFrames );
154+
return NULL;
144155
}
145156

157+
// Kris: August 23, 2003
158+
// All OCLs return the first object that is created (or NULL if not applicable).
146159
/// inline convenience method to avoid having to check for null.
147-
inline static void create( const ObjectCreationList* ocl, const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 )
160+
inline static Object* create( const ObjectCreationList* ocl, const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 )
148161
{
149-
if (ocl) ocl->create( primary, secondary, lifetimeFrames );
162+
if (ocl)
163+
return ocl->createInternal( primary, secondary, lifetimeFrames );
164+
return NULL;
150165
}
151166

152167
protected:
153168

154169
private:
155170

156-
void create(const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 ) const;
157-
void create(const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, UnsignedInt lifetimeFrames = 0 ) const;
158-
void create(const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 ) const;
171+
// Kris: August 23, 2003
172+
// All OCLs return the first object that is created (or NULL if not applicable).
173+
Object* createInternal(const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 ) const;
174+
Object* createInternal(const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, UnsignedInt lifetimeFrames = 0 ) const;
175+
Object* createInternal(const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 ) const;
159176

160177
// note, this list doesn't own the nuggets; all nuggets are owned by the Store.
161178
typedef std::vector<ObjectCreationNugget*> ObjectCreationNuggetVector;

0 commit comments

Comments
 (0)