Move source code into source subfolder
This commit is contained in:
parent
870f459f75
commit
d0d3834449
23 changed files with 0 additions and 0 deletions
33
source/game/order.cpp
Normal file
33
source/game/order.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <string.h>
|
||||
#include "order.h"
|
||||
|
||||
// Convert an order to a string
|
||||
std::string GetStringFromOrder(const COrder& order )
|
||||
{
|
||||
static char buff[128];
|
||||
memset(buff,0,sizeof(buff));
|
||||
|
||||
snprintf(buff,128, ORDER_FORMATTER,
|
||||
order.command,
|
||||
order.unit);
|
||||
|
||||
return buff;
|
||||
}
|
||||
|
||||
// Convert a string to an order
|
||||
COrder GetOrderFromString( const std::string& order )
|
||||
{
|
||||
COrder ret;
|
||||
|
||||
char corder;
|
||||
unsigned int unit;
|
||||
|
||||
sscanf(order.c_str(), ORDER_FORMATTER,
|
||||
&corder,
|
||||
&unit);
|
||||
|
||||
ret.command = (command_c)corder;
|
||||
ret.unit = unit;
|
||||
|
||||
return ret;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue