Added TODO note and a warning comment
This commit is contained in:
@@ -41,6 +41,10 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct // copy of CardObject in card.h
|
typedef struct // copy of CardObject in card.h
|
||||||
{
|
{
|
||||||
|
/* Note that since JokerObject is cast to CardObject in joker_object_update(),
|
||||||
|
* they have to have the exact same structure to have
|
||||||
|
* the exact same field offsets in memory
|
||||||
|
*/
|
||||||
Joker *joker;
|
Joker *joker;
|
||||||
Sprite *sprite;
|
Sprite *sprite;
|
||||||
FIXED tx, ty;
|
FIXED tx, ty;
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ void joker_object_update(JokerObject *joker_object)
|
|||||||
{
|
{
|
||||||
// Re-use the card object update logic by casting the JokerObject to a CardObject temporarily
|
// Re-use the card object update logic by casting the JokerObject to a CardObject temporarily
|
||||||
// This works because card_object_update doesn't use any card data, which is why CardObject should've been generic. my bad
|
// This works because card_object_update doesn't use any card data, which is why CardObject should've been generic. my bad
|
||||||
|
// TODO: Refactor and separate the relevant fields to a generic struct, maybe to Sprite or make a SpriteObject
|
||||||
CardObject *card_object = (CardObject *)joker_object;
|
CardObject *card_object = (CardObject *)joker_object;
|
||||||
card_object_update(card_object);
|
card_object_update(card_object);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user