Trying to compile snake
So it doesn't compile in newer versions of SM. I decided to try and update the syntax to get it to compile. For some reason enum structs (when to use then and when not and how to handle them) are what always throw me for a loop.
So my first attempt (code here - https://pastebin.com/xijWumi8 )was to update everything to new syntax as normal and the only error I'm left with is to update the enum to enum struct. Code:
snake.sp(91) : warning 213: tag mismatch (expected "WormMode", got "int") However I don't understand the difference here. Both of these enums appear to have set values and don't mix data types. Code:
enum WormDirection Changing it to an enum struct introduces a lot more errors and complications that I can't seem to fix. Now I have this code - https://pastebin.com/kALEd6se And I have a lot more errors I don't know how to fix: Code:
snake2.sp(182) : error 017: undefined symbol "Mode_Snake1" |
Re: Trying to compile snake
An enum struct acts similarly to a struct or class from an OOP language. It replaces the old method of indexing arrays using an enum because that was extremely obtuse.
So in your second code link, it doesn't make sense to use just Mode_Snake1 on the right side of an assignment since it's the name of a property/field on an object (using OOP terms). You have WormMode g_iSnakeMode[MAXPLAYERS+1]; so each thing in that array is-a WormMode. With that declaration, you can do something like g_iSnakeMode[1].Mode_Snake1 = 42;. |
All times are GMT -4. The time now is 07:15. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.