[crossfire] [Crossfire-cvs] SF.net SVN: crossfire:[20646] server/trunk/server/player.c

Kevin Zheng kevinz5000 at gmail.com
Fri Jan 4 16:12:26 CST 2019


Sorry, my fault. On this note, the C99 "//" comments, inline, atoll(), 
and probably other stuff need to be changed to be strictly ANSI C.

On this note, can we have a temperature check on requiring C99? C99 is 
more convenient to use in places, especially where it improves 
readability and typechecking inline functions vs macros.

It's also not that much work to get this back in strict ANSI C.

If I remember correctly, it was the MSVC C compiler that needed C89 last 
time this issue came up. Has the situation on Windows changed?

On 1/4/19 1:42 PM, Nicolas Weeger wrote:
> Hello.
> 
> 
> That change will break strict ANSI C conformance, as you can't declare
> variables except at the start of a block. Here "turn" is declared only when
> assigned.
> 
> 
> I'm fine with that change, of course, but then we should clearly state that
> ANSI C is no longer relevant :)
> 
> 
> 
> Best regards
> 
> 
> Nicolas
> 
> 
> Le samedi 29 décembre 2018 05:42:49, Crossfire CVS repository messages. via
> Crossfire-cvs a écrit :
>> Revision: 20646
>>            http://sourceforge.net/p/crossfire/code/20646
>> Author:   partmedia
>> Date:     2018-12-29 04:42:48 +0000 (Sat, 29 Dec 2018)
>> Log Message:
>> -----------
>> Clean up
>>
>> Modified Paths:
>> --------------
>>      server/trunk/server/player.c
>>
>> Modified: server/trunk/server/player.c
>> ===================================================================
>> --- server/trunk/server/player.c	2018-12-29 04:42:41 UTC (rev 20645)
>> +++ server/trunk/server/player.c	2018-12-29 04:42:48 UTC (rev 20646)
>> @@ -3007,7 +3007,8 @@
>>   }
>>
>>   /**
>> - * Player gave us a direction, check whether to move or fire.
>> + * Move player in the given direction. Can be called by a client through a
>> + * movement command, or by the server for some other reasons.
>>    *
>>    * @param op
>>    * player.
>> @@ -3017,8 +3018,7 @@
>>    * 0.
>>    */
>>   int move_player(object *op, int dir) {
>> -    int pick;
>> -    object *transport = op->contr->transport;
>> +    object *transport = op->contr->transport; //< Transport player is in
>>
>>       if (!transport && (op->map == NULL || op->map->in_memory !=
>> MAP_IN_MEMORY)) return 0;
>> @@ -3029,7 +3029,6 @@
>>           return 0;
>>       }
>>
>> -    /* peterm:  added following line */
>>       if (QUERY_FLAG(op, FLAG_CONFUSED) && dir)
>>           dir = get_randomized_dir(dir);
>>
>> @@ -3036,8 +3035,6 @@
>>       op->facing = dir;
>>
>>       if (transport) {
>> -        int turn;
>> -
>>           /* transport->contr is set up for the person in charge of the
>> boat. * if that isn't this person, he can't steer it, etc
>>            */
>> @@ -3044,7 +3041,7 @@
>>           if (transport->contr != op->contr)
>>               return 0;
>>
>> -        /* Transport can't move.  But update dir so it at least
>> +        /* Transport is out of movement.  But update dir so it at least
>>            * will point in the same direction if player is running.
>>            */
>>           if (transport->speed_left < 0.0) {
>> @@ -3057,7 +3054,7 @@
>>           if (op->speed_left < 0.0)
>>               op->speed_left = -0.01;
>>
>> -        turn = turn_transport(transport, op, dir);
>> +        int turn = turn_transport(transport, op, dir);
>>           if (turn != 0)
>>               return 0;
>>       } else {
>> @@ -3076,7 +3073,7 @@
>>       } else
>>           move_player_attack(op, dir);
>>
>> -    pick = check_pick(op);
>> +    int pick = check_pick(op);
>>
>>
>>       /* Add special check for newcs players and fire on - this way, the
>>
>> This was sent by the SourceForge.net collaborative development platform,
>> the world's largest Open Source development site.
>>
>>
>>
>> _______________________________________________
>> Crossfire-cvs mailing list
>> Crossfire-cvs at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/crossfire-cvs
>>
>> _______________________________________________
>> crossfire mailing list
>> crossfire at metalforge.org
>> http://mailman.metalforge.org/mailman/listinfo/crossfire


-- 
Kevin Zheng
kevinz5000 at gmail.com | kevinz at berkeley.edu | PGP: 0xC22E1090


More information about the crossfire mailing list